Andrew Trick | 922d314 | 2012-02-01 23:20:51 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mcpu=generic -march=x86 | FileCheck %s |
Nick Lewycky | c06b5bf | 2011-06-16 01:15:49 +0000 | [diff] [blame] | 2 | |
| 3 | ;; Simple case |
| 4 | define i32 @test1(i8 %x) nounwind readnone { |
| 5 | %A = and i8 %x, -32 |
| 6 | %B = zext i8 %A to i32 |
| 7 | ret i32 %B |
| 8 | } |
| 9 | ; CHECK: test1 |
| 10 | ; CHECK: movzbl |
| 11 | ; CHECK-NEXT: andl {{.*}}224 |
| 12 | |
| 13 | ;; Multiple uses of %x but easily extensible. |
| 14 | define i32 @test2(i8 %x) nounwind readnone { |
| 15 | %A = and i8 %x, -32 |
| 16 | %B = zext i8 %A to i32 |
| 17 | %C = or i8 %x, 63 |
| 18 | %D = zext i8 %C to i32 |
| 19 | %E = add i32 %B, %D |
| 20 | ret i32 %E |
| 21 | } |
| 22 | ; CHECK: test2 |
| 23 | ; CHECK: movzbl |
Nick Lewycky | 3cae396 | 2011-06-16 01:35:45 +0000 | [diff] [blame] | 24 | ; CHECK: orl $63 |
| 25 | ; CHECK: andl $224 |
Nick Lewycky | c06b5bf | 2011-06-16 01:15:49 +0000 | [diff] [blame] | 26 | |
| 27 | declare void @use(i32, i8) |
| 28 | |
| 29 | ;; Multiple uses of %x where we shouldn't extend the load. |
| 30 | define void @test3(i8 %x) nounwind readnone { |
| 31 | %A = and i8 %x, -32 |
| 32 | %B = zext i8 %A to i32 |
| 33 | call void @use(i32 %B, i8 %x) |
| 34 | ret void |
| 35 | } |
| 36 | ; CHECK: test3 |
NAKAMURA Takumi | 69b5df8 | 2012-01-11 07:34:22 +0000 | [diff] [blame] | 37 | ; CHECK: movzbl {{[0-9]+}}(%esp), [[REGISTER:%e[a-z]{2}]] |
Nick Lewycky | d61f84e | 2011-06-16 21:00:00 +0000 | [diff] [blame] | 38 | ; CHECK-NEXT: movl [[REGISTER]], 4(%esp) |
| 39 | ; CHECK-NEXT: andl $224, [[REGISTER]] |
| 40 | ; CHECK-NEXT: movl [[REGISTER]], (%esp) |
Nick Lewycky | 3cae396 | 2011-06-16 01:35:45 +0000 | [diff] [blame] | 41 | ; CHECK-NEXT: call{{.*}}use |