diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-11-23 18:52:42 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-11-23 18:52:42 +0000 |
commit | b70ebd2aa3b6f4546d4734e7bcdbed2017036b4d (patch) | |
tree | 7a1cb693711ee656cedc1b3c67fddc8f6bf61aa0 /lib/Target/README.txt | |
parent | e104f1bccbf828dcbe4e82709c8ca97d8bf018d5 (diff) | |
download | llvm-b70ebd2aa3b6f4546d4734e7bcdbed2017036b4d.tar.gz llvm-b70ebd2aa3b6f4546d4734e7bcdbed2017036b4d.tar.bz2 llvm-b70ebd2aa3b6f4546d4734e7bcdbed2017036b4d.tar.xz |
InstCombine: Reduce "X shift (A srem B)" to "X shift (A urem B)" iff B is positive.
This allows to transform the rem in "1 << ((int)x % 8);" to an and.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/README.txt')
-rw-r--r-- | lib/Target/README.txt | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt index 4d5b17ab36..b98531ca85 100644 --- a/lib/Target/README.txt +++ b/lib/Target/README.txt @@ -1698,22 +1698,14 @@ from gcc. //===---------------------------------------------------------------------===// Missed instcombine transformation: -define i32 @a(i32 %x) nounwind readnone { -entry: - %rem = srem i32 %x, 32 - %shl = shl i32 1, %rem - ret i32 %shl -} - -The srem can be transformed to an and because if x is negative, the shift is -undefined. Here's a more general case that occurs on 64-bit targets: %382 = srem i32 %tmp14.i, 64 ; [#uses=1] %383 = zext i32 %382 to i64 ; [#uses=1] %384 = shl i64 %381, %383 ; [#uses=1] %385 = icmp slt i32 %tmp14.i, 64 ; [#uses=1] -Testcase derived from 403.gcc. +The srem can be transformed to an and because if x is negative, the shift is +undefined. Testcase derived from 403.gcc. //===---------------------------------------------------------------------===// |