aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2006-01-28 01:22:10 +0000
committerNate Begeman <natebegeman@mac.com>2006-01-28 01:22:10 +0000
commiteb20ed6c86837870e749cf9d6272ae596dbef303 (patch)
tree57726fd6f1eddd81ac57aa1bc8bb35a626317818
parent61af66e687561a821181f742677c38a933a6fea0 (diff)
Add a couple more things to the readme.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25724 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PowerPC/README.txt53
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/README.txt b/lib/Target/PowerPC/README.txt
index 938fff2865..149c2db34e 100644
--- a/lib/Target/PowerPC/README.txt
+++ b/lib/Target/PowerPC/README.txt
@@ -194,6 +194,59 @@ currently only commutes to avoid inserting a copy BEFORE the two addr instr.
===-------------------------------------------------------------------------===
+176.gcc contains a bunch of code like this (this occurs dozens of times):
+
+int %test(uint %mode.0.i.0) {
+ %tmp.79 = cast uint %mode.0.i.0 to sbyte ; <sbyte> [#uses=1]
+ %tmp.80 = cast sbyte %tmp.79 to int ; <int> [#uses=1]
+ %tmp.81 = shl int %tmp.80, ubyte 16 ; <int> [#uses=1]
+ %tmp.82 = and int %tmp.81, 16711680
+ ret int %tmp.82
+}
+
+which we compile to:
+
+_test:
+ extsb r2, r3
+ rlwinm r3, r2, 16, 8, 15
+ blr
+
+The extsb is obviously dead. This can be handled by a future thing like
+MaskedValueIsZero that checks to see if bits are ever demanded (in this case,
+the sign bits are never used, so we can fold the sext_inreg to nothing).
+
+I'm seeing code like this:
+
+ srwi r3, r3, 16
+ extsb r3, r3
+ rlwimi r4, r3, 16, 8, 15
+
+in which the extsb is preventing the srwi from being nuked.
+
+===-------------------------------------------------------------------------===
+
+Another example that occurs is:
+
+uint %test(int %specbits.6.1) {
+ %tmp.2540 = shr int %specbits.6.1, ubyte 11 ; <int> [#uses=1]
+ %tmp.2541 = cast int %tmp.2540 to uint ; <uint> [#uses=1]
+ %tmp.2542 = shl uint %tmp.2541, ubyte 13 ; <uint> [#uses=1]
+ %tmp.2543 = and uint %tmp.2542, 8192 ; <uint> [#uses=1]
+ ret uint %tmp.2543
+}
+
+which we codegen as:
+
+l1_test:
+ srawi r2, r3, 11
+ rlwinm r3, r2, 13, 18, 18
+ blr
+
+the srawi can be nuked by turning the SAR into a logical SHR (the sext bits are
+dead), which I think can then be folded into the rlwinm.
+
+===-------------------------------------------------------------------------===
+
Compile offsets from allocas:
int *%test() {