1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -run-pass=regallocfast -verify-machineinstrs %s -o - | FileCheck %s
5 source_filename = "x.c"
6 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-unknown-linux-gnu"
9 ; Function Attrs: noinline nounwind optnone
10 define dso_local i32 @main() #0 {
12 %retval = alloca i32, align 4
13 %x = alloca i32, align 4
14 store i32 0, ptr %retval, align 4
15 store i32 123, ptr %x, align 4
16 %0 = callbr i32 asm "mov $1, $0\0A\09jmp ${2:l}", "=r,r,!i,~{dirflag},~{fpsr},~{flags}"(i32 45) #2
17 to label %asm.fallthrough [label %label.split], !srcloc !5
19 asm.fallthrough: ; preds = %entry
20 store i32 %0, ptr %x, align 4
21 store i32 6, ptr %x, align 4
24 label: ; preds = %asm.fallthrough, %label.split
25 %1 = load i32, ptr %x, align 4
28 label.split: ; preds = %entry
29 %2 = call i32 @llvm.callbr.landingpad.i32(i32 %0)
30 store i32 %2, ptr %x, align 4
34 ; Function Attrs: nomerge nounwind
35 declare i32 @llvm.callbr.landingpad.i32(i32) #1
37 attributes #0 = { noinline nounwind optnone "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
38 attributes #1 = { nomerge nounwind }
39 attributes #2 = { nounwind memory(none) }
41 !llvm.module.flags = !{!0, !1, !2, !3}
44 !0 = !{i32 1, !"wchar_size", i32 4}
45 !1 = !{i32 8, !"PIC Level", i32 2}
46 !2 = !{i32 7, !"PIE Level", i32 2}
47 !3 = !{i32 7, !"frame-pointer", i32 2}
48 !4 = !{!"clang version 17.0.0 (git@github.com:llvm/llvm-project.git cf86855c4453d029a9b9ed8c4c4c18cefc1bc895)"}
49 !5 = !{i64 166, i64 179}
55 exposesReturnsTwice: false
57 regBankSelected: false
60 tracksRegLiveness: true
63 callsUnwindInit: false
68 failsVerification: false
69 tracksDebugUserValues: false
71 - { id: 0, class: gr32, preferred-register: '' }
72 - { id: 1, class: gr32, preferred-register: '' }
73 - { id: 2, class: gr32, preferred-register: '' }
74 - { id: 3, class: gr32, preferred-register: '' }
75 - { id: 4, class: gr32, preferred-register: '' }
76 - { id: 5, class: gr32, preferred-register: '' }
77 - { id: 6, class: gr32, preferred-register: '' }
80 isFrameAddressTaken: false
81 isReturnAddressTaken: false
91 maxCallFrameSize: 4294967295
92 cvBytesOfCalleeSavedRegisters: 0
93 hasOpaqueSPAdjustment: false
95 hasMustTailInVarArgFunc: false
102 - { id: 0, name: retval, type: default, offset: 0, size: 4, alignment: 4,
103 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
104 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
105 - { id: 1, name: x, type: default, offset: 0, size: 4, alignment: 4,
106 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
107 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
109 debugValueSubstitutions: []
111 machineFunctionInfo: {}
113 ; CHECK-LABEL: name: main
115 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.3(0x40000000)
117 ; CHECK-NEXT: MOV32mi %stack.0.retval, 1, $noreg, 0, $noreg, 0 :: (store (s32) into %ir.retval)
118 ; CHECK-NEXT: MOV32mi %stack.1.x, 1, $noreg, 0, $noreg, 123 :: (store (s32) into %ir.x)
119 ; CHECK-NEXT: renamable $eax = MOV32ri 45
120 ; CHECK-NEXT: INLINEASM_BR &"mov $1, $0\0A\09jmp ${2:l}", 0 /* attdialect */, 2359306 /* regdef:GR32 */, def renamable $eax, 2359305 /* reguse:GR32 */, killed renamable $eax, 13 /* imm */, %bb.3, 12 /* clobber */, implicit-def dead early-clobber $df, 12 /* clobber */, implicit-def early-clobber $fpsw, 12 /* clobber */, implicit-def dead early-clobber $eflags, !5
121 ; CHECK-NEXT: MOV32mr %stack.3, 1, $noreg, 0, $noreg, $eax :: (store (s32) into %stack.3)
122 ; CHECK-NEXT: MOV32mr %stack.2, 1, $noreg, 0, $noreg, killed $eax :: (store (s32) into %stack.2)
123 ; CHECK-NEXT: JMP_1 %bb.1
125 ; CHECK-NEXT: bb.1.asm.fallthrough:
126 ; CHECK-NEXT: successors: %bb.2(0x80000000)
128 ; CHECK-NEXT: $eax = MOV32rm %stack.2, 1, $noreg, 0, $noreg :: (load (s32) from %stack.2)
129 ; CHECK-NEXT: MOV32mr %stack.1.x, 1, $noreg, 0, $noreg, renamable $eax :: (store (s32) into %ir.x)
130 ; CHECK-NEXT: MOV32mi %stack.1.x, 1, $noreg, 0, $noreg, 6 :: (store (s32) into %ir.x)
132 ; CHECK-NEXT: bb.2.label:
133 ; CHECK-NEXT: renamable $eax = MOV32rm %stack.1.x, 1, $noreg, 0, $noreg :: (load (s32) from %ir.x)
134 ; CHECK-NEXT: RET64 implicit killed $eax
136 ; CHECK-NEXT: bb.3.label.split (machine-block-address-taken, inlineasm-br-indirect-target):
137 ; CHECK-NEXT: successors: %bb.2(0x80000000)
138 ; CHECK-NEXT: liveins: $eax
140 ; CHECK-NEXT: MOV32mr %stack.3, 1, $noreg, 0, $noreg, $eax :: (store (s32) into %stack.3)
141 ; CHECK-NEXT: $eax = MOV32rm %stack.3, 1, $noreg, 0, $noreg :: (load (s32) from %stack.3)
142 ; CHECK-NEXT: MOV32mr %stack.1.x, 1, $noreg, 0, $noreg, killed renamable $eax :: (store (s32) into %ir.x)
143 ; CHECK-NEXT: JMP_1 %bb.2
145 successors: %bb.1(0x40000000), %bb.3(0x40000000)
147 MOV32mi %stack.0.retval, 1, $noreg, 0, $noreg, 0 :: (store (s32) into %ir.retval)
148 MOV32mi %stack.1.x, 1, $noreg, 0, $noreg, 123 :: (store (s32) into %ir.x)
150 INLINEASM_BR &"mov $1, $0\0A\09jmp ${2:l}", 0 /* attdialect */, 2359306 /* regdef:GR32 */, def %1, 2359305 /* reguse:GR32 */, %2, 13 /* imm */, %bb.3, 12 /* clobber */, implicit-def early-clobber $df, 12 /* clobber */, implicit-def early-clobber $fpsw, 12 /* clobber */, implicit-def early-clobber $eflags, !5
154 bb.1.asm.fallthrough:
155 successors: %bb.2(0x80000000)
157 MOV32mr %stack.1.x, 1, $noreg, 0, $noreg, %0 :: (store (s32) into %ir.x)
158 MOV32mi %stack.1.x, 1, $noreg, 0, $noreg, 6 :: (store (s32) into %ir.x)
161 %6:gr32 = MOV32rm %stack.1.x, 1, $noreg, 0, $noreg :: (load (s32) from %ir.x)
165 bb.3.label.split (machine-block-address-taken, inlineasm-br-indirect-target):
166 successors: %bb.2(0x80000000)
169 MOV32mr %stack.1.x, 1, $noreg, 0, $noreg, %3 :: (store (s32) into %ir.x)