1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
5 define i32 @test1(i32 %x) nounwind {
8 ; CHECK-NEXT: movl %edi, %eax
9 ; CHECK-NEXT: andl $31, %eax
10 ; CHECK-NEXT: shll $10, %eax
13 %shl = and i32 %and, 31744
17 define i32 @test2(i32 %x) nounwind {
20 ; CHECK-NEXT: movl %edi, %eax
21 ; CHECK-NEXT: orl $31, %eax
22 ; CHECK-NEXT: shll $10, %eax
25 %shl = or i32 %or, 31744
29 define i32 @test3(i32 %x) nounwind {
32 ; CHECK-NEXT: movl %edi, %eax
33 ; CHECK-NEXT: xorl $31, %eax
34 ; CHECK-NEXT: shll $10, %eax
37 %shl = xor i32 %xor, 31744
41 define i64 @test4(i64 %x) nounwind {
44 ; CHECK-NEXT: movq %rdi, %rax
45 ; CHECK-NEXT: andl $241, %eax
46 ; CHECK-NEXT: shlq $40, %rax
49 %shl = and i64 %and, 264982302294016
53 define i64 @test5(i64 %x) nounwind {
56 ; CHECK-NEXT: movq %rdi, %rax
57 ; CHECK-NEXT: andl $31, %eax
58 ; CHECK-NEXT: shlq $40, %rax
61 %shl = and i64 %and, 34084860461056
65 define i64 @test6(i64 %x) nounwind {
68 ; CHECK-NEXT: movq %rdi, %rax
69 ; CHECK-NEXT: andl $-65536, %eax # imm = 0xFFFF0000
70 ; CHECK-NEXT: shlq $32, %rax
73 %shl = and i64 %and, -281474976710656
77 define i64 @test7(i64 %x) nounwind {
80 ; CHECK-NEXT: movq %rdi, %rax
81 ; CHECK-NEXT: orq $241, %rax
82 ; CHECK-NEXT: shlq $40, %rax
85 %shl = or i64 %or, 264982302294016
89 define i64 @test8(i64 %x) nounwind {
92 ; CHECK-NEXT: movq %rdi, %rax
93 ; CHECK-NEXT: orq $31, %rax
94 ; CHECK-NEXT: shlq $40, %rax
97 %shl = or i64 %or, 34084860461056
101 define i64 @test9(i64 %x) nounwind {
102 ; CHECK-LABEL: test9:
104 ; CHECK-NEXT: movq %rdi, %rax
105 ; CHECK-NEXT: xorq $241, %rax
106 ; CHECK-NEXT: shlq $40, %rax
108 %xor = shl i64 %x, 40
109 %shl = xor i64 %xor, 264982302294016
113 define i64 @test10(i64 %x) nounwind {
114 ; CHECK-LABEL: test10:
116 ; CHECK-NEXT: movq %rdi, %rax
117 ; CHECK-NEXT: xorq $31, %rax
118 ; CHECK-NEXT: shlq $40, %rax
120 %xor = shl i64 %x, 40
121 %shl = xor i64 %xor, 34084860461056
125 define i64 @test11(i64 %x) nounwind {
126 ; CHECK-LABEL: test11:
128 ; CHECK-NEXT: movq %rdi, %rax
129 ; CHECK-NEXT: xorq $-65536, %rax # imm = 0xFFFF0000
130 ; CHECK-NEXT: shlq $33, %rax
132 %xor = shl i64 %x, 33
133 %shl = xor i64 %xor, -562949953421312
138 define i32 @test12(i32 %x, ptr %y) nounwind {
139 ; CHECK-LABEL: test12:
141 ; CHECK-NEXT: addl %edi, %edi
142 ; CHECK-NEXT: movzbl %dil, %eax
143 ; CHECK-NEXT: movl %eax, (%rsi)
146 %shl = and i32 %and, 255
147 store i32 %shl, ptr %y
151 define i64 @test13(i64 %x, ptr %y) nounwind {
152 ; CHECK-LABEL: test13:
154 ; CHECK-NEXT: addl %edi, %edi
155 ; CHECK-NEXT: movzbl %dil, %eax
156 ; CHECK-NEXT: movq %rax, (%rsi)
159 %shl = and i64 %and, 255
160 store i64 %shl, ptr %y
164 define i64 @test14(i64 %x, ptr %y) nounwind {
165 ; CHECK-LABEL: test14:
167 ; CHECK-NEXT: movq %rdi, %rax
168 ; CHECK-NEXT: andl $-16777216, %eax # imm = 0xFF000000
169 ; CHECK-NEXT: shlq $8, %rax
172 %shl = and i64 %and, 1095216660480
176 define i64 @test15(i64 %x, ptr %y) nounwind {
177 ; CHECK-LABEL: test15:
179 ; CHECK-NEXT: movl $4278190080, %eax # imm = 0xFF000000
180 ; CHECK-NEXT: orq %rdi, %rax
181 ; CHECK-NEXT: shlq $8, %rax
184 %shl = or i64 %or, 1095216660480
188 define i64 @test16(i64 %x, ptr %y) nounwind {
189 ; CHECK-LABEL: test16:
191 ; CHECK-NEXT: movl $4278190080, %eax # imm = 0xFF000000
192 ; CHECK-NEXT: xorq %rdi, %rax
193 ; CHECK-NEXT: shlq $8, %rax
196 %shl = xor i64 %xor, 1095216660480
200 define i32 @test17(i32 %x) nounwind {
201 ; CHECK-LABEL: test17:
203 ; CHECK-NEXT: movzbl %dil, %eax
204 ; CHECK-NEXT: shll $10, %eax
206 %and = shl i32 %x, 10
207 %shl = and i32 %and, 261120
211 define i64 @test18(i64 %x) nounwind {
212 ; CHECK-LABEL: test18:
214 ; CHECK-NEXT: movzbl %dil, %eax
215 ; CHECK-NEXT: shll $10, %eax
217 %and = shl i64 %x, 10
218 %shl = and i64 %and, 261120
222 define i32 @test19(i32 %x) nounwind {
223 ; CHECK-LABEL: test19:
225 ; CHECK-NEXT: movzwl %di, %eax
226 ; CHECK-NEXT: shll $10, %eax
228 %and = shl i32 %x, 10
229 %shl = and i32 %and, 67107840
233 define i64 @test20(i64 %x) nounwind {
234 ; CHECK-LABEL: test20:
236 ; CHECK-NEXT: movzwl %di, %eax
237 ; CHECK-NEXT: shll $10, %eax
239 %and = shl i64 %x, 10
240 %shl = and i64 %and, 67107840
244 define i64 @test21(i64 %x) nounwind {
245 ; CHECK-LABEL: test21:
247 ; CHECK-NEXT: movl %edi, %eax
248 ; CHECK-NEXT: shlq $10, %rax
250 %and = shl i64 %x, 10
251 %shl = and i64 %and, 4398046510080