diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-10-11 21:22:21 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-10-11 21:22:21 +0000 |
| commit | 406cb75c6b53750a807d64dd57e79f64cd8e9375 (patch) | |
| tree | 9b2f3eb94b9df767769b369d28a16a656c728f93 /llvm/test | |
| parent | f39f4f928a7d8228c9898c4a93aac0ec3bbc6bdd (diff) | |
| download | bcm5719-llvm-406cb75c6b53750a807d64dd57e79f64cd8e9375.tar.gz bcm5719-llvm-406cb75c6b53750a807d64dd57e79f64cd8e9375.zip | |
simplify a transformation by making it more general.
llvm-svn: 83792
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/icmp.ll | 10 | ||||
| -rw-r--r-- | llvm/test/Transforms/InstCombine/mul.ll | 11 |
2 files changed, 20 insertions, 1 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index 3b6f8c59ce6..64e88c9ae86 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -33,4 +33,12 @@ define <2 x i1> @test5(<2 x i64> %x) { entry: %V = icmp eq <2 x i64> %x, undef ret <2 x i1> %V -}
\ No newline at end of file +} + +define i32 @test6(i32 %a, i32 %b) { + %c = icmp sle i32 %a, -1 + %d = zext i1 %c to i32 + %e = sub i32 0, %d + %f = and i32 %e, %b + ret i32 %f +} diff --git a/llvm/test/Transforms/InstCombine/mul.ll b/llvm/test/Transforms/InstCombine/mul.ll index e127efb9dcf..d8e623c4834 100644 --- a/llvm/test/Transforms/InstCombine/mul.ll +++ b/llvm/test/Transforms/InstCombine/mul.ll @@ -96,3 +96,14 @@ entry: %m = mul i32 %shl, %A ret i32 %m } + +; X * Y (when Y is 0 or 1) --> x & (0-Y) +define i32 @test16(i32 %b, i1 %c) { + %d = zext i1 %c to i32 ; <i32> [#uses=1] + ; e = b & (a >> 31) + %e = mul i32 %d, %b ; <i32> [#uses=1] + ret i32 %e +} + + + |

