summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/test-shrink.ll
blob: c9b76c88c1a2995976b6fa3a127bc79130a09411 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=CHECK-64
; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s --check-prefix=CHECK-64
; RUN: llc < %s -march=x86 | FileCheck %s --check-prefix=CHECK-32

; CHECK-64-LABEL: g64xh:
; CHECK-64:   testb $8, {{%ah|%ch}}
; CHECK-64:   ret
; CHECK-32-LABEL: g64xh:
; CHECK-32:   testb $8, %ah
; CHECK-32:   ret
define void @g64xh(i64 inreg %x) nounwind {
  %t = and i64 %x, 2048
  %s = icmp eq i64 %t, 0
  br i1 %s, label %yes, label %no

yes:
  call void @bar()
  ret void
no:
  ret void
}
; CHECK-64-LABEL: g64xl:
; CHECK-64:   testb $8, [[A0L:%dil|%cl]]
; CHECK-64:   ret
; CHECK-32-LABEL: g64xl:
; CHECK-32:   testb $8, %al
; CHECK-32:   ret
define void @g64xl(i64 inreg %x) nounwind {
  %t = and i64 %x, 8
  %s = icmp eq i64 %t, 0
  br i1 %s, label %yes, label %no

yes:
  call void @bar()
  ret void
no:
  ret void
}
; CHECK-64-LABEL: g32xh:
; CHECK-64:   testb $8, {{%ah|%ch}}
; CHECK-64:   ret
; CHECK-32-LABEL: g32xh:
; CHECK-32:   testb $8, %ah
; CHECK-32:   ret
define void @g32xh(i32 inreg %x) nounwind {
  %t = and i32 %x, 2048
  %s = icmp eq i32 %t, 0
  br i1 %s, label %yes, label %no

yes:
  call void @bar()
  ret void
no:
  ret void
}
; CHECK-64-LABEL: g32xl:
; CHECK-64:   testb $8, [[A0L]]
; CHECK-64:   ret
; CHECK-32-LABEL: g32xl:
; CHECK-32:   testb $8, %al
; CHECK-32:   ret
define void @g32xl(i32 inreg %x) nounwind {
  %t = and i32 %x, 8
  %s = icmp eq i32 %t, 0
  br i1 %s, label %yes, label %no

yes:
  call void @bar()
  ret void
no:
  ret void
}
; CHECK-64-LABEL: g16xh:
; CHECK-64:   testb $8, {{%ah|%ch}}
; CHECK-64:   ret
; CHECK-32-LABEL: g16xh:
; CHECK-32:   testb $8, %ah
; CHECK-32:   ret
define void @g16xh(i16 inreg %x) nounwind {
  %t = and i16 %x, 2048
  %s = icmp eq i16 %t, 0
  br i1 %s, label %yes, label %no

yes:
  call void @bar()
  ret void
no:
  ret void
}
; CHECK-64-LABEL: g16xl:
; CHECK-64:   testb $8, [[A0L]]
; CHECK-64:   ret
; CHECK-32-LABEL: g16xl:
; CHECK-32:   testb $8, %al
; CHECK-32:   ret
define void @g16xl(i16 inreg %x) nounwind {
  %t = and i16 %x, 8
  %s = icmp eq i16 %t, 0
  br i1 %s, label %yes, label %no

yes:
  call void @bar()
  ret void
no:
  ret void
}
; CHECK-64-LABEL: g64x16:
; CHECK-64:   testw $-32640, %[[A0W:di|cx]]
; CHECK-64:   ret
; CHECK-32-LABEL: g64x16:
; CHECK-32:   testw $-32640, %ax
; CHECK-32:   ret
define void @g64x16(i64 inreg %x) nounwind {
  %t = and i64 %x, 32896
  %s = icmp eq i64 %t, 0
  br i1 %s, label %yes, label %no

yes:
  call void @bar()
  ret void
no:
  ret void
}
; CHECK-64-LABEL: g32x16:
; CHECK-64:   testw $-32640, %[[A0W]]
; CHECK-64:   ret
; CHECK-32-LABEL: g32x16:
; CHECK-32:   testw $-32640, %ax
; CHECK-32:   ret
define void @g32x16(i32 inreg %x) nounwind {
  %t = and i32 %x, 32896
  %s = icmp eq i32 %t, 0
  br i1 %s, label %yes, label %no

yes:
  call void @bar()
  ret void
no:
  ret void
}
; CHECK-64-LABEL: g64x32:
; CHECK-64:   testl $268468352, %e[[A0W]]
; CHECK-64:   ret
; CHECK-32-LABEL: g64x32:
; CHECK-32:   testl $268468352, %eax
; CHECK-32:   ret
define void @g64x32(i64 inreg %x) nounwind {
  %t = and i64 %x, 268468352
  %s = icmp eq i64 %t, 0
  br i1 %s, label %yes, label %no

yes:
  call void @bar()
  ret void
no:
  ret void
}

declare void @bar()