1 ; RUN: llc -march=mips64el -mcpu=mips4 -asm-show-inst -relocation-model=pic < %s | FileCheck %s -check-prefixes=CHECK,NOT-R6
2 ; RUN: llc -march=mips64el -mcpu=mips64 -asm-show-inst -relocation-model=pic < %s | FileCheck %s -check-prefixes=CHECK,NOT-R6
3 ; RUN: llc -march=mips64el -mcpu=mips64r2 -asm-show-inst -relocation-model=pic < %s | FileCheck %s -check-prefixes=CHECK,NOT-R6
4 ; RUN: llc -march=mips64el -mcpu=mips64r6 -asm-show-inst -relocation-model=pic < %s | FileCheck %s -check-prefixes=CHECK,R6
6 declare void @llvm.eh.return.i64(i64, ptr)
9 define void @f1(i64 %offset, ptr %handler) {
11 call void (...) @foo()
12 call void @llvm.eh.return.i64(i64 %offset, ptr %handler)
16 ; CHECK: daddiu $sp, $sp, -[[spoffset:[0-9]+]]
18 ; check that $a0-$a3 are saved on stack.
19 ; CHECK: sd $4, [[offset0:[0-9]+]]($sp)
20 ; CHECK: sd $5, [[offset1:[0-9]+]]($sp)
21 ; CHECK: sd $6, [[offset2:[0-9]+]]($sp)
22 ; CHECK: sd $7, [[offset3:[0-9]+]]($sp)
24 ; check that .cfi_offset directives are emitted for $a0-$a3.
25 ; CHECK: .cfi_offset 4,
26 ; CHECK: .cfi_offset 5,
27 ; CHECK: .cfi_offset 6,
28 ; CHECK: .cfi_offset 7,
30 ; check that stack adjustment and handler are put in $v1 and $v0.
31 ; CHECK: move $[[R0:[a-z0-9]+]], $5
32 ; CHECK: move $[[R1:[a-z0-9]+]], $4
33 ; CHECK: move $3, $[[R1]]
34 ; CHECK: move $2, $[[R0]]
36 ; check that $a0-$a3 are restored from stack.
37 ; CHECK: ld $4, [[offset0]]($sp)
38 ; CHECK: ld $5, [[offset1]]($sp)
39 ; CHECK: ld $6, [[offset2]]($sp)
40 ; CHECK: ld $7, [[offset3]]($sp)
42 ; check that stack is adjusted by $v1 and that code returns to address in $v0
43 ; also check that $25 contains handler value
44 ; CHECK: daddiu $sp, $sp, [[spoffset]]
47 ; NOT-R6: jr $ra # <MCInst #{{[0-9]+}} JR
48 ; R6: jr $ra # <MCInst #{{[0-9]+}} JALR
49 ; CHECK: daddu $sp, $sp, $3
52 define void @f2(i64 %offset, ptr %handler) {
54 call void @llvm.eh.return.i64(i64 %offset, ptr %handler)
58 ; CHECK: .cfi_startproc
59 ; CHECK: daddiu $sp, $sp, -[[spoffset:[0-9]+]]
60 ; CHECK: .cfi_def_cfa_offset [[spoffset]]
62 ; check that $a0-$a3 are saved on stack.
63 ; CHECK: sd $4, [[offset0:[0-9]+]]($sp)
64 ; CHECK: sd $5, [[offset1:[0-9]+]]($sp)
65 ; CHECK: sd $6, [[offset2:[0-9]+]]($sp)
66 ; CHECK: sd $7, [[offset3:[0-9]+]]($sp)
68 ; check that .cfi_offset directives are emitted for $a0-$a3.
69 ; CHECK: .cfi_offset 4, -8
70 ; CHECK: .cfi_offset 5, -16
71 ; CHECK: .cfi_offset 6, -24
72 ; CHECK: .cfi_offset 7, -32
74 ; check that stack adjustment and handler are put in $v1 and $v0.
78 ; check that $a0-$a3 are restored from stack.
79 ; CHECK: ld $4, [[offset0]]($sp)
80 ; CHECK: ld $5, [[offset1]]($sp)
81 ; CHECK: ld $6, [[offset2]]($sp)
82 ; CHECK: ld $7, [[offset3]]($sp)
84 ; check that stack is adjusted by $v1 and that code returns to address in $v0
85 ; also check that $25 contains handler value
86 ; CHECK: daddiu $sp, $sp, [[spoffset]]
89 ; NOT-R6: jr $ra # <MCInst #{{[0-9]+}} JR
90 ; R6: jr $ra # <MCInst #{{[0-9]+}} JALR
91 ; CHECK: daddu $sp, $sp, $3