Index: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp =================================================================== --- llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -1266,6 +1266,46 @@ return nullptr; } +/// or (is_fpclass x, mask0), (is_fpclass x, mask1) +/// -> is_fpclass x, (mask0 | mask1) +/// and (is_fpclass x, mask0), (is_fpclass x, mask1) +/// -> is_fpclass x, (mask0 & mask1) +/// xor (is_fpclass x, mask0), (is_fpclass x, mask1) +/// -> is_fpclass x, (mask0 ^ mask1) +Instruction *InstCombinerImpl::foldLogicOfIsFPClass(BinaryOperator &BO, + Value *Op0, Value *Op1) { + Value *ClassVal; + uint64_t ClassMask0, ClassMask1; + + if (match(Op0, m_OneUse(m_Intrinsic( + m_Value(ClassVal), m_ConstantInt(ClassMask0)))) && + match(Op1, m_OneUse(m_Intrinsic( + m_Specific(ClassVal), m_ConstantInt(ClassMask1))))) { + unsigned NewClassMask; + switch (BO.getOpcode()) { + case Instruction::And: + NewClassMask = ClassMask0 & ClassMask1; + break; + case Instruction::Or: + NewClassMask = ClassMask0 | ClassMask1; + break; + case Instruction::Xor: + NewClassMask = ClassMask0 ^ ClassMask1; + break; + default: + llvm_unreachable("not a binary logic operator"); + } + + // TODO: Also check for special fcmps + auto *II = cast(Op0); + II->setArgOperand( + 1, ConstantInt::get(II->getArgOperand(1)->getType(), NewClassMask)); + return replaceInstUsesWith(BO, II); + } + + return nullptr; +} + /// This a limited reassociation for a special case (see above) where we are /// checking if two values are either both NAN (unordered) or not-NAN (ordered). /// This could be handled more generally in '-reassociation', but it seems like @@ -2227,6 +2267,9 @@ if (Value *Res = foldLogicOfFCmps(LHS, RHS, /*IsAnd*/ true)) return replaceInstUsesWith(I, Res); + if (Instruction *Folded = foldLogicOfIsFPClass(I, Op0, Op1)) + return Folded; + if (Instruction *FoldedFCmps = reassociateFCmps(I, Builder)) return FoldedFCmps; @@ -3113,6 +3156,9 @@ if (Value *Res = foldLogicOfFCmps(LHS, RHS, /*IsAnd*/ false)) return replaceInstUsesWith(I, Res); + if (Instruction *Folded = foldLogicOfIsFPClass(I, Op0, Op1)) + return Folded; + if (Instruction *FoldedFCmps = reassociateFCmps(I, Builder)) return FoldedFCmps; @@ -4055,5 +4101,8 @@ if (Instruction *Canonicalized = canonicalizeLogicFirst(I, Builder)) return Canonicalized; + if (Instruction *Folded = foldLogicOfIsFPClass(I, Op0, Op1)) + return Folded; + return nullptr; } Index: llvm/lib/Transforms/InstCombine/InstCombineInternal.h =================================================================== --- llvm/lib/Transforms/InstCombine/InstCombineInternal.h +++ llvm/lib/Transforms/InstCombine/InstCombineInternal.h @@ -361,6 +361,9 @@ Value *foldLogicOfFCmps(FCmpInst *LHS, FCmpInst *RHS, bool IsAnd, bool IsLogicalSelect = false); + Instruction *foldLogicOfIsFPClass(BinaryOperator &Operator, Value *LHS, + Value *RHS); + Value *foldAndOrOfICmpsOfAndWithPow2(ICmpInst *LHS, ICmpInst *RHS, Instruction *CxtI, bool IsAnd, bool IsLogical = false); Index: llvm/test/Transforms/InstCombine/is_fpclass.ll =================================================================== --- llvm/test/Transforms/InstCombine/is_fpclass.ll +++ llvm/test/Transforms/InstCombine/is_fpclass.ll @@ -620,11 +620,9 @@ define i1 @test_fold_or3_class_f32_0(float %a) { ; CHECK-LABEL: @test_fold_or3_class_f32_0( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 1) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 2) +; CHECK-NEXT: [[CLASS0:%.*]] = fcmp uno float [[A:%.*]], 0.000000e+00 ; CHECK-NEXT: [[CLASS2:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 4) -; CHECK-NEXT: [[OR_0:%.*]] = or i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: [[OR_1:%.*]] = or i1 [[OR_0]], [[CLASS2]] +; CHECK-NEXT: [[OR_1:%.*]] = or i1 [[CLASS0]], [[CLASS2]] ; CHECK-NEXT: ret i1 [[OR_1]] ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 1) @@ -637,8 +635,7 @@ define i1 @test_fold_or_all_tests_class_f32_0(float %a) { ; CHECK-LABEL: @test_fold_or_all_tests_class_f32_0( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 1) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 2) +; CHECK-NEXT: [[CLASS0:%.*]] = fcmp uno float [[A:%.*]], 0.000000e+00 ; CHECK-NEXT: [[CLASS2:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 4) ; CHECK-NEXT: [[CLASS3:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 8) ; CHECK-NEXT: [[CLASS4:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 16) @@ -647,8 +644,7 @@ ; CHECK-NEXT: [[CLASS7:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 128) ; CHECK-NEXT: [[CLASS8:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 256) ; CHECK-NEXT: [[CLASS9:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 512) -; CHECK-NEXT: [[OR_0:%.*]] = or i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: [[OR_1:%.*]] = or i1 [[OR_0]], [[CLASS2]] +; CHECK-NEXT: [[OR_1:%.*]] = or i1 [[CLASS0]], [[CLASS2]] ; CHECK-NEXT: [[OR_2:%.*]] = or i1 [[OR_1]], [[CLASS3]] ; CHECK-NEXT: [[OR_3:%.*]] = or i1 [[OR_2]], [[CLASS4]] ; CHECK-NEXT: [[OR_4:%.*]] = or i1 [[OR_3]], [[CLASS5]] @@ -682,10 +678,8 @@ define i1 @test_fold_or_class_f32_1(float %a) { ; CHECK-LABEL: @test_fold_or_class_f32_1( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 4) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 8) -; CHECK-NEXT: [[OR:%.*]] = or i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret i1 [[OR]] +; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 12) +; CHECK-NEXT: ret i1 [[CLASS0]] ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 4) %class1 = call i1 @llvm.is.fpclass.f32(float %a, i32 8) @@ -726,9 +720,7 @@ define i1 @test_fold_or_class_f32_2(float %a) { ; CHECK-LABEL: @test_fold_or_class_f32_2( ; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 7) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 7) -; CHECK-NEXT: [[OR:%.*]] = or i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret i1 [[OR]] +; CHECK-NEXT: ret i1 [[CLASS0]] ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 7) %class1 = call i1 @llvm.is.fpclass.f32(float %a, i32 7) @@ -751,10 +743,8 @@ define <2 x i1> @test_fold_or_class_v2f32(<2 x float> %a) { ; CHECK-LABEL: @test_fold_or_class_v2f32( -; CHECK-NEXT: [[CLASS0:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[A:%.*]], i32 4) -; CHECK-NEXT: [[CLASS1:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[A]], i32 8) -; CHECK-NEXT: [[OR:%.*]] = or <2 x i1> [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret <2 x i1> [[OR]] +; CHECK-NEXT: [[CLASS0:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[A:%.*]], i32 12) +; CHECK-NEXT: ret <2 x i1> [[CLASS0]] ; %class0 = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %a, i32 4) %class1 = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %a, i32 8) @@ -798,26 +788,7 @@ define i1 @test_fold_and_all_tests_class_f32_0(float %a) { ; CHECK-LABEL: @test_fold_and_all_tests_class_f32_0( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 1) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 2) -; CHECK-NEXT: [[CLASS2:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 4) -; CHECK-NEXT: [[CLASS3:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 8) -; CHECK-NEXT: [[CLASS4:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 16) -; CHECK-NEXT: [[CLASS5:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 32) -; CHECK-NEXT: [[CLASS6:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 64) -; CHECK-NEXT: [[CLASS7:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 128) -; CHECK-NEXT: [[CLASS8:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 256) -; CHECK-NEXT: [[CLASS9:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 512) -; CHECK-NEXT: [[AND_0:%.*]] = and i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[AND_0]], [[CLASS2]] -; CHECK-NEXT: [[AND_2:%.*]] = and i1 [[AND_1]], [[CLASS3]] -; CHECK-NEXT: [[AND_3:%.*]] = and i1 [[AND_2]], [[CLASS4]] -; CHECK-NEXT: [[AND_4:%.*]] = and i1 [[AND_3]], [[CLASS5]] -; CHECK-NEXT: [[AND_5:%.*]] = and i1 [[AND_4]], [[CLASS6]] -; CHECK-NEXT: [[AND_6:%.*]] = and i1 [[AND_5]], [[CLASS7]] -; CHECK-NEXT: [[AND_7:%.*]] = and i1 [[AND_6]], [[CLASS8]] -; CHECK-NEXT: [[AND_8:%.*]] = and i1 [[AND_7]], [[CLASS9]] -; CHECK-NEXT: ret i1 [[AND_8]] +; CHECK-NEXT: ret i1 false ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 1) %class1 = call i1 @llvm.is.fpclass.f32(float %a, i32 2) @@ -843,8 +814,7 @@ define i1 @test_fold_and_not_all_tests_class_f32_0(float %a) { ; CHECK-LABEL: @test_fold_and_not_all_tests_class_f32_0( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 1022) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 1021) +; CHECK-NEXT: [[CLASS0:%.*]] = fcmp ord float [[A:%.*]], 0.000000e+00 ; CHECK-NEXT: [[CLASS2:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 1019) ; CHECK-NEXT: [[CLASS3:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 1015) ; CHECK-NEXT: [[CLASS4:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 1007) @@ -853,8 +823,7 @@ ; CHECK-NEXT: [[CLASS7:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 895) ; CHECK-NEXT: [[CLASS8:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 767) ; CHECK-NEXT: [[CLASS9:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 511) -; CHECK-NEXT: [[AND_0:%.*]] = and i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[AND_0]], [[CLASS2]] +; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[CLASS0]], [[CLASS2]] ; CHECK-NEXT: [[AND_2:%.*]] = and i1 [[AND_1]], [[CLASS3]] ; CHECK-NEXT: [[AND_3:%.*]] = and i1 [[AND_2]], [[CLASS4]] ; CHECK-NEXT: [[AND_4:%.*]] = and i1 [[AND_3]], [[CLASS5]] @@ -888,10 +857,7 @@ define i1 @test_fold_and_class_f32_1(float %a) { ; CHECK-LABEL: @test_fold_and_class_f32_1( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 48) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 11) -; CHECK-NEXT: [[AND:%.*]] = and i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret i1 [[AND]] +; CHECK-NEXT: ret i1 false ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 48) %class1 = call i1 @llvm.is.fpclass.f32(float %a, i32 11) @@ -932,9 +898,7 @@ define i1 @test_fold_and_class_f32_2(float %a) { ; CHECK-LABEL: @test_fold_and_class_f32_2( ; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 7) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 7) -; CHECK-NEXT: [[AND:%.*]] = and i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret i1 [[AND]] +; CHECK-NEXT: ret i1 [[CLASS0]] ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 7) %class1 = call i1 @llvm.is.fpclass.f32(float %a, i32 7) @@ -944,10 +908,8 @@ define i1 @test_fold_and_class_f32_3(float %a) { ; CHECK-LABEL: @test_fold_and_class_f32_3( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 37) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 393) -; CHECK-NEXT: [[AND:%.*]] = and i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret i1 [[AND]] +; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 1) +; CHECK-NEXT: ret i1 [[CLASS0]] ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 37) %class1 = call i1 @llvm.is.fpclass.f32(float %a, i32 393) @@ -957,10 +919,8 @@ define i1 @test_fold_and_class_f32_4(float %a) { ; CHECK-LABEL: @test_fold_and_class_f32_4( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 393) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 37) -; CHECK-NEXT: [[AND:%.*]] = and i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret i1 [[AND]] +; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 1) +; CHECK-NEXT: ret i1 [[CLASS0]] ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 393) %class1 = call i1 @llvm.is.fpclass.f32(float %a, i32 37) @@ -984,9 +944,7 @@ define <2 x i1> @test_fold_and_class_v2f32(<2 x float> %a) { ; CHECK-LABEL: @test_fold_and_class_v2f32( ; CHECK-NEXT: [[CLASS0:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[A:%.*]], i32 7) -; CHECK-NEXT: [[CLASS1:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[A]], i32 15) -; CHECK-NEXT: [[AND:%.*]] = and <2 x i1> [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret <2 x i1> [[AND]] +; CHECK-NEXT: ret <2 x i1> [[CLASS0]] ; %class0 = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %a, i32 7) %class1 = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %a, i32 15) @@ -1013,11 +971,9 @@ define i1 @test_fold_xor3_class_f32_0(float %a) { ; CHECK-LABEL: @test_fold_xor3_class_f32_0( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 1) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 2) +; CHECK-NEXT: [[CLASS0:%.*]] = fcmp uno float [[A:%.*]], 0.000000e+00 ; CHECK-NEXT: [[CLASS2:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 4) -; CHECK-NEXT: [[XOR_0:%.*]] = xor i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: [[XOR_1:%.*]] = xor i1 [[XOR_0]], [[CLASS2]] +; CHECK-NEXT: [[XOR_1:%.*]] = xor i1 [[CLASS0]], [[CLASS2]] ; CHECK-NEXT: ret i1 [[XOR_1]] ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 1) @@ -1030,8 +986,7 @@ define i1 @test_fold_xor_all_tests_class_f32_0(float %a) { ; CHECK-LABEL: @test_fold_xor_all_tests_class_f32_0( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 1) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 2) +; CHECK-NEXT: [[CLASS0:%.*]] = fcmp uno float [[A:%.*]], 0.000000e+00 ; CHECK-NEXT: [[CLASS2:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 4) ; CHECK-NEXT: [[CLASS3:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 8) ; CHECK-NEXT: [[CLASS4:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 16) @@ -1040,8 +995,7 @@ ; CHECK-NEXT: [[CLASS7:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 128) ; CHECK-NEXT: [[CLASS8:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 256) ; CHECK-NEXT: [[CLASS9:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 512) -; CHECK-NEXT: [[XOR_0:%.*]] = xor i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: [[XOR_1:%.*]] = xor i1 [[XOR_0]], [[CLASS2]] +; CHECK-NEXT: [[XOR_1:%.*]] = xor i1 [[CLASS0]], [[CLASS2]] ; CHECK-NEXT: [[XOR_2:%.*]] = xor i1 [[XOR_1]], [[CLASS3]] ; CHECK-NEXT: [[XOR_3:%.*]] = xor i1 [[XOR_2]], [[CLASS4]] ; CHECK-NEXT: [[XOR_4:%.*]] = xor i1 [[XOR_3]], [[CLASS5]] @@ -1075,10 +1029,8 @@ define i1 @test_fold_xor_class_f32_1(float %a) { ; CHECK-LABEL: @test_fold_xor_class_f32_1( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 4) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 8) -; CHECK-NEXT: [[XOR:%.*]] = xor i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret i1 [[XOR]] +; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 12) +; CHECK-NEXT: ret i1 [[CLASS0]] ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 4) %class1 = call i1 @llvm.is.fpclass.f32(float %a, i32 8) @@ -1118,10 +1070,7 @@ define i1 @test_fold_xor_class_f32_2(float %a) { ; CHECK-LABEL: @test_fold_xor_class_f32_2( -; CHECK-NEXT: [[CLASS0:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A:%.*]], i32 7) -; CHECK-NEXT: [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 7) -; CHECK-NEXT: [[XOR:%.*]] = xor i1 [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret i1 [[XOR]] +; CHECK-NEXT: ret i1 false ; %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 7) %class1 = call i1 @llvm.is.fpclass.f32(float %a, i32 7) @@ -1144,10 +1093,8 @@ define <2 x i1> @test_fold_xor_class_v2f32(<2 x float> %a) { ; CHECK-LABEL: @test_fold_xor_class_v2f32( -; CHECK-NEXT: [[CLASS0:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[A:%.*]], i32 4) -; CHECK-NEXT: [[CLASS1:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[A]], i32 8) -; CHECK-NEXT: [[XOR:%.*]] = or <2 x i1> [[CLASS0]], [[CLASS1]] -; CHECK-NEXT: ret <2 x i1> [[XOR]] +; CHECK-NEXT: [[CLASS0:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[A:%.*]], i32 12) +; CHECK-NEXT: ret <2 x i1> [[CLASS0]] ; %class0 = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %a, i32 4) %class1 = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %a, i32 8)