1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-- < %s | FileCheck %s
3 @sc8 = external dso_local global i8
5 define void @atomic_maxmin_i8() {
6 ; CHECK-LABEL: atomic_maxmin_i8:
8 ; CHECK-NEXT: movzbl sc8(%rip), %eax
9 ; CHECK-NEXT: .p2align 4, 0x90
10 ; CHECK-NEXT: .LBB0_1: # %atomicrmw.start
11 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
12 ; CHECK-NEXT: cmpb $6, %al
13 ; CHECK-NEXT: movzbl %al, %eax
14 ; CHECK-NEXT: movl $5, %ecx
15 ; CHECK-NEXT: cmovgel %eax, %ecx
16 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
17 ; CHECK-NEXT: lock cmpxchgb %cl, sc8(%rip)
18 ; CHECK-NEXT: jne .LBB0_1
19 ; CHECK-NEXT: # %bb.2: # %atomicrmw.end
20 ; CHECK-NEXT: movzbl sc8(%rip), %eax
21 ; CHECK-NEXT: .p2align 4, 0x90
22 ; CHECK-NEXT: .LBB0_3: # %atomicrmw.start2
23 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
24 ; CHECK-NEXT: cmpb $7, %al
25 ; CHECK-NEXT: movzbl %al, %eax
26 ; CHECK-NEXT: movl $6, %ecx
27 ; CHECK-NEXT: cmovll %eax, %ecx
28 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
29 ; CHECK-NEXT: lock cmpxchgb %cl, sc8(%rip)
30 ; CHECK-NEXT: jne .LBB0_3
31 ; CHECK-NEXT: # %bb.4: # %atomicrmw.end1
32 ; CHECK-NEXT: movzbl sc8(%rip), %eax
33 ; CHECK-NEXT: .p2align 4, 0x90
34 ; CHECK-NEXT: .LBB0_5: # %atomicrmw.start8
35 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
36 ; CHECK-NEXT: cmpb $8, %al
37 ; CHECK-NEXT: movzbl %al, %eax
38 ; CHECK-NEXT: movl $7, %ecx
39 ; CHECK-NEXT: cmovael %eax, %ecx
40 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
41 ; CHECK-NEXT: lock cmpxchgb %cl, sc8(%rip)
42 ; CHECK-NEXT: jne .LBB0_5
43 ; CHECK-NEXT: # %bb.6: # %atomicrmw.end7
44 ; CHECK-NEXT: movzbl sc8(%rip), %eax
45 ; CHECK-NEXT: .p2align 4, 0x90
46 ; CHECK-NEXT: .LBB0_7: # %atomicrmw.start14
47 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
48 ; CHECK-NEXT: cmpb $9, %al
49 ; CHECK-NEXT: movzbl %al, %eax
50 ; CHECK-NEXT: movl $8, %ecx
51 ; CHECK-NEXT: cmovbl %eax, %ecx
52 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
53 ; CHECK-NEXT: lock cmpxchgb %cl, sc8(%rip)
54 ; CHECK-NEXT: jne .LBB0_7
55 ; CHECK-NEXT: # %bb.8: # %atomicrmw.end13
57 %1 = atomicrmw max ptr @sc8, i8 5 acquire
58 %2 = atomicrmw min ptr @sc8, i8 6 acquire
59 %3 = atomicrmw umax ptr @sc8, i8 7 acquire
60 %4 = atomicrmw umin ptr @sc8, i8 8 acquire