1 ; RUN: llc -march=mips64el -mcpu=mips64 < %s | FileCheck %s 2 3 declare void @llvm.eh.return.i64(i64, i8*) 4 declare void @foo(...) 5 6 define void @f1(i64 %offset, i8* %handler) { 7 entry: 8 call void (...)* @foo() 9 call void @llvm.eh.return.i64(i64 %offset, i8* %handler) 10 unreachable 11 12 ; CHECK: f1 13 ; CHECK: daddiu $sp, $sp, -[[spoffset:[0-9]+]] 14 15 ; check that $a0-$a3 are saved on stack. 16 ; CHECK: sd $4, [[offset0:[0-9]+]]($sp) 17 ; CHECK: sd $5, [[offset1:[0-9]+]]($sp) 18 ; CHECK: sd $6, [[offset2:[0-9]+]]($sp) 19 ; CHECK: sd $7, [[offset3:[0-9]+]]($sp) 20 21 ; check that .cfi_offset directives are emitted for $a0-$a3. 22 ; CHECK: .cfi_offset 4, 23 ; CHECK: .cfi_offset 5, 24 ; CHECK: .cfi_offset 6, 25 ; CHECK: .cfi_offset 7, 26 27 ; check that stack adjustment and handler are put in $v1 and $v0. 28 ; CHECK: move $[[R0:[a-z0-9]+]], $5 29 ; CHECK: move $[[R1:[a-z0-9]+]], $4 30 ; CHECK: move $3, $[[R1]] 31 ; CHECK: move $2, $[[R0]] 32 33 ; check that $a0-$a3 are restored from stack. 34 ; CHECK: ld $4, [[offset0]]($sp) 35 ; CHECK: ld $5, [[offset1]]($sp) 36 ; CHECK: ld $6, [[offset2]]($sp) 37 ; CHECK: ld $7, [[offset3]]($sp) 38 39 ; check that stack is adjusted by $v1 and that code returns to address in $v0 40 ; also check that $25 contains handler value 41 ; CHECK: daddiu $sp, $sp, [[spoffset]] 42 ; CHECK: move $25, $2 43 ; CHECK: move $ra, $2 44 ; CHECK: jr $ra 45 ; CHECK: daddu $sp, $sp, $3 46 47 } 48 49 define void @f2(i64 %offset, i8* %handler) { 50 entry: 51 call void @llvm.eh.return.i64(i64 %offset, i8* %handler) 52 unreachable 53 54 ; CHECK: f2 55 ; CHECK: .cfi_startproc 56 ; CHECK: daddiu $sp, $sp, -[[spoffset:[0-9]+]] 57 ; CHECK: .cfi_def_cfa_offset [[spoffset]] 58 59 ; check that $a0-$a3 are saved on stack. 60 ; CHECK: sd $4, [[offset0:[0-9]+]]($sp) 61 ; CHECK: sd $5, [[offset1:[0-9]+]]($sp) 62 ; CHECK: sd $6, [[offset2:[0-9]+]]($sp) 63 ; CHECK: sd $7, [[offset3:[0-9]+]]($sp) 64 65 ; check that .cfi_offset directives are emitted for $a0-$a3. 66 ; CHECK: .cfi_offset 4, -8 67 ; CHECK: .cfi_offset 5, -16 68 ; CHECK: .cfi_offset 6, -24 69 ; CHECK: .cfi_offset 7, -32 70 71 ; check that stack adjustment and handler are put in $v1 and $v0. 72 ; CHECK: move $3, $4 73 ; CHECK: move $2, $5 74 75 ; check that $a0-$a3 are restored from stack. 76 ; CHECK: ld $4, [[offset0]]($sp) 77 ; CHECK: ld $5, [[offset1]]($sp) 78 ; CHECK: ld $6, [[offset2]]($sp) 79 ; CHECK: ld $7, [[offset3]]($sp) 80 81 ; check that stack is adjusted by $v1 and that code returns to address in $v0 82 ; also check that $25 contains handler value 83 ; CHECK: daddiu $sp, $sp, [[spoffset]] 84 ; CHECK: move $25, $2 85 ; CHECK: move $ra, $2 86 ; CHECK: jr $ra 87 ; CHECK: daddu $sp, $sp, $3 88 ; CHECK: .cfi_endproc 89 } 90