diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-08 00:25:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-08 00:25:47 +0000 |
commit | 49f398b96a026034c2e92ffeca692d0f57fa771a (patch) | |
tree | af7c45c4e38ba85d7a79ab7714f11999debbf5e9 /lib/Target/PowerPC/README.txt | |
parent | 9925642ec578948fcd601d1783a5710c92c2995e (diff) | |
download | llvm-49f398b96a026034c2e92ffeca692d0f57fa771a.tar.gz llvm-49f398b96a026034c2e92ffeca692d0f57fa771a.tar.bz2 llvm-49f398b96a026034c2e92ffeca692d0f57fa771a.tar.xz |
add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26605 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/README.txt')
-rw-r--r-- | lib/Target/PowerPC/README.txt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/README.txt b/lib/Target/PowerPC/README.txt index 8fad506f5c..898af148e0 100644 --- a/lib/Target/PowerPC/README.txt +++ b/lib/Target/PowerPC/README.txt @@ -466,3 +466,44 @@ we can convert to the "three address" instruction, to save code space. This only matters when we start generating cr logical ops. +===-------------------------------------------------------------------------=== + +We should compile these two functions to the same thing: + +#include <stdlib.h> +void f(int a, int b, int *P) { + *P = (a-b)>=0?(a-b):(b-a); +} +void g(int a, int b, int *P) { + *P = abs(a-b); +} + +Further, they should compile to something better than: + +_g: + subf r2, r4, r3 + subfic r3, r2, 0 + cmpwi cr0, r2, -1 + bgt cr0, LBB2_2 ; entry +LBB2_1: ; entry + mr r2, r3 +LBB2_2: ; entry + stw r2, 0(r5) + blr + +GCC produces: + +_g: + subf r4,r4,r3 + srawi r2,r4,31 + xor r0,r2,r4 + subf r0,r2,r0 + stw r0,0(r5) + blr + +... which is much nicer. + +This theoretically may help improve twolf slightly (used in dimbox.c:142?). + +===-------------------------------------------------------------------------=== + |