xref: /aosp_15_r20/external/llvm/test/CodeGen/MIR/X86/early-clobber-register-flag.mir (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o - %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker# This test ensures that the MIR parser parses the 'early-clobber' register
3*9880d681SAndroid Build Coastguard Worker# flags correctly.
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker--- |
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker  declare void @foo(i32)
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker  define void @test(i32 %a, i32 %b) #0 {
10*9880d681SAndroid Build Coastguard Worker  entry:
11*9880d681SAndroid Build Coastguard Worker    %c = add i32 %a, %b
12*9880d681SAndroid Build Coastguard Worker    call void asm sideeffect "nop", "~{ax},~{di}"()
13*9880d681SAndroid Build Coastguard Worker    call void @foo(i32 %c)
14*9880d681SAndroid Build Coastguard Worker    ret void
15*9880d681SAndroid Build Coastguard Worker  }
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker  attributes #0 = { optsize }
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker...
20*9880d681SAndroid Build Coastguard Worker---
21*9880d681SAndroid Build Coastguard Workername:            test
22*9880d681SAndroid Build Coastguard WorkerhasInlineAsm:    true
23*9880d681SAndroid Build Coastguard WorkertracksRegLiveness: true
24*9880d681SAndroid Build Coastguard Workerliveins:
25*9880d681SAndroid Build Coastguard Worker  - { reg: '%edi' }
26*9880d681SAndroid Build Coastguard Worker  - { reg: '%esi' }
27*9880d681SAndroid Build Coastguard WorkerframeInfo:
28*9880d681SAndroid Build Coastguard Worker  stackSize:     8
29*9880d681SAndroid Build Coastguard Worker  adjustsStack:  true
30*9880d681SAndroid Build Coastguard Worker  hasCalls:      true
31*9880d681SAndroid Build Coastguard Workerbody: |
32*9880d681SAndroid Build Coastguard Worker  bb.0.entry:
33*9880d681SAndroid Build Coastguard Worker    liveins: %edi, %esi
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker    frame-setup PUSH64r undef %rax, implicit-def %rsp, implicit %rsp
36*9880d681SAndroid Build Coastguard Worker    CFI_INSTRUCTION .cfi_def_cfa_offset 16
37*9880d681SAndroid Build Coastguard Worker    %ecx = COPY %edi
38*9880d681SAndroid Build Coastguard Worker    %ecx = ADD32rr killed %ecx, killed %esi, implicit-def dead %eflags
39*9880d681SAndroid Build Coastguard Worker  ; CHECK: INLINEASM $nop, 1, 12, implicit-def dead early-clobber %ax, 12, implicit-def dead early-clobber %di
40*9880d681SAndroid Build Coastguard Worker    INLINEASM $nop, 1, 12, implicit-def dead early-clobber %ax, 12, implicit-def dead early-clobber %di
41*9880d681SAndroid Build Coastguard Worker    %edi = COPY killed %ecx
42*9880d681SAndroid Build Coastguard Worker    CALL64pcrel32 @foo, csr_64, implicit %rsp, implicit %edi, implicit-def %rsp
43*9880d681SAndroid Build Coastguard Worker    %rax = POP64r implicit-def %rsp, implicit %rsp
44*9880d681SAndroid Build Coastguard Worker    RETQ
45*9880d681SAndroid Build Coastguard Worker...
46