@@ -2531,14 +2531,12 @@ Instruction *InstCombinerImpl::visitAnd(BinaryOperator &I) {
25312531 // Assumes any IEEE-represented type has the sign bit in the high bit.
25322532 // TODO: Unify with APInt matcher. This version allows undef unlike m_APInt
25332533 Value *CastOp;
2534- if (match (Op0, m_BitCast (m_Value (CastOp))) &&
2534+ if (match (Op0, m_ElementWiseBitCast (m_Value (CastOp))) &&
25352535 match (Op1, m_MaxSignedValue ()) &&
25362536 !Builder.GetInsertBlock ()->getParent ()->hasFnAttribute (
2537- Attribute::NoImplicitFloat)) {
2537+ Attribute::NoImplicitFloat)) {
25382538 Type *EltTy = CastOp->getType ()->getScalarType ();
2539- if (EltTy->isFloatingPointTy () && EltTy->isIEEE () &&
2540- EltTy->getPrimitiveSizeInBits () ==
2541- I.getType ()->getScalarType ()->getPrimitiveSizeInBits ()) {
2539+ if (EltTy->isFloatingPointTy () && EltTy->isIEEE ()) {
25422540 Value *FAbs = Builder.CreateUnaryIntrinsic (Intrinsic::fabs, CastOp);
25432541 return new BitCastInst (FAbs, I.getType ());
25442542 }
@@ -3963,13 +3961,12 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) {
39633961 // This is generous interpretation of noimplicitfloat, this is not a true
39643962 // floating-point operation.
39653963 Value *CastOp;
3966- if (match (Op0, m_BitCast (m_Value (CastOp))) && match (Op1, m_SignMask ()) &&
3964+ if (match (Op0, m_ElementWiseBitCast (m_Value (CastOp))) &&
3965+ match (Op1, m_SignMask ()) &&
39673966 !Builder.GetInsertBlock ()->getParent ()->hasFnAttribute (
39683967 Attribute::NoImplicitFloat)) {
39693968 Type *EltTy = CastOp->getType ()->getScalarType ();
3970- if (EltTy->isFloatingPointTy () && EltTy->isIEEE () &&
3971- EltTy->getPrimitiveSizeInBits () ==
3972- I.getType ()->getScalarType ()->getPrimitiveSizeInBits ()) {
3969+ if (EltTy->isFloatingPointTy () && EltTy->isIEEE ()) {
39733970 Value *FAbs = Builder.CreateUnaryIntrinsic (Intrinsic::fabs, CastOp);
39743971 Value *FNegFAbs = Builder.CreateFNeg (FAbs);
39753972 return new BitCastInst (FNegFAbs, I.getType ());
@@ -4739,13 +4736,12 @@ Instruction *InstCombinerImpl::visitXor(BinaryOperator &I) {
47394736 // Assumes any IEEE-represented type has the sign bit in the high bit.
47404737 // TODO: Unify with APInt matcher. This version allows undef unlike m_APInt
47414738 Value *CastOp;
4742- if (match (Op0, m_BitCast (m_Value (CastOp))) && match (Op1, m_SignMask ()) &&
4739+ if (match (Op0, m_ElementWiseBitCast (m_Value (CastOp))) &&
4740+ match (Op1, m_SignMask ()) &&
47434741 !Builder.GetInsertBlock ()->getParent ()->hasFnAttribute (
47444742 Attribute::NoImplicitFloat)) {
47454743 Type *EltTy = CastOp->getType ()->getScalarType ();
4746- if (EltTy->isFloatingPointTy () && EltTy->isIEEE () &&
4747- EltTy->getPrimitiveSizeInBits () ==
4748- I.getType ()->getScalarType ()->getPrimitiveSizeInBits ()) {
4744+ if (EltTy->isFloatingPointTy () && EltTy->isIEEE ()) {
47494745 Value *FNeg = Builder.CreateFNeg (CastOp);
47504746 return new BitCastInst (FNeg, I.getType ());
47514747 }
0 commit comments