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
7 declare ptr @llvm.eh.dwarf.cfa(i32) nounwind
8 declare ptr @llvm.frameaddress(i32) nounwind readnone
10 define ptr @f1() nounwind {
12 %x = alloca [32 x i8], align 1
13 %0 = call ptr @llvm.eh.dwarf.cfa(i32 0)
18 ; CHECK: addiu $sp, $sp, -32
19 ; CHECK: addiu $2, $sp, 32
23 define ptr @f2() nounwind {
25 %x = alloca [65536 x i8], align 1
26 %0 = call ptr @llvm.eh.dwarf.cfa(i32 0)
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]]
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
43 define i32 @f3() nounwind {
45 %x = alloca [32 x i8], align 1
46 %0 = call ptr @llvm.eh.dwarf.cfa(i32 0)
47 %1 = ptrtoint ptr %0 to i32
48 %2 = call ptr @llvm.frameaddress(i32 0)
49 %3 = ptrtoint ptr %2 to i32
55 ; CHECK: addiu $sp, $sp, -40
57 ; check return value ($fp + stack size + $fp)
58 ; CHECK: addiu $[[R0:[a-z0-9]+]], $fp, 40
59 ; CHECK: addu $2, $[[R0]], $fp
63 define ptr @f4() nounwind {
65 %x = alloca [32 x i8], align 1
66 %0 = call ptr @llvm.eh.dwarf.cfa(i32 0)
71 ; CHECK-MIPS64: daddiu $sp, $sp, -32
72 ; CHECK-MIPS64: daddiu $2, $sp, 32