diff options
author | Chris Lattner <sabre@nondot.org> | 2006-01-31 07:16:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-01-31 07:16:34 +0000 |
commit | b0fe138b65fa3170697bd14ad6b8a913a1699093 (patch) | |
tree | 978885402a77f06ffe54ec7b8f881e0473581a36 /llvm/lib | |
parent | 6f9bf658a7eabb49e5b6db72400f3225b7e77318 (diff) | |
download | bcm5719-llvm-b0fe138b65fa3170697bd14ad6b8a913a1699093.tar.gz bcm5719-llvm-b0fe138b65fa3170697bd14ad6b8a913a1699093.zip |
example nate pointed out
llvm-svn: 25841
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/PowerPC/README.txt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/README.txt b/llvm/lib/Target/PowerPC/README.txt index b23b9a4cc4b..e5cf75d3bec 100644 --- a/llvm/lib/Target/PowerPC/README.txt +++ b/llvm/lib/Target/PowerPC/README.txt @@ -427,3 +427,36 @@ _test: without the lwz/stw's. +===-------------------------------------------------------------------------=== + +Compile this: + +int foo(int a) { + int b = (a < 8); + if (b) { + return b * 3; // ignore the fact that this is always 3. + } else { + return 2; + } +} + +into something not this: + +_foo: +1) cmpwi cr7, r3, 8 + mfcr r2, 1 + rlwinm r2, r2, 29, 31, 31 +1) cmpwi cr0, r3, 7 + bgt cr0, LBB1_2 ; UnifiedReturnBlock +LBB1_1: ; then + rlwinm r2, r2, 0, 31, 31 + mulli r3, r2, 3 + blr +LBB1_2: ; UnifiedReturnBlock + li r3, 2 + blr + +In particular, the two compares (marked 1) could be shared by reversing one. +This could be done in the dag combiner, by swapping a BR_CC when a SETCC of the +same operands (but backwards) exists. In this case, this wouldn't save us +anything though, because the compares still wouldn't be shared. |