1; RUN: llc -march=mips64el -mcpu=mips4 -asm-show-inst < %s | FileCheck %s -check-prefix=CHECK -check-prefix=NOT-R6 2; RUN: llc -march=mips64el -mcpu=mips64 -asm-show-inst < %s | FileCheck %s -check-prefix=CHECK -check-prefix=NOT-R6 3; RUN: llc -march=mips64el -mcpu=mips64r2 -asm-show-inst < %s | FileCheck %s -check-prefix=CHECK -check-prefix=NOT-R6 4; RUN: llc -march=mips64el -mcpu=mips64r6 -asm-show-inst < %s | FileCheck %s -check-prefix=CHECK -check-prefix=R6 5 6declare void @llvm.eh.return.i64(i64, i8*) 7declare void @foo(...) 8 9define void @f1(i64 %offset, i8* %handler) { 10entry: 11 call void (...) @foo() 12 call void @llvm.eh.return.i64(i64 %offset, i8* %handler) 13 unreachable 14 15; CHECK: f1: 16; CHECK: daddiu $sp, $sp, -[[spoffset:[0-9]+]] 17 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) 23 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, 29 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]] 35 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) 41 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]] 45; CHECK: move $25, $2 46; CHECK: move $ra, $2 47; NOT-R6: jr $ra # <MCInst #{{[0-9]+}} JR 48; R6: jr $ra # <MCInst #{{[0-9]+}} JALR 49; CHECK: daddu $sp, $sp, $3 50} 51 52define void @f2(i64 %offset, i8* %handler) { 53entry: 54 call void @llvm.eh.return.i64(i64 %offset, i8* %handler) 55 unreachable 56 57; CHECK: f2: 58; CHECK: .cfi_startproc 59; CHECK: daddiu $sp, $sp, -[[spoffset:[0-9]+]] 60; CHECK: .cfi_def_cfa_offset [[spoffset]] 61 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) 67 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 73 74; check that stack adjustment and handler are put in $v1 and $v0. 75; CHECK: move $3, $4 76; CHECK: move $2, $5 77 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) 83 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]] 87; CHECK: move $25, $2 88; CHECK: move $ra, $2 89; NOT-R6: jr $ra # <MCInst #{{[0-9]+}} JR 90; R6: jr $ra # <MCInst #{{[0-9]+}} JALR 91; CHECK: daddu $sp, $sp, $3 92; CHECK: .cfi_endproc 93} 94