xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/test-shrink.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=CHECK-64
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s --check-prefix=CHECK-64
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 | FileCheck %s --check-prefix=CHECK-32
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; CHECK-64-LABEL: g64xh:
6*9880d681SAndroid Build Coastguard Worker; CHECK-64:   testb $8, {{%ah|%ch}}
7*9880d681SAndroid Build Coastguard Worker; CHECK-64:   ret
8*9880d681SAndroid Build Coastguard Worker; CHECK-32-LABEL: g64xh:
9*9880d681SAndroid Build Coastguard Worker; CHECK-32:   testb $8, %ah
10*9880d681SAndroid Build Coastguard Worker; CHECK-32:   ret
11*9880d681SAndroid Build Coastguard Workerdefine void @g64xh(i64 inreg %x) nounwind {
12*9880d681SAndroid Build Coastguard Worker  %t = and i64 %x, 2048
13*9880d681SAndroid Build Coastguard Worker  %s = icmp eq i64 %t, 0
14*9880d681SAndroid Build Coastguard Worker  br i1 %s, label %yes, label %no
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workeryes:
17*9880d681SAndroid Build Coastguard Worker  call void @bar()
18*9880d681SAndroid Build Coastguard Worker  ret void
19*9880d681SAndroid Build Coastguard Workerno:
20*9880d681SAndroid Build Coastguard Worker  ret void
21*9880d681SAndroid Build Coastguard Worker}
22*9880d681SAndroid Build Coastguard Worker; CHECK-64-LABEL: g64xl:
23*9880d681SAndroid Build Coastguard Worker; CHECK-64:   testb $8, [[A0L:%dil|%cl]]
24*9880d681SAndroid Build Coastguard Worker; CHECK-64:   ret
25*9880d681SAndroid Build Coastguard Worker; CHECK-32-LABEL: g64xl:
26*9880d681SAndroid Build Coastguard Worker; CHECK-32:   testb $8, %al
27*9880d681SAndroid Build Coastguard Worker; CHECK-32:   ret
28*9880d681SAndroid Build Coastguard Workerdefine void @g64xl(i64 inreg %x) nounwind {
29*9880d681SAndroid Build Coastguard Worker  %t = and i64 %x, 8
30*9880d681SAndroid Build Coastguard Worker  %s = icmp eq i64 %t, 0
31*9880d681SAndroid Build Coastguard Worker  br i1 %s, label %yes, label %no
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Workeryes:
34*9880d681SAndroid Build Coastguard Worker  call void @bar()
35*9880d681SAndroid Build Coastguard Worker  ret void
36*9880d681SAndroid Build Coastguard Workerno:
37*9880d681SAndroid Build Coastguard Worker  ret void
38*9880d681SAndroid Build Coastguard Worker}
39*9880d681SAndroid Build Coastguard Worker; CHECK-64-LABEL: g32xh:
40*9880d681SAndroid Build Coastguard Worker; CHECK-64:   testb $8, {{%ah|%ch}}
41*9880d681SAndroid Build Coastguard Worker; CHECK-64:   ret
42*9880d681SAndroid Build Coastguard Worker; CHECK-32-LABEL: g32xh:
43*9880d681SAndroid Build Coastguard Worker; CHECK-32:   testb $8, %ah
44*9880d681SAndroid Build Coastguard Worker; CHECK-32:   ret
45*9880d681SAndroid Build Coastguard Workerdefine void @g32xh(i32 inreg %x) nounwind {
46*9880d681SAndroid Build Coastguard Worker  %t = and i32 %x, 2048
47*9880d681SAndroid Build Coastguard Worker  %s = icmp eq i32 %t, 0
48*9880d681SAndroid Build Coastguard Worker  br i1 %s, label %yes, label %no
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Workeryes:
51*9880d681SAndroid Build Coastguard Worker  call void @bar()
52*9880d681SAndroid Build Coastguard Worker  ret void
53*9880d681SAndroid Build Coastguard Workerno:
54*9880d681SAndroid Build Coastguard Worker  ret void
55*9880d681SAndroid Build Coastguard Worker}
56*9880d681SAndroid Build Coastguard Worker; CHECK-64-LABEL: g32xl:
57*9880d681SAndroid Build Coastguard Worker; CHECK-64:   testb $8, [[A0L]]
58*9880d681SAndroid Build Coastguard Worker; CHECK-64:   ret
59*9880d681SAndroid Build Coastguard Worker; CHECK-32-LABEL: g32xl:
60*9880d681SAndroid Build Coastguard Worker; CHECK-32:   testb $8, %al
61*9880d681SAndroid Build Coastguard Worker; CHECK-32:   ret
62*9880d681SAndroid Build Coastguard Workerdefine void @g32xl(i32 inreg %x) nounwind {
63*9880d681SAndroid Build Coastguard Worker  %t = and i32 %x, 8
64*9880d681SAndroid Build Coastguard Worker  %s = icmp eq i32 %t, 0
65*9880d681SAndroid Build Coastguard Worker  br i1 %s, label %yes, label %no
66*9880d681SAndroid Build Coastguard Worker
67*9880d681SAndroid Build Coastguard Workeryes:
68*9880d681SAndroid Build Coastguard Worker  call void @bar()
69*9880d681SAndroid Build Coastguard Worker  ret void
70*9880d681SAndroid Build Coastguard Workerno:
71*9880d681SAndroid Build Coastguard Worker  ret void
72*9880d681SAndroid Build Coastguard Worker}
73*9880d681SAndroid Build Coastguard Worker; CHECK-64-LABEL: g16xh:
74*9880d681SAndroid Build Coastguard Worker; CHECK-64:   testb $8, {{%ah|%ch}}
75*9880d681SAndroid Build Coastguard Worker; CHECK-64:   ret
76*9880d681SAndroid Build Coastguard Worker; CHECK-32-LABEL: g16xh:
77*9880d681SAndroid Build Coastguard Worker; CHECK-32:   testb $8, %ah
78*9880d681SAndroid Build Coastguard Worker; CHECK-32:   ret
79*9880d681SAndroid Build Coastguard Workerdefine void @g16xh(i16 inreg %x) nounwind {
80*9880d681SAndroid Build Coastguard Worker  %t = and i16 %x, 2048
81*9880d681SAndroid Build Coastguard Worker  %s = icmp eq i16 %t, 0
82*9880d681SAndroid Build Coastguard Worker  br i1 %s, label %yes, label %no
83*9880d681SAndroid Build Coastguard Worker
84*9880d681SAndroid Build Coastguard Workeryes:
85*9880d681SAndroid Build Coastguard Worker  call void @bar()
86*9880d681SAndroid Build Coastguard Worker  ret void
87*9880d681SAndroid Build Coastguard Workerno:
88*9880d681SAndroid Build Coastguard Worker  ret void
89*9880d681SAndroid Build Coastguard Worker}
90*9880d681SAndroid Build Coastguard Worker; CHECK-64-LABEL: g16xl:
91*9880d681SAndroid Build Coastguard Worker; CHECK-64:   testb $8, [[A0L]]
92*9880d681SAndroid Build Coastguard Worker; CHECK-64:   ret
93*9880d681SAndroid Build Coastguard Worker; CHECK-32-LABEL: g16xl:
94*9880d681SAndroid Build Coastguard Worker; CHECK-32:   testb $8, %al
95*9880d681SAndroid Build Coastguard Worker; CHECK-32:   ret
96*9880d681SAndroid Build Coastguard Workerdefine void @g16xl(i16 inreg %x) nounwind {
97*9880d681SAndroid Build Coastguard Worker  %t = and i16 %x, 8
98*9880d681SAndroid Build Coastguard Worker  %s = icmp eq i16 %t, 0
99*9880d681SAndroid Build Coastguard Worker  br i1 %s, label %yes, label %no
100*9880d681SAndroid Build Coastguard Worker
101*9880d681SAndroid Build Coastguard Workeryes:
102*9880d681SAndroid Build Coastguard Worker  call void @bar()
103*9880d681SAndroid Build Coastguard Worker  ret void
104*9880d681SAndroid Build Coastguard Workerno:
105*9880d681SAndroid Build Coastguard Worker  ret void
106*9880d681SAndroid Build Coastguard Worker}
107*9880d681SAndroid Build Coastguard Worker; CHECK-64-LABEL: g64x16:
108*9880d681SAndroid Build Coastguard Worker; CHECK-64:   testw $-32640, %[[A0W:di|cx]]
109*9880d681SAndroid Build Coastguard Worker; CHECK-64:   ret
110*9880d681SAndroid Build Coastguard Worker; CHECK-32-LABEL: g64x16:
111*9880d681SAndroid Build Coastguard Worker; CHECK-32:   testw $-32640, %ax
112*9880d681SAndroid Build Coastguard Worker; CHECK-32:   ret
113*9880d681SAndroid Build Coastguard Workerdefine void @g64x16(i64 inreg %x) nounwind {
114*9880d681SAndroid Build Coastguard Worker  %t = and i64 %x, 32896
115*9880d681SAndroid Build Coastguard Worker  %s = icmp eq i64 %t, 0
116*9880d681SAndroid Build Coastguard Worker  br i1 %s, label %yes, label %no
117*9880d681SAndroid Build Coastguard Worker
118*9880d681SAndroid Build Coastguard Workeryes:
119*9880d681SAndroid Build Coastguard Worker  call void @bar()
120*9880d681SAndroid Build Coastguard Worker  ret void
121*9880d681SAndroid Build Coastguard Workerno:
122*9880d681SAndroid Build Coastguard Worker  ret void
123*9880d681SAndroid Build Coastguard Worker}
124*9880d681SAndroid Build Coastguard Worker; CHECK-64-LABEL: g32x16:
125*9880d681SAndroid Build Coastguard Worker; CHECK-64:   testw $-32640, %[[A0W]]
126*9880d681SAndroid Build Coastguard Worker; CHECK-64:   ret
127*9880d681SAndroid Build Coastguard Worker; CHECK-32-LABEL: g32x16:
128*9880d681SAndroid Build Coastguard Worker; CHECK-32:   testw $-32640, %ax
129*9880d681SAndroid Build Coastguard Worker; CHECK-32:   ret
130*9880d681SAndroid Build Coastguard Workerdefine void @g32x16(i32 inreg %x) nounwind {
131*9880d681SAndroid Build Coastguard Worker  %t = and i32 %x, 32896
132*9880d681SAndroid Build Coastguard Worker  %s = icmp eq i32 %t, 0
133*9880d681SAndroid Build Coastguard Worker  br i1 %s, label %yes, label %no
134*9880d681SAndroid Build Coastguard Worker
135*9880d681SAndroid Build Coastguard Workeryes:
136*9880d681SAndroid Build Coastguard Worker  call void @bar()
137*9880d681SAndroid Build Coastguard Worker  ret void
138*9880d681SAndroid Build Coastguard Workerno:
139*9880d681SAndroid Build Coastguard Worker  ret void
140*9880d681SAndroid Build Coastguard Worker}
141*9880d681SAndroid Build Coastguard Worker; CHECK-64-LABEL: g64x32:
142*9880d681SAndroid Build Coastguard Worker; CHECK-64:   testl $268468352, %e[[A0W]]
143*9880d681SAndroid Build Coastguard Worker; CHECK-64:   ret
144*9880d681SAndroid Build Coastguard Worker; CHECK-32-LABEL: g64x32:
145*9880d681SAndroid Build Coastguard Worker; CHECK-32:   testl $268468352, %eax
146*9880d681SAndroid Build Coastguard Worker; CHECK-32:   ret
147*9880d681SAndroid Build Coastguard Workerdefine void @g64x32(i64 inreg %x) nounwind {
148*9880d681SAndroid Build Coastguard Worker  %t = and i64 %x, 268468352
149*9880d681SAndroid Build Coastguard Worker  %s = icmp eq i64 %t, 0
150*9880d681SAndroid Build Coastguard Worker  br i1 %s, label %yes, label %no
151*9880d681SAndroid Build Coastguard Worker
152*9880d681SAndroid Build Coastguard Workeryes:
153*9880d681SAndroid Build Coastguard Worker  call void @bar()
154*9880d681SAndroid Build Coastguard Worker  ret void
155*9880d681SAndroid Build Coastguard Workerno:
156*9880d681SAndroid Build Coastguard Worker  ret void
157*9880d681SAndroid Build Coastguard Worker}
158*9880d681SAndroid Build Coastguard Worker
159*9880d681SAndroid Build Coastguard Workerdeclare void @bar()
160