File: stack.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (53 lines) | stat: -rw-r--r-- 1,714 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
; RUN: llc -march=mipsel -mcpu=mips32 < %s | FileCheck %s -check-prefix=CHECK-MIPS32
; RUN: llc -march=mips64el -mcpu=mips64 -relocation-model=pic < %s | \
; RUN:      FileCheck %s -check-prefix=CHECK-MIPS64
; RUN: llc -march=mipsel -mcpu=mips64 -target-abi n32 < %s | \
; RUN:      FileCheck %s -check-prefix=CHECK-MIPSN32

; Test that the expansion of ADJCALLSTACKDOWN and ADJCALLSTACKUP generate
; (d)subu and (d)addu rather than just (d)addu. The (d)subu sequences are
; generally shorter as the constant that has to be materialized is smaller.

define i32 @main() {
entry:
  %z = alloca [1048576 x i8], align 1
  %call = call i32 @foo(ptr %z)
  ret i32 0
; CHECK-LABEL: main

; CHECK-MIPS32: lui   $[[R0:[0-9]+]], 16
; CHECK-MIPS32: addiu $[[R0]], $[[R0]], 24
; CHECK-MIPS32: subu  $sp, $sp, $[[R0]]

; CHECK-MIPS32: lui   $[[R1:[0-9]+]], 16
; CHECK-MIPS32: addiu $[[R1]], $[[R1]], 24
; CHECK-MIPS32: addu  $sp, $sp, $[[R1]]

; CHECK-MIPS64: lui     $[[R0:[0-9]+]], 1
; CHECK-MIPS64: daddiu  $[[R0]], $[[R0]], 32
; CHECK-MIPS64: dsubu   $sp, $sp, $[[R0]]

; FIXME:
; These are here to match other lui's used in address computations. We need to
; investigate why address computations are not CSE'd. Or implement it.

; CHECK-MIPS64: lui
; CHECK-MIPS64: lui
; CHECK-MIPS64: lui
; CHECK-MIPS64: lui

; CHECK-MIPS64: lui     $[[R1:[0-9]+]], 16
; CHECK-MIPS64: daddiu  $[[R1]], $[[R1]], 32
; CHECK-MIPS64: daddu   $sp, $sp, $[[R1]]

; CHECK-MIPSN32: lui   $[[R0:[0-9]+]], 16
; CHECK-MIPSN32: addiu $[[R0]], $[[R0]], 16
; CHECK-MIPSN32: subu  $sp, $sp, $[[R0]]

; CHECK-MIPSN32: lui   $[[R1:[0-9]+]], 16
; CHECK-MIPSN32: addiu $[[R1]], $[[R1]], 16
; CHECK-MIPSN32: addu  $sp, $sp, $[[R1]]

}

declare i32 @foo(ptr)