diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-02 02:16:23 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-02 02:16:23 +0000 |
commit | 832254e1c2387c0cbeb0a820b8315fbe85cb003a (patch) | |
tree | d3d0c15237b69dfda4ea152775417f2cc67b369b /test/Transforms/InstCombine | |
parent | 9a2ef9509e76869c3d658fb3e321d9b9e9d479d9 (diff) | |
download | llvm-832254e1c2387c0cbeb0a820b8315fbe85cb003a.tar.gz llvm-832254e1c2387c0cbeb0a820b8315fbe85cb003a.tar.bz2 llvm-832254e1c2387c0cbeb0a820b8315fbe85cb003a.tar.xz |
Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types. This changes the syntax for llvm assembly to
make shl, ashr and lshr instructions look like a binary operator:
shl i32 %X, 1
instead of
shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r-- | test/Transforms/InstCombine/add.ll | 6 | ||||
-rw-r--r-- | test/Transforms/InstCombine/shift-simplify.ll | 33 | ||||
-rw-r--r-- | test/Transforms/InstCombine/shift-sra.ll | 3 | ||||
-rw-r--r-- | test/Transforms/InstCombine/signext.ll | 3 |
4 files changed, 25 insertions, 20 deletions
diff --git a/test/Transforms/InstCombine/add.ll b/test/Transforms/InstCombine/add.ll index aa12a99bdc..4e5dbb3853 100644 --- a/test/Transforms/InstCombine/add.ll +++ b/test/Transforms/InstCombine/add.ll @@ -1,7 +1,8 @@ ; This test makes sure that add instructions are properly eliminated. ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output && -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v OK | not grep add +; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \ +; RUN: grep -v OK | not grep add implementation @@ -46,7 +47,8 @@ int %test7(int %A) { ret int %C } -int %test8(int %A, int %B) { ; (A & C1)+(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0 +; (A & C1)+(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0 +int %test8(int %A, int %B) { %A1 = and int %A, 7 %B1 = and int %B, 128 %C = add int %A1, %B1 diff --git a/test/Transforms/InstCombine/shift-simplify.ll b/test/Transforms/InstCombine/shift-simplify.ll index ce19384d16..1049b0c01a 100644 --- a/test/Transforms/InstCombine/shift-simplify.ll +++ b/test/Transforms/InstCombine/shift-simplify.ll @@ -1,22 +1,23 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | egrep 'shl|lshr|ashr' | wc -l | grep 3 +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: egrep 'shl|lshr|ashr' | wc -l | grep 3 -int %test0(int %A, int %B, ubyte %C) { - %X = shl int %A, ubyte %C - %Y = shl int %B, ubyte %C - %Z = and int %X, %Y - ret int %Z +define i32 @test0(i32 %A, i32 %B, i32 %C) { + %X = shl i32 %A, %C + %Y = shl i32 %B, %C + %Z = and i32 %X, %Y + ret i32 %Z } -int %test1(int %A, int %B, ubyte %C) { - %X = lshr int %A, ubyte %C - %Y = lshr int %B, ubyte %C - %Z = or int %X, %Y - ret int %Z +define i32 @test1(i32 %A, i32 %B, i32 %C) { + %X = lshr i32 %A, %C + %Y = lshr i32 %B, %C + %Z = or i32 %X, %Y + ret i32 %Z } -int %test2(int %A, int %B, ubyte %C) { - %X = ashr int %A, ubyte %C - %Y = ashr int %B, ubyte %C - %Z = xor int %X, %Y - ret int %Z +define i32 @test2(i32 %A, i32 %B, i32 %C) { + %X = ashr i32 %A, %C + %Y = ashr i32 %B, %C + %Z = xor i32 %X, %Y + ret i32 %Z } diff --git a/test/Transforms/InstCombine/shift-sra.ll b/test/Transforms/InstCombine/shift-sra.ll index a887d61196..80a2ac9cae 100644 --- a/test/Transforms/InstCombine/shift-sra.ll +++ b/test/Transforms/InstCombine/shift-sra.ll @@ -1,5 +1,6 @@ ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output && -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'lshr i32' | wc -l | grep 2 && +; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \ +; RUN: grep 'lshr i32' | wc -l | grep 2 && ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep ashr int %test1(int %X, ubyte %A) { diff --git a/test/Transforms/InstCombine/signext.ll b/test/Transforms/InstCombine/signext.ll index 7dcb466ad6..88f7b02c19 100644 --- a/test/Transforms/InstCombine/signext.ll +++ b/test/Transforms/InstCombine/signext.ll @@ -1,5 +1,6 @@ ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output && -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep '(and\|xor\|add\|shl\|shr)' +; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \ +; RUN: not grep '(and\|xor\|add\|shl\|shr)' int %test1(int %x) { %tmp.1 = and int %x, 65535 ; <int> [#uses=1] |