diff options
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fadd.ll | 27 | ||||
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fast-math.ll | 24 |
2 files changed, 27 insertions, 24 deletions
diff --git a/llvm/test/Transforms/InstCombine/fadd.ll b/llvm/test/Transforms/InstCombine/fadd.ll new file mode 100644 index 00000000000..f7eac8e14b6 --- /dev/null +++ b/llvm/test/Transforms/InstCombine/fadd.ll @@ -0,0 +1,27 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -instcombine -S | FileCheck %s + +; -x + y => y - x + +define float @fneg_op0(float %x, float %y) { +; CHECK-LABEL: @fneg_op0( +; CHECK-NEXT: [[ADD:%.*]] = fsub float [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: ret float [[ADD]] +; + %neg = fsub float -0.0, %x + %add = fadd float %neg, %y + ret float %add +} + +; x + -y => x - y + +define float @fneg_op1(float %x, float %y) { +; CHECK-LABEL: @fneg_op1( +; CHECK-NEXT: [[ADD:%.*]] = fsub float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret float [[ADD]] +; + %neg = fsub float -0.0, %y + %add = fadd float %x, %neg + ret float %add +} + diff --git a/llvm/test/Transforms/InstCombine/fast-math.ll b/llvm/test/Transforms/InstCombine/fast-math.ll index 132432f1013..81310fdd92b 100644 --- a/llvm/test/Transforms/InstCombine/fast-math.ll +++ b/llvm/test/Transforms/InstCombine/fast-math.ll @@ -406,30 +406,6 @@ define float @fold13_reassoc(float %x) { ret float %sub } -; -x + y => y - x -; This is always safe. No FMF required. -define float @fold14(float %x, float %y) { -; CHECK-LABEL: @fold14( -; CHECK-NEXT: [[ADD:%.*]] = fsub float [[Y:%.*]], [[X:%.*]] -; CHECK-NEXT: ret float [[ADD]] -; - %neg = fsub float -0.0, %x - %add = fadd float %neg, %y - ret float %add -} - -; x + -y => x - y -; This is always safe. No FMF required. -define float @fold15(float %x, float %y) { -; CHECK-LABEL: @fold15( -; CHECK-NEXT: [[ADD:%.*]] = fsub float [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: ret float [[ADD]] -; - %neg = fsub float -0.0, %y - %add = fadd float %x, %neg - ret float %add -} - ; (select X+Y, X-Y) => X + (select Y, -Y) ; This is always safe. No FMF required. define float @fold16(float %x, float %y) { |

