diff options
| author | Owen Anderson <resistor@mac.com> | 2014-01-16 21:26:02 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2014-01-16 21:26:02 +0000 |
| commit | e7321660c111e9c5dcfbfc1df4f669b025eb9d23 (patch) | |
| tree | 886e1f874789f1a6cfd848be1722ba95b846dc86 /llvm/test/Transforms/InstCombine/fast-math.ll | |
| parent | a475693947498ff605781f9e66f2128bc19eb3a9 (diff) | |
| download | bcm5719-llvm-e7321660c111e9c5dcfbfc1df4f669b025eb9d23.tar.gz bcm5719-llvm-e7321660c111e9c5dcfbfc1df4f669b025eb9d23.zip | |
Fix two cases where we could lose fast math flags when optimizing FADD expressions.
llvm-svn: 199427
Diffstat (limited to 'llvm/test/Transforms/InstCombine/fast-math.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fast-math.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fast-math.ll b/llvm/test/Transforms/InstCombine/fast-math.ll index d8ba2a59ff5..0371488dfd8 100644 --- a/llvm/test/Transforms/InstCombine/fast-math.ll +++ b/llvm/test/Transforms/InstCombine/fast-math.ll @@ -140,6 +140,26 @@ define float @fold13(float %x) { ; CHECK: ret } +; -x + y => y - x +define float @fold14(float %x, float %y) { + %neg = fsub fast float -0.0, %x + %add = fadd fast float %neg, %y + ret float %add +; CHECK: fold14 +; CHECK: fsub fast float %y, %x +; CHECK: ret +} + +; x + -y => x - y +define float @fold15(float %x, float %y) { + %neg = fsub fast float -0.0, %y + %add = fadd fast float %x, %neg + ret float %add +; CHECK: fold15 +; CHECK: fsub fast float %x, %y +; CHECK: ret +} + ; ========================================================================= ; ; Testing-cases about fmul begin |

