Lines Matching refs:Op1

129   if (BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS))  in ExpandBinOp()  local
130 if (Op1->getOpcode() == OpcodeToExpand) { in ExpandBinOp()
132 Value *A = LHS, *B = Op1->getOperand(0), *C = Op1->getOperand(1); in ExpandBinOp()
168 BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS); in FactorizeBinOp() local
171 !Op1 || Op1->getOpcode() != OpcodeToExtract) in FactorizeBinOp()
176 Value *C = Op1->getOperand(0), *D = Op1->getOperand(1); in FactorizeBinOp()
241 BinaryOperator *Op1 = dyn_cast<BinaryOperator>(RHS); in SimplifyAssociativeBinOp() local
263 if (Op1 && Op1->getOpcode() == Opcode) { in SimplifyAssociativeBinOp()
265 Value *B = Op1->getOperand(0); in SimplifyAssociativeBinOp()
266 Value *C = Op1->getOperand(1); in SimplifyAssociativeBinOp()
305 if (Op1 && Op1->getOpcode() == Opcode) { in SimplifyAssociativeBinOp()
307 Value *B = Op1->getOperand(0); in SimplifyAssociativeBinOp()
308 Value *C = Op1->getOperand(1); in SimplifyAssociativeBinOp()
542 static Value *SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW, in SimplifyAddInst() argument
546 if (Constant *CRHS = dyn_cast<Constant>(Op1)) { in SimplifyAddInst()
553 std::swap(Op0, Op1); in SimplifyAddInst()
557 if (match(Op1, m_Undef())) in SimplifyAddInst()
558 return Op1; in SimplifyAddInst()
561 if (match(Op1, m_Zero())) in SimplifyAddInst()
568 if (match(Op1, m_Sub(m_Value(Y), m_Specific(Op0))) || in SimplifyAddInst()
569 match(Op0, m_Sub(m_Value(Y), m_Specific(Op1)))) in SimplifyAddInst()
573 if (match(Op0, m_Not(m_Specific(Op1))) || in SimplifyAddInst()
574 match(Op1, m_Not(m_Specific(Op0)))) in SimplifyAddInst()
579 if (Value *V = SimplifyXorInst(Op0, Op1, TD, DT, MaxRecurse-1)) in SimplifyAddInst()
583 if (Value *V = SimplifyAssociativeBinOp(Instruction::Add, Op0, Op1, TD, DT, in SimplifyAddInst()
588 if (Value *V = FactorizeBinOp(Instruction::Add, Op0, Op1, Instruction::Mul, in SimplifyAddInst()
604 Value *llvm::SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW, in SimplifyAddInst() argument
606 return ::SimplifyAddInst(Op0, Op1, isNSW, isNUW, TD, DT, RecursionLimit); in SimplifyAddInst()
611 static Value *SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW, in SimplifySubInst() argument
615 if (Constant *CRHS = dyn_cast<Constant>(Op1)) { in SimplifySubInst()
623 if (match(Op0, m_Undef()) || match(Op1, m_Undef())) in SimplifySubInst()
627 if (match(Op1, m_Zero())) in SimplifySubInst()
631 if (Op0 == Op1) in SimplifySubInst()
637 if (match(Op0, m_Mul(m_Specific(Op1), m_ConstantInt<2>())) || in SimplifySubInst()
638 match(Op0, m_Shl(m_Specific(Op1), m_One()))) in SimplifySubInst()
639 return Op1; in SimplifySubInst()
643 Value *Y = 0, *Z = Op1; in SimplifySubInst()
668 if (MaxRecurse && match(Op1, m_Add(m_Value(Y), m_Value(Z)))) { // X - (Y + Z) in SimplifySubInst()
692 if (MaxRecurse && match(Op1, m_Sub(m_Value(X), m_Value(Y)))) // Z - (X - Y) in SimplifySubInst()
704 if (Value *V = FactorizeBinOp(Instruction::Sub, Op0, Op1, Instruction::Mul, in SimplifySubInst()
710 if (Value *V = SimplifyXorInst(Op0, Op1, TD, DT, MaxRecurse-1)) in SimplifySubInst()
725 Value *llvm::SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW, in SimplifySubInst() argument
727 return ::SimplifySubInst(Op0, Op1, isNSW, isNUW, TD, DT, RecursionLimit); in SimplifySubInst()
732 static Value *SimplifyMulInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyMulInst() argument
735 if (Constant *CRHS = dyn_cast<Constant>(Op1)) { in SimplifyMulInst()
742 std::swap(Op0, Op1); in SimplifyMulInst()
746 if (match(Op1, m_Undef())) in SimplifyMulInst()
750 if (match(Op1, m_Zero())) in SimplifyMulInst()
751 return Op1; in SimplifyMulInst()
754 if (match(Op1, m_One())) in SimplifyMulInst()
759 if ((match(Op0, m_IDiv(m_Value(X), m_Value(Y))) && Y == Op1) || // (X / Y) * Y in SimplifyMulInst()
760 (match(Op1, m_IDiv(m_Value(X), m_Value(Y))) && Y == Op0)) { // Y * (X / Y) in SimplifyMulInst()
761 BinaryOperator *Div = cast<BinaryOperator>(Y == Op1 ? Op0 : Op1); in SimplifyMulInst()
768 if (Value *V = SimplifyAndInst(Op0, Op1, TD, DT, MaxRecurse-1)) in SimplifyMulInst()
772 if (Value *V = SimplifyAssociativeBinOp(Instruction::Mul, Op0, Op1, TD, DT, in SimplifyMulInst()
777 if (Value *V = ExpandBinOp(Instruction::Mul, Op0, Op1, Instruction::Add, in SimplifyMulInst()
783 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1)) in SimplifyMulInst()
784 if (Value *V = ThreadBinOpOverSelect(Instruction::Mul, Op0, Op1, TD, DT, in SimplifyMulInst()
790 if (isa<PHINode>(Op0) || isa<PHINode>(Op1)) in SimplifyMulInst()
791 if (Value *V = ThreadBinOpOverPHI(Instruction::Mul, Op0, Op1, TD, DT, in SimplifyMulInst()
798 Value *llvm::SimplifyMulInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyMulInst() argument
800 return ::SimplifyMulInst(Op0, Op1, TD, DT, RecursionLimit); in SimplifyMulInst()
805 static Value *SimplifyDiv(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1, in SimplifyDiv() argument
809 if (Constant *C1 = dyn_cast<Constant>(Op1)) { in SimplifyDiv()
818 if (match(Op1, m_Undef())) in SimplifyDiv()
819 return Op1; in SimplifyDiv()
830 if (match(Op1, m_One())) in SimplifyDiv()
838 if (Op0 == Op1) in SimplifyDiv()
843 if (match(Op0, m_Mul(m_Value(X), m_Value(Y))) && (X == Op1 || Y == Op1)) { in SimplifyDiv()
844 if (Y != Op1) std::swap(X, Y); // Ensure expression is (X * Y) / Y, Y = Op1 in SimplifyDiv()
857 if ((isSigned && match(Op0, m_SRem(m_Value(), m_Specific(Op1)))) || in SimplifyDiv()
858 (!isSigned && match(Op0, m_URem(m_Value(), m_Specific(Op1))))) in SimplifyDiv()
863 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1)) in SimplifyDiv()
864 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyDiv()
869 if (isa<PHINode>(Op0) || isa<PHINode>(Op1)) in SimplifyDiv()
870 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyDiv()
878 static Value *SimplifySDivInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifySDivInst() argument
880 if (Value *V = SimplifyDiv(Instruction::SDiv, Op0, Op1, TD, DT, MaxRecurse)) in SimplifySDivInst()
886 Value *llvm::SimplifySDivInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifySDivInst() argument
888 return ::SimplifySDivInst(Op0, Op1, TD, DT, RecursionLimit); in SimplifySDivInst()
893 static Value *SimplifyUDivInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyUDivInst() argument
895 if (Value *V = SimplifyDiv(Instruction::UDiv, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyUDivInst()
901 Value *llvm::SimplifyUDivInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyUDivInst() argument
903 return ::SimplifyUDivInst(Op0, Op1, TD, DT, RecursionLimit); in SimplifyUDivInst()
906 static Value *SimplifyFDivInst(Value *Op0, Value *Op1, const TargetData *, in SimplifyFDivInst() argument
913 if (match(Op1, m_Undef())) in SimplifyFDivInst()
914 return Op1; in SimplifyFDivInst()
919 Value *llvm::SimplifyFDivInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyFDivInst() argument
921 return ::SimplifyFDivInst(Op0, Op1, TD, DT, RecursionLimit); in SimplifyFDivInst()
926 static Value *SimplifyRem(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1, in SimplifyRem() argument
930 if (Constant *C1 = dyn_cast<Constant>(Op1)) { in SimplifyRem()
937 if (match(Op1, m_Undef())) in SimplifyRem()
938 return Op1; in SimplifyRem()
949 if (match(Op1, m_Zero())) in SimplifyRem()
953 if (match(Op1, m_One())) in SimplifyRem()
961 if (Op0 == Op1) in SimplifyRem()
966 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1)) in SimplifyRem()
967 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyRem()
972 if (isa<PHINode>(Op0) || isa<PHINode>(Op1)) in SimplifyRem()
973 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyRem()
981 static Value *SimplifySRemInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifySRemInst() argument
983 if (Value *V = SimplifyRem(Instruction::SRem, Op0, Op1, TD, DT, MaxRecurse)) in SimplifySRemInst()
989 Value *llvm::SimplifySRemInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifySRemInst() argument
991 return ::SimplifySRemInst(Op0, Op1, TD, DT, RecursionLimit); in SimplifySRemInst()
996 static Value *SimplifyURemInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyURemInst() argument
998 if (Value *V = SimplifyRem(Instruction::URem, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyURemInst()
1004 Value *llvm::SimplifyURemInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyURemInst() argument
1006 return ::SimplifyURemInst(Op0, Op1, TD, DT, RecursionLimit); in SimplifyURemInst()
1009 static Value *SimplifyFRemInst(Value *Op0, Value *Op1, const TargetData *, in SimplifyFRemInst() argument
1016 if (match(Op1, m_Undef())) in SimplifyFRemInst()
1017 return Op1; in SimplifyFRemInst()
1022 Value *llvm::SimplifyFRemInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyFRemInst() argument
1024 return ::SimplifyFRemInst(Op0, Op1, TD, DT, RecursionLimit); in SimplifyFRemInst()
1029 static Value *SimplifyShift(unsigned Opcode, Value *Op0, Value *Op1, in SimplifyShift() argument
1033 if (Constant *C1 = dyn_cast<Constant>(Op1)) { in SimplifyShift()
1044 if (match(Op1, m_Zero())) in SimplifyShift()
1048 if (match(Op1, m_Undef())) in SimplifyShift()
1049 return Op1; in SimplifyShift()
1052 if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) in SimplifyShift()
1059 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1)) in SimplifyShift()
1060 if (Value *V = ThreadBinOpOverSelect(Opcode, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyShift()
1065 if (isa<PHINode>(Op0) || isa<PHINode>(Op1)) in SimplifyShift()
1066 if (Value *V = ThreadBinOpOverPHI(Opcode, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyShift()
1074 static Value *SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW, in SimplifyShlInst() argument
1077 if (Value *V = SimplifyShift(Instruction::Shl, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyShlInst()
1086 if (match(Op0, m_Shr(m_Value(X), m_Specific(Op1))) && in SimplifyShlInst()
1092 Value *llvm::SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW, in SimplifyShlInst() argument
1094 return ::SimplifyShlInst(Op0, Op1, isNSW, isNUW, TD, DT, RecursionLimit); in SimplifyShlInst()
1099 static Value *SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact, in SimplifyLShrInst() argument
1102 if (Value *V = SimplifyShift(Instruction::LShr, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyLShrInst()
1111 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) && in SimplifyLShrInst()
1118 Value *llvm::SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact, in SimplifyLShrInst() argument
1120 return ::SimplifyLShrInst(Op0, Op1, isExact, TD, DT, RecursionLimit); in SimplifyLShrInst()
1125 static Value *SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact, in SimplifyAShrInst() argument
1128 if (Value *V = SimplifyShift(Instruction::AShr, Op0, Op1, TD, DT, MaxRecurse)) in SimplifyAShrInst()
1141 if (match(Op0, m_Shl(m_Value(X), m_Specific(Op1))) && in SimplifyAShrInst()
1148 Value *llvm::SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact, in SimplifyAShrInst() argument
1150 return ::SimplifyAShrInst(Op0, Op1, isExact, TD, DT, RecursionLimit); in SimplifyAShrInst()
1155 static Value *SimplifyAndInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyAndInst() argument
1158 if (Constant *CRHS = dyn_cast<Constant>(Op1)) { in SimplifyAndInst()
1165 std::swap(Op0, Op1); in SimplifyAndInst()
1169 if (match(Op1, m_Undef())) in SimplifyAndInst()
1173 if (Op0 == Op1) in SimplifyAndInst()
1177 if (match(Op1, m_Zero())) in SimplifyAndInst()
1178 return Op1; in SimplifyAndInst()
1181 if (match(Op1, m_AllOnes())) in SimplifyAndInst()
1185 if (match(Op0, m_Not(m_Specific(Op1))) || in SimplifyAndInst()
1186 match(Op1, m_Not(m_Specific(Op0)))) in SimplifyAndInst()
1192 (A == Op1 || B == Op1)) in SimplifyAndInst()
1193 return Op1; in SimplifyAndInst()
1196 if (match(Op1, m_Or(m_Value(A), m_Value(B))) && in SimplifyAndInst()
1201 if (Value *V = SimplifyAssociativeBinOp(Instruction::And, Op0, Op1, TD, DT, in SimplifyAndInst()
1206 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Or, in SimplifyAndInst()
1211 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Xor, in SimplifyAndInst()
1216 if (Value *V = FactorizeBinOp(Instruction::And, Op0, Op1, Instruction::Or, in SimplifyAndInst()
1222 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1)) in SimplifyAndInst()
1223 if (Value *V = ThreadBinOpOverSelect(Instruction::And, Op0, Op1, TD, DT, in SimplifyAndInst()
1229 if (isa<PHINode>(Op0) || isa<PHINode>(Op1)) in SimplifyAndInst()
1230 if (Value *V = ThreadBinOpOverPHI(Instruction::And, Op0, Op1, TD, DT, in SimplifyAndInst()
1237 Value *llvm::SimplifyAndInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyAndInst() argument
1239 return ::SimplifyAndInst(Op0, Op1, TD, DT, RecursionLimit); in SimplifyAndInst()
1244 static Value *SimplifyOrInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyOrInst() argument
1247 if (Constant *CRHS = dyn_cast<Constant>(Op1)) { in SimplifyOrInst()
1254 std::swap(Op0, Op1); in SimplifyOrInst()
1258 if (match(Op1, m_Undef())) in SimplifyOrInst()
1262 if (Op0 == Op1) in SimplifyOrInst()
1266 if (match(Op1, m_Zero())) in SimplifyOrInst()
1270 if (match(Op1, m_AllOnes())) in SimplifyOrInst()
1271 return Op1; in SimplifyOrInst()
1274 if (match(Op0, m_Not(m_Specific(Op1))) || in SimplifyOrInst()
1275 match(Op1, m_Not(m_Specific(Op0)))) in SimplifyOrInst()
1281 (A == Op1 || B == Op1)) in SimplifyOrInst()
1282 return Op1; in SimplifyOrInst()
1285 if (match(Op1, m_And(m_Value(A), m_Value(B))) && in SimplifyOrInst()
1291 (A == Op1 || B == Op1)) in SimplifyOrInst()
1292 return Constant::getAllOnesValue(Op1->getType()); in SimplifyOrInst()
1295 if (match(Op1, m_Not(m_And(m_Value(A), m_Value(B)))) && in SimplifyOrInst()
1300 if (Value *V = SimplifyAssociativeBinOp(Instruction::Or, Op0, Op1, TD, DT, in SimplifyOrInst()
1305 if (Value *V = ExpandBinOp(Instruction::Or, Op0, Op1, Instruction::And, in SimplifyOrInst()
1310 if (Value *V = FactorizeBinOp(Instruction::Or, Op0, Op1, Instruction::And, in SimplifyOrInst()
1316 if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1)) in SimplifyOrInst()
1317 if (Value *V = ThreadBinOpOverSelect(Instruction::Or, Op0, Op1, TD, DT, in SimplifyOrInst()
1323 if (isa<PHINode>(Op0) || isa<PHINode>(Op1)) in SimplifyOrInst()
1324 if (Value *V = ThreadBinOpOverPHI(Instruction::Or, Op0, Op1, TD, DT, in SimplifyOrInst()
1331 Value *llvm::SimplifyOrInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyOrInst() argument
1333 return ::SimplifyOrInst(Op0, Op1, TD, DT, RecursionLimit); in SimplifyOrInst()
1338 static Value *SimplifyXorInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyXorInst() argument
1341 if (Constant *CRHS = dyn_cast<Constant>(Op1)) { in SimplifyXorInst()
1348 std::swap(Op0, Op1); in SimplifyXorInst()
1352 if (match(Op1, m_Undef())) in SimplifyXorInst()
1353 return Op1; in SimplifyXorInst()
1356 if (match(Op1, m_Zero())) in SimplifyXorInst()
1360 if (Op0 == Op1) in SimplifyXorInst()
1364 if (match(Op0, m_Not(m_Specific(Op1))) || in SimplifyXorInst()
1365 match(Op1, m_Not(m_Specific(Op0)))) in SimplifyXorInst()
1369 if (Value *V = SimplifyAssociativeBinOp(Instruction::Xor, Op0, Op1, TD, DT, in SimplifyXorInst()
1374 if (Value *V = FactorizeBinOp(Instruction::Xor, Op0, Op1, Instruction::And, in SimplifyXorInst()
1390 Value *llvm::SimplifyXorInst(Value *Op0, Value *Op1, const TargetData *TD, in SimplifyXorInst() argument
1392 return ::SimplifyXorInst(Op0, Op1, TD, DT, RecursionLimit); in SimplifyXorInst()