1 ; RUN: llc -march=mipsel -mcpu=mips32 < %s | FileCheck %s 2 ; RUN: llc -march=mips64el -mcpu=mips64 < %s | \ 3 ; RUN: FileCheck %s -check-prefix=CHECK-MIPS64 4 5 declare i8* @llvm.eh.dwarf.cfa(i32) nounwind 6 declare i8* @llvm.frameaddress(i32) nounwind readnone 7 8 define i8* @f1() nounwind { 9 entry: 10 %x = alloca [32 x i8], align 1 11 %0 = call i8* @llvm.eh.dwarf.cfa(i32 0) 12 ret i8* %0 13 14 ; CHECK: addiu $sp, $sp, -32 15 ; CHECK: addiu $2, $sp, 32 16 } 17 18 19 define i8* @f2() nounwind { 20 entry: 21 %x = alloca [65536 x i8], align 1 22 %0 = call i8* @llvm.eh.dwarf.cfa(i32 0) 23 ret i8* %0 24 25 ; check stack size (65536 + 8) 26 ; CHECK: lui $[[R0:[a-z0-9]+]], 65535 27 ; CHECK: addiu $[[R0]], $[[R0]], -8 28 ; CHECK: addu $sp, $sp, $[[R0]] 29 30 ; check return value ($sp + stack size) 31 ; CHECK: lui $[[R1:[a-z0-9]+]], 1 32 ; CHECK: addu $[[R1]], $sp, $[[R1]] 33 ; CHECK: addiu $2, $[[R1]], 8 34 } 35 36 37 define i32 @f3() nounwind { 38 entry: 39 %x = alloca [32 x i8], align 1 40 %0 = call i8* @llvm.eh.dwarf.cfa(i32 0) 41 %1 = ptrtoint i8* %0 to i32 42 %2 = call i8* @llvm.frameaddress(i32 0) 43 %3 = ptrtoint i8* %2 to i32 44 %add = add i32 %1, %3 45 ret i32 %add 46 47 ; CHECK: addiu $sp, $sp, -40 48 49 ; check return value ($fp + stack size + $fp) 50 ; CHECK: addiu $[[R0:[a-z0-9]+]], $fp, 40 51 ; CHECK: addu $2, $[[R0]], $fp 52 } 53 54 55 define i8* @f4() nounwind { 56 entry: 57 %x = alloca [32 x i8], align 1 58 %0 = call i8* @llvm.eh.dwarf.cfa(i32 0) 59 ret i8* %0 60 61 ; CHECK-MIPS64: daddiu $sp, $sp, -32 62 ; CHECK-MIPS64: daddiu $2, $sp, 32 63 } 64