Remove BinaryOperator::CreateFNeg

Use UnaryOperator::CreateFNeg instead.

Summary:
With the introduction of the native fneg instruction, the
fsub -0.0, %x idiom is obsolete. This patch makes LLVM
emit fneg instead of the idiom in all places.

Reviewed By: cameron.mcinally

Differential Revision: https://reviews.llvm.org/D75130
This commit is contained in:
Simon Moll 2020-02-27 09:05:54 -08:00
parent 740ed617f7
commit ddd11273d9
23 changed files with 87 additions and 108 deletions

View File

@ -149,7 +149,7 @@ float _Complex div_float_rc(float a, float _Complex b) {
// AARCH64-FASTMATH: [[CCpDD:%.*]] = fadd fast float [[CC]], [[DD]]
//
// BC = 0
// AARCH64-FASTMATH: [[NEGA:%.*]] = fsub fast float -0.000000e+00, %a
// AARCH64-FASTMATH: [[NEGA:%.*]] = fneg fast float %a
// AARCH64-FASTMATH: [[AD:%.*]] = fmul fast float [[D]], [[NEGA]]
//
// AARCH64-FASTMATH: fdiv fast float [[AC]], [[CCpDD]]
@ -327,7 +327,7 @@ double _Complex div_double_rc(double a, double _Complex b) {
// AARCH64-FASTMATH: [[CCpDD:%.*]] = fadd fast double [[CC]], [[DD]]
//
// BC = 0
// AARCH64-FASTMATH: [[NEGA:%.*]] = fsub fast double -0.000000e+00, %a
// AARCH64-FASTMATH: [[NEGA:%.*]] = fneg fast double %a
// AARCH64-FASTMATH: [[AD:%.*]] = fmul fast double [[D]], [[NEGA]]
//
// AARCH64-FASTMATH: fdiv fast double [[AC]], [[CCpDD]]
@ -523,7 +523,7 @@ long double _Complex div_long_double_rc(long double a, long double _Complex b) {
// AARCH64-FASTMATH: [[CCpDD:%.*]] = fadd fast fp128 [[CC]], [[DD]]
//
// BC = 0
// AARCH64-FASTMATH: [[NEGA:%.*]] = fsub fast fp128 0xL00000000000000008000000000000000, %a
// AARCH64-FASTMATH: [[NEGA:%.*]] = fneg fast fp128 %a
// AARCH64-FASTMATH: [[AD:%.*]] = fmul fast fp128 [[D]], [[NEGA]]
//
// AARCH64-FASTMATH: fdiv fast fp128 [[AC]], [[CCpDD]]

View File

@ -154,18 +154,20 @@ public:
}
#include "llvm/IR/Instruction.def"
static UnaryOperator *CreateWithCopiedFlags(UnaryOps Opc,
Value *V,
Instruction *CopyO,
const Twine &Name = "") {
UnaryOperator *UO = Create(Opc, V, Name);
static UnaryOperator *
CreateWithCopiedFlags(UnaryOps Opc, Value *V, Instruction *CopyO,
const Twine &Name = "",
Instruction *InsertBefore = nullptr) {
UnaryOperator *UO = Create(Opc, V, Name, InsertBefore);
UO->copyIRFlags(CopyO);
return UO;
}
static UnaryOperator *CreateFNegFMF(Value *Op, Instruction *FMFSource,
const Twine &Name = "") {
return CreateWithCopiedFlags(Instruction::FNeg, Op, FMFSource, Name);
const Twine &Name = "",
Instruction *InsertBefore = nullptr) {
return CreateWithCopiedFlags(Instruction::FNeg, Op, FMFSource, Name,
InsertBefore);
}
UnaryOps getOpcode() const {
@ -280,11 +282,6 @@ public:
const Twine &Name = "") {
return CreateWithCopiedFlags(Instruction::FRem, V1, V2, FMFSource, Name);
}
static BinaryOperator *CreateFNegFMF(Value *Op, Instruction *FMFSource,
const Twine &Name = "") {
Value *Zero = ConstantFP::getNegativeZero(Op->getType());
return CreateWithCopiedFlags(Instruction::FSub, Zero, Op, FMFSource, Name);
}
static BinaryOperator *CreateNSW(BinaryOps Opc, Value *V1, Value *V2,
const Twine &Name = "") {
@ -390,10 +387,6 @@ public:
Instruction *InsertBefore = nullptr);
static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd);
static BinaryOperator *CreateFNeg(Value *Op, const Twine &Name = "",
Instruction *InsertBefore = nullptr);
static BinaryOperator *CreateFNeg(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd);
static BinaryOperator *CreateNot(Value *Op, const Twine &Name = "",
Instruction *InsertBefore = nullptr);
static BinaryOperator *CreateNot(Value *Op, const Twine &Name,

View File

@ -2393,20 +2393,6 @@ BinaryOperator *BinaryOperator::CreateNUWNeg(Value *Op, const Twine &Name,
return BinaryOperator::CreateNUWSub(zero, Op, Name, InsertAtEnd);
}
BinaryOperator *BinaryOperator::CreateFNeg(Value *Op, const Twine &Name,
Instruction *InsertBefore) {
Value *zero = ConstantFP::getZeroValueForNegation(Op->getType());
return new BinaryOperator(Instruction::FSub, zero, Op,
Op->getType(), Name, InsertBefore);
}
BinaryOperator *BinaryOperator::CreateFNeg(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd) {
Value *zero = ConstantFP::getZeroValueForNegation(Op->getType());
return new BinaryOperator(Instruction::FSub, zero, Op,
Op->getType(), Name, InsertAtEnd);
}
BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
Instruction *InsertBefore) {
Constant *C = Constant::getAllOnesValue(Op->getType());

View File

@ -2136,7 +2136,7 @@ Instruction *InstCombiner::visitFSub(BinaryOperator &I) {
// fsub nsz 0, X ==> fsub nsz -0.0, X
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
if (I.hasNoSignedZeros() && match(Op0, m_PosZeroFP()))
return BinaryOperator::CreateFNegFMF(Op1, &I);
return UnaryOperator::CreateFNegFMF(Op1, &I);
if (Instruction *X = foldFNegIntoConstant(I))
return X;
@ -2214,12 +2214,12 @@ Instruction *InstCombiner::visitFSub(BinaryOperator &I) {
if (I.hasAllowReassoc() && I.hasNoSignedZeros()) {
// (Y - X) - Y --> -X
if (match(Op0, m_FSub(m_Specific(Op1), m_Value(X))))
return BinaryOperator::CreateFNegFMF(X, &I);
return UnaryOperator::CreateFNegFMF(X, &I);
// Y - (X + Y) --> -X
// Y - (Y + X) --> -X
if (match(Op1, m_c_FAdd(m_Specific(Op0), m_Value(X))))
return BinaryOperator::CreateFNegFMF(X, &I);
return UnaryOperator::CreateFNegFMF(X, &I);
// (X * C) - X --> X * (C - 1.0)
if (match(Op0, m_FMul(m_Specific(Op1), m_Constant(C)))) {

View File

@ -2189,7 +2189,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
llvm_unreachable("unexpected intrinsic ID");
}
Value *NewCall = Builder.CreateBinaryIntrinsic(NewIID, X, Y, II);
Instruction *FNeg = BinaryOperator::CreateFNeg(NewCall);
Instruction *FNeg = UnaryOperator::CreateFNeg(NewCall);
FNeg->copyIRFlags(II);
return FNeg;
}
@ -2354,7 +2354,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
if (match(II->getArgOperand(0), m_OneUse(m_FNeg(m_Value(X))))) {
// sin(-x) --> -sin(x)
Value *NewSin = Builder.CreateUnaryIntrinsic(Intrinsic::sin, X, II);
Instruction *FNeg = BinaryOperator::CreateFNeg(NewSin);
Instruction *FNeg = UnaryOperator::CreateFNeg(NewSin);
FNeg->copyFastMathFlags(II);
return FNeg;
}

View File

@ -1639,7 +1639,7 @@ Instruction *InstCombiner::visitFPTrunc(FPTruncInst &FPT) {
// FIXME: Once we're sure that unary FNeg optimizations are on par with
// binary FNeg, this should always return a unary operator.
if (isa<BinaryOperator>(Op))
return BinaryOperator::CreateFNegFMF(InnerTrunc, Op);
return UnaryOperator::CreateFNegFMF(InnerTrunc, Op);
return UnaryOperator::CreateFNegFMF(InnerTrunc, Op);
}

View File

@ -411,7 +411,7 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
// X * -1.0 --> -X
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
if (match(Op1, m_SpecificFP(-1.0)))
return BinaryOperator::CreateFNegFMF(Op0, &I);
return UnaryOperator::CreateFNegFMF(Op0, &I);
// -X * -Y --> X * Y
Value *X, *Y;

View File

@ -341,7 +341,7 @@ Instruction *InstCombiner::foldSelectOpOp(SelectInst &SI, Instruction *TI,
// TODO: Remove the hack for the binop form when the unary op is optimized
// properly with all IR passes.
if (TI->getOpcode() != Instruction::FNeg)
return BinaryOperator::CreateFNegFMF(NewSel, cast<BinaryOperator>(TI));
return UnaryOperator::CreateFNegFMF(NewSel, cast<BinaryOperator>(TI));
return UnaryOperator::CreateFNeg(NewSel);
}

View File

@ -254,15 +254,15 @@ static BinaryOperator *CreateMul(Value *S1, Value *S2, const Twine &Name,
}
}
static BinaryOperator *CreateNeg(Value *S1, const Twine &Name,
Instruction *InsertBefore, Value *FlagsOp) {
static Instruction *CreateNeg(Value *S1, const Twine &Name,
Instruction *InsertBefore, Value *FlagsOp) {
if (S1->getType()->isIntOrIntVectorTy())
return BinaryOperator::CreateNeg(S1, Name, InsertBefore);
else {
BinaryOperator *Res = BinaryOperator::CreateFNeg(S1, Name, InsertBefore);
Res->setFastMathFlags(cast<FPMathOperator>(FlagsOp)->getFastMathFlags());
return Res;
}
if (auto *FMFSource = dyn_cast<Instruction>(FlagsOp))
return UnaryOperator::CreateFNegFMF(S1, FMFSource, Name, InsertBefore);
return UnaryOperator::CreateFNeg(S1, Name, InsertBefore);
}
/// Replace 0-X with X*-1.
@ -914,7 +914,7 @@ static Value *NegateValue(Value *V, Instruction *BI,
// Insert a 'neg' instruction that subtracts the value from zero to get the
// negation.
BinaryOperator *NewNeg = CreateNeg(V, V->getName() + ".neg", BI, BI);
Instruction *NewNeg = CreateNeg(V, V->getName() + ".neg", BI, BI);
ToRedo.insert(NewNeg);
return NewNeg;
}

View File

@ -151,7 +151,7 @@ declare <2 x float> @llvm.sin.v2f32(<2 x float>)
define <2 x float> @fneg_sin(<2 x float> %x){
; CHECK-LABEL: @fneg_sin(
; CHECK-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.sin.v2f32(<2 x float> [[X:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg <2 x float> [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%negx = fsub <2 x float> <float -0.0, float -0.0>, %x
@ -162,7 +162,7 @@ define <2 x float> @fneg_sin(<2 x float> %x){
define <2 x float> @unary_fneg_sin(<2 x float> %x){
; CHECK-LABEL: @unary_fneg_sin(
; CHECK-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.sin.v2f32(<2 x float> [[X:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg <2 x float> [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%negx = fneg <2 x float> %x
@ -175,7 +175,7 @@ define <2 x float> @unary_fneg_sin(<2 x float> %x){
define <2 x float> @fneg_sin_fmf(<2 x float> %x){
; CHECK-LABEL: @fneg_sin_fmf(
; CHECK-NEXT: [[TMP1:%.*]] = call nnan arcp afn <2 x float> @llvm.sin.v2f32(<2 x float> [[X:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub nnan arcp afn <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg nnan arcp afn <2 x float> [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%negx = fsub fast <2 x float> <float -0.0, float -0.0>, %x
@ -186,7 +186,7 @@ define <2 x float> @fneg_sin_fmf(<2 x float> %x){
define <2 x float> @unary_fneg_sin_fmf(<2 x float> %x){
; CHECK-LABEL: @unary_fneg_sin_fmf(
; CHECK-NEXT: [[TMP1:%.*]] = call nnan arcp afn <2 x float> @llvm.sin.v2f32(<2 x float> [[X:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub nnan arcp afn <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg nnan arcp afn <2 x float> [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%negx = fneg fast <2 x float> %x

View File

@ -269,7 +269,7 @@ define float @fold8_reassoc(float %f1) {
define float @fsub_fadd_common_op_fneg(float %x, float %y) {
; CHECK-LABEL: @fsub_fadd_common_op_fneg(
; CHECK-NEXT: [[R:%.*]] = fsub fast float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[R:%.*]] = fneg fast float [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%a = fadd float %x, %y
@ -283,7 +283,7 @@ define float @fsub_fadd_common_op_fneg(float %x, float %y) {
define float @fsub_fadd_common_op_fneg_reassoc_nsz(float %x, float %y) {
; CHECK-LABEL: @fsub_fadd_common_op_fneg_reassoc_nsz(
; CHECK-NEXT: [[R:%.*]] = fsub reassoc nsz float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[R:%.*]] = fneg reassoc nsz float [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%a = fadd float %x, %y
@ -295,7 +295,7 @@ define float @fsub_fadd_common_op_fneg_reassoc_nsz(float %x, float %y) {
define <2 x float> @fsub_fadd_common_op_fneg_vec(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @fsub_fadd_common_op_fneg_vec(
; CHECK-NEXT: [[R:%.*]] = fsub reassoc nsz <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
; CHECK-NEXT: [[R:%.*]] = fneg reassoc nsz <2 x float> [[X:%.*]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%a = fadd <2 x float> %x, %y
@ -308,7 +308,7 @@ define <2 x float> @fsub_fadd_common_op_fneg_vec(<2 x float> %x, <2 x float> %y)
define float @fsub_fadd_common_op_fneg_commute(float %x, float %y) {
; CHECK-LABEL: @fsub_fadd_common_op_fneg_commute(
; CHECK-NEXT: [[R:%.*]] = fsub reassoc nsz float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[R:%.*]] = fneg reassoc nsz float [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%a = fadd float %y, %x
@ -320,7 +320,7 @@ define float @fsub_fadd_common_op_fneg_commute(float %x, float %y) {
define <2 x float> @fsub_fadd_common_op_fneg_commute_vec(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @fsub_fadd_common_op_fneg_commute_vec(
; CHECK-NEXT: [[R:%.*]] = fsub reassoc nsz <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
; CHECK-NEXT: [[R:%.*]] = fneg reassoc nsz <2 x float> [[X:%.*]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%a = fadd <2 x float> %y, %x
@ -333,7 +333,7 @@ define <2 x float> @fsub_fadd_common_op_fneg_commute_vec(<2 x float> %x, <2 x fl
define float @fsub_fsub_common_op_fneg(float %x, float %y) {
; CHECK-LABEL: @fsub_fsub_common_op_fneg(
; CHECK-NEXT: [[R:%.*]] = fsub reassoc nsz float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[R:%.*]] = fneg reassoc nsz float [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%s = fsub float %y, %x
@ -345,7 +345,7 @@ define float @fsub_fsub_common_op_fneg(float %x, float %y) {
define <2 x float> @fsub_fsub_common_op_fneg_vec(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @fsub_fsub_common_op_fneg_vec(
; CHECK-NEXT: [[R:%.*]] = fsub reassoc nsz <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
; CHECK-NEXT: [[R:%.*]] = fneg reassoc nsz <2 x float> [[X:%.*]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%s = fsub <2 x float> %y, %x
@ -534,7 +534,7 @@ define float @fneg1(float %f1, float %f2) {
define float @fneg2(float %x) {
; CHECK-LABEL: @fneg2(
; CHECK-NEXT: [[SUB:%.*]] = fsub nsz float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[SUB:%.*]] = fneg nsz float [[X:%.*]]
; CHECK-NEXT: ret float [[SUB]]
;
%sub = fsub nsz float 0.0, %x
@ -543,7 +543,7 @@ define float @fneg2(float %x) {
define <2 x float> @fneg2_vec_undef(<2 x float> %x) {
; CHECK-LABEL: @fneg2_vec_undef(
; CHECK-NEXT: [[SUB:%.*]] = fsub nsz <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
; CHECK-NEXT: [[SUB:%.*]] = fneg nsz <2 x float> [[X:%.*]]
; CHECK-NEXT: ret <2 x float> [[SUB]]
;
%sub = fsub nsz <2 x float> <float undef, float 0.0>, %x

View File

@ -336,7 +336,7 @@ define <2 x float> @neg_mul_vec_undef(<2 x float> %x, <2 x float> %y) {
; (0.0 - X) * Y
define float @neg_sink_nsz(float %x, float %y) {
; CHECK-LABEL: @neg_sink_nsz(
; CHECK-NEXT: [[SUB1:%.*]] = fsub nsz float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[SUB1:%.*]] = fneg nsz float [[X:%.*]]
; CHECK-NEXT: [[MUL:%.*]] = fmul float [[SUB1]], [[Y:%.*]]
; CHECK-NEXT: ret float [[MUL]]
;
@ -409,7 +409,7 @@ for.end: ; preds = %for.cond
; X * -1.0 => -0.0 - X
define float @test9(float %x) {
; CHECK-LABEL: @test9(
; CHECK-NEXT: [[MUL:%.*]] = fsub float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[MUL:%.*]] = fneg float [[X:%.*]]
; CHECK-NEXT: ret float [[MUL]]
;
%mul = fmul float %x, -1.0
@ -419,7 +419,7 @@ define float @test9(float %x) {
; PR18532
define <4 x float> @test10(<4 x float> %x) {
; CHECK-LABEL: @test10(
; CHECK-NEXT: [[MUL:%.*]] = fsub arcp afn <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
; CHECK-NEXT: [[MUL:%.*]] = fneg arcp afn <4 x float> [[X:%.*]]
; CHECK-NEXT: ret <4 x float> [[MUL]]
;
%mul = fmul arcp afn <4 x float> %x, <float -1.0, float -1.0, float -1.0, float -1.0>

View File

@ -349,7 +349,7 @@ define float @fsub_fsub_sel_extra_use1(float %x, float %y, i1 %cond) {
; CHECK-NEXT: [[N1:%.*]] = fsub float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: call void @use(float [[N1]])
; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND:%.*]], float [[X]], float [[Y:%.*]]
; CHECK-NEXT: [[SEL:%.*]] = fsub float -0.000000e+00, [[SEL_V]]
; CHECK-NEXT: [[SEL:%.*]] = fneg float [[SEL_V]]
; CHECK-NEXT: ret float [[SEL]]
;
%n1 = fsub float -0.0, %x

View File

@ -32,7 +32,7 @@ define half @test3(float %a) {
define half @fneg_fptrunc(float %a) {
; CHECK-LABEL: @fneg_fptrunc(
; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
; CHECK-NEXT: [[C:%.*]] = fsub half 0xH8000, [[TMP1]]
; CHECK-NEXT: [[C:%.*]] = fneg half [[TMP1]]
; CHECK-NEXT: ret half [[C]]
;
%b = fsub float -0.0, %a
@ -54,7 +54,7 @@ define half @unary_fneg_fptrunc(float %a) {
define <2 x half> @fneg_fptrunc_vec_undef(<2 x float> %a) {
; CHECK-LABEL: @fneg_fptrunc_vec_undef(
; CHECK-NEXT: [[TMP1:%.*]] = fptrunc <2 x float> [[A:%.*]] to <2 x half>
; CHECK-NEXT: [[C:%.*]] = fsub <2 x half> <half 0xH8000, half 0xH8000>, [[TMP1]]
; CHECK-NEXT: [[C:%.*]] = fneg <2 x half> [[TMP1]]
; CHECK-NEXT: ret <2 x half> [[C]]
;
%b = fsub <2 x float> <float -0.0, float undef>, %a
@ -76,7 +76,7 @@ define <2 x half> @unary_fneg_fptrunc_vec(<2 x float> %a) {
define half @test4-fast(float %a) {
; CHECK-LABEL: @test4-fast(
; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
; CHECK-NEXT: [[C:%.*]] = fsub fast half 0xH8000, [[TMP1]]
; CHECK-NEXT: [[C:%.*]] = fneg fast half [[TMP1]]
; CHECK-NEXT: ret half [[C]]
;
%b = fsub fast float -0.0, %a

View File

@ -331,7 +331,7 @@ define float @unary_neg_ext_op1_extra_use(half %a, float %b) {
define float @neg_trunc_op1_extra_use(double %a, float %b) {
; CHECK-LABEL: @neg_trunc_op1_extra_use(
; CHECK-NEXT: [[TMP1:%.*]] = fptrunc double [[A:%.*]] to float
; CHECK-NEXT: [[T2:%.*]] = fsub float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[T2:%.*]] = fneg float [[TMP1]]
; CHECK-NEXT: [[T3:%.*]] = fadd float [[TMP1]], [[B:%.*]]
; CHECK-NEXT: call void @use(float [[T2]])
; CHECK-NEXT: ret float [[T3]]

View File

@ -217,7 +217,7 @@ define float @maximum4(float %x, float %y, float %z, float %w) {
define <2 x float> @neg_neg(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @neg_neg(
; CHECK-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.minimum.v2f32(<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg <2 x float> [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%negx = fsub <2 x float> <float -0.0, float -0.0>, %x
@ -229,7 +229,7 @@ define <2 x float> @neg_neg(<2 x float> %x, <2 x float> %y) {
define <2 x float> @unary_neg_neg(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @unary_neg_neg(
; CHECK-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.minimum.v2f32(<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg <2 x float> [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%negx = fneg <2 x float> %x
@ -243,7 +243,7 @@ define <2 x float> @unary_neg_neg(<2 x float> %x, <2 x float> %y) {
define float @neg_neg_vec_fmf(float %x, float %y) {
; CHECK-LABEL: @neg_neg_vec_fmf(
; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.minimum.f32(float [[X:%.*]], float [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub fast float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg fast float [[TMP1]]
; CHECK-NEXT: ret float [[R]]
;
%negx = fsub arcp float -0.0, %x
@ -255,7 +255,7 @@ define float @neg_neg_vec_fmf(float %x, float %y) {
define float @unary_neg_neg_vec_fmf(float %x, float %y) {
; CHECK-LABEL: @unary_neg_neg_vec_fmf(
; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.minimum.f32(float [[X:%.*]], float [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub fast float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg fast float [[TMP1]]
; CHECK-NEXT: ret float [[R]]
;
%negx = fneg arcp float %x
@ -272,7 +272,7 @@ define float @neg_neg_extra_use_x(float %x, float %y) {
; CHECK-LABEL: @neg_neg_extra_use_x(
; CHECK-NEXT: [[NEGX:%.*]] = fsub float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.minimum.f32(float [[X]], float [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg float [[TMP1]]
; CHECK-NEXT: call void @use(float [[NEGX]])
; CHECK-NEXT: ret float [[R]]
;
@ -287,7 +287,7 @@ define float @unary_neg_neg_extra_use_x(float %x, float %y) {
; CHECK-LABEL: @unary_neg_neg_extra_use_x(
; CHECK-NEXT: [[NEGX:%.*]] = fneg float [[X:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.minimum.f32(float [[X]], float [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg float [[TMP1]]
; CHECK-NEXT: call void @use(float [[NEGX]])
; CHECK-NEXT: ret float [[R]]
;
@ -302,7 +302,7 @@ define float @neg_neg_extra_use_y(float %x, float %y) {
; CHECK-LABEL: @neg_neg_extra_use_y(
; CHECK-NEXT: [[NEGY:%.*]] = fsub float -0.000000e+00, [[Y:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float [[Y]])
; CHECK-NEXT: [[R:%.*]] = fsub float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg float [[TMP1]]
; CHECK-NEXT: call void @use(float [[NEGY]])
; CHECK-NEXT: ret float [[R]]
;
@ -317,7 +317,7 @@ define float @unary_neg_neg_extra_use_y(float %x, float %y) {
; CHECK-LABEL: @unary_neg_neg_extra_use_y(
; CHECK-NEXT: [[NEGY:%.*]] = fneg float [[Y:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float [[Y]])
; CHECK-NEXT: [[R:%.*]] = fsub float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg float [[TMP1]]
; CHECK-NEXT: call void @use(float [[NEGY]])
; CHECK-NEXT: ret float [[R]]
;

View File

@ -223,7 +223,7 @@ define float @maxnum4(float %x, float %y, float %z, float %w) {
define <2 x float> @neg_neg(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @neg_neg(
; CHECK-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.minnum.v2f32(<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg <2 x float> [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[R]]
;
%negx = fsub <2 x float> <float -0.0, float -0.0>, %x
@ -237,7 +237,7 @@ define <2 x float> @neg_neg(<2 x float> %x, <2 x float> %y) {
define float @neg_neg_vec_fmf(float %x, float %y) {
; CHECK-LABEL: @neg_neg_vec_fmf(
; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub fast float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg fast float [[TMP1]]
; CHECK-NEXT: ret float [[R]]
;
%negx = fsub arcp float -0.0, %x
@ -249,7 +249,7 @@ define float @neg_neg_vec_fmf(float %x, float %y) {
define float @unary_neg_neg_vec_fmf(float %x, float %y) {
; CHECK-LABEL: @unary_neg_neg_vec_fmf(
; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub fast float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg fast float [[TMP1]]
; CHECK-NEXT: ret float [[R]]
;
%negx = fneg arcp float %x
@ -266,7 +266,7 @@ define float @neg_neg_extra_use_x(float %x, float %y) {
; CHECK-LABEL: @neg_neg_extra_use_x(
; CHECK-NEXT: [[NEGX:%.*]] = fsub float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.minnum.f32(float [[X]], float [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg float [[TMP1]]
; CHECK-NEXT: call void @use(float [[NEGX]])
; CHECK-NEXT: ret float [[R]]
;
@ -281,7 +281,7 @@ define float @unary_neg_neg_extra_use_x(float %x, float %y) {
; CHECK-LABEL: @unary_neg_neg_extra_use_x(
; CHECK-NEXT: [[NEGX:%.*]] = fneg float [[X:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.minnum.f32(float [[X]], float [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg float [[TMP1]]
; CHECK-NEXT: call void @use(float [[NEGX]])
; CHECK-NEXT: ret float [[R]]
;
@ -296,7 +296,7 @@ define float @neg_neg_extra_use_y(float %x, float %y) {
; CHECK-LABEL: @neg_neg_extra_use_y(
; CHECK-NEXT: [[NEGY:%.*]] = fsub float -0.000000e+00, [[Y:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y]])
; CHECK-NEXT: [[R:%.*]] = fsub float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg float [[TMP1]]
; CHECK-NEXT: call void @use(float [[NEGY]])
; CHECK-NEXT: ret float [[R]]
;
@ -311,7 +311,7 @@ define float @unary_neg_neg_extra_use_y(float %x, float %y) {
; CHECK-LABEL: @unary_neg_neg_extra_use_y(
; CHECK-NEXT: [[NEGY:%.*]] = fneg float [[Y:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float [[Y]])
; CHECK-NEXT: [[R:%.*]] = fsub float -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg float [[TMP1]]
; CHECK-NEXT: call void @use(float [[NEGY]])
; CHECK-NEXT: ret float [[R]]
;

View File

@ -241,7 +241,7 @@ define float @maximum_x_minimum_x_y(float %x, float %y) {
define double @neg_neg(double %x, double %y) {
; CHECK-LABEL: @neg_neg(
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maximum.f64(double [[X:%.*]], double [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: ret double [[R]]
;
%negx = fsub double -0.0, %x
@ -253,7 +253,7 @@ define double @neg_neg(double %x, double %y) {
define double @unary_neg_neg(double %x, double %y) {
; CHECK-LABEL: @unary_neg_neg(
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maximum.f64(double [[X:%.*]], double [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: ret double [[R]]
;
%negx = fneg double %x
@ -268,7 +268,7 @@ define double @unary_neg_neg(double %x, double %y) {
define <2 x double> @neg_neg_vec_fmf(<2 x double> %x, <2 x double> %y) {
; CHECK-LABEL: @neg_neg_vec_fmf(
; CHECK-NEXT: [[TMP1:%.*]] = call nnan ninf <2 x double> @llvm.maximum.v2f64(<2 x double> [[X:%.*]], <2 x double> [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub nnan ninf <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg nnan ninf <2 x double> [[TMP1]]
; CHECK-NEXT: ret <2 x double> [[R]]
;
%negx = fsub reassoc <2 x double> <double -0.0, double -0.0>, %x
@ -280,7 +280,7 @@ define <2 x double> @neg_neg_vec_fmf(<2 x double> %x, <2 x double> %y) {
define <2 x double> @unary_neg_neg_vec_fmf(<2 x double> %x, <2 x double> %y) {
; CHECK-LABEL: @unary_neg_neg_vec_fmf(
; CHECK-NEXT: [[TMP1:%.*]] = call nnan ninf <2 x double> @llvm.maximum.v2f64(<2 x double> [[X:%.*]], <2 x double> [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub nnan ninf <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg nnan ninf <2 x double> [[TMP1]]
; CHECK-NEXT: ret <2 x double> [[R]]
;
%negx = fneg reassoc <2 x double> %x
@ -297,7 +297,7 @@ define double @neg_neg_extra_use_x(double %x, double %y) {
; CHECK-LABEL: @neg_neg_extra_use_x(
; CHECK-NEXT: [[NEGX:%.*]] = fsub double -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maximum.f64(double [[X]], double [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: call void @use(double [[NEGX]])
; CHECK-NEXT: ret double [[R]]
;
@ -312,7 +312,7 @@ define double @unary_neg_neg_extra_use_x(double %x, double %y) {
; CHECK-LABEL: @unary_neg_neg_extra_use_x(
; CHECK-NEXT: [[NEGX:%.*]] = fneg double [[X:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maximum.f64(double [[X]], double [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: call void @use(double [[NEGX]])
; CHECK-NEXT: ret double [[R]]
;
@ -327,7 +327,7 @@ define double @neg_neg_extra_use_y(double %x, double %y) {
; CHECK-LABEL: @neg_neg_extra_use_y(
; CHECK-NEXT: [[NEGY:%.*]] = fsub double -0.000000e+00, [[Y:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maximum.f64(double [[X:%.*]], double [[Y]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: call void @use(double [[NEGY]])
; CHECK-NEXT: ret double [[R]]
;
@ -342,7 +342,7 @@ define double @unary_neg_neg_extra_use_y(double %x, double %y) {
; CHECK-LABEL: @unary_neg_neg_extra_use_y(
; CHECK-NEXT: [[NEGY:%.*]] = fneg double [[Y:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maximum.f64(double [[X:%.*]], double [[Y]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: call void @use(double [[NEGY]])
; CHECK-NEXT: ret double [[R]]
;

View File

@ -273,7 +273,7 @@ define <2 x float> @fsub_fmax(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: define {{[^@]+}}@fsub_fmax(
; CHECK-NEXT: [[COND_INV:%.*]] = fcmp nnan nsz ogt <2 x float> [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = select nnan nsz <2 x i1> [[COND_INV]], <2 x float> [[Y]], <2 x float> [[X]]
; CHECK-NEXT: [[MAX:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[MAX:%.*]] = fneg <2 x float> [[TMP1]]
; CHECK-NEXT: ret <2 x float> [[MAX]]
;
%n1 = fsub <2 x float> <float -0.0, float -0.0>, %x
@ -287,7 +287,7 @@ define <2 x double> @fsub_fmin(<2 x double> %x, <2 x double> %y) {
; CHECK-LABEL: define {{[^@]+}}@fsub_fmin(
; CHECK-NEXT: [[COND:%.*]] = fcmp nnan ogt <2 x double> [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: [[MAX_V:%.*]] = select <2 x i1> [[COND]], <2 x double> [[X]], <2 x double> [[Y]]
; CHECK-NEXT: [[MAX:%.*]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[MAX_V]]
; CHECK-NEXT: [[MAX:%.*]] = fneg <2 x double> [[MAX_V]]
; CHECK-NEXT: ret <2 x double> [[MAX]]
;
%n1 = fsub <2 x double> <double -0.0, double -0.0>, %x

View File

@ -247,7 +247,7 @@ define float @maxnum_x_minnum_x_y(float %x, float %y) {
define double @neg_neg(double %x, double %y) {
; CHECK-LABEL: @neg_neg(
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: ret double [[R]]
;
%negx = fsub double -0.0, %x
@ -259,7 +259,7 @@ define double @neg_neg(double %x, double %y) {
define double @unary_neg_neg(double %x, double %y) {
; CHECK-LABEL: @unary_neg_neg(
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: ret double [[R]]
;
%negx = fneg double %x
@ -274,7 +274,7 @@ define double @unary_neg_neg(double %x, double %y) {
define <2 x double> @neg_neg_vec_fmf(<2 x double> %x, <2 x double> %y) {
; CHECK-LABEL: @neg_neg_vec_fmf(
; CHECK-NEXT: [[TMP1:%.*]] = call nnan ninf <2 x double> @llvm.maxnum.v2f64(<2 x double> [[X:%.*]], <2 x double> [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub nnan ninf <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg nnan ninf <2 x double> [[TMP1]]
; CHECK-NEXT: ret <2 x double> [[R]]
;
%negx = fsub reassoc <2 x double> <double -0.0, double -0.0>, %x
@ -286,7 +286,7 @@ define <2 x double> @neg_neg_vec_fmf(<2 x double> %x, <2 x double> %y) {
define <2 x double> @unary_neg_neg_vec_fmf(<2 x double> %x, <2 x double> %y) {
; CHECK-LABEL: @unary_neg_neg_vec_fmf(
; CHECK-NEXT: [[TMP1:%.*]] = call nnan ninf <2 x double> @llvm.maxnum.v2f64(<2 x double> [[X:%.*]], <2 x double> [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub nnan ninf <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg nnan ninf <2 x double> [[TMP1]]
; CHECK-NEXT: ret <2 x double> [[R]]
;
%negx = fneg reassoc <2 x double> %x
@ -303,7 +303,7 @@ define double @neg_neg_extra_use_x(double %x, double %y) {
; CHECK-LABEL: @neg_neg_extra_use_x(
; CHECK-NEXT: [[NEGX:%.*]] = fsub double -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maxnum.f64(double [[X]], double [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: call void @use(double [[NEGX]])
; CHECK-NEXT: ret double [[R]]
;
@ -318,7 +318,7 @@ define double @unary_neg_neg_extra_use_x(double %x, double %y) {
; CHECK-LABEL: @unary_neg_neg_extra_use_x(
; CHECK-NEXT: [[NEGX:%.*]] = fneg double [[X:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maxnum.f64(double [[X]], double [[Y:%.*]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: call void @use(double [[NEGX]])
; CHECK-NEXT: ret double [[R]]
;
@ -333,7 +333,7 @@ define double @neg_neg_extra_use_y(double %x, double %y) {
; CHECK-LABEL: @neg_neg_extra_use_y(
; CHECK-NEXT: [[NEGY:%.*]] = fsub double -0.000000e+00, [[Y:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maxnum.f64(double [[X:%.*]], double [[Y]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: call void @use(double [[NEGY]])
; CHECK-NEXT: ret double [[R]]
;
@ -348,7 +348,7 @@ define double @unary_neg_neg_extra_use_y(double %x, double %y) {
; CHECK-LABEL: @unary_neg_neg_extra_use_y(
; CHECK-NEXT: [[NEGY:%.*]] = fneg double [[Y:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.maxnum.f64(double [[X:%.*]], double [[Y]])
; CHECK-NEXT: [[R:%.*]] = fsub double -0.000000e+00, [[TMP1]]
; CHECK-NEXT: [[R:%.*]] = fneg double [[TMP1]]
; CHECK-NEXT: call void @use(double [[NEGY]])
; CHECK-NEXT: ret double [[R]]
;

View File

@ -170,7 +170,7 @@ define <2 x double> @test_simplify4v(<2 x double> %x) {
define <2 x float> @test_simplify4vn(<2 x float> %x) {
; CHECK-LABEL: @test_simplify4vn(
; ANY-NEXT: [[MUL:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
; ANY-NEXT: [[MUL:%.*]] = fneg <2 x float> [[X:%.*]]
; ANY-NEXT: [[EXP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[MUL]])
; ANY-NEXT: ret <2 x float> [[EXP2]]
; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> [[X:%.*]])

View File

@ -4,7 +4,7 @@
; With reassociation, constant folding can eliminate the 12 and -12 constants.
define float @test1(float %arg) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[ARG_NEG:%.*]] = fsub fast float -0.000000e+00, [[ARG:%.*]]
; CHECK-NEXT: [[ARG_NEG:%.*]] = fneg fast float [[ARG:%.*]]
; CHECK-NEXT: ret float [[ARG_NEG]]
;
%t1 = fsub fast float -1.200000e+01, %arg
@ -16,7 +16,7 @@ define float @test1(float %arg) {
; Both 'reassoc' and 'nsz' are required.
define float @test1_minimal(float %arg) {
; CHECK-LABEL: @test1_minimal(
; CHECK-NEXT: [[TMP1:%.*]] = fsub reassoc nsz float -0.000000e+00, [[ARG:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = fneg reassoc nsz float [[ARG:%.*]]
; CHECK-NEXT: ret float [[TMP1]]
;
%t1 = fsub reassoc nsz float -1.200000e+01, %arg

View File

@ -4,7 +4,7 @@
define void @test1() {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[T1:%.*]] = tail call <4 x float> @blam()
; CHECK-NEXT: [[T1_NEG:%.*]] = fsub fast <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[T1]]
; CHECK-NEXT: [[T1_NEG:%.*]] = fneg fast <4 x float> [[T1]]
; CHECK-NEXT: [[T24:%.*]] = fadd fast <4 x float> [[T1_NEG]], undef
; CHECK-NEXT: tail call void @wombat(<4 x float> [[T24]])
; CHECK-NEXT: ret void
@ -19,7 +19,7 @@ define void @test1() {
define half @test2() {
; CHECK-LABEL: @test2(
; CHECK-NEXT: [[T15:%.*]] = fsub fast half undef, undef
; CHECK-NEXT: [[T15_NEG:%.*]] = fsub fast half 0xH8000, [[T15]]
; CHECK-NEXT: [[T15_NEG:%.*]] = fneg fast half [[T15]]
; CHECK-NEXT: [[T18:%.*]] = fadd fast half [[T15_NEG]], undef
; CHECK-NEXT: ret half [[T18]]
;