summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-24 20:01:41 +0000
committerChris Lattner <sabre@nondot.org>2010-01-24 20:01:41 +0000
commit7e3f8b60d6be8196c7aba595235e4a4e73f8d142 (patch)
tree1c457483af5dbf7782ce11c6c7554f8941d6210b /llvm/lib
parent45dd2327cbeb29edfa7ad180760e418499ab7813 (diff)
downloadbcm5719-llvm-7e3f8b60d6be8196c7aba595235e4a4e73f8d142.tar.gz
bcm5719-llvm-7e3f8b60d6be8196c7aba595235e4a4e73f8d142.zip
add a note.
llvm-svn: 94373
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/README.txt39
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/lib/Target/README.txt b/llvm/lib/Target/README.txt
index c68ae76a257..f4aa531ae06 100644
--- a/llvm/lib/Target/README.txt
+++ b/llvm/lib/Target/README.txt
@@ -156,6 +156,45 @@ void f () { /* this can be optimized to four additions... */
This requires reassociating to forms of expressions that are already available,
something that reassoc doesn't think about yet.
+
+//===---------------------------------------------------------------------===//
+
+This function: (derived from GCC PR19988)
+double foo(double x, double y) {
+ return ((x + 0.1234 * y) * (x + -0.1234 * y));
+}
+
+compiles to:
+_foo:
+ movapd %xmm1, %xmm2
+ mulsd LCPI1_1(%rip), %xmm1
+ mulsd LCPI1_0(%rip), %xmm2
+ addsd %xmm0, %xmm1
+ addsd %xmm0, %xmm2
+ movapd %xmm1, %xmm0
+ mulsd %xmm2, %xmm0
+ ret
+
+Instcombine should be able to turn it into:
+
+double foo(double x, double y) {
+ return ((x + 0.1234 * y) * (x - 0.1234 * y));
+}
+
+Which allows the multiply by constant to be CSE'd, producing:
+
+_foo:
+ mulsd LCPI1_0(%rip), %xmm1
+ movapd %xmm1, %xmm2
+ addsd %xmm0, %xmm2
+ subsd %xmm1, %xmm0
+ mulsd %xmm2, %xmm0
+ ret
+
+This doesn't need -ffast-math support at all. This is particularly bad because
+the llvm-gcc frontend is canonicalizing the later into the former, but clang
+doesn't have this problem.
+
//===---------------------------------------------------------------------===//
These two functions should generate the same code on big-endian systems:
OpenPOWER on IntegriCloud