Lines Matching refs:RHS

180   static void divide(const APInt LHS, unsigned lhsWords, const APInt &RHS,
196 APInt AndSlowCase(const APInt &RHS) const;
199 APInt OrSlowCase(const APInt &RHS) const;
202 APInt XorSlowCase(const APInt &RHS) const;
205 APInt &AssignSlowCase(const APInt &RHS);
208 bool EqualSlowCase(const APInt &RHS) const;
651 /// \returns *this after assignment of RHS.
652 APInt &operator=(const APInt &RHS) {
654 if (isSingleWord() && RHS.isSingleWord()) {
655 VAL = RHS.VAL;
656 BitWidth = RHS.BitWidth;
660 return AssignSlowCase(RHS);
689 /// The RHS value is assigned to *this. If the significant bits in RHS exceed
693 /// \returns *this after assignment of RHS value.
694 APInt &operator=(uint64_t RHS);
698 /// Performs a bitwise AND operation on this APInt and RHS. The result is
701 /// \returns *this after ANDing with RHS.
702 APInt &operator&=(const APInt &RHS);
706 /// Performs a bitwise OR operation on this APInt and RHS. The result is
709 /// \returns *this after ORing with RHS.
710 APInt &operator|=(const APInt &RHS);
714 /// Performs a bitwise OR operation on this APInt and RHS. RHS is
717 APInt &operator|=(uint64_t RHS) {
719 VAL |= RHS;
722 pVal[0] |= RHS;
729 /// Performs a bitwise XOR operation on this APInt and RHS. The result is
732 /// \returns *this after XORing with RHS.
733 APInt &operator^=(const APInt &RHS);
737 /// Multiplies this APInt by RHS and assigns the result to *this.
740 APInt &operator*=(const APInt &RHS);
744 /// Adds RHS to *this and assigns the result to *this.
747 APInt &operator+=(const APInt &RHS);
751 /// Subtracts RHS from *this and assigns the result to *this.
754 APInt &operator-=(const APInt &RHS);
772 /// Performs a bitwise AND operation on *this and RHS.
774 /// \returns An APInt value representing the bitwise AND of *this and RHS.
775 APInt operator&(const APInt &RHS) const {
776 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
778 return APInt(getBitWidth(), VAL & RHS.VAL);
779 return AndSlowCase(RHS);
781 APInt LLVM_ATTRIBUTE_UNUSED_RESULT And(const APInt &RHS) const {
782 return this->operator&(RHS);
787 /// Performs a bitwise OR operation on *this and RHS.
789 /// \returns An APInt value representing the bitwise OR of *this and RHS.
790 APInt operator|(const APInt &RHS) const {
791 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
793 return APInt(getBitWidth(), VAL | RHS.VAL);
794 return OrSlowCase(RHS);
799 /// Performs a bitwise or on *this and RHS. This is implemented bny simply
802 /// \returns An APInt value representing the bitwise OR of *this and RHS.
803 APInt LLVM_ATTRIBUTE_UNUSED_RESULT Or(const APInt &RHS) const {
804 return this->operator|(RHS);
809 /// Performs a bitwise XOR operation on *this and RHS.
811 /// \returns An APInt value representing the bitwise XOR of *this and RHS.
812 APInt operator^(const APInt &RHS) const {
813 assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
815 return APInt(BitWidth, VAL ^ RHS.VAL);
816 return XorSlowCase(RHS);
821 /// Performs a bitwise XOR operation on *this and RHS. This is implemented
824 /// \returns An APInt value representing the bitwise XOR of *this and RHS.
825 APInt LLVM_ATTRIBUTE_UNUSED_RESULT Xor(const APInt &RHS) const {
826 return this->operator^(RHS);
831 /// Multiplies this APInt by RHS and returns the result.
832 APInt operator*(const APInt &RHS) const;
836 /// Adds RHS to this APInt and returns the result.
837 APInt operator+(const APInt &RHS) const;
838 APInt operator+(uint64_t RHS) const { return (*this) + APInt(BitWidth, RHS); }
842 /// Subtracts RHS from this APInt and returns the result.
843 APInt operator-(const APInt &RHS) const;
844 APInt operator-(uint64_t RHS) const { return (*this) - APInt(BitWidth, RHS); }
908 /// Perform an unsigned divide operation on this APInt by RHS. Both this and
909 /// RHS are treated as unsigned quantities for purposes of this division.
912 APInt LLVM_ATTRIBUTE_UNUSED_RESULT udiv(const APInt &RHS) const;
916 /// Signed divide this APInt by APInt RHS.
917 APInt LLVM_ATTRIBUTE_UNUSED_RESULT sdiv(const APInt &RHS) const;
921 /// Perform an unsigned remainder operation on this APInt with RHS being the
922 /// divisor. Both this and RHS are treated as unsigned quantities for purposes
928 APInt LLVM_ATTRIBUTE_UNUSED_RESULT urem(const APInt &RHS) const;
933 APInt LLVM_ATTRIBUTE_UNUSED_RESULT srem(const APInt &RHS) const;
942 static void udivrem(const APInt &LHS, const APInt &RHS, APInt &Quotient,
945 static void sdivrem(const APInt &LHS, const APInt &RHS, APInt &Quotient,
949 APInt sadd_ov(const APInt &RHS, bool &Overflow) const;
950 APInt uadd_ov(const APInt &RHS, bool &Overflow) const;
951 APInt ssub_ov(const APInt &RHS, bool &Overflow) const;
952 APInt usub_ov(const APInt &RHS, bool &Overflow) const;
953 APInt sdiv_ov(const APInt &RHS, bool &Overflow) const;
954 APInt smul_ov(const APInt &RHS, bool &Overflow) const;
955 APInt umul_ov(const APInt &RHS, bool &Overflow) const;
975 /// Compares this APInt with RHS for the validity of the equality
977 bool operator==(const APInt &RHS) const {
978 assert(BitWidth == RHS.BitWidth && "Comparison requires equal bit widths");
980 return VAL == RHS.VAL;
981 return EqualSlowCase(RHS);
998 /// Compares this APInt with RHS for the validity of the equality
1002 bool eq(const APInt &RHS) const { return (*this) == RHS; }
1006 /// Compares this APInt with RHS for the validity of the inequality
1010 bool operator!=(const APInt &RHS) const { return !((*this) == RHS); }
1022 /// Compares this APInt with RHS for the validity of the inequality
1026 bool ne(const APInt &RHS) const { return !((*this) == RHS); }
1030 /// Regards both *this and RHS as unsigned quantities and compares them for
1033 /// \returns true if *this < RHS when both are considered unsigned.
1034 bool ult(const APInt &RHS) const;
1038 /// Regards both *this as an unsigned quantity and compares it with RHS for
1041 /// \returns true if *this < RHS when considered unsigned.
1042 bool ult(uint64_t RHS) const { return ult(APInt(getBitWidth(), RHS)); }
1046 /// Regards both *this and RHS as signed quantities and compares them for
1049 /// \returns true if *this < RHS when both are considered signed.
1050 bool slt(const APInt &RHS) const;
1054 /// Regards both *this as a signed quantity and compares it with RHS for
1057 /// \returns true if *this < RHS when considered signed.
1058 bool slt(uint64_t RHS) const { return slt(APInt(getBitWidth(), RHS)); }
1062 /// Regards both *this and RHS as unsigned quantities and compares them for
1065 /// \returns true if *this <= RHS when both are considered unsigned.
1066 bool ule(const APInt &RHS) const { return ult(RHS) || eq(RHS); }
1070 /// Regards both *this as an unsigned quantity and compares it with RHS for
1073 /// \returns true if *this <= RHS when considered unsigned.
1074 bool ule(uint64_t RHS) const { return ule(APInt(getBitWidth(), RHS)); }
1078 /// Regards both *this and RHS as signed quantities and compares them for
1081 /// \returns true if *this <= RHS when both are considered signed.
1082 bool sle(const APInt &RHS) const { return slt(RHS) || eq(RHS); }
1086 /// Regards both *this as a signed quantity and compares it with RHS for the
1089 /// \returns true if *this <= RHS when considered signed.
1090 bool sle(uint64_t RHS) const { return sle(APInt(getBitWidth(), RHS)); }
1094 /// Regards both *this and RHS as unsigned quantities and compares them for
1097 /// \returns true if *this > RHS when both are considered unsigned.
1098 bool ugt(const APInt &RHS) const { return !ult(RHS) && !eq(RHS); }
1102 /// Regards both *this as an unsigned quantity and compares it with RHS for
1105 /// \returns true if *this > RHS when considered unsigned.
1106 bool ugt(uint64_t RHS) const { return ugt(APInt(getBitWidth(), RHS)); }
1110 /// Regards both *this and RHS as signed quantities and compares them for the
1113 /// \returns true if *this > RHS when both are considered signed.
1114 bool sgt(const APInt &RHS) const { return !slt(RHS) && !eq(RHS); }
1118 /// Regards both *this as a signed quantity and compares it with RHS for
1121 /// \returns true if *this > RHS when considered signed.
1122 bool sgt(uint64_t RHS) const { return sgt(APInt(getBitWidth(), RHS)); }
1126 /// Regards both *this and RHS as unsigned quantities and compares them for
1129 /// \returns true if *this >= RHS when both are considered unsigned.
1130 bool uge(const APInt &RHS) const { return !ult(RHS); }
1134 /// Regards both *this as an unsigned quantity and compares it with RHS for
1137 /// \returns true if *this >= RHS when considered unsigned.
1138 bool uge(uint64_t RHS) const { return uge(APInt(getBitWidth(), RHS)); }
1142 /// Regards both *this and RHS as signed quantities and compares them for
1145 /// \returns true if *this >= RHS when both are considered signed.
1146 bool sge(const APInt &RHS) const { return !slt(RHS); }
1150 /// Regards both *this as a signed quantity and compares it with RHS for
1153 /// \returns true if *this >= RHS when considered signed.
1154 bool sge(uint64_t RHS) const { return sge(APInt(getBitWidth(), RHS)); }
1157 /// between this APInt and RHS that are both set.
1158 bool intersects(const APInt &RHS) const { return (*this & RHS) != 0; }
1630 /// DST += RHS + CARRY where CARRY is zero or one. Returns the carry flag.
1634 /// DST -= RHS + CARRY where CARRY is zero or one. Returns the carry flag.
1653 /// DST = LHS * RHS, where DST has the same width as the operands and is
1660 /// DST = LHS * RHS, where DST has width the sum of the widths of the
1666 /// If RHS is zero LHS and REMAINDER are left unchanged, return one.
1667 /// Otherwise set LHS to LHS / RHS with the fractional part discarded, set
1670 /// OLD_LHS = RHS * LHS + REMAINDER
1846 /// Signed divide APInt LHS by APInt RHS.
1847 inline APInt sdiv(const APInt &LHS, const APInt &RHS) { return LHS.sdiv(RHS); }
1851 /// Unsigned divide APInt LHS by APInt RHS.
1852 inline APInt udiv(const APInt &LHS, const APInt &RHS) { return LHS.udiv(RHS); }
1857 inline APInt srem(const APInt &LHS, const APInt &RHS) { return LHS.srem(RHS); }
1862 inline APInt urem(const APInt &LHS, const APInt &RHS) { return LHS.urem(RHS); }
1867 inline APInt mul(const APInt &LHS, const APInt &RHS) { return LHS * RHS; }
1872 inline APInt add(const APInt &LHS, const APInt &RHS) { return LHS + RHS; }
1877 inline APInt sub(const APInt &LHS, const APInt &RHS) { return LHS - RHS; }
1882 /// APInt RHS.
1883 inline APInt And(const APInt &LHS, const APInt &RHS) { return LHS & RHS; }
1887 /// Performs bitwise OR operation on APInt LHS and APInt RHS.
1888 inline APInt Or(const APInt &LHS, const APInt &RHS) { return LHS | RHS; }
1893 inline APInt Xor(const APInt &LHS, const APInt &RHS) { return LHS ^ RHS; }