summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-12 19:23:25 +0000
committerDan Gohman <gohman@apple.com>2009-06-12 19:23:25 +0000
commit9377b086f5481ed2bd0232b33491e51c565b6758 (patch)
tree041baf5f944b1edbed6991afee16bdd4d2df1c02 /llvm/test
parentdc41eb18e9c926750174526c46710ebfbee9c4f3 (diff)
downloadbcm5719-llvm-9377b086f5481ed2bd0232b33491e51c565b6758.tar.gz
bcm5719-llvm-9377b086f5481ed2bd0232b33491e51c565b6758.zip
Don't do (x - (y - z)) --> (x + (z - y)) on floating-point types, because
it may round differently. This fixes PR4374. llvm-svn: 73243
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/fsub-fsub.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fsub-fsub.ll b/llvm/test/Transforms/InstCombine/fsub-fsub.ll
new file mode 100644
index 00000000000..ab70479204b
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/fsub-fsub.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep fsub | count 2
+; PR4374
+
+define float @func(float %a, float %b) nounwind {
+ %tmp3 = fsub float %a, %b
+ %tmp4 = fsub float -0.000000e+00, %tmp3
+ ret float %tmp4
+}
OpenPOWER on IntegriCloud