From: Sanjay Patel Date: Fri, 27 Aug 2021 18:07:44 +0000 (-0400) Subject: [InstCombine] add tests for FMF propagation for select-of-fneg; NFC X-Git-Tag: upstream/15.0.7~32652 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=027de5c7d4729fb54b9b88474066afe222a0401a;p=platform%2Fupstream%2Fllvm.git [InstCombine] add tests for FMF propagation for select-of-fneg; NFC --- diff --git a/llvm/test/Transforms/InstCombine/fneg.ll b/llvm/test/Transforms/InstCombine/fneg.ll index 60aea51..9caa620 100644 --- a/llvm/test/Transforms/InstCombine/fneg.ll +++ b/llvm/test/Transforms/InstCombine/fneg.ll @@ -438,6 +438,54 @@ define float @fneg_fneg_sel_extra_use3(float %x, float %y, i1 %cond) { ret float %sel } +define double @fneg_fneg_sel_fmf1(double %x, double %y, i1 %cond) { +; CHECK-LABEL: @fneg_fneg_sel_fmf1( +; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND:%.*]], double [[X:%.*]], double [[Y:%.*]] +; CHECK-NEXT: [[SEL:%.*]] = fneg nnan double [[SEL_V]] +; CHECK-NEXT: ret double [[SEL]] +; + %n1 = fneg nnan double %x + %n2 = fneg ninf double %y + %sel = select i1 %cond, double %n1, double %n2 + ret double %sel +} + +define double @fneg_fneg_sel_fmf2(double %x, double %y, i1 %cond) { +; CHECK-LABEL: @fneg_fneg_sel_fmf2( +; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND:%.*]], double [[X:%.*]], double [[Y:%.*]] +; CHECK-NEXT: [[SEL:%.*]] = fneg nnan ninf double [[SEL_V]] +; CHECK-NEXT: ret double [[SEL]] +; + %n1 = fneg nnan ninf double %x + %n2 = fneg ninf double %y + %sel = select i1 %cond, double %n1, double %n2 + ret double %sel +} + +define double @fneg_fneg_sel_fmf3(double %x, double %y, i1 %cond) { +; CHECK-LABEL: @fneg_fneg_sel_fmf3( +; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND:%.*]], double [[X:%.*]], double [[Y:%.*]] +; CHECK-NEXT: [[SEL:%.*]] = fneg nnan ninf double [[SEL_V]] +; CHECK-NEXT: ret double [[SEL]] +; + %n1 = fneg nnan ninf double %x + %n2 = fneg ninf double %y + %sel = select ninf i1 %cond, double %n1, double %n2 + ret double %sel +} + +define double @fneg_fneg_sel_fmf4(double %x, double %y, i1 %cond) { +; CHECK-LABEL: @fneg_fneg_sel_fmf4( +; CHECK-NEXT: [[SEL_V:%.*]] = select i1 [[COND:%.*]], double [[X:%.*]], double [[Y:%.*]] +; CHECK-NEXT: [[SEL:%.*]] = fneg nnan double [[SEL_V]] +; CHECK-NEXT: ret double [[SEL]] +; + %n1 = fneg nnan double %x + %n2 = fneg ninf double %y + %sel = select nsz nnan ninf i1 %cond, double %n1, double %n2 + ret double %sel +} + ; Negative test define float @fneg_fadd_constant(float %x) {