1# RUN: llc -march=x86-64 -run-pass none -o - %s | FileCheck %s
2# This test ensures that the MIR parser parses the cfi offset operands
3# correctly.
4
5--- |
6
7  declare void @foo(i32)
8
9  define i32 @test(i32 %a, i32 %b, i32 %c, i32 %d) {
10  entry:
11    %add = add nsw i32 %b, %a
12    %add1 = add nsw i32 %add, %c
13    %add2 = add nsw i32 %add1, %d
14    tail call void @foo(i32 %add2)
15    %add6 = add nsw i32 %add2, %add2
16    ret i32 %add6
17  }
18
19...
20---
21name:            test
22tracksRegLiveness: true
23frameInfo:
24  stackSize:       8
25  adjustsStack:    true
26  hasCalls:        true
27fixedStack:
28  - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16 }
29body: |
30  bb.0.entry:
31    liveins: $ecx, $edi, $edx, $esi, $rbx
32
33    PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
34    CFI_INSTRUCTION def_cfa_offset 16
35    ; CHECK: CFI_INSTRUCTION offset $rbx, -16
36    CFI_INSTRUCTION offset $rbx, -16
37    $ebx = COPY $edi, implicit-def $rbx
38    $ebx = ADD32rr $ebx, killed $esi, implicit-def dead $eflags
39    $ebx = ADD32rr $ebx, killed $edx, implicit-def dead $eflags
40    $ebx = ADD32rr $ebx, killed $ecx, implicit-def dead $eflags
41    $edi = COPY $ebx
42    CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $edi, implicit-def $rsp
43    $eax = LEA64_32r killed $rbx, 1, $rbx, 0, _
44    $rbx = POP64r implicit-def $rsp, implicit $rsp
45    RETQ $eax
46...
47
48