• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=-bmi < %s | FileCheck %s --check-prefix=CHECK-NOBMI
3; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+bmi < %s | FileCheck %s --check-prefix=CHECK-BMI
4
5; https://bugs.llvm.org/show_bug.cgi?id=37104
6
7; X:       [bit2]      [bit0]
8; Y: [bit3]      [bit1]
9
10define i8 @out8_constmask(i8 %x, i8 %y) {
11; CHECK-NOBMI-LABEL: out8_constmask:
12; CHECK-NOBMI:       # %bb.0:
13; CHECK-NOBMI-NEXT:    andb $85, %dil
14; CHECK-NOBMI-NEXT:    andb $-86, %sil
15; CHECK-NOBMI-NEXT:    orb %dil, %sil
16; CHECK-NOBMI-NEXT:    movl %esi, %eax
17; CHECK-NOBMI-NEXT:    retq
18;
19; CHECK-BMI-LABEL: out8_constmask:
20; CHECK-BMI:       # %bb.0:
21; CHECK-BMI-NEXT:    andb $85, %dil
22; CHECK-BMI-NEXT:    andb $-86, %sil
23; CHECK-BMI-NEXT:    orb %dil, %sil
24; CHECK-BMI-NEXT:    movl %esi, %eax
25; CHECK-BMI-NEXT:    retq
26  %mx = and i8 %x, 85
27  %my = and i8 %y, -86
28  %r = or i8 %mx, %my
29  ret i8 %r
30}
31
32define i16 @out16_constmask(i16 %x, i16 %y) {
33; CHECK-NOBMI-LABEL: out16_constmask:
34; CHECK-NOBMI:       # %bb.0:
35; CHECK-NOBMI-NEXT:    # kill: def $esi killed $esi def $rsi
36; CHECK-NOBMI-NEXT:    # kill: def $edi killed $edi def $rdi
37; CHECK-NOBMI-NEXT:    andl $21845, %edi # imm = 0x5555
38; CHECK-NOBMI-NEXT:    andl $-21846, %esi # imm = 0xAAAA
39; CHECK-NOBMI-NEXT:    leal (%rsi,%rdi), %eax
40; CHECK-NOBMI-NEXT:    # kill: def $ax killed $ax killed $eax
41; CHECK-NOBMI-NEXT:    retq
42;
43; CHECK-BMI-LABEL: out16_constmask:
44; CHECK-BMI:       # %bb.0:
45; CHECK-BMI-NEXT:    # kill: def $esi killed $esi def $rsi
46; CHECK-BMI-NEXT:    # kill: def $edi killed $edi def $rdi
47; CHECK-BMI-NEXT:    andl $21845, %edi # imm = 0x5555
48; CHECK-BMI-NEXT:    andl $-21846, %esi # imm = 0xAAAA
49; CHECK-BMI-NEXT:    leal (%rsi,%rdi), %eax
50; CHECK-BMI-NEXT:    # kill: def $ax killed $ax killed $eax
51; CHECK-BMI-NEXT:    retq
52  %mx = and i16 %x, 21845
53  %my = and i16 %y, -21846
54  %r = or i16 %mx, %my
55  ret i16 %r
56}
57
58define i32 @out32_constmask(i32 %x, i32 %y) {
59; CHECK-NOBMI-LABEL: out32_constmask:
60; CHECK-NOBMI:       # %bb.0:
61; CHECK-NOBMI-NEXT:    # kill: def $esi killed $esi def $rsi
62; CHECK-NOBMI-NEXT:    # kill: def $edi killed $edi def $rdi
63; CHECK-NOBMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
64; CHECK-NOBMI-NEXT:    andl $-1431655766, %esi # imm = 0xAAAAAAAA
65; CHECK-NOBMI-NEXT:    leal (%rsi,%rdi), %eax
66; CHECK-NOBMI-NEXT:    retq
67;
68; CHECK-BMI-LABEL: out32_constmask:
69; CHECK-BMI:       # %bb.0:
70; CHECK-BMI-NEXT:    # kill: def $esi killed $esi def $rsi
71; CHECK-BMI-NEXT:    # kill: def $edi killed $edi def $rdi
72; CHECK-BMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
73; CHECK-BMI-NEXT:    andl $-1431655766, %esi # imm = 0xAAAAAAAA
74; CHECK-BMI-NEXT:    leal (%rsi,%rdi), %eax
75; CHECK-BMI-NEXT:    retq
76  %mx = and i32 %x, 1431655765
77  %my = and i32 %y, -1431655766
78  %r = or i32 %mx, %my
79  ret i32 %r
80}
81
82define i64 @out64_constmask(i64 %x, i64 %y) {
83; CHECK-NOBMI-LABEL: out64_constmask:
84; CHECK-NOBMI:       # %bb.0:
85; CHECK-NOBMI-NEXT:    movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555
86; CHECK-NOBMI-NEXT:    andq %rdi, %rcx
87; CHECK-NOBMI-NEXT:    movabsq $-6148914691236517206, %rax # imm = 0xAAAAAAAAAAAAAAAA
88; CHECK-NOBMI-NEXT:    andq %rsi, %rax
89; CHECK-NOBMI-NEXT:    orq %rcx, %rax
90; CHECK-NOBMI-NEXT:    retq
91;
92; CHECK-BMI-LABEL: out64_constmask:
93; CHECK-BMI:       # %bb.0:
94; CHECK-BMI-NEXT:    movabsq $6148914691236517205, %rcx # imm = 0x5555555555555555
95; CHECK-BMI-NEXT:    andq %rdi, %rcx
96; CHECK-BMI-NEXT:    movabsq $-6148914691236517206, %rax # imm = 0xAAAAAAAAAAAAAAAA
97; CHECK-BMI-NEXT:    andq %rsi, %rax
98; CHECK-BMI-NEXT:    orq %rcx, %rax
99; CHECK-BMI-NEXT:    retq
100  %mx = and i64 %x, 6148914691236517205
101  %my = and i64 %y, -6148914691236517206
102  %r = or i64 %mx, %my
103  ret i64 %r
104}
105
106;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
107; Should be the same as the previous one.
108;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
109
110define i8 @in8_constmask(i8 %x, i8 %y) {
111; CHECK-NOBMI-LABEL: in8_constmask:
112; CHECK-NOBMI:       # %bb.0:
113; CHECK-NOBMI-NEXT:    xorl %esi, %edi
114; CHECK-NOBMI-NEXT:    andb $85, %dil
115; CHECK-NOBMI-NEXT:    xorb %dil, %sil
116; CHECK-NOBMI-NEXT:    movl %esi, %eax
117; CHECK-NOBMI-NEXT:    retq
118;
119; CHECK-BMI-LABEL: in8_constmask:
120; CHECK-BMI:       # %bb.0:
121; CHECK-BMI-NEXT:    xorl %esi, %edi
122; CHECK-BMI-NEXT:    andb $85, %dil
123; CHECK-BMI-NEXT:    xorb %dil, %sil
124; CHECK-BMI-NEXT:    movl %esi, %eax
125; CHECK-BMI-NEXT:    retq
126  %n0 = xor i8 %x, %y
127  %n1 = and i8 %n0, 85
128  %r = xor i8 %n1, %y
129  ret i8 %r
130}
131
132define i16 @in16_constmask(i16 %x, i16 %y) {
133; CHECK-NOBMI-LABEL: in16_constmask:
134; CHECK-NOBMI:       # %bb.0:
135; CHECK-NOBMI-NEXT:    xorl %esi, %edi
136; CHECK-NOBMI-NEXT:    andl $21845, %edi # imm = 0x5555
137; CHECK-NOBMI-NEXT:    xorl %esi, %edi
138; CHECK-NOBMI-NEXT:    movl %edi, %eax
139; CHECK-NOBMI-NEXT:    retq
140;
141; CHECK-BMI-LABEL: in16_constmask:
142; CHECK-BMI:       # %bb.0:
143; CHECK-BMI-NEXT:    xorl %esi, %edi
144; CHECK-BMI-NEXT:    andl $21845, %edi # imm = 0x5555
145; CHECK-BMI-NEXT:    xorl %esi, %edi
146; CHECK-BMI-NEXT:    movl %edi, %eax
147; CHECK-BMI-NEXT:    retq
148  %n0 = xor i16 %x, %y
149  %n1 = and i16 %n0, 21845
150  %r = xor i16 %n1, %y
151  ret i16 %r
152}
153
154define i32 @in32_constmask(i32 %x, i32 %y) {
155; CHECK-NOBMI-LABEL: in32_constmask:
156; CHECK-NOBMI:       # %bb.0:
157; CHECK-NOBMI-NEXT:    xorl %esi, %edi
158; CHECK-NOBMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
159; CHECK-NOBMI-NEXT:    xorl %esi, %edi
160; CHECK-NOBMI-NEXT:    movl %edi, %eax
161; CHECK-NOBMI-NEXT:    retq
162;
163; CHECK-BMI-LABEL: in32_constmask:
164; CHECK-BMI:       # %bb.0:
165; CHECK-BMI-NEXT:    xorl %esi, %edi
166; CHECK-BMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
167; CHECK-BMI-NEXT:    xorl %esi, %edi
168; CHECK-BMI-NEXT:    movl %edi, %eax
169; CHECK-BMI-NEXT:    retq
170  %n0 = xor i32 %x, %y
171  %n1 = and i32 %n0, 1431655765
172  %r = xor i32 %n1, %y
173  ret i32 %r
174}
175
176define i64 @in64_constmask(i64 %x, i64 %y) {
177; CHECK-NOBMI-LABEL: in64_constmask:
178; CHECK-NOBMI:       # %bb.0:
179; CHECK-NOBMI-NEXT:    xorq %rsi, %rdi
180; CHECK-NOBMI-NEXT:    movabsq $6148914691236517205, %rax # imm = 0x5555555555555555
181; CHECK-NOBMI-NEXT:    andq %rdi, %rax
182; CHECK-NOBMI-NEXT:    xorq %rsi, %rax
183; CHECK-NOBMI-NEXT:    retq
184;
185; CHECK-BMI-LABEL: in64_constmask:
186; CHECK-BMI:       # %bb.0:
187; CHECK-BMI-NEXT:    xorq %rsi, %rdi
188; CHECK-BMI-NEXT:    movabsq $6148914691236517205, %rax # imm = 0x5555555555555555
189; CHECK-BMI-NEXT:    andq %rdi, %rax
190; CHECK-BMI-NEXT:    xorq %rsi, %rax
191; CHECK-BMI-NEXT:    retq
192  %n0 = xor i64 %x, %y
193  %n1 = and i64 %n0, 6148914691236517205
194  %r = xor i64 %n1, %y
195  ret i64 %r
196}
197
198; ============================================================================ ;
199; Constant Commutativity tests.
200; ============================================================================ ;
201
202define i32 @in_constmask_commutativity_0_1(i32 %x, i32 %y) {
203; CHECK-NOBMI-LABEL: in_constmask_commutativity_0_1:
204; CHECK-NOBMI:       # %bb.0:
205; CHECK-NOBMI-NEXT:    xorl %esi, %edi
206; CHECK-NOBMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
207; CHECK-NOBMI-NEXT:    xorl %esi, %edi
208; CHECK-NOBMI-NEXT:    movl %edi, %eax
209; CHECK-NOBMI-NEXT:    retq
210;
211; CHECK-BMI-LABEL: in_constmask_commutativity_0_1:
212; CHECK-BMI:       # %bb.0:
213; CHECK-BMI-NEXT:    xorl %esi, %edi
214; CHECK-BMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
215; CHECK-BMI-NEXT:    xorl %esi, %edi
216; CHECK-BMI-NEXT:    movl %edi, %eax
217; CHECK-BMI-NEXT:    retq
218  %n0 = xor i32 %x, %y
219  %n1 = and i32 %n0, 1431655765
220  %r = xor i32 %y, %n1 ; swapped
221  ret i32 %r
222}
223
224define i32 @in_constmask_commutativity_1_0(i32 %x, i32 %y) {
225; CHECK-NOBMI-LABEL: in_constmask_commutativity_1_0:
226; CHECK-NOBMI:       # %bb.0:
227; CHECK-NOBMI-NEXT:    xorl %edi, %esi
228; CHECK-NOBMI-NEXT:    andl $1431655765, %esi # imm = 0x55555555
229; CHECK-NOBMI-NEXT:    xorl %edi, %esi
230; CHECK-NOBMI-NEXT:    movl %esi, %eax
231; CHECK-NOBMI-NEXT:    retq
232;
233; CHECK-BMI-LABEL: in_constmask_commutativity_1_0:
234; CHECK-BMI:       # %bb.0:
235; CHECK-BMI-NEXT:    xorl %edi, %esi
236; CHECK-BMI-NEXT:    andl $1431655765, %esi # imm = 0x55555555
237; CHECK-BMI-NEXT:    xorl %edi, %esi
238; CHECK-BMI-NEXT:    movl %esi, %eax
239; CHECK-BMI-NEXT:    retq
240  %n0 = xor i32 %x, %y
241  %n1 = and i32 %n0, 1431655765
242  %r = xor i32 %n1, %x ; %x instead of %y
243  ret i32 %r
244}
245
246define i32 @in_constmask_commutativity_1_1(i32 %x, i32 %y) {
247; CHECK-NOBMI-LABEL: in_constmask_commutativity_1_1:
248; CHECK-NOBMI:       # %bb.0:
249; CHECK-NOBMI-NEXT:    xorl %edi, %esi
250; CHECK-NOBMI-NEXT:    andl $1431655765, %esi # imm = 0x55555555
251; CHECK-NOBMI-NEXT:    xorl %edi, %esi
252; CHECK-NOBMI-NEXT:    movl %esi, %eax
253; CHECK-NOBMI-NEXT:    retq
254;
255; CHECK-BMI-LABEL: in_constmask_commutativity_1_1:
256; CHECK-BMI:       # %bb.0:
257; CHECK-BMI-NEXT:    xorl %edi, %esi
258; CHECK-BMI-NEXT:    andl $1431655765, %esi # imm = 0x55555555
259; CHECK-BMI-NEXT:    xorl %edi, %esi
260; CHECK-BMI-NEXT:    movl %esi, %eax
261; CHECK-BMI-NEXT:    retq
262  %n0 = xor i32 %x, %y
263  %n1 = and i32 %n0, 1431655765
264  %r = xor i32 %x, %n1 ; swapped, %x instead of %y
265  ret i32 %r
266}
267
268; ============================================================================ ;
269; Y is an 'and' too.
270; ============================================================================ ;
271
272define i32 @in_complex_y0_constmask(i32 %x, i32 %y_hi, i32 %y_low) {
273; CHECK-NOBMI-LABEL: in_complex_y0_constmask:
274; CHECK-NOBMI:       # %bb.0:
275; CHECK-NOBMI-NEXT:    andl %edx, %esi
276; CHECK-NOBMI-NEXT:    xorl %esi, %edi
277; CHECK-NOBMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
278; CHECK-NOBMI-NEXT:    xorl %esi, %edi
279; CHECK-NOBMI-NEXT:    movl %edi, %eax
280; CHECK-NOBMI-NEXT:    retq
281;
282; CHECK-BMI-LABEL: in_complex_y0_constmask:
283; CHECK-BMI:       # %bb.0:
284; CHECK-BMI-NEXT:    andl %edx, %esi
285; CHECK-BMI-NEXT:    xorl %esi, %edi
286; CHECK-BMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
287; CHECK-BMI-NEXT:    xorl %esi, %edi
288; CHECK-BMI-NEXT:    movl %edi, %eax
289; CHECK-BMI-NEXT:    retq
290  %y = and i32 %y_hi, %y_low
291  %n0 = xor i32 %x, %y
292  %n1 = and i32 %n0, 1431655765
293  %r = xor i32 %n1, %y
294  ret i32 %r
295}
296
297define i32 @in_complex_y1_constmask(i32 %x, i32 %y_hi, i32 %y_low) {
298; CHECK-NOBMI-LABEL: in_complex_y1_constmask:
299; CHECK-NOBMI:       # %bb.0:
300; CHECK-NOBMI-NEXT:    andl %edx, %esi
301; CHECK-NOBMI-NEXT:    xorl %esi, %edi
302; CHECK-NOBMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
303; CHECK-NOBMI-NEXT:    xorl %esi, %edi
304; CHECK-NOBMI-NEXT:    movl %edi, %eax
305; CHECK-NOBMI-NEXT:    retq
306;
307; CHECK-BMI-LABEL: in_complex_y1_constmask:
308; CHECK-BMI:       # %bb.0:
309; CHECK-BMI-NEXT:    andl %edx, %esi
310; CHECK-BMI-NEXT:    xorl %esi, %edi
311; CHECK-BMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
312; CHECK-BMI-NEXT:    xorl %esi, %edi
313; CHECK-BMI-NEXT:    movl %edi, %eax
314; CHECK-BMI-NEXT:    retq
315  %y = and i32 %y_hi, %y_low
316  %n0 = xor i32 %x, %y
317  %n1 = and i32 %n0, 1431655765
318  %r = xor i32 %y, %n1
319  ret i32 %r
320}
321
322; ============================================================================ ;
323; Negative tests. Should not be folded.
324; ============================================================================ ;
325
326; Multi-use tests.
327
328declare void @use32(i32) nounwind
329
330define i32 @in_multiuse_A_constmask(i32 %x, i32 %y, i32 %z) nounwind {
331; CHECK-NOBMI-LABEL: in_multiuse_A_constmask:
332; CHECK-NOBMI:       # %bb.0:
333; CHECK-NOBMI-NEXT:    pushq %rbp
334; CHECK-NOBMI-NEXT:    pushq %rbx
335; CHECK-NOBMI-NEXT:    pushq %rax
336; CHECK-NOBMI-NEXT:    movl %esi, %ebx
337; CHECK-NOBMI-NEXT:    movl %edi, %ebp
338; CHECK-NOBMI-NEXT:    xorl %esi, %ebp
339; CHECK-NOBMI-NEXT:    andl $1431655765, %ebp # imm = 0x55555555
340; CHECK-NOBMI-NEXT:    movl %ebp, %edi
341; CHECK-NOBMI-NEXT:    callq use32
342; CHECK-NOBMI-NEXT:    xorl %ebx, %ebp
343; CHECK-NOBMI-NEXT:    movl %ebp, %eax
344; CHECK-NOBMI-NEXT:    addq $8, %rsp
345; CHECK-NOBMI-NEXT:    popq %rbx
346; CHECK-NOBMI-NEXT:    popq %rbp
347; CHECK-NOBMI-NEXT:    retq
348;
349; CHECK-BMI-LABEL: in_multiuse_A_constmask:
350; CHECK-BMI:       # %bb.0:
351; CHECK-BMI-NEXT:    pushq %rbp
352; CHECK-BMI-NEXT:    pushq %rbx
353; CHECK-BMI-NEXT:    pushq %rax
354; CHECK-BMI-NEXT:    movl %esi, %ebx
355; CHECK-BMI-NEXT:    movl %edi, %ebp
356; CHECK-BMI-NEXT:    xorl %esi, %ebp
357; CHECK-BMI-NEXT:    andl $1431655765, %ebp # imm = 0x55555555
358; CHECK-BMI-NEXT:    movl %ebp, %edi
359; CHECK-BMI-NEXT:    callq use32
360; CHECK-BMI-NEXT:    xorl %ebx, %ebp
361; CHECK-BMI-NEXT:    movl %ebp, %eax
362; CHECK-BMI-NEXT:    addq $8, %rsp
363; CHECK-BMI-NEXT:    popq %rbx
364; CHECK-BMI-NEXT:    popq %rbp
365; CHECK-BMI-NEXT:    retq
366  %n0 = xor i32 %x, %y
367  %n1 = and i32 %n0, 1431655765
368  call void @use32(i32 %n1)
369  %r = xor i32 %n1, %y
370  ret i32 %r
371}
372
373define i32 @in_multiuse_B_constmask(i32 %x, i32 %y, i32 %z) nounwind {
374; CHECK-NOBMI-LABEL: in_multiuse_B_constmask:
375; CHECK-NOBMI:       # %bb.0:
376; CHECK-NOBMI-NEXT:    pushq %rbp
377; CHECK-NOBMI-NEXT:    pushq %rbx
378; CHECK-NOBMI-NEXT:    pushq %rax
379; CHECK-NOBMI-NEXT:    movl %esi, %ebx
380; CHECK-NOBMI-NEXT:    xorl %esi, %edi
381; CHECK-NOBMI-NEXT:    movl %edi, %ebp
382; CHECK-NOBMI-NEXT:    andl $1431655765, %ebp # imm = 0x55555555
383; CHECK-NOBMI-NEXT:    callq use32
384; CHECK-NOBMI-NEXT:    xorl %ebx, %ebp
385; CHECK-NOBMI-NEXT:    movl %ebp, %eax
386; CHECK-NOBMI-NEXT:    addq $8, %rsp
387; CHECK-NOBMI-NEXT:    popq %rbx
388; CHECK-NOBMI-NEXT:    popq %rbp
389; CHECK-NOBMI-NEXT:    retq
390;
391; CHECK-BMI-LABEL: in_multiuse_B_constmask:
392; CHECK-BMI:       # %bb.0:
393; CHECK-BMI-NEXT:    pushq %rbp
394; CHECK-BMI-NEXT:    pushq %rbx
395; CHECK-BMI-NEXT:    pushq %rax
396; CHECK-BMI-NEXT:    movl %esi, %ebx
397; CHECK-BMI-NEXT:    xorl %esi, %edi
398; CHECK-BMI-NEXT:    movl %edi, %ebp
399; CHECK-BMI-NEXT:    andl $1431655765, %ebp # imm = 0x55555555
400; CHECK-BMI-NEXT:    callq use32
401; CHECK-BMI-NEXT:    xorl %ebx, %ebp
402; CHECK-BMI-NEXT:    movl %ebp, %eax
403; CHECK-BMI-NEXT:    addq $8, %rsp
404; CHECK-BMI-NEXT:    popq %rbx
405; CHECK-BMI-NEXT:    popq %rbp
406; CHECK-BMI-NEXT:    retq
407  %n0 = xor i32 %x, %y
408  %n1 = and i32 %n0, 1431655765
409  call void @use32(i32 %n0)
410  %r = xor i32 %n1, %y
411  ret i32 %r
412}
413
414; Various bad variants
415
416define i32 @n0_badconstmask(i32 %x, i32 %y) {
417; CHECK-NOBMI-LABEL: n0_badconstmask:
418; CHECK-NOBMI:       # %bb.0:
419; CHECK-NOBMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
420; CHECK-NOBMI-NEXT:    andl $-1431655765, %esi # imm = 0xAAAAAAAB
421; CHECK-NOBMI-NEXT:    orl %edi, %esi
422; CHECK-NOBMI-NEXT:    movl %esi, %eax
423; CHECK-NOBMI-NEXT:    retq
424;
425; CHECK-BMI-LABEL: n0_badconstmask:
426; CHECK-BMI:       # %bb.0:
427; CHECK-BMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
428; CHECK-BMI-NEXT:    andl $-1431655765, %esi # imm = 0xAAAAAAAB
429; CHECK-BMI-NEXT:    orl %edi, %esi
430; CHECK-BMI-NEXT:    movl %esi, %eax
431; CHECK-BMI-NEXT:    retq
432  %mx = and i32 %x, 1431655765
433  %my = and i32 %y, -1431655765 ; instead of -1431655766
434  %r = or i32 %mx, %my
435  ret i32 %r
436}
437
438define i32 @n1_thirdvar_constmask(i32 %x, i32 %y, i32 %z) {
439; CHECK-NOBMI-LABEL: n1_thirdvar_constmask:
440; CHECK-NOBMI:       # %bb.0:
441; CHECK-NOBMI-NEXT:    xorl %esi, %edi
442; CHECK-NOBMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
443; CHECK-NOBMI-NEXT:    xorl %edx, %edi
444; CHECK-NOBMI-NEXT:    movl %edi, %eax
445; CHECK-NOBMI-NEXT:    retq
446;
447; CHECK-BMI-LABEL: n1_thirdvar_constmask:
448; CHECK-BMI:       # %bb.0:
449; CHECK-BMI-NEXT:    xorl %esi, %edi
450; CHECK-BMI-NEXT:    andl $1431655765, %edi # imm = 0x55555555
451; CHECK-BMI-NEXT:    xorl %edx, %edi
452; CHECK-BMI-NEXT:    movl %edi, %eax
453; CHECK-BMI-NEXT:    retq
454  %n0 = xor i32 %x, %y
455  %n1 = and i32 %n0, 1431655765
456  %r = xor i32 %n1, %z ; instead of %y
457  ret i32 %r
458}
459