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