Lines Matching defs:LHS

151 bool CheckShift(InterpState &S, CodePtr OpPC, const LT &LHS, const RT &RHS,
171 if (LHS.isSigned() && !S.getLangOpts().CPlusPlus20) {
175 if (LHS.isNegative()) {
176 S.CCEDiag(E, diag::note_constexpr_lshift_of_negative) << LHS.toAPSInt();
179 } else if (LHS.toUnsigned().countLeadingZeros() <
193 /// Checks if Div/Rem operation on LHS and RHS is valid.
195 bool CheckDivRem(InterpState &S, CodePtr OpPC, const T &LHS, const T &RHS) {
209 if (LHS.isSigned() && LHS.isMin() && RHS.isNegative() && RHS.isMinusOne()) {
210 APSInt LHSInt = LHS.toAPSInt();
332 bool AddSubMulHelper(InterpState &S, CodePtr OpPC, unsigned Bits, const T &LHS,
336 if (!OpFW(LHS, RHS, Bits, &Result)) {
345 APSInt Value = OpAP<APSInt>()(LHS.toAPSInt(Bits), RHS.toAPSInt(Bits));
373 const T &LHS = S.Stk.pop<T>();
375 return AddSubMulHelper<T, T::add, std::plus>(S, OpPC, Bits, LHS, RHS);
380 const Floating &LHS = S.Stk.pop<Floating>();
383 auto Status = Floating::add(LHS, RHS, RM, &Result);
391 const T &LHS = S.Stk.pop<T>();
393 return AddSubMulHelper<T, T::sub, std::minus>(S, OpPC, Bits, LHS, RHS);
398 const Floating &LHS = S.Stk.pop<Floating>();
401 auto Status = Floating::sub(LHS, RHS, RM, &Result);
409 const T &LHS = S.Stk.pop<T>();
411 return AddSubMulHelper<T, T::mul, std::multiplies>(S, OpPC, Bits, LHS, RHS);
416 const Floating &LHS = S.Stk.pop<Floating>();
419 auto Status = Floating::mul(LHS, RHS, RM, &Result);
427 const Pointer &LHS = S.Stk.pop<Pointer>();
431 APFloat A = LHS.atIndex(0).deref<Floating>().getAPFloat();
432 APFloat B = LHS.atIndex(1).deref<Floating>().getAPFloat();
448 const T &LHSR = LHS.atIndex(0).deref<T>();
449 const T &LHSI = LHS.atIndex(1).deref<T>();
454 // real(Result) = (real(LHS) * real(RHS)) - (imag(LHS) * imag(RHS))
465 // imag(Result) = (real(LHS) * imag(RHS)) + (imag(LHS) * real(RHS))
482 const Pointer &LHS = S.Stk.pop<Pointer>();
486 APFloat A = LHS.atIndex(0).deref<Floating>().getAPFloat();
487 APFloat B = LHS.atIndex(1).deref<Floating>().getAPFloat();
503 const T &LHSR = LHS.atIndex(0).deref<T>();
504 const T &LHSI = LHS.atIndex(1).deref<T>();
525 // real(Result) = ((real(LHS) * real(RHS)) + (imag(LHS) * imag(RHS))) / Den
537 // imag(Result) = ((imag(LHS) * real(RHS)) - (real(LHS) * imag(RHS))) / Den
552 /// 2) Pops the LHS from the stack.
553 /// 3) Pushes 'LHS & RHS' on the stack
557 const T &LHS = S.Stk.pop<T>();
561 if (!T::bitAnd(LHS, RHS, Bits, &Result)) {
569 /// 2) Pops the LHS from the stack.
570 /// 3) Pushes 'LHS | RHS' on the stack
574 const T &LHS = S.Stk.pop<T>();
578 if (!T::bitOr(LHS, RHS, Bits, &Result)) {
586 /// 2) Pops the LHS from the stack.
587 /// 3) Pushes 'LHS ^ RHS' on the stack
591 const T &LHS = S.Stk.pop<T>();
595 if (!T::bitXor(LHS, RHS, Bits, &Result)) {
603 /// 2) Pops the LHS from the stack.
604 /// 3) Pushes 'LHS % RHS' on the stack (the remainder of dividing LHS by RHS).
608 const T &LHS = S.Stk.pop<T>();
610 if (!CheckDivRem(S, OpPC, LHS, RHS))
615 if (!T::rem(LHS, RHS, Bits, &Result)) {
623 /// 2) Pops the LHS from the stack.
624 /// 3) Pushes 'LHS / RHS' on the stack
628 const T &LHS = S.Stk.pop<T>();
630 if (!CheckDivRem(S, OpPC, LHS, RHS))
635 if (!T::div(LHS, RHS, Bits, &Result)) {
644 const Floating &LHS = S.Stk.pop<Floating>();
646 if (!CheckDivRem(S, OpPC, LHS, RHS))
650 auto Status = Floating::div(LHS, RHS, RM, &Result);
900 const T &LHS = S.Stk.pop<T>();
901 S.Stk.push<BoolT>(BoolT::from(Fn(LHS.compare(RHS))));
915 const auto &LHS = S.Stk.pop<FunctionPointer>();
919 << LHS.toDiagnosticString(S.getCtx())
928 const auto &LHS = S.Stk.pop<FunctionPointer>();
931 for (const auto &FP : {LHS, RHS}) {
940 S.Stk.push<Boolean>(Boolean::from(Fn(LHS.compare(RHS))));
948 const Pointer &LHS = S.Stk.pop<Pointer>();
950 if (!Pointer::hasSameBase(LHS, RHS)) {
953 << LHS.toDiagnosticString(S.getCtx())
957 unsigned VL = LHS.getByteOffset();
968 const Pointer &LHS = S.Stk.pop<Pointer>();
970 if (LHS.isZero() && RHS.isZero()) {
976 for (const auto &P : {LHS, RHS}) {
987 if (!Pointer::hasSameBase(LHS, RHS)) {
988 if (LHS.isOnePastEnd() && !RHS.isOnePastEnd() && !RHS.isZero() &&
992 << LHS.toDiagnosticString(S.getCtx());
994 } else if (RHS.isOnePastEnd() && !LHS.isOnePastEnd() && !LHS.isZero() &&
995 LHS.getOffset() == 0) {
1005 unsigned VL = LHS.getByteOffset();
1012 if (!LHS.isZero() && LHS.isArrayRoot())
1013 VL = LHS.atIndex(0).getByteOffset();
1026 const auto &LHS = S.Stk.pop<MemberPointer>();
1030 for (const auto &MP : {LHS, RHS}) {
1041 if (LHS.isZero() && RHS.isZero()) {
1045 if (LHS.isZero() || RHS.isZero()) {
1051 for (const auto &MP : {LHS, RHS}) {
1059 S.Stk.push<Boolean>(Boolean::from(Fn(LHS.compare(RHS))));
1073 const T &LHS = S.Stk.pop<T>();
1076 ComparisonCategoryResult CmpResult = LHS.compare(RHS);
1081 << LHS.toDiagnosticString(S.getCtx())
1138 const T LHS = S.Stk.pop<T>();
1141 S.Stk.push<bool>(LHS <= Value && Value <= RHS);
1975 const Pointer &LHS = S.Stk.pop<Pointer>();
1979 S.Stk.push<T>(T::from(LHS.getIndex()));
1983 if (!Pointer::hasSameBase(LHS, RHS) && S.getLangOpts().CPlusPlus) {
1988 if (LHS.isZero() && RHS.isZero()) {
1993 T A = LHS.isElementPastEnd() ? T::from(LHS.getNumElems())
1994 : T::from(LHS.getIndex());
2267 inline bool DoShift(InterpState &S, CodePtr OpPC, LT &LHS, RT &RHS) {
2268 const unsigned Bits = LHS.bitWidth();
2270 // OpenCL 6.3j: shift values are effectively % word size of LHS.
2272 RT::bitAnd(RHS, RT::from(LHS.bitWidth() - 1, RHS.bitWidth()),
2285 : ShiftDir::Left > (S, OpPC, LHS, RHS);
2289 if (LHS.isNegative() && !S.getLangOpts().CPlusPlus20) {
2295 S.CCEDiag(Loc, diag::note_constexpr_lshift_of_negative) << LHS.toAPSInt();
2301 if (!CheckShift(S, OpPC, LHS, RHS, Bits))
2310 LT::AsUnsigned::shiftLeft(LT::AsUnsigned::from(LHS),
2313 LT::AsUnsigned::shiftLeft(LT::AsUnsigned::from(LHS),
2317 LT::AsUnsigned::shiftRight(LT::AsUnsigned::from(LHS),
2320 LT::AsUnsigned::shiftRight(LT::AsUnsigned::from(LHS),
2333 auto LHS = S.Stk.pop<LT>();
2335 return DoShift<LT, RT, ShiftDir::Right>(S, OpPC, LHS, RHS);
2343 auto LHS = S.Stk.pop<LT>();
2345 return DoShift<LT, RT, ShiftDir::Left>(S, OpPC, LHS, RHS);