1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; FIXME(ndesaulniers): get this test to pass with -verify-machineinstrs
3 ; enabled. https://github.com/llvm/llvm-project/issues/60827
4 ; RUN: llc -mtriple=i386-linux-gnu %s -o - -stop-after=finalize-isel \
5 ; RUN: -verify-machineinstrs=0 -start-before=x86-isel | FileCheck %s
7 define i8 @emulator_cmpxchg_emulated() {
8 ; CHECK-LABEL: name: emulator_cmpxchg_emulated
10 ; CHECK-NEXT: successors: %bb.1(0x80000000), %bb.2(0x00000000)
12 ; CHECK-NEXT: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm $noreg, 1, $noreg, 0, $noreg :: (load (s32) from `ptr null`, align 8)
13 ; CHECK-NEXT: INLINEASM_BR &"", 16 /* maystore attdialect */, 2359306 /* regdef:GR32 */, def %2, 2359306 /* regdef:GR32 */, def %3, 2147549193 /* reguse tiedto:$1 */, [[MOV32rm]](tied-def 5), 13 /* imm */, %bb.2
14 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $eflags
15 ; CHECK-NEXT: $eflags = COPY [[COPY]]
16 ; CHECK-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 4, implicit $eflags
17 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY %3
18 ; CHECK-NEXT: JMP_1 %bb.1
20 ; CHECK-NEXT: bb.1.asm.fallthrough:
21 ; CHECK-NEXT: $al = COPY [[SETCCr]]
22 ; CHECK-NEXT: RET 0, $al
24 ; CHECK-NEXT: bb.2.efaultu64.split (machine-block-address-taken, inlineasm-br-indirect-target):
25 ; CHECK-NEXT: [[SETCCr1:%[0-9]+]]:gr8 = SETCCr 4, implicit $eflags
26 ; CHECK-NEXT: $al = COPY [[SETCCr1]]
27 ; CHECK-NEXT: RET 0, $al
29 %0 = load i32, ptr null, align 8
30 %1 = callbr { i8, i32 } asm "", "={@ccz},=r,1,!i"(i32 %0)
31 to label %asm.fallthrough [label %efaultu64.split]
34 %asmresult = extractvalue { i8, i32 } %1, 0
35 %asmresult1 = extractvalue { i8, i32 } %1, 1
39 %2 = call { i8, i32 } @llvm.callbr.landingpad.sl_i8i32s({ i8, i32 } %1)
40 %asmresult2 = extractvalue { i8, i32 } %2, 0
41 %asmresult3 = extractvalue { i8, i32 } %2, 1
45 ; Same test but return second value
46 define i32 @emulator_cmpxchg_emulated2() {
47 ; CHECK-LABEL: name: emulator_cmpxchg_emulated2
49 ; CHECK-NEXT: successors: %bb.1(0x80000000), %bb.2(0x00000000)
51 ; CHECK-NEXT: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm $noreg, 1, $noreg, 0, $noreg :: (load (s32) from `ptr null`, align 8)
52 ; CHECK-NEXT: INLINEASM_BR &"", 16 /* maystore attdialect */, 2359306 /* regdef:GR32 */, def %2, 2359306 /* regdef:GR32 */, def %3, 2147549193 /* reguse tiedto:$1 */, [[MOV32rm]](tied-def 5), 13 /* imm */, %bb.2
53 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $eflags
54 ; CHECK-NEXT: $eflags = COPY [[COPY]]
55 ; CHECK-NEXT: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 4, implicit $eflags
56 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY %3
57 ; CHECK-NEXT: JMP_1 %bb.1
59 ; CHECK-NEXT: bb.1.asm.fallthrough:
60 ; CHECK-NEXT: $eax = COPY [[COPY1]]
61 ; CHECK-NEXT: RET 0, $eax
63 ; CHECK-NEXT: bb.2.efaultu64.split (machine-block-address-taken, inlineasm-br-indirect-target):
64 ; CHECK-NEXT: $eax = COPY %3
65 ; CHECK-NEXT: RET 0, $eax
67 %0 = load i32, ptr null, align 8
68 %1 = callbr { i8, i32 } asm "", "={@ccz},=r,1,!i"(i32 %0)
69 to label %asm.fallthrough [label %efaultu64.split]
72 %asmresult = extractvalue { i8, i32 } %1, 0
73 %asmresult1 = extractvalue { i8, i32 } %1, 1
77 %2 = call { i8, i32 } @llvm.callbr.landingpad.sl_i8i32s({ i8, i32 } %1)
78 %asmresult2 = extractvalue { i8, i32 } %2, 0
79 %asmresult3 = extractvalue { i8, i32 } %2, 1
83 define i64 @multireg() {
84 ; CHECK-LABEL: name: multireg
86 ; CHECK-NEXT: successors: %bb.1(0x80000000), %bb.2(0x00000000)
88 ; CHECK-NEXT: INLINEASM_BR &"", 0 /* attdialect */, 18 /* regdef */, implicit-def $eax, implicit-def $edx, 13 /* imm */, %bb.2
89 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $eax
90 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY $edx
91 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gr32 = COPY [[COPY1]]
92 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gr32 = COPY [[COPY]]
93 ; CHECK-NEXT: JMP_1 %bb.1
95 ; CHECK-NEXT: bb.1.ft:
96 ; CHECK-NEXT: $eax = COPY [[COPY3]]
97 ; CHECK-NEXT: $edx = COPY [[COPY2]]
98 ; CHECK-NEXT: RET 0, $eax, $edx
100 ; CHECK-NEXT: bb.2.split (machine-block-address-taken, inlineasm-br-indirect-target):
101 ; CHECK-NEXT: liveins: $eax, $edx
103 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gr32 = COPY $eax
104 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:gr32 = COPY $edx
105 ; CHECK-NEXT: $eax = COPY [[COPY4]]
106 ; CHECK-NEXT: $edx = COPY [[COPY5]]
107 ; CHECK-NEXT: RET 0, $eax, $edx
109 %0 = callbr i64 asm "", "=A,!i"() to label %ft [label %split]
113 %1 = call i64 @llvm.callbr.landingpad.i64(i64 %0)
116 declare i64 @llvm.callbr.landingpad.i64(i64)
117 declare { i8, i32 } @llvm.callbr.landingpad.sl_i8i32s({ i8, i32 })