1 ; RUN: llc -march=mipsel -mcpu=mips32 < %s | FileCheck %s 2 3 declare void @llvm.eh.return.i32(i32, i8*) 4 declare void @foo(...) 5 6 define i8* @f1(i32 %offset, i8* %handler) { 7 entry: 8 call void (...)* @foo() 9 call void @llvm.eh.return.i32(i32 %offset, i8* %handler) 10 unreachable 11 12 ; CHECK: f1 13 ; CHECK: addiu $sp, $sp, -[[spoffset:[0-9]+]] 14 15 ; check that $a0-$a3 are saved on stack. 16 ; CHECK: sw $4, [[offset0:[0-9]+]]($sp) 17 ; CHECK: sw $5, [[offset1:[0-9]+]]($sp) 18 ; CHECK: sw $6, [[offset2:[0-9]+]]($sp) 19 ; CHECK: sw $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: lw $4, [[offset0]]($sp) 35 ; CHECK: lw $5, [[offset1]]($sp) 36 ; CHECK: lw $6, [[offset2]]($sp) 37 ; CHECK: lw $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: addiu $sp, $sp, [[spoffset]] 42 ; CHECK: move $25, $2 43 ; CHECK: move $ra, $2 44 ; CHECK: jr $ra 45 ; CHECK: addu $sp, $sp, $3 46 } 47 48 define i8* @f2(i32 %offset, i8* %handler) { 49 entry: 50 call void @llvm.eh.return.i32(i32 %offset, i8* %handler) 51 unreachable 52 53 ; CHECK: f2 54 ; CHECK: addiu $sp, $sp, -[[spoffset:[0-9]+]] 55 56 ; check that $a0-$a3 are saved on stack. 57 ; CHECK: sw $4, [[offset0:[0-9]+]]($sp) 58 ; CHECK: sw $5, [[offset1:[0-9]+]]($sp) 59 ; CHECK: sw $6, [[offset2:[0-9]+]]($sp) 60 ; CHECK: sw $7, [[offset3:[0-9]+]]($sp) 61 62 ; check that .cfi_offset directives are emitted for $a0-$a3. 63 ; CHECK: .cfi_offset 4, 64 ; CHECK: .cfi_offset 5, 65 ; CHECK: .cfi_offset 6, 66 ; CHECK: .cfi_offset 7, 67 68 ; check that stack adjustment and handler are put in $v1 and $v0. 69 ; CHECK: move $3, $4 70 ; CHECK: move $2, $5 71 72 ; check that $a0-$a3 are restored from stack. 73 ; CHECK: lw $4, [[offset0]]($sp) 74 ; CHECK: lw $5, [[offset1]]($sp) 75 ; CHECK: lw $6, [[offset2]]($sp) 76 ; CHECK: lw $7, [[offset3]]($sp) 77 78 ; check that stack is adjusted by $v1 and that code returns to address in $v0 79 ; also check that $25 contains handler value 80 ; CHECK: addiu $sp, $sp, [[spoffset]] 81 ; CHECK: move $25, $2 82 ; CHECK: move $ra, $2 83 ; CHECK: jr $ra 84 ; CHECK: addu $sp, $sp, $3 85 } 86