Lines Matching refs:C1

869                                               Constant *C1, Constant *C2) {
871 if (C1->getType()->isPPC_FP128Ty())
875 if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) {
878 if (isa<UndefValue>(C1) && isa<UndefValue>(C2))
881 return Constant::getNullValue(C1->getType());
885 return UndefValue::get(C1->getType());
887 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef & undef -> undef
888 return C1;
889 return Constant::getNullValue(C1->getType()); // undef & X -> 0
893 if (((CI = dyn_cast<ConstantInt>(C1)) && CI->getValue()[0]) ||
895 (isa<UndefValue>(C1) && isa<UndefValue>(C2)))
896 return UndefValue::get(C1->getType());
899 return Constant::getNullValue(C1->getType());
907 return C1;
912 return Constant::getNullValue(C1->getType());
915 if (isa<UndefValue>(C1) && isa<UndefValue>(C2)) // undef | undef -> undef
916 return C1;
917 return Constant::getAllOnesValue(C1->getType()); // undef | X -> ~0
919 if (isa<UndefValue>(C2) && isa<UndefValue>(C1))
920 return C1; // undef lshr undef -> undef
921 return Constant::getNullValue(C1->getType()); // X lshr undef -> 0
925 return Constant::getAllOnesValue(C1->getType());
926 else if (isa<UndefValue>(C1))
927 return C1; // undef ashr undef -> undef
929 return C1; // X ashr undef --> X
931 if (isa<UndefValue>(C2) && isa<UndefValue>(C1))
932 return C1; // undef shl undef -> undef
934 return Constant::getNullValue(C1->getType());
942 if (CI2->equalsInt(0)) return C1; // X + 0 == X
945 if (CI2->equalsInt(0)) return C1; // X - 0 == X
950 return C1; // X * 1 == X
955 return C1; // X / 1 == X
969 return C1; // X & -1 == X
971 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
979 return C1;
1005 if (CI2->equalsInt(0)) return C1; // X | 0 == X
1010 if (CI2->equalsInt(0)) return C1; // X ^ 0 == X
1012 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
1028 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1))
1030 return ConstantExpr::getLShr(C1, C2);
1033 } else if (isa<ConstantInt>(C1)) {
1034 // If C1 is a ConstantInt and C2 is not, swap the operands.
1036 return ConstantExpr::get(Opcode, C2, C1);
1040 if (ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) {
1080 return UndefValue::get(C1->getType()); // too big shift is undef
1087 return UndefValue::get(C1->getType()); // too big shift is undef
1094 return UndefValue::get(C1->getType()); // too big shift is undef
1107 if (CI1->equalsInt(0)) return C1;
1112 } else if (ConstantFP *CFP1 = dyn_cast<ConstantFP>(C1)) {
1122 return ConstantFP::get(C1->getContext(), C3V);
1125 return ConstantFP::get(C1->getContext(), C3V);
1128 return ConstantFP::get(C1->getContext(), C3V);
1131 return ConstantFP::get(C1->getContext(), C3V);
1134 return ConstantFP::get(C1->getContext(), C3V);
1137 } else if (VectorType *VTy = dyn_cast<VectorType>(C1->getType())) {
1143 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, i));
1153 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
1166 // If C2 is a constant expr and C1 isn't, flop them around and fold the
1169 return ConstantFoldBinaryInstruction(Opcode, C2, C1);
1173 if (C1->getType()->isIntegerTy(1)) {
1177 return ConstantExpr::getXor(C1, C2);
1179 return ConstantExpr::getAnd(C1, C2);
1185 return C1;
1190 return C1;
1195 return ConstantInt::getFalse(C1->getContext());
1229 static int IdxCompare(Constant *C1, Constant *C2, Type *ElTy) {
1230 if (C1 == C2) return 0;
1234 if (!isa<ConstantInt>(C1) || !isa<ConstantInt>(C2))
1239 if (!C1->getType()->isIntegerTy(64))
1240 C1 = ConstantExpr::getSExt(C1, Type::getInt64Ty(C1->getContext()));
1243 C2 = ConstantExpr::getSExt(C2, Type::getInt64Ty(C1->getContext()));
1245 if (C1 == C2) return 0; // They are equal
1254 if (cast<ConstantInt>(C1)->getSExtValue() <
1577 Constant *C1, Constant *C2) {
1579 if (VectorType *VT = dyn_cast<VectorType>(C1->getType()))
1580 ResultTy = VectorType::get(Type::getInt1Ty(C1->getContext()),
1583 ResultTy = Type::getInt1Ty(C1->getContext());
1593 if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) {
1598 (isa<UndefValue>(C1) && isa<UndefValue>(C2)))
1606 if (C1->getType()->isPPC_FP128Ty())
1610 if (C1->isNullValue()) {
1615 return ConstantInt::getFalse(C1->getContext());
1617 return ConstantInt::getTrue(C1->getContext());
1621 if (const GlobalValue *GV = dyn_cast<GlobalValue>(C1))
1625 return ConstantInt::getFalse(C1->getContext());
1627 return ConstantInt::getTrue(C1->getContext());
1632 if (C1->getType()->isIntegerTy(1)) {
1636 return ConstantExpr::getXor(C1, ConstantExpr::getNot(C2));
1637 return ConstantExpr::getXor(ConstantExpr::getNot(C1), C2);
1639 return ConstantExpr::getXor(C1, C2);
1645 if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2)) {
1646 APInt V1 = cast<ConstantInt>(C1)->getValue();
1661 } else if (isa<ConstantFP>(C1) && isa<ConstantFP>(C2)) {
1662 APFloat C1V = cast<ConstantFP>(C1)->getValueAPF();
1704 } else if (C1->getType()->isVectorTy()) {
1708 Type *Ty = IntegerType::get(C1->getContext(), 32);
1710 for (unsigned i = 0, e = C1->getType()->getVectorNumElements(); i != e;++i){
1712 ConstantExpr::getExtractElement(C1, ConstantInt::get(Ty, i));
1722 if (C1->getType()->isFloatingPointTy()) {
1724 switch (evaluateFCmpRelation(C1, C2)) {
1738 case FCmpInst::FCMP_OEQ: // We know that C1 == C2
1743 case FCmpInst::FCMP_OLT: // We know that C1 < C2
1748 case FCmpInst::FCMP_OGT: // We know that C1 > C2
1753 case FCmpInst::FCMP_OLE: // We know that C1 <= C2
1760 case FCmpInst::FCMP_OGE: // We known that C1 >= C2
1767 case FCmpInst::FCMP_ONE: // We know that C1 != C2
1783 switch (evaluateICmpRelation(C1, C2, CmpInst::isSigned(pred))) {
1857 Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType());
1863 if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
1878 if ((!isa<ConstantExpr>(C1) && isa<ConstantExpr>(C2)) ||
1879 (C1->isNullValue() && !C2->isNullValue())) {
1880 // If C2 is a constant expr and C1 isn't, flip them around and fold the
1882 // Also, if C1 is null and C2 isn't, flip them around.
1884 return ConstantExpr::getICmp(pred, C2, C1);
1967 Constant *C1 = ConstantExpr::getSExtOrBitCast(Idx0, Int64Ty);
1969 Combined = ConstantExpr::get(Instruction::Add, C1, C2);