diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2008-07-05 21:19:34 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2008-07-05 21:19:34 +0000 |
commit | b8cd6a49b584d11ac9521e274734b77fce35ba83 (patch) | |
tree | 7ea527d2834ad2b34a0b21793981a1f5302c1a50 /test/Transforms/InstCombine | |
parent | 364d73ddab43b699ab90240f11b7a2eb5cf69bd8 (diff) | |
download | llvm-b8cd6a49b584d11ac9521e274734b77fce35ba83.tar.gz llvm-b8cd6a49b584d11ac9521e274734b77fce35ba83.tar.bz2 llvm-b8cd6a49b584d11ac9521e274734b77fce35ba83.tar.xz |
Fix missed optimization opportunity when analyzing cast of mul and select.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53151 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r-- | test/Transforms/InstCombine/cast-mul-select.ll | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/cast-mul-select.ll b/test/Transforms/InstCombine/cast-mul-select.ll new file mode 100644 index 0000000000..76e9b24332 --- /dev/null +++ b/test/Transforms/InstCombine/cast-mul-select.ll @@ -0,0 +1,29 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast + +define i32 @mul(i32 %x, i32 %y) { + %A = trunc i32 %x to i8 + %B = trunc i32 %y to i8 + %C = mul i8 %A, %B + %D = zext i8 %C to i32 + ret i32 %D +} + +define i32 @select1(i1 %cond, i32 %x, i32 %y, i32 %z) { + %A = trunc i32 %x to i8 + %B = trunc i32 %y to i8 + %C = trunc i32 %z to i8 + %D = add i8 %A, %B + %E = select i1 %cond, i8 %C, i8 %D + %F = zext i8 %E to i32 + ret i32 %F +} + +define i8 @select2(i1 %cond, i8 %x, i8 %y, i8 %z) { + %A = zext i8 %x to i32 + %B = zext i8 %y to i32 + %C = zext i8 %z to i32 + %D = add i32 %A, %B + %E = select i1 %cond, i32 %C, i32 %D + %F = trunc i32 %E to i8 + ret i8 %F +} |