[PowerPC] Recommit r314244 with refactoring and off by default
[llvm-core.git] / test / CodeGen / X86 / zext-fold.ll
blob6aca4f40f0aa37789d9a7dd3ff28084a3e174376
1 ; RUN: llc < %s -mtriple=i686-unknown-linux -enable-misched=false | FileCheck %s
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
9 ; CHECK: test1
10 ; CHECK: movzbl
11 ; CHECK-NEXT: andl {{.*}}224
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
22 ; CHECK: test2
23 ; CHECK: movzbl
24 ; CHECK: andl $224
25 ; CHECK: orl $63
27 declare void @use(i32, i8)
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
36 ; CHECK: test3
37 ; CHECK: movzbl {{[0-9]+}}(%esp), [[REGISTER:%e[a-z]{2}]]
38 ; CHECK: subl $8, %esp
39 ; CHECK-NEXT: pushl [[REGISTER]]
40 ; CHECK-NEXT: andl $224, [[REGISTER]]
41 ; CHECK-NEXT: pushl [[REGISTER]]
42 ; CHECK-NEXT: call{{.*}}use