xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/Fast-ISel/fastalloca.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1; RUN: llc -march=mipsel -relocation-model=pic -O0 -fast-isel-abort=1 -mcpu=mips32r2 \
2; RUN:     < %s -verify-machineinstrs | FileCheck %s
3
4%struct.x = type { i32 }
5
6@i = common global i32 0, align 4
7
8define i32 @foobar(i32 signext %x) {
9entry:
10; CHECK-LABEL: foobar:
11  %retval = alloca i32, align 4
12  %x.addr = alloca i32, align 4
13  %a = alloca %struct.x, align 4
14  %c = alloca %struct.x*, align 4
15  store i32 %x, i32* %x.addr, align 4
16  %x1 = getelementptr inbounds %struct.x, %struct.x* %a, i32 0, i32 0
17  %0 = load i32, i32* %x.addr, align 4
18  store i32 %0, i32* %x1, align 4
19  store %struct.x* %a, %struct.x** %c, align 4
20  %1 = load %struct.x*, %struct.x** %c, align 4
21  %x2 = getelementptr inbounds %struct.x, %struct.x* %1, i32 0, i32 0
22  %2 = load i32, i32* %x2, align 4
23  store i32 %2, i32* @i, align 4
24  %3 = load i32, i32* %retval
25; CHECK-DAG:    lw      $[[I_ADDR:[0-9]+]], %got(i)($[[REG_GP:[0-9]+]])
26; CHECK-DAG:    addiu   $[[A_ADDR:[0-9]+]], $sp, 8
27; CHECK-DAG:    sw      $[[A_ADDR]], [[A_ADDR_FI:[0-9]+]]($sp)
28; CHECK-DAG:    lw      $[[A_ADDR2:[0-9]+]], [[A_ADDR_FI]]($sp)
29; CHECK-DAG:    lw      $[[A_X:[0-9]+]], 0($[[A_ADDR2]])
30; CHECK-DAG:    sw      $[[A_X]], 0($[[I_ADDR]])
31  ret i32 %3
32}
33