xref: /llvm-project/llvm/test/CodeGen/X86/statepoint-fastregalloc.mir (revision 1bc8b3258e6d42f702fb11eb60d84d0e23935e3e)
1# RUN: llc -mtriple=x86_64-- -run-pass=regallocfast -o - %s | FileCheck %s
2# RUN: llc -mtriple=x86_64-- -passes=regallocfast -o - %s | FileCheck %s
3
4# Check that fastregalloc does not displace register assigned to tied def when
5# RegMask operand is present. STATEPOINT is an example of such instruction.
6# Tied def/use must be assigned to the same register.
7---
8name:            test_relocate
9tracksRegLiveness: true
10frameInfo:
11  adjustsStack:    true
12body:             |
13  bb.0.entry:
14    liveins: $rdi
15
16    ; CHECK: renamable [[REG:\$[a-z0-9]+]] = STATEPOINT 0, 0, 0, target-flags(x86-plt) 0, 2, 0, 2, 0, 2, 0, 2, 1, renamable [[REG]](tied-def 0)
17
18    %1:gr64 = COPY $rdi
19    ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
20    %1:gr64 = STATEPOINT 0, 0, 0, target-flags(x86-plt) 0, 2, 0, 2, 0, 2, 0, 2, 1, %1(tied-def 0), 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp
21    ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
22    $rax = COPY %1
23    RET 0, killed $rax
24...
25
26# Same as above but with multiple RegMask operands per instruction.
27# These regmasks have no real meaning and chosen to allow only single register to be assignable ($rbp)
28---
29name:            test_relocate_multi_regmasks
30tracksRegLiveness: true
31frameInfo:
32  adjustsStack:    true
33body:             |
34  bb.0.entry:
35    liveins: $rdi
36
37    ; CHECK: renamable $rbp = STATEPOINT 0, 0, 0, target-flags(x86-plt) 0, 2, 0, 2, 0, 2, 0, 2, 1, renamable $rbp(tied-def 0)
38
39    %1:gr64 = COPY $rdi
40    ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
41    %1:gr64 = STATEPOINT 0, 0, 0, target-flags(x86-plt) 0, 2, 0, 2, 0, 2, 0, 2, 1, %1(tied-def 0), 2, 0, 2, 1, 0, 0, csr_64_rt_allregs, csr_64_cxx_tls_darwin_pe, implicit-def $rsp, implicit-def $ssp
42    ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
43    $rax = COPY %1
44    RET 0, killed $rax
45...
46