1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -verify-machineinstrs -show-mc-encoding | FileCheck %s
3
4target triple = "x86_64-unknown-unknown"
5
6@g64 = external dso_local global i64, align 8
7@g32 = external dso_local global i32, align 4
8@g16 = external dso_local global i16, align 2
9@g8 = external dso_local global i8, align 1
10
11declare dso_local void @a()
12declare dso_local void @b()
13
14define void @add64_imm32_br() nounwind {
15; CHECK-LABEL: add64_imm32_br:
16; CHECK:       # %bb.0: # %entry
17; CHECK-NEXT:    addq $16777214, {{.*}}(%rip) # encoding: [0x48,0x81,0x05,A,A,A,A,0xfe,0xff,0xff,0x00]
18; CHECK-NEXT:    # fixup A - offset: 3, value: g64-8, kind: reloc_riprel_4byte
19; CHECK-NEXT:    # imm = 0xFFFFFE
20; CHECK-NEXT:    js .LBB0_1 # encoding: [0x78,A]
21; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB0_1-1, kind: FK_PCRel_1
22; CHECK-NEXT:  # %bb.2: # %b
23; CHECK-NEXT:    jmp b # TAILCALL
24; CHECK-NEXT:    # encoding: [0xeb,A]
25; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
26; CHECK-NEXT:  .LBB0_1: # %a
27; CHECK-NEXT:    jmp a # TAILCALL
28; CHECK-NEXT:    # encoding: [0xeb,A]
29; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
30entry:
31  %load1 = load i64, i64* @g64
32  ; Add 0x00FFFFFE, a positive immediate requiring 24-bits.
33  %add = add i64 %load1, 16777214
34  store i64 %add, i64* @g64
35  %cond = icmp slt i64 %add, 0
36  br i1 %cond, label %a, label %b
37
38a:
39  tail call void @a()
40  ret void
41
42b:
43  tail call void @b()
44  ret void
45}
46
47define void @add64_sext_imm32_br() nounwind {
48; CHECK-LABEL: add64_sext_imm32_br:
49; CHECK:       # %bb.0: # %entry
50; CHECK-NEXT:    addq $-2147483648, {{.*}}(%rip) # encoding: [0x48,0x81,0x05,A,A,A,A,0x00,0x00,0x00,0x80]
51; CHECK-NEXT:    # fixup A - offset: 3, value: g64-8, kind: reloc_riprel_4byte
52; CHECK-NEXT:    # imm = 0x80000000
53; CHECK-NEXT:    js .LBB1_1 # encoding: [0x78,A]
54; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB1_1-1, kind: FK_PCRel_1
55; CHECK-NEXT:  # %bb.2: # %b
56; CHECK-NEXT:    jmp b # TAILCALL
57; CHECK-NEXT:    # encoding: [0xeb,A]
58; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
59; CHECK-NEXT:  .LBB1_1: # %a
60; CHECK-NEXT:    jmp a # TAILCALL
61; CHECK-NEXT:    # encoding: [0xeb,A]
62; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
63entry:
64  %load1 = load i64, i64* @g64
65  ; Add -0x80000000, which requires sign-extended 32 bits.
66  %add = add i64 %load1, -2147483648
67  store i64 %add, i64* @g64
68  %cond = icmp slt i64 %add, 0
69  br i1 %cond, label %a, label %b
70
71a:
72  tail call void @a()
73  ret void
74
75b:
76  tail call void @b()
77  ret void
78}
79
80define void @add64_imm32_via_sub_br() nounwind {
81; CHECK-LABEL: add64_imm32_via_sub_br:
82; CHECK:       # %bb.0: # %entry
83; CHECK-NEXT:    subq $-2147483648, {{.*}}(%rip) # encoding: [0x48,0x81,0x2d,A,A,A,A,0x00,0x00,0x00,0x80]
84; CHECK-NEXT:    # fixup A - offset: 3, value: g64-8, kind: reloc_riprel_4byte
85; CHECK-NEXT:    # imm = 0x80000000
86; CHECK-NEXT:    js .LBB2_1 # encoding: [0x78,A]
87; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB2_1-1, kind: FK_PCRel_1
88; CHECK-NEXT:  # %bb.2: # %b
89; CHECK-NEXT:    jmp b # TAILCALL
90; CHECK-NEXT:    # encoding: [0xeb,A]
91; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
92; CHECK-NEXT:  .LBB2_1: # %a
93; CHECK-NEXT:    jmp a # TAILCALL
94; CHECK-NEXT:    # encoding: [0xeb,A]
95; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
96entry:
97  %load1 = load i64, i64* @g64
98  ; Add 0x80000000, which cannot fit in a sign extended 32-bit immediate. This
99  ; get's folded because we can instead subtract -0x80000000.
100  %add = add i64 %load1, 2147483648
101  store i64 %add, i64* @g64
102  %cond = icmp slt i64 %add, 0
103  br i1 %cond, label %a, label %b
104
105a:
106  tail call void @a()
107  ret void
108
109b:
110  tail call void @b()
111  ret void
112}
113
114define void @add64_no_imm32_via_sub_due_to_cf_br() nounwind {
115; CHECK-LABEL: add64_no_imm32_via_sub_due_to_cf_br:
116; CHECK:       # %bb.0: # %entry
117; CHECK-NEXT:    movl $2147483648, %eax # encoding: [0xb8,0x00,0x00,0x00,0x80]
118; CHECK-NEXT:    # imm = 0x80000000
119; CHECK-NEXT:    addq %rax, {{.*}}(%rip) # encoding: [0x48,0x01,0x05,A,A,A,A]
120; CHECK-NEXT:    # fixup A - offset: 3, value: g64-4, kind: reloc_riprel_4byte
121; CHECK-NEXT:    jae .LBB3_2 # encoding: [0x73,A]
122; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB3_2-1, kind: FK_PCRel_1
123; CHECK-NEXT:  # %bb.1: # %a
124; CHECK-NEXT:    jmp a # TAILCALL
125; CHECK-NEXT:    # encoding: [0xeb,A]
126; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
127; CHECK-NEXT:  .LBB3_2: # %b
128; CHECK-NEXT:    jmp b # TAILCALL
129; CHECK-NEXT:    # encoding: [0xeb,A]
130; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
131entry:
132  %load1 = load i64, i64* @g64
133  ; Add 0x80000000, which cannot fit in a sign extended 32-bit immediate, but
134  ; could in theory be folded into an immediate operand of a sub. However, we
135  ; use the CF flag here and so shouldn't make that transformation.
136  %add = add i64 %load1, 2147483648
137  store i64 %add, i64* @g64
138  %cond = icmp ult i64 %add, 2147483648
139  br i1 %cond, label %a, label %b
140
141a:
142  tail call void @a()
143  ret void
144
145b:
146  tail call void @b()
147  ret void
148}
149
150define void @add64_too_large_imm32_br() nounwind {
151; CHECK-LABEL: add64_too_large_imm32_br:
152; CHECK:       # %bb.0: # %entry
153; CHECK-NEXT:    movl $2147483649, %eax # encoding: [0xb8,0x01,0x00,0x00,0x80]
154; CHECK-NEXT:    # imm = 0x80000001
155; CHECK-NEXT:    addq %rax, {{.*}}(%rip) # encoding: [0x48,0x01,0x05,A,A,A,A]
156; CHECK-NEXT:    # fixup A - offset: 3, value: g64-4, kind: reloc_riprel_4byte
157; CHECK-NEXT:    js .LBB4_1 # encoding: [0x78,A]
158; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB4_1-1, kind: FK_PCRel_1
159; CHECK-NEXT:  # %bb.2: # %b
160; CHECK-NEXT:    jmp b # TAILCALL
161; CHECK-NEXT:    # encoding: [0xeb,A]
162; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
163; CHECK-NEXT:  .LBB4_1: # %a
164; CHECK-NEXT:    jmp a # TAILCALL
165; CHECK-NEXT:    # encoding: [0xeb,A]
166; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
167entry:
168  %load1 = load i64, i64* @g64
169  ; Add 0x80000001, which cannot fit in a sign extended 32-bit immediate. This
170  ; should not get folded into an immediate.
171  %add = add i64 %load1, 2147483649
172  store i64 %add, i64* @g64
173  %cond = icmp slt i64 %add, 0
174  br i1 %cond, label %a, label %b
175
176a:
177  tail call void @a()
178  ret void
179
180b:
181  tail call void @b()
182  ret void
183}
184
185define void @add64_imm8_via_sub_br() nounwind {
186; CHECK-LABEL: add64_imm8_via_sub_br:
187; CHECK:       # %bb.0: # %entry
188; CHECK-NEXT:    subq $-128, {{.*}}(%rip) # encoding: [0x48,0x83,0x2d,A,A,A,A,0x80]
189; CHECK-NEXT:    # fixup A - offset: 3, value: g64-5, kind: reloc_riprel_4byte
190; CHECK-NEXT:    js .LBB5_1 # encoding: [0x78,A]
191; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB5_1-1, kind: FK_PCRel_1
192; CHECK-NEXT:  # %bb.2: # %b
193; CHECK-NEXT:    jmp b # TAILCALL
194; CHECK-NEXT:    # encoding: [0xeb,A]
195; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
196; CHECK-NEXT:  .LBB5_1: # %a
197; CHECK-NEXT:    jmp a # TAILCALL
198; CHECK-NEXT:    # encoding: [0xeb,A]
199; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
200entry:
201  %load1 = load i64, i64* @g64
202  ; Add 0x80 which can't quite fit into an imm8 because it would be sign
203  ; extended, but which can fit if we convert to a sub and negate the value.
204  %add = add i64 %load1, 128
205  store i64 %add, i64* @g64
206  %cond = icmp slt i64 %add, 0
207  br i1 %cond, label %a, label %b
208
209a:
210  tail call void @a()
211  ret void
212
213b:
214  tail call void @b()
215  ret void
216}
217
218define void @add64_imm8_br() nounwind {
219; CHECK-LABEL: add64_imm8_br:
220; CHECK:       # %bb.0: # %entry
221; CHECK-NEXT:    addq $42, {{.*}}(%rip) # encoding: [0x48,0x83,0x05,A,A,A,A,0x2a]
222; CHECK-NEXT:    # fixup A - offset: 3, value: g64-5, kind: reloc_riprel_4byte
223; CHECK-NEXT:    js .LBB6_1 # encoding: [0x78,A]
224; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB6_1-1, kind: FK_PCRel_1
225; CHECK-NEXT:  # %bb.2: # %b
226; CHECK-NEXT:    jmp b # TAILCALL
227; CHECK-NEXT:    # encoding: [0xeb,A]
228; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
229; CHECK-NEXT:  .LBB6_1: # %a
230; CHECK-NEXT:    jmp a # TAILCALL
231; CHECK-NEXT:    # encoding: [0xeb,A]
232; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
233entry:
234  %load1 = load i64, i64* @g64
235  %add = add i64 %load1, 42
236  store i64 %add, i64* @g64
237  %cond = icmp slt i64 %add, 0
238  br i1 %cond, label %a, label %b
239
240a:
241  tail call void @a()
242  ret void
243
244b:
245  tail call void @b()
246  ret void
247}
248
249define void @add64_imm8_neg_br() nounwind {
250; CHECK-LABEL: add64_imm8_neg_br:
251; CHECK:       # %bb.0: # %entry
252; CHECK-NEXT:    addq $-42, {{.*}}(%rip) # encoding: [0x48,0x83,0x05,A,A,A,A,0xd6]
253; CHECK-NEXT:    # fixup A - offset: 3, value: g64-5, kind: reloc_riprel_4byte
254; CHECK-NEXT:    js .LBB7_1 # encoding: [0x78,A]
255; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB7_1-1, kind: FK_PCRel_1
256; CHECK-NEXT:  # %bb.2: # %b
257; CHECK-NEXT:    jmp b # TAILCALL
258; CHECK-NEXT:    # encoding: [0xeb,A]
259; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
260; CHECK-NEXT:  .LBB7_1: # %a
261; CHECK-NEXT:    jmp a # TAILCALL
262; CHECK-NEXT:    # encoding: [0xeb,A]
263; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
264entry:
265  %load1 = load i64, i64* @g64
266  %add = add i64 %load1, -42
267  store i64 %add, i64* @g64
268  %cond = icmp slt i64 %add, 0
269  br i1 %cond, label %a, label %b
270
271a:
272  tail call void @a()
273  ret void
274
275b:
276  tail call void @b()
277  ret void
278}
279
280define void @add32_imm_br() nounwind {
281; CHECK-LABEL: add32_imm_br:
282; CHECK:       # %bb.0: # %entry
283; CHECK-NEXT:    addl $-2147483648, {{.*}}(%rip) # encoding: [0x81,0x05,A,A,A,A,0x00,0x00,0x00,0x80]
284; CHECK-NEXT:    # fixup A - offset: 2, value: g32-8, kind: reloc_riprel_4byte
285; CHECK-NEXT:    # imm = 0x80000000
286; CHECK-NEXT:    js .LBB8_1 # encoding: [0x78,A]
287; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB8_1-1, kind: FK_PCRel_1
288; CHECK-NEXT:  # %bb.2: # %b
289; CHECK-NEXT:    jmp b # TAILCALL
290; CHECK-NEXT:    # encoding: [0xeb,A]
291; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
292; CHECK-NEXT:  .LBB8_1: # %a
293; CHECK-NEXT:    jmp a # TAILCALL
294; CHECK-NEXT:    # encoding: [0xeb,A]
295; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
296entry:
297  %load1 = load i32, i32* @g32
298  ; Add 0x80000000, a positive number requiring 32 bits of immediate.
299  %add = add i32 %load1, 2147483648
300  store i32 %add, i32* @g32
301  %cond = icmp slt i32 %add, 0
302  br i1 %cond, label %a, label %b
303
304a:
305  tail call void @a()
306  ret void
307
308b:
309  tail call void @b()
310  ret void
311}
312
313define void @add32_imm8_br() nounwind {
314; CHECK-LABEL: add32_imm8_br:
315; CHECK:       # %bb.0: # %entry
316; CHECK-NEXT:    addl $42, {{.*}}(%rip) # encoding: [0x83,0x05,A,A,A,A,0x2a]
317; CHECK-NEXT:    # fixup A - offset: 2, value: g32-5, kind: reloc_riprel_4byte
318; CHECK-NEXT:    js .LBB9_1 # encoding: [0x78,A]
319; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB9_1-1, kind: FK_PCRel_1
320; CHECK-NEXT:  # %bb.2: # %b
321; CHECK-NEXT:    jmp b # TAILCALL
322; CHECK-NEXT:    # encoding: [0xeb,A]
323; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
324; CHECK-NEXT:  .LBB9_1: # %a
325; CHECK-NEXT:    jmp a # TAILCALL
326; CHECK-NEXT:    # encoding: [0xeb,A]
327; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
328entry:
329  %load1 = load i32, i32* @g32
330  %add = add i32 %load1, 42
331  store i32 %add, i32* @g32
332  %cond = icmp slt i32 %add, 0
333  br i1 %cond, label %a, label %b
334
335a:
336  tail call void @a()
337  ret void
338
339b:
340  tail call void @b()
341  ret void
342}
343
344define void @add32_imm8_neg_br() nounwind {
345; CHECK-LABEL: add32_imm8_neg_br:
346; CHECK:       # %bb.0: # %entry
347; CHECK-NEXT:    addl $-42, {{.*}}(%rip) # encoding: [0x83,0x05,A,A,A,A,0xd6]
348; CHECK-NEXT:    # fixup A - offset: 2, value: g32-5, kind: reloc_riprel_4byte
349; CHECK-NEXT:    js .LBB10_1 # encoding: [0x78,A]
350; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB10_1-1, kind: FK_PCRel_1
351; CHECK-NEXT:  # %bb.2: # %b
352; CHECK-NEXT:    jmp b # TAILCALL
353; CHECK-NEXT:    # encoding: [0xeb,A]
354; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
355; CHECK-NEXT:  .LBB10_1: # %a
356; CHECK-NEXT:    jmp a # TAILCALL
357; CHECK-NEXT:    # encoding: [0xeb,A]
358; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
359entry:
360  %load1 = load i32, i32* @g32
361  %add = add i32 %load1, -42
362  store i32 %add, i32* @g32
363  %cond = icmp slt i32 %add, 0
364  br i1 %cond, label %a, label %b
365
366a:
367  tail call void @a()
368  ret void
369
370b:
371  tail call void @b()
372  ret void
373}
374
375define void @add16_imm_br() nounwind {
376; CHECK-LABEL: add16_imm_br:
377; CHECK:       # %bb.0: # %entry
378; CHECK-NEXT:    addw $-32768, {{.*}}(%rip) # encoding: [0x66,0x81,0x05,A,A,A,A,0x00,0x80]
379; CHECK-NEXT:    # fixup A - offset: 3, value: g16-6, kind: reloc_riprel_4byte
380; CHECK-NEXT:    # imm = 0x8000
381; CHECK-NEXT:    js .LBB11_1 # encoding: [0x78,A]
382; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB11_1-1, kind: FK_PCRel_1
383; CHECK-NEXT:  # %bb.2: # %b
384; CHECK-NEXT:    jmp b # TAILCALL
385; CHECK-NEXT:    # encoding: [0xeb,A]
386; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
387; CHECK-NEXT:  .LBB11_1: # %a
388; CHECK-NEXT:    jmp a # TAILCALL
389; CHECK-NEXT:    # encoding: [0xeb,A]
390; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
391entry:
392  %load1 = load i16, i16* @g16
393  ; Add 0x8000, a positive number requiring 16 bits of immediate.
394  %add = add i16 %load1, 32768
395  store i16 %add, i16* @g16
396  %cond = icmp slt i16 %add, 0
397  br i1 %cond, label %a, label %b
398
399a:
400  tail call void @a()
401  ret void
402
403b:
404  tail call void @b()
405  ret void
406}
407
408define void @add16_imm8_br() nounwind {
409; CHECK-LABEL: add16_imm8_br:
410; CHECK:       # %bb.0: # %entry
411; CHECK-NEXT:    addw $42, {{.*}}(%rip) # encoding: [0x66,0x83,0x05,A,A,A,A,0x2a]
412; CHECK-NEXT:    # fixup A - offset: 3, value: g16-5, kind: reloc_riprel_4byte
413; CHECK-NEXT:    js .LBB12_1 # encoding: [0x78,A]
414; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB12_1-1, kind: FK_PCRel_1
415; CHECK-NEXT:  # %bb.2: # %b
416; CHECK-NEXT:    jmp b # TAILCALL
417; CHECK-NEXT:    # encoding: [0xeb,A]
418; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
419; CHECK-NEXT:  .LBB12_1: # %a
420; CHECK-NEXT:    jmp a # TAILCALL
421; CHECK-NEXT:    # encoding: [0xeb,A]
422; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
423entry:
424  %load1 = load i16, i16* @g16
425  %add = add i16 %load1, 42
426  store i16 %add, i16* @g16
427  %cond = icmp slt i16 %add, 0
428  br i1 %cond, label %a, label %b
429
430a:
431  tail call void @a()
432  ret void
433
434b:
435  tail call void @b()
436  ret void
437}
438
439define void @add16_imm8_neg_br() nounwind {
440; CHECK-LABEL: add16_imm8_neg_br:
441; CHECK:       # %bb.0: # %entry
442; CHECK-NEXT:    addw $-42, {{.*}}(%rip) # encoding: [0x66,0x83,0x05,A,A,A,A,0xd6]
443; CHECK-NEXT:    # fixup A - offset: 3, value: g16-5, kind: reloc_riprel_4byte
444; CHECK-NEXT:    js .LBB13_1 # encoding: [0x78,A]
445; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB13_1-1, kind: FK_PCRel_1
446; CHECK-NEXT:  # %bb.2: # %b
447; CHECK-NEXT:    jmp b # TAILCALL
448; CHECK-NEXT:    # encoding: [0xeb,A]
449; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
450; CHECK-NEXT:  .LBB13_1: # %a
451; CHECK-NEXT:    jmp a # TAILCALL
452; CHECK-NEXT:    # encoding: [0xeb,A]
453; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
454entry:
455  %load1 = load i16, i16* @g16
456  %add = add i16 %load1, -42
457  store i16 %add, i16* @g16
458  %cond = icmp slt i16 %add, 0
459  br i1 %cond, label %a, label %b
460
461a:
462  tail call void @a()
463  ret void
464
465b:
466  tail call void @b()
467  ret void
468}
469
470define void @add8_imm_br() nounwind {
471; CHECK-LABEL: add8_imm_br:
472; CHECK:       # %bb.0: # %entry
473; CHECK-NEXT:    addb $-2, {{.*}}(%rip) # encoding: [0x80,0x05,A,A,A,A,0xfe]
474; CHECK-NEXT:    # fixup A - offset: 2, value: g8-5, kind: reloc_riprel_4byte
475; CHECK-NEXT:    js .LBB14_1 # encoding: [0x78,A]
476; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB14_1-1, kind: FK_PCRel_1
477; CHECK-NEXT:  # %bb.2: # %b
478; CHECK-NEXT:    jmp b # TAILCALL
479; CHECK-NEXT:    # encoding: [0xeb,A]
480; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
481; CHECK-NEXT:  .LBB14_1: # %a
482; CHECK-NEXT:    jmp a # TAILCALL
483; CHECK-NEXT:    # encoding: [0xeb,A]
484; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
485entry:
486  %load1 = load i8, i8* @g8
487  %add = add i8 %load1, -2
488  store i8 %add, i8* @g8
489  %cond = icmp slt i8 %add, 0
490  br i1 %cond, label %a, label %b
491
492a:
493  tail call void @a()
494  ret void
495
496b:
497  tail call void @b()
498  ret void
499}
500
501define void @add64_reg_br(i64 %arg) nounwind {
502; CHECK-LABEL: add64_reg_br:
503; CHECK:       # %bb.0: # %entry
504; CHECK-NEXT:    addq %rdi, {{.*}}(%rip) # encoding: [0x48,0x01,0x3d,A,A,A,A]
505; CHECK-NEXT:    # fixup A - offset: 3, value: g64-4, kind: reloc_riprel_4byte
506; CHECK-NEXT:    js .LBB15_1 # encoding: [0x78,A]
507; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB15_1-1, kind: FK_PCRel_1
508; CHECK-NEXT:  # %bb.2: # %b
509; CHECK-NEXT:    jmp b # TAILCALL
510; CHECK-NEXT:    # encoding: [0xeb,A]
511; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
512; CHECK-NEXT:  .LBB15_1: # %a
513; CHECK-NEXT:    jmp a # TAILCALL
514; CHECK-NEXT:    # encoding: [0xeb,A]
515; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
516entry:
517  %load1 = load i64, i64* @g64
518  %add = add i64 %load1, %arg
519  store i64 %add, i64* @g64
520  %cond = icmp slt i64 %add, 0
521  br i1 %cond, label %a, label %b
522
523a:
524  tail call void @a()
525  ret void
526
527b:
528  tail call void @b()
529  ret void
530}
531
532define void @add32_reg_br(i32 %arg) nounwind {
533; CHECK-LABEL: add32_reg_br:
534; CHECK:       # %bb.0: # %entry
535; CHECK-NEXT:    addl %edi, {{.*}}(%rip) # encoding: [0x01,0x3d,A,A,A,A]
536; CHECK-NEXT:    # fixup A - offset: 2, value: g32-4, kind: reloc_riprel_4byte
537; CHECK-NEXT:    js .LBB16_1 # encoding: [0x78,A]
538; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB16_1-1, kind: FK_PCRel_1
539; CHECK-NEXT:  # %bb.2: # %b
540; CHECK-NEXT:    jmp b # TAILCALL
541; CHECK-NEXT:    # encoding: [0xeb,A]
542; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
543; CHECK-NEXT:  .LBB16_1: # %a
544; CHECK-NEXT:    jmp a # TAILCALL
545; CHECK-NEXT:    # encoding: [0xeb,A]
546; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
547entry:
548  %load1 = load i32, i32* @g32
549  %add = add i32 %load1, %arg
550  store i32 %add, i32* @g32
551  %cond = icmp slt i32 %add, 0
552  br i1 %cond, label %a, label %b
553
554a:
555  tail call void @a()
556  ret void
557
558b:
559  tail call void @b()
560  ret void
561}
562
563define void @add16_reg_br(i16 %arg) nounwind {
564; CHECK-LABEL: add16_reg_br:
565; CHECK:       # %bb.0: # %entry
566; CHECK-NEXT:    addw %di, {{.*}}(%rip) # encoding: [0x66,0x01,0x3d,A,A,A,A]
567; CHECK-NEXT:    # fixup A - offset: 3, value: g16-4, kind: reloc_riprel_4byte
568; CHECK-NEXT:    js .LBB17_1 # encoding: [0x78,A]
569; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB17_1-1, kind: FK_PCRel_1
570; CHECK-NEXT:  # %bb.2: # %b
571; CHECK-NEXT:    jmp b # TAILCALL
572; CHECK-NEXT:    # encoding: [0xeb,A]
573; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
574; CHECK-NEXT:  .LBB17_1: # %a
575; CHECK-NEXT:    jmp a # TAILCALL
576; CHECK-NEXT:    # encoding: [0xeb,A]
577; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
578entry:
579  %load1 = load i16, i16* @g16
580  %add = add i16 %load1, %arg
581  store i16 %add, i16* @g16
582  %cond = icmp slt i16 %add, 0
583  br i1 %cond, label %a, label %b
584
585a:
586  tail call void @a()
587  ret void
588
589b:
590  tail call void @b()
591  ret void
592}
593
594define void @add8_reg_br(i8 %arg) nounwind {
595; CHECK-LABEL: add8_reg_br:
596; CHECK:       # %bb.0: # %entry
597; CHECK-NEXT:    addb %dil, {{.*}}(%rip) # encoding: [0x40,0x00,0x3d,A,A,A,A]
598; CHECK-NEXT:    # fixup A - offset: 3, value: g8-4, kind: reloc_riprel_4byte
599; CHECK-NEXT:    js .LBB18_1 # encoding: [0x78,A]
600; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB18_1-1, kind: FK_PCRel_1
601; CHECK-NEXT:  # %bb.2: # %b
602; CHECK-NEXT:    jmp b # TAILCALL
603; CHECK-NEXT:    # encoding: [0xeb,A]
604; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
605; CHECK-NEXT:  .LBB18_1: # %a
606; CHECK-NEXT:    jmp a # TAILCALL
607; CHECK-NEXT:    # encoding: [0xeb,A]
608; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
609entry:
610  %load1 = load i8, i8* @g8
611  %add = add i8 %load1, %arg
612  store i8 %add, i8* @g8
613  %cond = icmp slt i8 %add, 0
614  br i1 %cond, label %a, label %b
615
616a:
617  tail call void @a()
618  ret void
619
620b:
621  tail call void @b()
622  ret void
623}
624
625define void @sub64_imm32_br() nounwind {
626; CHECK-LABEL: sub64_imm32_br:
627; CHECK:       # %bb.0: # %entry
628; CHECK-NEXT:    subq $-2147483648, {{.*}}(%rip) # encoding: [0x48,0x81,0x2d,A,A,A,A,0x00,0x00,0x00,0x80]
629; CHECK-NEXT:    # fixup A - offset: 3, value: g64-8, kind: reloc_riprel_4byte
630; CHECK-NEXT:    # imm = 0x80000000
631; CHECK-NEXT:    js .LBB19_1 # encoding: [0x78,A]
632; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB19_1-1, kind: FK_PCRel_1
633; CHECK-NEXT:  # %bb.2: # %b
634; CHECK-NEXT:    jmp b # TAILCALL
635; CHECK-NEXT:    # encoding: [0xeb,A]
636; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
637; CHECK-NEXT:  .LBB19_1: # %a
638; CHECK-NEXT:    jmp a # TAILCALL
639; CHECK-NEXT:    # encoding: [0xeb,A]
640; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
641entry:
642  %load1 = load i64, i64* @g64
643  ; Subtract -0x80000000, which can't be negated into a sign-extended 32-bit
644  ; immediate, so that we have to select sub here.
645  %sub = sub i64 %load1, -2147483648
646  store i64 %sub, i64* @g64
647  %cond = icmp slt i64 %sub, 0
648  br i1 %cond, label %a, label %b
649
650a:
651  tail call void @a()
652  ret void
653
654b:
655  tail call void @b()
656  ret void
657}
658
659define void @sub64_too_large_imm32_br() nounwind {
660; CHECK-LABEL: sub64_too_large_imm32_br:
661; CHECK:       # %bb.0: # %entry
662; CHECK-NEXT:    movabsq $-4294967295, %rax # encoding: [0x48,0xb8,0x01,0x00,0x00,0x00,0xff,0xff,0xff,0xff]
663; CHECK-NEXT:    # imm = 0xFFFFFFFF00000001
664; CHECK-NEXT:    addq %rax, {{.*}}(%rip) # encoding: [0x48,0x01,0x05,A,A,A,A]
665; CHECK-NEXT:    # fixup A - offset: 3, value: g64-4, kind: reloc_riprel_4byte
666; CHECK-NEXT:    js .LBB20_1 # encoding: [0x78,A]
667; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB20_1-1, kind: FK_PCRel_1
668; CHECK-NEXT:  # %bb.2: # %b
669; CHECK-NEXT:    jmp b # TAILCALL
670; CHECK-NEXT:    # encoding: [0xeb,A]
671; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
672; CHECK-NEXT:  .LBB20_1: # %a
673; CHECK-NEXT:    jmp a # TAILCALL
674; CHECK-NEXT:    # encoding: [0xeb,A]
675; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
676entry:
677  %load1 = load i64, i64* @g64
678  ; Subtract 0xFFFFFFFF, which cannot fit in a sign extended 32-bit immediate,
679  ; even if negated and sign extended as an add.
680  %sub = sub i64 %load1, 4294967295
681  store i64 %sub, i64* @g64
682  %cond = icmp slt i64 %sub, 0
683  br i1 %cond, label %a, label %b
684
685a:
686  tail call void @a()
687  ret void
688
689b:
690  tail call void @b()
691  ret void
692}
693
694define void @sub64_imm8_br() nounwind {
695; CHECK-LABEL: sub64_imm8_br:
696; CHECK:       # %bb.0: # %entry
697; CHECK-NEXT:    subq $-128, {{.*}}(%rip) # encoding: [0x48,0x83,0x2d,A,A,A,A,0x80]
698; CHECK-NEXT:    # fixup A - offset: 3, value: g64-5, kind: reloc_riprel_4byte
699; CHECK-NEXT:    js .LBB21_1 # encoding: [0x78,A]
700; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB21_1-1, kind: FK_PCRel_1
701; CHECK-NEXT:  # %bb.2: # %b
702; CHECK-NEXT:    jmp b # TAILCALL
703; CHECK-NEXT:    # encoding: [0xeb,A]
704; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
705; CHECK-NEXT:  .LBB21_1: # %a
706; CHECK-NEXT:    jmp a # TAILCALL
707; CHECK-NEXT:    # encoding: [0xeb,A]
708; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
709entry:
710  %load1 = load i64, i64* @g64
711  ; Subtract -0x80, which can be done with an 8-bit immediate but only as
712  ; a subtract where that immediate can be negative.
713  %sub = sub i64 %load1, -128
714  store i64 %sub, i64* @g64
715  %cond = icmp slt i64 %sub, 0
716  br i1 %cond, label %a, label %b
717
718a:
719  tail call void @a()
720  ret void
721
722b:
723  tail call void @b()
724  ret void
725}
726
727define void @sub32_imm_br() nounwind {
728; CHECK-LABEL: sub32_imm_br:
729; CHECK:       # %bb.0: # %entry
730; CHECK-NEXT:    addl $-2147483648, {{.*}}(%rip) # encoding: [0x81,0x05,A,A,A,A,0x00,0x00,0x00,0x80]
731; CHECK-NEXT:    # fixup A - offset: 2, value: g32-8, kind: reloc_riprel_4byte
732; CHECK-NEXT:    # imm = 0x80000000
733; CHECK-NEXT:    js .LBB22_1 # encoding: [0x78,A]
734; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB22_1-1, kind: FK_PCRel_1
735; CHECK-NEXT:  # %bb.2: # %b
736; CHECK-NEXT:    jmp b # TAILCALL
737; CHECK-NEXT:    # encoding: [0xeb,A]
738; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
739; CHECK-NEXT:  .LBB22_1: # %a
740; CHECK-NEXT:    jmp a # TAILCALL
741; CHECK-NEXT:    # encoding: [0xeb,A]
742; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
743entry:
744  %load1 = load i32, i32* @g32
745  ; Subtract -0x80000000, which requires 32 bits of immediate but still gets
746  ; lowered as an add.
747  %sub = sub i32 %load1, -2147483648
748  store i32 %sub, i32* @g32
749  %cond = icmp slt i32 %sub, 0
750  br i1 %cond, label %a, label %b
751
752a:
753  tail call void @a()
754  ret void
755
756b:
757  tail call void @b()
758  ret void
759}
760
761define void @sub32_imm8_br() nounwind {
762; CHECK-LABEL: sub32_imm8_br:
763; CHECK:       # %bb.0: # %entry
764; CHECK-NEXT:    subl $-128, {{.*}}(%rip) # encoding: [0x83,0x2d,A,A,A,A,0x80]
765; CHECK-NEXT:    # fixup A - offset: 2, value: g32-5, kind: reloc_riprel_4byte
766; CHECK-NEXT:    js .LBB23_1 # encoding: [0x78,A]
767; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB23_1-1, kind: FK_PCRel_1
768; CHECK-NEXT:  # %bb.2: # %b
769; CHECK-NEXT:    jmp b # TAILCALL
770; CHECK-NEXT:    # encoding: [0xeb,A]
771; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
772; CHECK-NEXT:  .LBB23_1: # %a
773; CHECK-NEXT:    jmp a # TAILCALL
774; CHECK-NEXT:    # encoding: [0xeb,A]
775; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
776entry:
777  %load1 = load i32, i32* @g32
778  ; Subtract -0x80, which can be done with an 8-bit immediate but only as
779  ; a subtract where that immediate can be negative.
780  %sub = sub i32 %load1, -128
781  store i32 %sub, i32* @g32
782  %cond = icmp slt i32 %sub, 0
783  br i1 %cond, label %a, label %b
784
785a:
786  tail call void @a()
787  ret void
788
789b:
790  tail call void @b()
791  ret void
792}
793
794define void @sub16_imm_br() nounwind {
795; CHECK-LABEL: sub16_imm_br:
796; CHECK:       # %bb.0: # %entry
797; CHECK-NEXT:    addw $-32768, {{.*}}(%rip) # encoding: [0x66,0x81,0x05,A,A,A,A,0x00,0x80]
798; CHECK-NEXT:    # fixup A - offset: 3, value: g16-6, kind: reloc_riprel_4byte
799; CHECK-NEXT:    # imm = 0x8000
800; CHECK-NEXT:    js .LBB24_1 # encoding: [0x78,A]
801; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB24_1-1, kind: FK_PCRel_1
802; CHECK-NEXT:  # %bb.2: # %b
803; CHECK-NEXT:    jmp b # TAILCALL
804; CHECK-NEXT:    # encoding: [0xeb,A]
805; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
806; CHECK-NEXT:  .LBB24_1: # %a
807; CHECK-NEXT:    jmp a # TAILCALL
808; CHECK-NEXT:    # encoding: [0xeb,A]
809; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
810entry:
811  %load1 = load i16, i16* @g16
812  ; Subtract -0x8000, which requires a 16 bits of immediate but still gets
813  ; lowered as an add.
814  %sub = sub i16 %load1, -32768
815  store i16 %sub, i16* @g16
816  %cond = icmp slt i16 %sub, 0
817  br i1 %cond, label %a, label %b
818
819a:
820  tail call void @a()
821  ret void
822
823b:
824  tail call void @b()
825  ret void
826}
827
828define void @sub16_imm8_br() nounwind {
829; CHECK-LABEL: sub16_imm8_br:
830; CHECK:       # %bb.0: # %entry
831; CHECK-NEXT:    subw $-128, {{.*}}(%rip) # encoding: [0x66,0x83,0x2d,A,A,A,A,0x80]
832; CHECK-NEXT:    # fixup A - offset: 3, value: g16-5, kind: reloc_riprel_4byte
833; CHECK-NEXT:    js .LBB25_1 # encoding: [0x78,A]
834; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB25_1-1, kind: FK_PCRel_1
835; CHECK-NEXT:  # %bb.2: # %b
836; CHECK-NEXT:    jmp b # TAILCALL
837; CHECK-NEXT:    # encoding: [0xeb,A]
838; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
839; CHECK-NEXT:  .LBB25_1: # %a
840; CHECK-NEXT:    jmp a # TAILCALL
841; CHECK-NEXT:    # encoding: [0xeb,A]
842; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
843entry:
844  %load1 = load i16, i16* @g16
845  ; Subtract -0x80, which can be done with an 8-bit immediate but only as
846  ; a subtract where that immediate can be negative.
847  %sub = sub i16 %load1, -128
848  store i16 %sub, i16* @g16
849  %cond = icmp slt i16 %sub, 0
850  br i1 %cond, label %a, label %b
851
852a:
853  tail call void @a()
854  ret void
855
856b:
857  tail call void @b()
858  ret void
859}
860
861define void @sub8_imm_br() nounwind {
862; CHECK-LABEL: sub8_imm_br:
863; CHECK:       # %bb.0: # %entry
864; CHECK-NEXT:    addb $-128, {{.*}}(%rip) # encoding: [0x80,0x05,A,A,A,A,0x80]
865; CHECK-NEXT:    # fixup A - offset: 2, value: g8-5, kind: reloc_riprel_4byte
866; CHECK-NEXT:    js .LBB26_1 # encoding: [0x78,A]
867; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB26_1-1, kind: FK_PCRel_1
868; CHECK-NEXT:  # %bb.2: # %b
869; CHECK-NEXT:    jmp b # TAILCALL
870; CHECK-NEXT:    # encoding: [0xeb,A]
871; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
872; CHECK-NEXT:  .LBB26_1: # %a
873; CHECK-NEXT:    jmp a # TAILCALL
874; CHECK-NEXT:    # encoding: [0xeb,A]
875; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
876entry:
877  %load1 = load i8, i8* @g8
878  ; Subtract -0x80, which requires an 8-bit immediate but still gets lowered as
879  ; an add.
880  %sub = sub i8 %load1, -128
881  store i8 %sub, i8* @g8
882  %cond = icmp slt i8 %sub, 0
883  br i1 %cond, label %a, label %b
884
885a:
886  tail call void @a()
887  ret void
888
889b:
890  tail call void @b()
891  ret void
892}
893
894define void @sub64_reg_br(i64 %arg) nounwind {
895; CHECK-LABEL: sub64_reg_br:
896; CHECK:       # %bb.0: # %entry
897; CHECK-NEXT:    subq %rdi, {{.*}}(%rip) # encoding: [0x48,0x29,0x3d,A,A,A,A]
898; CHECK-NEXT:    # fixup A - offset: 3, value: g64-4, kind: reloc_riprel_4byte
899; CHECK-NEXT:    js .LBB27_1 # encoding: [0x78,A]
900; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB27_1-1, kind: FK_PCRel_1
901; CHECK-NEXT:  # %bb.2: # %b
902; CHECK-NEXT:    jmp b # TAILCALL
903; CHECK-NEXT:    # encoding: [0xeb,A]
904; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
905; CHECK-NEXT:  .LBB27_1: # %a
906; CHECK-NEXT:    jmp a # TAILCALL
907; CHECK-NEXT:    # encoding: [0xeb,A]
908; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
909entry:
910  %load1 = load i64, i64* @g64
911  %sub = sub i64 %load1, %arg
912  store i64 %sub, i64* @g64
913  %cond = icmp slt i64 %sub, 0
914  br i1 %cond, label %a, label %b
915
916a:
917  tail call void @a()
918  ret void
919
920b:
921  tail call void @b()
922  ret void
923}
924
925define void @sub32_reg_br(i32 %arg) nounwind {
926; CHECK-LABEL: sub32_reg_br:
927; CHECK:       # %bb.0: # %entry
928; CHECK-NEXT:    subl %edi, {{.*}}(%rip) # encoding: [0x29,0x3d,A,A,A,A]
929; CHECK-NEXT:    # fixup A - offset: 2, value: g32-4, kind: reloc_riprel_4byte
930; CHECK-NEXT:    js .LBB28_1 # encoding: [0x78,A]
931; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB28_1-1, kind: FK_PCRel_1
932; CHECK-NEXT:  # %bb.2: # %b
933; CHECK-NEXT:    jmp b # TAILCALL
934; CHECK-NEXT:    # encoding: [0xeb,A]
935; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
936; CHECK-NEXT:  .LBB28_1: # %a
937; CHECK-NEXT:    jmp a # TAILCALL
938; CHECK-NEXT:    # encoding: [0xeb,A]
939; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
940entry:
941  %load1 = load i32, i32* @g32
942  %sub = sub i32 %load1, %arg
943  store i32 %sub, i32* @g32
944  %cond = icmp slt i32 %sub, 0
945  br i1 %cond, label %a, label %b
946
947a:
948  tail call void @a()
949  ret void
950
951b:
952  tail call void @b()
953  ret void
954}
955
956define void @sub16_reg_br(i16 %arg) nounwind {
957; CHECK-LABEL: sub16_reg_br:
958; CHECK:       # %bb.0: # %entry
959; CHECK-NEXT:    subw %di, {{.*}}(%rip) # encoding: [0x66,0x29,0x3d,A,A,A,A]
960; CHECK-NEXT:    # fixup A - offset: 3, value: g16-4, kind: reloc_riprel_4byte
961; CHECK-NEXT:    js .LBB29_1 # encoding: [0x78,A]
962; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB29_1-1, kind: FK_PCRel_1
963; CHECK-NEXT:  # %bb.2: # %b
964; CHECK-NEXT:    jmp b # TAILCALL
965; CHECK-NEXT:    # encoding: [0xeb,A]
966; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
967; CHECK-NEXT:  .LBB29_1: # %a
968; CHECK-NEXT:    jmp a # TAILCALL
969; CHECK-NEXT:    # encoding: [0xeb,A]
970; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
971entry:
972  %load1 = load i16, i16* @g16
973  %sub = sub i16 %load1, %arg
974  store i16 %sub, i16* @g16
975  %cond = icmp slt i16 %sub, 0
976  br i1 %cond, label %a, label %b
977
978a:
979  tail call void @a()
980  ret void
981
982b:
983  tail call void @b()
984  ret void
985}
986
987define void @sub8_reg_br(i8 %arg) nounwind {
988; CHECK-LABEL: sub8_reg_br:
989; CHECK:       # %bb.0: # %entry
990; CHECK-NEXT:    subb %dil, {{.*}}(%rip) # encoding: [0x40,0x28,0x3d,A,A,A,A]
991; CHECK-NEXT:    # fixup A - offset: 3, value: g8-4, kind: reloc_riprel_4byte
992; CHECK-NEXT:    js .LBB30_1 # encoding: [0x78,A]
993; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB30_1-1, kind: FK_PCRel_1
994; CHECK-NEXT:  # %bb.2: # %b
995; CHECK-NEXT:    jmp b # TAILCALL
996; CHECK-NEXT:    # encoding: [0xeb,A]
997; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
998; CHECK-NEXT:  .LBB30_1: # %a
999; CHECK-NEXT:    jmp a # TAILCALL
1000; CHECK-NEXT:    # encoding: [0xeb,A]
1001; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1002entry:
1003  %load1 = load i8, i8* @g8
1004  %sub = sub i8 %load1, %arg
1005  store i8 %sub, i8* @g8
1006  %cond = icmp slt i8 %sub, 0
1007  br i1 %cond, label %a, label %b
1008
1009a:
1010  tail call void @a()
1011  ret void
1012
1013b:
1014  tail call void @b()
1015  ret void
1016}
1017
1018define void @and64_imm32_br() nounwind {
1019; CHECK-LABEL: and64_imm32_br:
1020; CHECK:       # %bb.0: # %entry
1021; CHECK-NEXT:    andq $16777215, {{.*}}(%rip) # encoding: [0x48,0x81,0x25,A,A,A,A,0xff,0xff,0xff,0x00]
1022; CHECK-NEXT:    # fixup A - offset: 3, value: g64-8, kind: reloc_riprel_4byte
1023; CHECK-NEXT:    # imm = 0xFFFFFF
1024; CHECK-NEXT:    je .LBB31_1 # encoding: [0x74,A]
1025; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB31_1-1, kind: FK_PCRel_1
1026; CHECK-NEXT:  # %bb.2: # %b
1027; CHECK-NEXT:    jmp b # TAILCALL
1028; CHECK-NEXT:    # encoding: [0xeb,A]
1029; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1030; CHECK-NEXT:  .LBB31_1: # %a
1031; CHECK-NEXT:    jmp a # TAILCALL
1032; CHECK-NEXT:    # encoding: [0xeb,A]
1033; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1034entry:
1035  %load1 = load i64, i64* @g64
1036  ; And 0x00FFFFFF, a positive immediate requiring 24-bits.
1037  %and = and i64 %load1, 16777215
1038  store i64 %and, i64* @g64
1039  %cond = icmp eq i64 %and, 0
1040  br i1 %cond, label %a, label %b
1041
1042a:
1043  tail call void @a()
1044  ret void
1045
1046b:
1047  tail call void @b()
1048  ret void
1049}
1050
1051define void @and64_sext_imm32_br() nounwind {
1052; CHECK-LABEL: and64_sext_imm32_br:
1053; CHECK:       # %bb.0: # %entry
1054; CHECK-NEXT:    andq $-2147483648, {{.*}}(%rip) # encoding: [0x48,0x81,0x25,A,A,A,A,0x00,0x00,0x00,0x80]
1055; CHECK-NEXT:    # fixup A - offset: 3, value: g64-8, kind: reloc_riprel_4byte
1056; CHECK-NEXT:    # imm = 0x80000000
1057; CHECK-NEXT:    je .LBB32_1 # encoding: [0x74,A]
1058; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB32_1-1, kind: FK_PCRel_1
1059; CHECK-NEXT:  # %bb.2: # %b
1060; CHECK-NEXT:    jmp b # TAILCALL
1061; CHECK-NEXT:    # encoding: [0xeb,A]
1062; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1063; CHECK-NEXT:  .LBB32_1: # %a
1064; CHECK-NEXT:    jmp a # TAILCALL
1065; CHECK-NEXT:    # encoding: [0xeb,A]
1066; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1067entry:
1068  %load1 = load i64, i64* @g64
1069  ; And -0x80000000, which requires sign-extended 32 bits.
1070  %and = and i64 %load1, -2147483648
1071  store i64 %and, i64* @g64
1072  %cond = icmp eq i64 %and, 0
1073  br i1 %cond, label %a, label %b
1074
1075a:
1076  tail call void @a()
1077  ret void
1078
1079b:
1080  tail call void @b()
1081  ret void
1082}
1083
1084define void @and64_imm8_br() nounwind {
1085; CHECK-LABEL: and64_imm8_br:
1086; CHECK:       # %bb.0: # %entry
1087; CHECK-NEXT:    andq $15, {{.*}}(%rip) # encoding: [0x48,0x83,0x25,A,A,A,A,0x0f]
1088; CHECK-NEXT:    # fixup A - offset: 3, value: g64-5, kind: reloc_riprel_4byte
1089; CHECK-NEXT:    je .LBB33_1 # encoding: [0x74,A]
1090; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB33_1-1, kind: FK_PCRel_1
1091; CHECK-NEXT:  # %bb.2: # %b
1092; CHECK-NEXT:    jmp b # TAILCALL
1093; CHECK-NEXT:    # encoding: [0xeb,A]
1094; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1095; CHECK-NEXT:  .LBB33_1: # %a
1096; CHECK-NEXT:    jmp a # TAILCALL
1097; CHECK-NEXT:    # encoding: [0xeb,A]
1098; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1099entry:
1100  %load1 = load i64, i64* @g64
1101  %and = and i64 %load1, 15
1102  store i64 %and, i64* @g64
1103  %cond = icmp eq i64 %and, 0
1104  br i1 %cond, label %a, label %b
1105
1106a:
1107  tail call void @a()
1108  ret void
1109
1110b:
1111  tail call void @b()
1112  ret void
1113}
1114
1115define void @and64_imm8_neg_br() nounwind {
1116; CHECK-LABEL: and64_imm8_neg_br:
1117; CHECK:       # %bb.0: # %entry
1118; CHECK-NEXT:    andq $-4, {{.*}}(%rip) # encoding: [0x48,0x83,0x25,A,A,A,A,0xfc]
1119; CHECK-NEXT:    # fixup A - offset: 3, value: g64-5, kind: reloc_riprel_4byte
1120; CHECK-NEXT:    je .LBB34_1 # encoding: [0x74,A]
1121; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB34_1-1, kind: FK_PCRel_1
1122; CHECK-NEXT:  # %bb.2: # %b
1123; CHECK-NEXT:    jmp b # TAILCALL
1124; CHECK-NEXT:    # encoding: [0xeb,A]
1125; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1126; CHECK-NEXT:  .LBB34_1: # %a
1127; CHECK-NEXT:    jmp a # TAILCALL
1128; CHECK-NEXT:    # encoding: [0xeb,A]
1129; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1130entry:
1131  %load1 = load i64, i64* @g64
1132  %and = and i64 %load1, -4
1133  store i64 %and, i64* @g64
1134  %cond = icmp eq i64 %and, 0
1135  br i1 %cond, label %a, label %b
1136
1137a:
1138  tail call void @a()
1139  ret void
1140
1141b:
1142  tail call void @b()
1143  ret void
1144}
1145
1146define void @and32_imm_br() nounwind {
1147; CHECK-LABEL: and32_imm_br:
1148; CHECK:       # %bb.0: # %entry
1149; CHECK-NEXT:    andl $-2147483648, {{.*}}(%rip) # encoding: [0x81,0x25,A,A,A,A,0x00,0x00,0x00,0x80]
1150; CHECK-NEXT:    # fixup A - offset: 2, value: g32-8, kind: reloc_riprel_4byte
1151; CHECK-NEXT:    # imm = 0x80000000
1152; CHECK-NEXT:    jne .LBB35_2 # encoding: [0x75,A]
1153; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB35_2-1, kind: FK_PCRel_1
1154; CHECK-NEXT:  # %bb.1: # %a
1155; CHECK-NEXT:    jmp a # TAILCALL
1156; CHECK-NEXT:    # encoding: [0xeb,A]
1157; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1158; CHECK-NEXT:  .LBB35_2: # %b
1159; CHECK-NEXT:    jmp b # TAILCALL
1160; CHECK-NEXT:    # encoding: [0xeb,A]
1161; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1162entry:
1163  %load1 = load i32, i32* @g32
1164  ; And 0x80000000, a positive number requiring 32 bits of immediate.
1165  %and = and i32 %load1, 2147483648
1166  store i32 %and, i32* @g32
1167  %cond = icmp eq i32 %and, 0
1168  br i1 %cond, label %a, label %b
1169
1170a:
1171  tail call void @a()
1172  ret void
1173
1174b:
1175  tail call void @b()
1176  ret void
1177}
1178
1179define void @and32_imm8_br() nounwind {
1180; CHECK-LABEL: and32_imm8_br:
1181; CHECK:       # %bb.0: # %entry
1182; CHECK-NEXT:    andl $15, {{.*}}(%rip) # encoding: [0x83,0x25,A,A,A,A,0x0f]
1183; CHECK-NEXT:    # fixup A - offset: 2, value: g32-5, kind: reloc_riprel_4byte
1184; CHECK-NEXT:    je .LBB36_1 # encoding: [0x74,A]
1185; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB36_1-1, kind: FK_PCRel_1
1186; CHECK-NEXT:  # %bb.2: # %b
1187; CHECK-NEXT:    jmp b # TAILCALL
1188; CHECK-NEXT:    # encoding: [0xeb,A]
1189; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1190; CHECK-NEXT:  .LBB36_1: # %a
1191; CHECK-NEXT:    jmp a # TAILCALL
1192; CHECK-NEXT:    # encoding: [0xeb,A]
1193; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1194entry:
1195  %load1 = load i32, i32* @g32
1196  %and = and i32 %load1, 15
1197  store i32 %and, i32* @g32
1198  %cond = icmp eq i32 %and, 0
1199  br i1 %cond, label %a, label %b
1200
1201a:
1202  tail call void @a()
1203  ret void
1204
1205b:
1206  tail call void @b()
1207  ret void
1208}
1209
1210define void @and32_imm8_neg_br() nounwind {
1211; CHECK-LABEL: and32_imm8_neg_br:
1212; CHECK:       # %bb.0: # %entry
1213; CHECK-NEXT:    andl $-4, {{.*}}(%rip) # encoding: [0x83,0x25,A,A,A,A,0xfc]
1214; CHECK-NEXT:    # fixup A - offset: 2, value: g32-5, kind: reloc_riprel_4byte
1215; CHECK-NEXT:    je .LBB37_1 # encoding: [0x74,A]
1216; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB37_1-1, kind: FK_PCRel_1
1217; CHECK-NEXT:  # %bb.2: # %b
1218; CHECK-NEXT:    jmp b # TAILCALL
1219; CHECK-NEXT:    # encoding: [0xeb,A]
1220; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1221; CHECK-NEXT:  .LBB37_1: # %a
1222; CHECK-NEXT:    jmp a # TAILCALL
1223; CHECK-NEXT:    # encoding: [0xeb,A]
1224; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1225entry:
1226  %load1 = load i32, i32* @g32
1227  %and = and i32 %load1, -4
1228  store i32 %and, i32* @g32
1229  %cond = icmp eq i32 %and, 0
1230  br i1 %cond, label %a, label %b
1231
1232a:
1233  tail call void @a()
1234  ret void
1235
1236b:
1237  tail call void @b()
1238  ret void
1239}
1240
1241define void @and16_imm_br() nounwind {
1242; CHECK-LABEL: and16_imm_br:
1243; CHECK:       # %bb.0: # %entry
1244; CHECK-NEXT:    andw $-32768, {{.*}}(%rip) # encoding: [0x66,0x81,0x25,A,A,A,A,0x00,0x80]
1245; CHECK-NEXT:    # fixup A - offset: 3, value: g16-6, kind: reloc_riprel_4byte
1246; CHECK-NEXT:    # imm = 0x8000
1247; CHECK-NEXT:    jne .LBB38_2 # encoding: [0x75,A]
1248; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB38_2-1, kind: FK_PCRel_1
1249; CHECK-NEXT:  # %bb.1: # %a
1250; CHECK-NEXT:    jmp a # TAILCALL
1251; CHECK-NEXT:    # encoding: [0xeb,A]
1252; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1253; CHECK-NEXT:  .LBB38_2: # %b
1254; CHECK-NEXT:    jmp b # TAILCALL
1255; CHECK-NEXT:    # encoding: [0xeb,A]
1256; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1257entry:
1258  %load1 = load i16, i16* @g16
1259  %and = and i16 %load1, 32768
1260  store i16 %and, i16* @g16
1261  %cond = icmp eq i16 %and, 0
1262  br i1 %cond, label %a, label %b
1263
1264a:
1265  tail call void @a()
1266  ret void
1267
1268b:
1269  tail call void @b()
1270  ret void
1271}
1272
1273define void @and16_imm8_br() nounwind {
1274; CHECK-LABEL: and16_imm8_br:
1275; CHECK:       # %bb.0: # %entry
1276; CHECK-NEXT:    andw $15, {{.*}}(%rip) # encoding: [0x66,0x83,0x25,A,A,A,A,0x0f]
1277; CHECK-NEXT:    # fixup A - offset: 3, value: g16-5, kind: reloc_riprel_4byte
1278; CHECK-NEXT:    je .LBB39_1 # encoding: [0x74,A]
1279; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB39_1-1, kind: FK_PCRel_1
1280; CHECK-NEXT:  # %bb.2: # %b
1281; CHECK-NEXT:    jmp b # TAILCALL
1282; CHECK-NEXT:    # encoding: [0xeb,A]
1283; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1284; CHECK-NEXT:  .LBB39_1: # %a
1285; CHECK-NEXT:    jmp a # TAILCALL
1286; CHECK-NEXT:    # encoding: [0xeb,A]
1287; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1288entry:
1289  %load1 = load i16, i16* @g16
1290  %and = and i16 %load1, 15
1291  store i16 %and, i16* @g16
1292  %cond = icmp eq i16 %and, 0
1293  br i1 %cond, label %a, label %b
1294
1295a:
1296  tail call void @a()
1297  ret void
1298
1299b:
1300  tail call void @b()
1301  ret void
1302}
1303
1304define void @and16_imm8_neg_br() nounwind {
1305; CHECK-LABEL: and16_imm8_neg_br:
1306; CHECK:       # %bb.0: # %entry
1307; CHECK-NEXT:    andw $-4, {{.*}}(%rip) # encoding: [0x66,0x83,0x25,A,A,A,A,0xfc]
1308; CHECK-NEXT:    # fixup A - offset: 3, value: g16-5, kind: reloc_riprel_4byte
1309; CHECK-NEXT:    je .LBB40_1 # encoding: [0x74,A]
1310; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB40_1-1, kind: FK_PCRel_1
1311; CHECK-NEXT:  # %bb.2: # %b
1312; CHECK-NEXT:    jmp b # TAILCALL
1313; CHECK-NEXT:    # encoding: [0xeb,A]
1314; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1315; CHECK-NEXT:  .LBB40_1: # %a
1316; CHECK-NEXT:    jmp a # TAILCALL
1317; CHECK-NEXT:    # encoding: [0xeb,A]
1318; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1319entry:
1320  %load1 = load i16, i16* @g16
1321  %and = and i16 %load1, -4
1322  store i16 %and, i16* @g16
1323  %cond = icmp eq i16 %and, 0
1324  br i1 %cond, label %a, label %b
1325
1326a:
1327  tail call void @a()
1328  ret void
1329
1330b:
1331  tail call void @b()
1332  ret void
1333}
1334
1335define void @and8_imm_br() nounwind {
1336; CHECK-LABEL: and8_imm_br:
1337; CHECK:       # %bb.0: # %entry
1338; CHECK-NEXT:    andb $-4, {{.*}}(%rip) # encoding: [0x80,0x25,A,A,A,A,0xfc]
1339; CHECK-NEXT:    # fixup A - offset: 2, value: g8-5, kind: reloc_riprel_4byte
1340; CHECK-NEXT:    je .LBB41_1 # encoding: [0x74,A]
1341; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB41_1-1, kind: FK_PCRel_1
1342; CHECK-NEXT:  # %bb.2: # %b
1343; CHECK-NEXT:    jmp b # TAILCALL
1344; CHECK-NEXT:    # encoding: [0xeb,A]
1345; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1346; CHECK-NEXT:  .LBB41_1: # %a
1347; CHECK-NEXT:    jmp a # TAILCALL
1348; CHECK-NEXT:    # encoding: [0xeb,A]
1349; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1350entry:
1351  %load1 = load i8, i8* @g8
1352  %and = and i8 %load1, -4
1353  store i8 %and, i8* @g8
1354  %cond = icmp eq i8 %and, 0
1355  br i1 %cond, label %a, label %b
1356
1357a:
1358  tail call void @a()
1359  ret void
1360
1361b:
1362  tail call void @b()
1363  ret void
1364}
1365
1366define void @and64_reg_br(i64 %arg) nounwind {
1367; CHECK-LABEL: and64_reg_br:
1368; CHECK:       # %bb.0: # %entry
1369; CHECK-NEXT:    andq %rdi, {{.*}}(%rip) # encoding: [0x48,0x21,0x3d,A,A,A,A]
1370; CHECK-NEXT:    # fixup A - offset: 3, value: g64-4, kind: reloc_riprel_4byte
1371; CHECK-NEXT:    je .LBB42_1 # encoding: [0x74,A]
1372; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB42_1-1, kind: FK_PCRel_1
1373; CHECK-NEXT:  # %bb.2: # %b
1374; CHECK-NEXT:    jmp b # TAILCALL
1375; CHECK-NEXT:    # encoding: [0xeb,A]
1376; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1377; CHECK-NEXT:  .LBB42_1: # %a
1378; CHECK-NEXT:    jmp a # TAILCALL
1379; CHECK-NEXT:    # encoding: [0xeb,A]
1380; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1381entry:
1382  %load1 = load i64, i64* @g64
1383  %and = and i64 %load1, %arg
1384  store i64 %and, i64* @g64
1385  %cond = icmp eq i64 %and, 0
1386  br i1 %cond, label %a, label %b
1387
1388a:
1389  tail call void @a()
1390  ret void
1391
1392b:
1393  tail call void @b()
1394  ret void
1395}
1396
1397define void @and32_reg_br(i32 %arg) nounwind {
1398; CHECK-LABEL: and32_reg_br:
1399; CHECK:       # %bb.0: # %entry
1400; CHECK-NEXT:    andl %edi, {{.*}}(%rip) # encoding: [0x21,0x3d,A,A,A,A]
1401; CHECK-NEXT:    # fixup A - offset: 2, value: g32-4, kind: reloc_riprel_4byte
1402; CHECK-NEXT:    je .LBB43_1 # encoding: [0x74,A]
1403; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB43_1-1, kind: FK_PCRel_1
1404; CHECK-NEXT:  # %bb.2: # %b
1405; CHECK-NEXT:    jmp b # TAILCALL
1406; CHECK-NEXT:    # encoding: [0xeb,A]
1407; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1408; CHECK-NEXT:  .LBB43_1: # %a
1409; CHECK-NEXT:    jmp a # TAILCALL
1410; CHECK-NEXT:    # encoding: [0xeb,A]
1411; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1412entry:
1413  %load1 = load i32, i32* @g32
1414  %and = and i32 %load1, %arg
1415  store i32 %and, i32* @g32
1416  %cond = icmp eq i32 %and, 0
1417  br i1 %cond, label %a, label %b
1418
1419a:
1420  tail call void @a()
1421  ret void
1422
1423b:
1424  tail call void @b()
1425  ret void
1426}
1427
1428define void @and16_reg_br(i16 %arg) nounwind {
1429; CHECK-LABEL: and16_reg_br:
1430; CHECK:       # %bb.0: # %entry
1431; CHECK-NEXT:    andw %di, {{.*}}(%rip) # encoding: [0x66,0x21,0x3d,A,A,A,A]
1432; CHECK-NEXT:    # fixup A - offset: 3, value: g16-4, kind: reloc_riprel_4byte
1433; CHECK-NEXT:    je .LBB44_1 # encoding: [0x74,A]
1434; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB44_1-1, kind: FK_PCRel_1
1435; CHECK-NEXT:  # %bb.2: # %b
1436; CHECK-NEXT:    jmp b # TAILCALL
1437; CHECK-NEXT:    # encoding: [0xeb,A]
1438; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1439; CHECK-NEXT:  .LBB44_1: # %a
1440; CHECK-NEXT:    jmp a # TAILCALL
1441; CHECK-NEXT:    # encoding: [0xeb,A]
1442; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1443entry:
1444  %load1 = load i16, i16* @g16
1445  %and = and i16 %load1, %arg
1446  store i16 %and, i16* @g16
1447  %cond = icmp eq i16 %and, 0
1448  br i1 %cond, label %a, label %b
1449
1450a:
1451  tail call void @a()
1452  ret void
1453
1454b:
1455  tail call void @b()
1456  ret void
1457}
1458
1459define void @and8_reg_br(i8 %arg) nounwind {
1460; CHECK-LABEL: and8_reg_br:
1461; CHECK:       # %bb.0: # %entry
1462; CHECK-NEXT:    andb %dil, {{.*}}(%rip) # encoding: [0x40,0x20,0x3d,A,A,A,A]
1463; CHECK-NEXT:    # fixup A - offset: 3, value: g8-4, kind: reloc_riprel_4byte
1464; CHECK-NEXT:    je .LBB45_1 # encoding: [0x74,A]
1465; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB45_1-1, kind: FK_PCRel_1
1466; CHECK-NEXT:  # %bb.2: # %b
1467; CHECK-NEXT:    jmp b # TAILCALL
1468; CHECK-NEXT:    # encoding: [0xeb,A]
1469; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1470; CHECK-NEXT:  .LBB45_1: # %a
1471; CHECK-NEXT:    jmp a # TAILCALL
1472; CHECK-NEXT:    # encoding: [0xeb,A]
1473; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1474entry:
1475  %load1 = load i8, i8* @g8
1476  %and = and i8 %load1, %arg
1477  store i8 %and, i8* @g8
1478  %cond = icmp eq i8 %and, 0
1479  br i1 %cond, label %a, label %b
1480
1481a:
1482  tail call void @a()
1483  ret void
1484
1485b:
1486  tail call void @b()
1487  ret void
1488}
1489
1490define void @or64_imm32_br() nounwind {
1491; CHECK-LABEL: or64_imm32_br:
1492; CHECK:       # %bb.0: # %entry
1493; CHECK-NEXT:    orq $16777215, {{.*}}(%rip) # encoding: [0x48,0x81,0x0d,A,A,A,A,0xff,0xff,0xff,0x00]
1494; CHECK-NEXT:    # fixup A - offset: 3, value: g64-8, kind: reloc_riprel_4byte
1495; CHECK-NEXT:    # imm = 0xFFFFFF
1496; CHECK-NEXT:    je .LBB46_1 # encoding: [0x74,A]
1497; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB46_1-1, kind: FK_PCRel_1
1498; CHECK-NEXT:  # %bb.2: # %b
1499; CHECK-NEXT:    jmp b # TAILCALL
1500; CHECK-NEXT:    # encoding: [0xeb,A]
1501; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1502; CHECK-NEXT:  .LBB46_1: # %a
1503; CHECK-NEXT:    jmp a # TAILCALL
1504; CHECK-NEXT:    # encoding: [0xeb,A]
1505; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1506entry:
1507  %load1 = load i64, i64* @g64
1508  ; Or 0x00FFFFFF, a positive immediate requiring 24-bits.
1509  %or = or i64 %load1, 16777215
1510  store i64 %or, i64* @g64
1511  %cond = icmp eq i64 %or, 0
1512  br i1 %cond, label %a, label %b
1513
1514a:
1515  tail call void @a()
1516  ret void
1517
1518b:
1519  tail call void @b()
1520  ret void
1521}
1522
1523define void @or64_sext_imm32_br() nounwind {
1524; CHECK-LABEL: or64_sext_imm32_br:
1525; CHECK:       # %bb.0: # %entry
1526; CHECK-NEXT:    orq $-2147483648, {{.*}}(%rip) # encoding: [0x48,0x81,0x0d,A,A,A,A,0x00,0x00,0x00,0x80]
1527; CHECK-NEXT:    # fixup A - offset: 3, value: g64-8, kind: reloc_riprel_4byte
1528; CHECK-NEXT:    # imm = 0x80000000
1529; CHECK-NEXT:    je .LBB47_1 # encoding: [0x74,A]
1530; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB47_1-1, kind: FK_PCRel_1
1531; CHECK-NEXT:  # %bb.2: # %b
1532; CHECK-NEXT:    jmp b # TAILCALL
1533; CHECK-NEXT:    # encoding: [0xeb,A]
1534; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1535; CHECK-NEXT:  .LBB47_1: # %a
1536; CHECK-NEXT:    jmp a # TAILCALL
1537; CHECK-NEXT:    # encoding: [0xeb,A]
1538; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1539entry:
1540  %load1 = load i64, i64* @g64
1541  ; Or -0x80000000, which requires sign-extended 32 bits.
1542  %or = or i64 %load1, -2147483648
1543  store i64 %or, i64* @g64
1544  %cond = icmp eq i64 %or, 0
1545  br i1 %cond, label %a, label %b
1546
1547a:
1548  tail call void @a()
1549  ret void
1550
1551b:
1552  tail call void @b()
1553  ret void
1554}
1555
1556define void @or64_imm8_br() nounwind {
1557; CHECK-LABEL: or64_imm8_br:
1558; CHECK:       # %bb.0: # %entry
1559; CHECK-NEXT:    orq $15, {{.*}}(%rip) # encoding: [0x48,0x83,0x0d,A,A,A,A,0x0f]
1560; CHECK-NEXT:    # fixup A - offset: 3, value: g64-5, kind: reloc_riprel_4byte
1561; CHECK-NEXT:    je .LBB48_1 # encoding: [0x74,A]
1562; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB48_1-1, kind: FK_PCRel_1
1563; CHECK-NEXT:  # %bb.2: # %b
1564; CHECK-NEXT:    jmp b # TAILCALL
1565; CHECK-NEXT:    # encoding: [0xeb,A]
1566; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1567; CHECK-NEXT:  .LBB48_1: # %a
1568; CHECK-NEXT:    jmp a # TAILCALL
1569; CHECK-NEXT:    # encoding: [0xeb,A]
1570; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1571entry:
1572  %load1 = load i64, i64* @g64
1573  %or = or i64 %load1, 15
1574  store i64 %or, i64* @g64
1575  %cond = icmp eq i64 %or, 0
1576  br i1 %cond, label %a, label %b
1577
1578a:
1579  tail call void @a()
1580  ret void
1581
1582b:
1583  tail call void @b()
1584  ret void
1585}
1586
1587define void @or64_imm8_neg_br() nounwind {
1588; CHECK-LABEL: or64_imm8_neg_br:
1589; CHECK:       # %bb.0: # %entry
1590; CHECK-NEXT:    orq $-4, {{.*}}(%rip) # encoding: [0x48,0x83,0x0d,A,A,A,A,0xfc]
1591; CHECK-NEXT:    # fixup A - offset: 3, value: g64-5, kind: reloc_riprel_4byte
1592; CHECK-NEXT:    je .LBB49_1 # encoding: [0x74,A]
1593; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB49_1-1, kind: FK_PCRel_1
1594; CHECK-NEXT:  # %bb.2: # %b
1595; CHECK-NEXT:    jmp b # TAILCALL
1596; CHECK-NEXT:    # encoding: [0xeb,A]
1597; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1598; CHECK-NEXT:  .LBB49_1: # %a
1599; CHECK-NEXT:    jmp a # TAILCALL
1600; CHECK-NEXT:    # encoding: [0xeb,A]
1601; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1602entry:
1603  %load1 = load i64, i64* @g64
1604  %or = or i64 %load1, -4
1605  store i64 %or, i64* @g64
1606  %cond = icmp eq i64 %or, 0
1607  br i1 %cond, label %a, label %b
1608
1609a:
1610  tail call void @a()
1611  ret void
1612
1613b:
1614  tail call void @b()
1615  ret void
1616}
1617
1618define void @or32_imm_br() nounwind {
1619; CHECK-LABEL: or32_imm_br:
1620; CHECK:       # %bb.0: # %entry
1621; CHECK-NEXT:    orl $-2147483648, {{.*}}(%rip) # encoding: [0x81,0x0d,A,A,A,A,0x00,0x00,0x00,0x80]
1622; CHECK-NEXT:    # fixup A - offset: 2, value: g32-8, kind: reloc_riprel_4byte
1623; CHECK-NEXT:    # imm = 0x80000000
1624; CHECK-NEXT:    je .LBB50_1 # encoding: [0x74,A]
1625; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB50_1-1, kind: FK_PCRel_1
1626; CHECK-NEXT:  # %bb.2: # %b
1627; CHECK-NEXT:    jmp b # TAILCALL
1628; CHECK-NEXT:    # encoding: [0xeb,A]
1629; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1630; CHECK-NEXT:  .LBB50_1: # %a
1631; CHECK-NEXT:    jmp a # TAILCALL
1632; CHECK-NEXT:    # encoding: [0xeb,A]
1633; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1634entry:
1635  %load1 = load i32, i32* @g32
1636  ; Or 0x80000000, a positive number requiring 32 bits of immediate.
1637  %or = or i32 %load1, 2147483648
1638  store i32 %or, i32* @g32
1639  %cond = icmp eq i32 %or, 0
1640  br i1 %cond, label %a, label %b
1641
1642a:
1643  tail call void @a()
1644  ret void
1645
1646b:
1647  tail call void @b()
1648  ret void
1649}
1650
1651define void @or32_imm8_br() nounwind {
1652; CHECK-LABEL: or32_imm8_br:
1653; CHECK:       # %bb.0: # %entry
1654; CHECK-NEXT:    orl $15, {{.*}}(%rip) # encoding: [0x83,0x0d,A,A,A,A,0x0f]
1655; CHECK-NEXT:    # fixup A - offset: 2, value: g32-5, kind: reloc_riprel_4byte
1656; CHECK-NEXT:    je .LBB51_1 # encoding: [0x74,A]
1657; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB51_1-1, kind: FK_PCRel_1
1658; CHECK-NEXT:  # %bb.2: # %b
1659; CHECK-NEXT:    jmp b # TAILCALL
1660; CHECK-NEXT:    # encoding: [0xeb,A]
1661; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1662; CHECK-NEXT:  .LBB51_1: # %a
1663; CHECK-NEXT:    jmp a # TAILCALL
1664; CHECK-NEXT:    # encoding: [0xeb,A]
1665; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1666entry:
1667  %load1 = load i32, i32* @g32
1668  %or = or i32 %load1, 15
1669  store i32 %or, i32* @g32
1670  %cond = icmp eq i32 %or, 0
1671  br i1 %cond, label %a, label %b
1672
1673a:
1674  tail call void @a()
1675  ret void
1676
1677b:
1678  tail call void @b()
1679  ret void
1680}
1681
1682define void @or32_imm8_neg_br() nounwind {
1683; CHECK-LABEL: or32_imm8_neg_br:
1684; CHECK:       # %bb.0: # %entry
1685; CHECK-NEXT:    orl $-4, {{.*}}(%rip) # encoding: [0x83,0x0d,A,A,A,A,0xfc]
1686; CHECK-NEXT:    # fixup A - offset: 2, value: g32-5, kind: reloc_riprel_4byte
1687; CHECK-NEXT:    je .LBB52_1 # encoding: [0x74,A]
1688; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB52_1-1, kind: FK_PCRel_1
1689; CHECK-NEXT:  # %bb.2: # %b
1690; CHECK-NEXT:    jmp b # TAILCALL
1691; CHECK-NEXT:    # encoding: [0xeb,A]
1692; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1693; CHECK-NEXT:  .LBB52_1: # %a
1694; CHECK-NEXT:    jmp a # TAILCALL
1695; CHECK-NEXT:    # encoding: [0xeb,A]
1696; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1697entry:
1698  %load1 = load i32, i32* @g32
1699  %or = or i32 %load1, -4
1700  store i32 %or, i32* @g32
1701  %cond = icmp eq i32 %or, 0
1702  br i1 %cond, label %a, label %b
1703
1704a:
1705  tail call void @a()
1706  ret void
1707
1708b:
1709  tail call void @b()
1710  ret void
1711}
1712
1713define void @or16_imm_br() nounwind {
1714; CHECK-LABEL: or16_imm_br:
1715; CHECK:       # %bb.0: # %entry
1716; CHECK-NEXT:    orw $-32768, {{.*}}(%rip) # encoding: [0x66,0x81,0x0d,A,A,A,A,0x00,0x80]
1717; CHECK-NEXT:    # fixup A - offset: 3, value: g16-6, kind: reloc_riprel_4byte
1718; CHECK-NEXT:    # imm = 0x8000
1719; CHECK-NEXT:    je .LBB53_1 # encoding: [0x74,A]
1720; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB53_1-1, kind: FK_PCRel_1
1721; CHECK-NEXT:  # %bb.2: # %b
1722; CHECK-NEXT:    jmp b # TAILCALL
1723; CHECK-NEXT:    # encoding: [0xeb,A]
1724; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1725; CHECK-NEXT:  .LBB53_1: # %a
1726; CHECK-NEXT:    jmp a # TAILCALL
1727; CHECK-NEXT:    # encoding: [0xeb,A]
1728; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1729entry:
1730  %load1 = load i16, i16* @g16
1731  %or = or i16 %load1, 32768
1732  store i16 %or, i16* @g16
1733  %cond = icmp eq i16 %or, 0
1734  br i1 %cond, label %a, label %b
1735
1736a:
1737  tail call void @a()
1738  ret void
1739
1740b:
1741  tail call void @b()
1742  ret void
1743}
1744
1745define void @or16_imm8_br() nounwind {
1746; CHECK-LABEL: or16_imm8_br:
1747; CHECK:       # %bb.0: # %entry
1748; CHECK-NEXT:    orw $15, {{.*}}(%rip) # encoding: [0x66,0x83,0x0d,A,A,A,A,0x0f]
1749; CHECK-NEXT:    # fixup A - offset: 3, value: g16-5, kind: reloc_riprel_4byte
1750; CHECK-NEXT:    je .LBB54_1 # encoding: [0x74,A]
1751; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB54_1-1, kind: FK_PCRel_1
1752; CHECK-NEXT:  # %bb.2: # %b
1753; CHECK-NEXT:    jmp b # TAILCALL
1754; CHECK-NEXT:    # encoding: [0xeb,A]
1755; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1756; CHECK-NEXT:  .LBB54_1: # %a
1757; CHECK-NEXT:    jmp a # TAILCALL
1758; CHECK-NEXT:    # encoding: [0xeb,A]
1759; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1760entry:
1761  %load1 = load i16, i16* @g16
1762  %or = or i16 %load1, 15
1763  store i16 %or, i16* @g16
1764  %cond = icmp eq i16 %or, 0
1765  br i1 %cond, label %a, label %b
1766
1767a:
1768  tail call void @a()
1769  ret void
1770
1771b:
1772  tail call void @b()
1773  ret void
1774}
1775
1776define void @or16_imm8_neg_br() nounwind {
1777; CHECK-LABEL: or16_imm8_neg_br:
1778; CHECK:       # %bb.0: # %entry
1779; CHECK-NEXT:    orw $-4, {{.*}}(%rip) # encoding: [0x66,0x83,0x0d,A,A,A,A,0xfc]
1780; CHECK-NEXT:    # fixup A - offset: 3, value: g16-5, kind: reloc_riprel_4byte
1781; CHECK-NEXT:    je .LBB55_1 # encoding: [0x74,A]
1782; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB55_1-1, kind: FK_PCRel_1
1783; CHECK-NEXT:  # %bb.2: # %b
1784; CHECK-NEXT:    jmp b # TAILCALL
1785; CHECK-NEXT:    # encoding: [0xeb,A]
1786; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1787; CHECK-NEXT:  .LBB55_1: # %a
1788; CHECK-NEXT:    jmp a # TAILCALL
1789; CHECK-NEXT:    # encoding: [0xeb,A]
1790; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1791entry:
1792  %load1 = load i16, i16* @g16
1793  %or = or i16 %load1, -4
1794  store i16 %or, i16* @g16
1795  %cond = icmp eq i16 %or, 0
1796  br i1 %cond, label %a, label %b
1797
1798a:
1799  tail call void @a()
1800  ret void
1801
1802b:
1803  tail call void @b()
1804  ret void
1805}
1806
1807define void @or8_imm_br() nounwind {
1808; CHECK-LABEL: or8_imm_br:
1809; CHECK:       # %bb.0: # %entry
1810; CHECK-NEXT:    orb $-4, {{.*}}(%rip) # encoding: [0x80,0x0d,A,A,A,A,0xfc]
1811; CHECK-NEXT:    # fixup A - offset: 2, value: g8-5, kind: reloc_riprel_4byte
1812; CHECK-NEXT:    je .LBB56_1 # encoding: [0x74,A]
1813; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB56_1-1, kind: FK_PCRel_1
1814; CHECK-NEXT:  # %bb.2: # %b
1815; CHECK-NEXT:    jmp b # TAILCALL
1816; CHECK-NEXT:    # encoding: [0xeb,A]
1817; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1818; CHECK-NEXT:  .LBB56_1: # %a
1819; CHECK-NEXT:    jmp a # TAILCALL
1820; CHECK-NEXT:    # encoding: [0xeb,A]
1821; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1822entry:
1823  %load1 = load i8, i8* @g8
1824  %or = or i8 %load1, -4
1825  store i8 %or, i8* @g8
1826  %cond = icmp eq i8 %or, 0
1827  br i1 %cond, label %a, label %b
1828
1829a:
1830  tail call void @a()
1831  ret void
1832
1833b:
1834  tail call void @b()
1835  ret void
1836}
1837
1838define void @or64_reg_br(i64 %arg) nounwind {
1839; CHECK-LABEL: or64_reg_br:
1840; CHECK:       # %bb.0: # %entry
1841; CHECK-NEXT:    orq %rdi, {{.*}}(%rip) # encoding: [0x48,0x09,0x3d,A,A,A,A]
1842; CHECK-NEXT:    # fixup A - offset: 3, value: g64-4, kind: reloc_riprel_4byte
1843; CHECK-NEXT:    je .LBB57_1 # encoding: [0x74,A]
1844; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB57_1-1, kind: FK_PCRel_1
1845; CHECK-NEXT:  # %bb.2: # %b
1846; CHECK-NEXT:    jmp b # TAILCALL
1847; CHECK-NEXT:    # encoding: [0xeb,A]
1848; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1849; CHECK-NEXT:  .LBB57_1: # %a
1850; CHECK-NEXT:    jmp a # TAILCALL
1851; CHECK-NEXT:    # encoding: [0xeb,A]
1852; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1853entry:
1854  %load1 = load i64, i64* @g64
1855  %or = or i64 %load1, %arg
1856  store i64 %or, i64* @g64
1857  %cond = icmp eq i64 %or, 0
1858  br i1 %cond, label %a, label %b
1859
1860a:
1861  tail call void @a()
1862  ret void
1863
1864b:
1865  tail call void @b()
1866  ret void
1867}
1868
1869define void @or32_reg_br(i32 %arg) nounwind {
1870; CHECK-LABEL: or32_reg_br:
1871; CHECK:       # %bb.0: # %entry
1872; CHECK-NEXT:    orl %edi, {{.*}}(%rip) # encoding: [0x09,0x3d,A,A,A,A]
1873; CHECK-NEXT:    # fixup A - offset: 2, value: g32-4, kind: reloc_riprel_4byte
1874; CHECK-NEXT:    je .LBB58_1 # encoding: [0x74,A]
1875; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB58_1-1, kind: FK_PCRel_1
1876; CHECK-NEXT:  # %bb.2: # %b
1877; CHECK-NEXT:    jmp b # TAILCALL
1878; CHECK-NEXT:    # encoding: [0xeb,A]
1879; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1880; CHECK-NEXT:  .LBB58_1: # %a
1881; CHECK-NEXT:    jmp a # TAILCALL
1882; CHECK-NEXT:    # encoding: [0xeb,A]
1883; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1884entry:
1885  %load1 = load i32, i32* @g32
1886  %or = or i32 %load1, %arg
1887  store i32 %or, i32* @g32
1888  %cond = icmp eq i32 %or, 0
1889  br i1 %cond, label %a, label %b
1890
1891a:
1892  tail call void @a()
1893  ret void
1894
1895b:
1896  tail call void @b()
1897  ret void
1898}
1899
1900define void @or16_reg_br(i16 %arg) nounwind {
1901; CHECK-LABEL: or16_reg_br:
1902; CHECK:       # %bb.0: # %entry
1903; CHECK-NEXT:    orw %di, {{.*}}(%rip) # encoding: [0x66,0x09,0x3d,A,A,A,A]
1904; CHECK-NEXT:    # fixup A - offset: 3, value: g16-4, kind: reloc_riprel_4byte
1905; CHECK-NEXT:    je .LBB59_1 # encoding: [0x74,A]
1906; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB59_1-1, kind: FK_PCRel_1
1907; CHECK-NEXT:  # %bb.2: # %b
1908; CHECK-NEXT:    jmp b # TAILCALL
1909; CHECK-NEXT:    # encoding: [0xeb,A]
1910; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1911; CHECK-NEXT:  .LBB59_1: # %a
1912; CHECK-NEXT:    jmp a # TAILCALL
1913; CHECK-NEXT:    # encoding: [0xeb,A]
1914; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1915entry:
1916  %load1 = load i16, i16* @g16
1917  %or = or i16 %load1, %arg
1918  store i16 %or, i16* @g16
1919  %cond = icmp eq i16 %or, 0
1920  br i1 %cond, label %a, label %b
1921
1922a:
1923  tail call void @a()
1924  ret void
1925
1926b:
1927  tail call void @b()
1928  ret void
1929}
1930
1931define void @or8_reg_br(i8 %arg) nounwind {
1932; CHECK-LABEL: or8_reg_br:
1933; CHECK:       # %bb.0: # %entry
1934; CHECK-NEXT:    orb %dil, {{.*}}(%rip) # encoding: [0x40,0x08,0x3d,A,A,A,A]
1935; CHECK-NEXT:    # fixup A - offset: 3, value: g8-4, kind: reloc_riprel_4byte
1936; CHECK-NEXT:    je .LBB60_1 # encoding: [0x74,A]
1937; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB60_1-1, kind: FK_PCRel_1
1938; CHECK-NEXT:  # %bb.2: # %b
1939; CHECK-NEXT:    jmp b # TAILCALL
1940; CHECK-NEXT:    # encoding: [0xeb,A]
1941; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1942; CHECK-NEXT:  .LBB60_1: # %a
1943; CHECK-NEXT:    jmp a # TAILCALL
1944; CHECK-NEXT:    # encoding: [0xeb,A]
1945; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1946entry:
1947  %load1 = load i8, i8* @g8
1948  %or = or i8 %load1, %arg
1949  store i8 %or, i8* @g8
1950  %cond = icmp eq i8 %or, 0
1951  br i1 %cond, label %a, label %b
1952
1953a:
1954  tail call void @a()
1955  ret void
1956
1957b:
1958  tail call void @b()
1959  ret void
1960}
1961
1962define void @xor64_imm32_br() nounwind {
1963; CHECK-LABEL: xor64_imm32_br:
1964; CHECK:       # %bb.0: # %entry
1965; CHECK-NEXT:    xorq $16777215, {{.*}}(%rip) # encoding: [0x48,0x81,0x35,A,A,A,A,0xff,0xff,0xff,0x00]
1966; CHECK-NEXT:    # fixup A - offset: 3, value: g64-8, kind: reloc_riprel_4byte
1967; CHECK-NEXT:    # imm = 0xFFFFFF
1968; CHECK-NEXT:    je .LBB61_1 # encoding: [0x74,A]
1969; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB61_1-1, kind: FK_PCRel_1
1970; CHECK-NEXT:  # %bb.2: # %b
1971; CHECK-NEXT:    jmp b # TAILCALL
1972; CHECK-NEXT:    # encoding: [0xeb,A]
1973; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
1974; CHECK-NEXT:  .LBB61_1: # %a
1975; CHECK-NEXT:    jmp a # TAILCALL
1976; CHECK-NEXT:    # encoding: [0xeb,A]
1977; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
1978entry:
1979  %load1 = load i64, i64* @g64
1980  ; Xor 0x00FFFFFF, a positive immediate requiring 24-bits.
1981  %xor = xor i64 %load1, 16777215
1982  store i64 %xor, i64* @g64
1983  %cond = icmp eq i64 %xor, 0
1984  br i1 %cond, label %a, label %b
1985
1986a:
1987  tail call void @a()
1988  ret void
1989
1990b:
1991  tail call void @b()
1992  ret void
1993}
1994
1995define void @xor64_sext_imm32_br() nounwind {
1996; CHECK-LABEL: xor64_sext_imm32_br:
1997; CHECK:       # %bb.0: # %entry
1998; CHECK-NEXT:    xorq $-2147483648, {{.*}}(%rip) # encoding: [0x48,0x81,0x35,A,A,A,A,0x00,0x00,0x00,0x80]
1999; CHECK-NEXT:    # fixup A - offset: 3, value: g64-8, kind: reloc_riprel_4byte
2000; CHECK-NEXT:    # imm = 0x80000000
2001; CHECK-NEXT:    je .LBB62_1 # encoding: [0x74,A]
2002; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB62_1-1, kind: FK_PCRel_1
2003; CHECK-NEXT:  # %bb.2: # %b
2004; CHECK-NEXT:    jmp b # TAILCALL
2005; CHECK-NEXT:    # encoding: [0xeb,A]
2006; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2007; CHECK-NEXT:  .LBB62_1: # %a
2008; CHECK-NEXT:    jmp a # TAILCALL
2009; CHECK-NEXT:    # encoding: [0xeb,A]
2010; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2011entry:
2012  %load1 = load i64, i64* @g64
2013  ; Xor -0x80000000, which requires sign-extended 32 bits.
2014  %xor = xor i64 %load1, -2147483648
2015  store i64 %xor, i64* @g64
2016  %cond = icmp eq i64 %xor, 0
2017  br i1 %cond, label %a, label %b
2018
2019a:
2020  tail call void @a()
2021  ret void
2022
2023b:
2024  tail call void @b()
2025  ret void
2026}
2027
2028define void @xor64_imm8_br() nounwind {
2029; CHECK-LABEL: xor64_imm8_br:
2030; CHECK:       # %bb.0: # %entry
2031; CHECK-NEXT:    xorq $15, {{.*}}(%rip) # encoding: [0x48,0x83,0x35,A,A,A,A,0x0f]
2032; CHECK-NEXT:    # fixup A - offset: 3, value: g64-5, kind: reloc_riprel_4byte
2033; CHECK-NEXT:    je .LBB63_1 # encoding: [0x74,A]
2034; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB63_1-1, kind: FK_PCRel_1
2035; CHECK-NEXT:  # %bb.2: # %b
2036; CHECK-NEXT:    jmp b # TAILCALL
2037; CHECK-NEXT:    # encoding: [0xeb,A]
2038; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2039; CHECK-NEXT:  .LBB63_1: # %a
2040; CHECK-NEXT:    jmp a # TAILCALL
2041; CHECK-NEXT:    # encoding: [0xeb,A]
2042; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2043entry:
2044  %load1 = load i64, i64* @g64
2045  %xor = xor i64 %load1, 15
2046  store i64 %xor, i64* @g64
2047  %cond = icmp eq i64 %xor, 0
2048  br i1 %cond, label %a, label %b
2049
2050a:
2051  tail call void @a()
2052  ret void
2053
2054b:
2055  tail call void @b()
2056  ret void
2057}
2058
2059define void @xor64_imm8_neg_br() nounwind {
2060; CHECK-LABEL: xor64_imm8_neg_br:
2061; CHECK:       # %bb.0: # %entry
2062; CHECK-NEXT:    xorq $-4, {{.*}}(%rip) # encoding: [0x48,0x83,0x35,A,A,A,A,0xfc]
2063; CHECK-NEXT:    # fixup A - offset: 3, value: g64-5, kind: reloc_riprel_4byte
2064; CHECK-NEXT:    je .LBB64_1 # encoding: [0x74,A]
2065; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB64_1-1, kind: FK_PCRel_1
2066; CHECK-NEXT:  # %bb.2: # %b
2067; CHECK-NEXT:    jmp b # TAILCALL
2068; CHECK-NEXT:    # encoding: [0xeb,A]
2069; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2070; CHECK-NEXT:  .LBB64_1: # %a
2071; CHECK-NEXT:    jmp a # TAILCALL
2072; CHECK-NEXT:    # encoding: [0xeb,A]
2073; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2074entry:
2075  %load1 = load i64, i64* @g64
2076  %xor = xor i64 %load1, -4
2077  store i64 %xor, i64* @g64
2078  %cond = icmp eq i64 %xor, 0
2079  br i1 %cond, label %a, label %b
2080
2081a:
2082  tail call void @a()
2083  ret void
2084
2085b:
2086  tail call void @b()
2087  ret void
2088}
2089
2090define void @xor32_imm_br() nounwind {
2091; CHECK-LABEL: xor32_imm_br:
2092; CHECK:       # %bb.0: # %entry
2093; CHECK-NEXT:    xorl $-2147483648, {{.*}}(%rip) # encoding: [0x81,0x35,A,A,A,A,0x00,0x00,0x00,0x80]
2094; CHECK-NEXT:    # fixup A - offset: 2, value: g32-8, kind: reloc_riprel_4byte
2095; CHECK-NEXT:    # imm = 0x80000000
2096; CHECK-NEXT:    je .LBB65_1 # encoding: [0x74,A]
2097; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB65_1-1, kind: FK_PCRel_1
2098; CHECK-NEXT:  # %bb.2: # %b
2099; CHECK-NEXT:    jmp b # TAILCALL
2100; CHECK-NEXT:    # encoding: [0xeb,A]
2101; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2102; CHECK-NEXT:  .LBB65_1: # %a
2103; CHECK-NEXT:    jmp a # TAILCALL
2104; CHECK-NEXT:    # encoding: [0xeb,A]
2105; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2106entry:
2107  %load1 = load i32, i32* @g32
2108  ; Xor 0x80000000, a positive number requiring 32 bits of immediate.
2109  %xor = xor i32 %load1, 2147483648
2110  store i32 %xor, i32* @g32
2111  %cond = icmp eq i32 %xor, 0
2112  br i1 %cond, label %a, label %b
2113
2114a:
2115  tail call void @a()
2116  ret void
2117
2118b:
2119  tail call void @b()
2120  ret void
2121}
2122
2123define void @xor32_imm8_br() nounwind {
2124; CHECK-LABEL: xor32_imm8_br:
2125; CHECK:       # %bb.0: # %entry
2126; CHECK-NEXT:    xorl $15, {{.*}}(%rip) # encoding: [0x83,0x35,A,A,A,A,0x0f]
2127; CHECK-NEXT:    # fixup A - offset: 2, value: g32-5, kind: reloc_riprel_4byte
2128; CHECK-NEXT:    je .LBB66_1 # encoding: [0x74,A]
2129; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB66_1-1, kind: FK_PCRel_1
2130; CHECK-NEXT:  # %bb.2: # %b
2131; CHECK-NEXT:    jmp b # TAILCALL
2132; CHECK-NEXT:    # encoding: [0xeb,A]
2133; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2134; CHECK-NEXT:  .LBB66_1: # %a
2135; CHECK-NEXT:    jmp a # TAILCALL
2136; CHECK-NEXT:    # encoding: [0xeb,A]
2137; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2138entry:
2139  %load1 = load i32, i32* @g32
2140  %xor = xor i32 %load1, 15
2141  store i32 %xor, i32* @g32
2142  %cond = icmp eq i32 %xor, 0
2143  br i1 %cond, label %a, label %b
2144
2145a:
2146  tail call void @a()
2147  ret void
2148
2149b:
2150  tail call void @b()
2151  ret void
2152}
2153
2154define void @xor32_imm8_neg_br() nounwind {
2155; CHECK-LABEL: xor32_imm8_neg_br:
2156; CHECK:       # %bb.0: # %entry
2157; CHECK-NEXT:    xorl $-4, {{.*}}(%rip) # encoding: [0x83,0x35,A,A,A,A,0xfc]
2158; CHECK-NEXT:    # fixup A - offset: 2, value: g32-5, kind: reloc_riprel_4byte
2159; CHECK-NEXT:    je .LBB67_1 # encoding: [0x74,A]
2160; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB67_1-1, kind: FK_PCRel_1
2161; CHECK-NEXT:  # %bb.2: # %b
2162; CHECK-NEXT:    jmp b # TAILCALL
2163; CHECK-NEXT:    # encoding: [0xeb,A]
2164; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2165; CHECK-NEXT:  .LBB67_1: # %a
2166; CHECK-NEXT:    jmp a # TAILCALL
2167; CHECK-NEXT:    # encoding: [0xeb,A]
2168; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2169entry:
2170  %load1 = load i32, i32* @g32
2171  %xor = xor i32 %load1, -4
2172  store i32 %xor, i32* @g32
2173  %cond = icmp eq i32 %xor, 0
2174  br i1 %cond, label %a, label %b
2175
2176a:
2177  tail call void @a()
2178  ret void
2179
2180b:
2181  tail call void @b()
2182  ret void
2183}
2184
2185define void @xor16_imm_br() nounwind {
2186; CHECK-LABEL: xor16_imm_br:
2187; CHECK:       # %bb.0: # %entry
2188; CHECK-NEXT:    xorw $-32768, {{.*}}(%rip) # encoding: [0x66,0x81,0x35,A,A,A,A,0x00,0x80]
2189; CHECK-NEXT:    # fixup A - offset: 3, value: g16-6, kind: reloc_riprel_4byte
2190; CHECK-NEXT:    # imm = 0x8000
2191; CHECK-NEXT:    je .LBB68_1 # encoding: [0x74,A]
2192; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB68_1-1, kind: FK_PCRel_1
2193; CHECK-NEXT:  # %bb.2: # %b
2194; CHECK-NEXT:    jmp b # TAILCALL
2195; CHECK-NEXT:    # encoding: [0xeb,A]
2196; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2197; CHECK-NEXT:  .LBB68_1: # %a
2198; CHECK-NEXT:    jmp a # TAILCALL
2199; CHECK-NEXT:    # encoding: [0xeb,A]
2200; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2201entry:
2202  %load1 = load i16, i16* @g16
2203  %xor = xor i16 %load1, 32768
2204  store i16 %xor, i16* @g16
2205  %cond = icmp eq i16 %xor, 0
2206  br i1 %cond, label %a, label %b
2207
2208a:
2209  tail call void @a()
2210  ret void
2211
2212b:
2213  tail call void @b()
2214  ret void
2215}
2216
2217define void @xor16_imm8_br() nounwind {
2218; CHECK-LABEL: xor16_imm8_br:
2219; CHECK:       # %bb.0: # %entry
2220; CHECK-NEXT:    xorw $15, {{.*}}(%rip) # encoding: [0x66,0x83,0x35,A,A,A,A,0x0f]
2221; CHECK-NEXT:    # fixup A - offset: 3, value: g16-5, kind: reloc_riprel_4byte
2222; CHECK-NEXT:    je .LBB69_1 # encoding: [0x74,A]
2223; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB69_1-1, kind: FK_PCRel_1
2224; CHECK-NEXT:  # %bb.2: # %b
2225; CHECK-NEXT:    jmp b # TAILCALL
2226; CHECK-NEXT:    # encoding: [0xeb,A]
2227; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2228; CHECK-NEXT:  .LBB69_1: # %a
2229; CHECK-NEXT:    jmp a # TAILCALL
2230; CHECK-NEXT:    # encoding: [0xeb,A]
2231; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2232entry:
2233  %load1 = load i16, i16* @g16
2234  %xor = xor i16 %load1, 15
2235  store i16 %xor, i16* @g16
2236  %cond = icmp eq i16 %xor, 0
2237  br i1 %cond, label %a, label %b
2238
2239a:
2240  tail call void @a()
2241  ret void
2242
2243b:
2244  tail call void @b()
2245  ret void
2246}
2247
2248define void @xor16_imm8_neg_br() nounwind {
2249; CHECK-LABEL: xor16_imm8_neg_br:
2250; CHECK:       # %bb.0: # %entry
2251; CHECK-NEXT:    xorw $-4, {{.*}}(%rip) # encoding: [0x66,0x83,0x35,A,A,A,A,0xfc]
2252; CHECK-NEXT:    # fixup A - offset: 3, value: g16-5, kind: reloc_riprel_4byte
2253; CHECK-NEXT:    je .LBB70_1 # encoding: [0x74,A]
2254; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB70_1-1, kind: FK_PCRel_1
2255; CHECK-NEXT:  # %bb.2: # %b
2256; CHECK-NEXT:    jmp b # TAILCALL
2257; CHECK-NEXT:    # encoding: [0xeb,A]
2258; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2259; CHECK-NEXT:  .LBB70_1: # %a
2260; CHECK-NEXT:    jmp a # TAILCALL
2261; CHECK-NEXT:    # encoding: [0xeb,A]
2262; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2263entry:
2264  %load1 = load i16, i16* @g16
2265  %xor = xor i16 %load1, -4
2266  store i16 %xor, i16* @g16
2267  %cond = icmp eq i16 %xor, 0
2268  br i1 %cond, label %a, label %b
2269
2270a:
2271  tail call void @a()
2272  ret void
2273
2274b:
2275  tail call void @b()
2276  ret void
2277}
2278
2279define void @xor8_imm_br() nounwind {
2280; CHECK-LABEL: xor8_imm_br:
2281; CHECK:       # %bb.0: # %entry
2282; CHECK-NEXT:    xorb $-4, {{.*}}(%rip) # encoding: [0x80,0x35,A,A,A,A,0xfc]
2283; CHECK-NEXT:    # fixup A - offset: 2, value: g8-5, kind: reloc_riprel_4byte
2284; CHECK-NEXT:    je .LBB71_1 # encoding: [0x74,A]
2285; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB71_1-1, kind: FK_PCRel_1
2286; CHECK-NEXT:  # %bb.2: # %b
2287; CHECK-NEXT:    jmp b # TAILCALL
2288; CHECK-NEXT:    # encoding: [0xeb,A]
2289; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2290; CHECK-NEXT:  .LBB71_1: # %a
2291; CHECK-NEXT:    jmp a # TAILCALL
2292; CHECK-NEXT:    # encoding: [0xeb,A]
2293; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2294entry:
2295  %load1 = load i8, i8* @g8
2296  %xor = xor i8 %load1, -4
2297  store i8 %xor, i8* @g8
2298  %cond = icmp eq i8 %xor, 0
2299  br i1 %cond, label %a, label %b
2300
2301a:
2302  tail call void @a()
2303  ret void
2304
2305b:
2306  tail call void @b()
2307  ret void
2308}
2309
2310define void @xor64_reg_br(i64 %arg) nounwind {
2311; CHECK-LABEL: xor64_reg_br:
2312; CHECK:       # %bb.0: # %entry
2313; CHECK-NEXT:    xorq %rdi, {{.*}}(%rip) # encoding: [0x48,0x31,0x3d,A,A,A,A]
2314; CHECK-NEXT:    # fixup A - offset: 3, value: g64-4, kind: reloc_riprel_4byte
2315; CHECK-NEXT:    je .LBB72_1 # encoding: [0x74,A]
2316; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB72_1-1, kind: FK_PCRel_1
2317; CHECK-NEXT:  # %bb.2: # %b
2318; CHECK-NEXT:    jmp b # TAILCALL
2319; CHECK-NEXT:    # encoding: [0xeb,A]
2320; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2321; CHECK-NEXT:  .LBB72_1: # %a
2322; CHECK-NEXT:    jmp a # TAILCALL
2323; CHECK-NEXT:    # encoding: [0xeb,A]
2324; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2325entry:
2326  %load1 = load i64, i64* @g64
2327  %xor = xor i64 %load1, %arg
2328  store i64 %xor, i64* @g64
2329  %cond = icmp eq i64 %xor, 0
2330  br i1 %cond, label %a, label %b
2331
2332a:
2333  tail call void @a()
2334  ret void
2335
2336b:
2337  tail call void @b()
2338  ret void
2339}
2340
2341define void @xor32_reg_br(i32 %arg) nounwind {
2342; CHECK-LABEL: xor32_reg_br:
2343; CHECK:       # %bb.0: # %entry
2344; CHECK-NEXT:    xorl %edi, {{.*}}(%rip) # encoding: [0x31,0x3d,A,A,A,A]
2345; CHECK-NEXT:    # fixup A - offset: 2, value: g32-4, kind: reloc_riprel_4byte
2346; CHECK-NEXT:    je .LBB73_1 # encoding: [0x74,A]
2347; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB73_1-1, kind: FK_PCRel_1
2348; CHECK-NEXT:  # %bb.2: # %b
2349; CHECK-NEXT:    jmp b # TAILCALL
2350; CHECK-NEXT:    # encoding: [0xeb,A]
2351; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2352; CHECK-NEXT:  .LBB73_1: # %a
2353; CHECK-NEXT:    jmp a # TAILCALL
2354; CHECK-NEXT:    # encoding: [0xeb,A]
2355; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2356entry:
2357  %load1 = load i32, i32* @g32
2358  %xor = xor i32 %load1, %arg
2359  store i32 %xor, i32* @g32
2360  %cond = icmp eq i32 %xor, 0
2361  br i1 %cond, label %a, label %b
2362
2363a:
2364  tail call void @a()
2365  ret void
2366
2367b:
2368  tail call void @b()
2369  ret void
2370}
2371
2372define void @xor16_reg_br(i16 %arg) nounwind {
2373; CHECK-LABEL: xor16_reg_br:
2374; CHECK:       # %bb.0: # %entry
2375; CHECK-NEXT:    xorw %di, {{.*}}(%rip) # encoding: [0x66,0x31,0x3d,A,A,A,A]
2376; CHECK-NEXT:    # fixup A - offset: 3, value: g16-4, kind: reloc_riprel_4byte
2377; CHECK-NEXT:    je .LBB74_1 # encoding: [0x74,A]
2378; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB74_1-1, kind: FK_PCRel_1
2379; CHECK-NEXT:  # %bb.2: # %b
2380; CHECK-NEXT:    jmp b # TAILCALL
2381; CHECK-NEXT:    # encoding: [0xeb,A]
2382; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2383; CHECK-NEXT:  .LBB74_1: # %a
2384; CHECK-NEXT:    jmp a # TAILCALL
2385; CHECK-NEXT:    # encoding: [0xeb,A]
2386; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2387entry:
2388  %load1 = load i16, i16* @g16
2389  %xor = xor i16 %load1, %arg
2390  store i16 %xor, i16* @g16
2391  %cond = icmp eq i16 %xor, 0
2392  br i1 %cond, label %a, label %b
2393
2394a:
2395  tail call void @a()
2396  ret void
2397
2398b:
2399  tail call void @b()
2400  ret void
2401}
2402
2403define void @xor8_reg_br(i8 %arg) nounwind {
2404; CHECK-LABEL: xor8_reg_br:
2405; CHECK:       # %bb.0: # %entry
2406; CHECK-NEXT:    xorb %dil, {{.*}}(%rip) # encoding: [0x40,0x30,0x3d,A,A,A,A]
2407; CHECK-NEXT:    # fixup A - offset: 3, value: g8-4, kind: reloc_riprel_4byte
2408; CHECK-NEXT:    je .LBB75_1 # encoding: [0x74,A]
2409; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB75_1-1, kind: FK_PCRel_1
2410; CHECK-NEXT:  # %bb.2: # %b
2411; CHECK-NEXT:    jmp b # TAILCALL
2412; CHECK-NEXT:    # encoding: [0xeb,A]
2413; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2414; CHECK-NEXT:  .LBB75_1: # %a
2415; CHECK-NEXT:    jmp a # TAILCALL
2416; CHECK-NEXT:    # encoding: [0xeb,A]
2417; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2418entry:
2419  %load1 = load i8, i8* @g8
2420  %xor = xor i8 %load1, %arg
2421  store i8 %xor, i8* @g8
2422  %cond = icmp eq i8 %xor, 0
2423  br i1 %cond, label %a, label %b
2424
2425a:
2426  tail call void @a()
2427  ret void
2428
2429b:
2430  tail call void @b()
2431  ret void
2432}
2433
2434define void @neg64_br() nounwind {
2435; CHECK-LABEL: neg64_br:
2436; CHECK:       # %bb.0: # %entry
2437; CHECK-NEXT:    negq {{.*}}(%rip) # encoding: [0x48,0xf7,0x1d,A,A,A,A]
2438; CHECK-NEXT:    # fixup A - offset: 3, value: g64-4, kind: reloc_riprel_4byte
2439; CHECK-NEXT:    js .LBB76_1 # encoding: [0x78,A]
2440; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB76_1-1, kind: FK_PCRel_1
2441; CHECK-NEXT:  # %bb.2: # %b
2442; CHECK-NEXT:    jmp b # TAILCALL
2443; CHECK-NEXT:    # encoding: [0xeb,A]
2444; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2445; CHECK-NEXT:  .LBB76_1: # %a
2446; CHECK-NEXT:    jmp a # TAILCALL
2447; CHECK-NEXT:    # encoding: [0xeb,A]
2448; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2449entry:
2450  %load1 = load i64, i64* @g64
2451  %sub = sub i64 0, %load1
2452  store i64 %sub, i64* @g64
2453  %cond = icmp slt i64 %sub, 0
2454  br i1 %cond, label %a, label %b
2455
2456a:
2457  tail call void @a()
2458  ret void
2459
2460b:
2461  tail call void @b()
2462  ret void
2463}
2464
2465define void @neg32_br() nounwind {
2466; CHECK-LABEL: neg32_br:
2467; CHECK:       # %bb.0: # %entry
2468; CHECK-NEXT:    negl {{.*}}(%rip) # encoding: [0xf7,0x1d,A,A,A,A]
2469; CHECK-NEXT:    # fixup A - offset: 2, value: g32-4, kind: reloc_riprel_4byte
2470; CHECK-NEXT:    js .LBB77_1 # encoding: [0x78,A]
2471; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB77_1-1, kind: FK_PCRel_1
2472; CHECK-NEXT:  # %bb.2: # %b
2473; CHECK-NEXT:    jmp b # TAILCALL
2474; CHECK-NEXT:    # encoding: [0xeb,A]
2475; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2476; CHECK-NEXT:  .LBB77_1: # %a
2477; CHECK-NEXT:    jmp a # TAILCALL
2478; CHECK-NEXT:    # encoding: [0xeb,A]
2479; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2480entry:
2481  %load1 = load i32, i32* @g32
2482  %sub = sub i32 0, %load1
2483  store i32 %sub, i32* @g32
2484  %cond = icmp slt i32 %sub, 0
2485  br i1 %cond, label %a, label %b
2486
2487a:
2488  tail call void @a()
2489  ret void
2490
2491b:
2492  tail call void @b()
2493  ret void
2494}
2495
2496define void @neg16_br() nounwind {
2497; CHECK-LABEL: neg16_br:
2498; CHECK:       # %bb.0: # %entry
2499; CHECK-NEXT:    negw {{.*}}(%rip) # encoding: [0x66,0xf7,0x1d,A,A,A,A]
2500; CHECK-NEXT:    # fixup A - offset: 3, value: g16-4, kind: reloc_riprel_4byte
2501; CHECK-NEXT:    js .LBB78_1 # encoding: [0x78,A]
2502; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB78_1-1, kind: FK_PCRel_1
2503; CHECK-NEXT:  # %bb.2: # %b
2504; CHECK-NEXT:    jmp b # TAILCALL
2505; CHECK-NEXT:    # encoding: [0xeb,A]
2506; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2507; CHECK-NEXT:  .LBB78_1: # %a
2508; CHECK-NEXT:    jmp a # TAILCALL
2509; CHECK-NEXT:    # encoding: [0xeb,A]
2510; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2511entry:
2512  %load1 = load i16, i16* @g16
2513  %sub = sub i16 0, %load1
2514  store i16 %sub, i16* @g16
2515  %cond = icmp slt i16 %sub, 0
2516  br i1 %cond, label %a, label %b
2517
2518a:
2519  tail call void @a()
2520  ret void
2521
2522b:
2523  tail call void @b()
2524  ret void
2525}
2526
2527define void @neg8_br() nounwind {
2528; CHECK-LABEL: neg8_br:
2529; CHECK:       # %bb.0: # %entry
2530; CHECK-NEXT:    negb {{.*}}(%rip) # encoding: [0xf6,0x1d,A,A,A,A]
2531; CHECK-NEXT:    # fixup A - offset: 2, value: g8-4, kind: reloc_riprel_4byte
2532; CHECK-NEXT:    js .LBB79_1 # encoding: [0x78,A]
2533; CHECK-NEXT:    # fixup A - offset: 1, value: .LBB79_1-1, kind: FK_PCRel_1
2534; CHECK-NEXT:  # %bb.2: # %b
2535; CHECK-NEXT:    jmp b # TAILCALL
2536; CHECK-NEXT:    # encoding: [0xeb,A]
2537; CHECK-NEXT:    # fixup A - offset: 1, value: b-1, kind: FK_PCRel_1
2538; CHECK-NEXT:  .LBB79_1: # %a
2539; CHECK-NEXT:    jmp a # TAILCALL
2540; CHECK-NEXT:    # encoding: [0xeb,A]
2541; CHECK-NEXT:    # fixup A - offset: 1, value: a-1, kind: FK_PCRel_1
2542entry:
2543  %load1 = load i8, i8* @g8
2544  %sub = sub i8 0, %load1
2545  store i8 %sub, i8* @g8
2546  %cond = icmp slt i8 %sub, 0
2547  br i1 %cond, label %a, label %b
2548
2549a:
2550  tail call void @a()
2551  ret void
2552
2553b:
2554  tail call void @b()
2555  ret void
2556}
2557