File: return.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 (66 lines) | stat: -rw-r--r-- 2,724 bytes parent folder | download | duplicates (12)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
; RUN: llc -mtriple=mips-linux-gnu -relocation-model=static < %s | FileCheck --check-prefixes=ALL,O32 %s
; RUN: llc -mtriple=mipsel-linux-gnu -relocation-model=static < %s | FileCheck --check-prefixes=ALL,O32 %s

; RUN-TODO: llc -mtriple=mips64-linux-gnu -relocation-model=static -target-abi o32 < %s | FileCheck --check-prefixes=ALL,O32 %s
; RUN-TODO: llc -mtriple=mips64el-linux-gnu -relocation-model=static -target-abi o32 < %s | FileCheck --check-prefixes=ALL,O32 %s

; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=static -target-abi n32 < %s | FileCheck --check-prefixes=ALL,N32 %s
; RUN: llc -mtriple=mips64el-linux-gnu -relocation-model=static -target-abi n32 < %s | FileCheck --check-prefixes=ALL,N32 %s

; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=static -target-abi n64 < %s | FileCheck --check-prefixes=ALL,N64 %s
; RUN: llc -mtriple=mips64el-linux-gnu -relocation-model=static -target-abi n64 < %s | FileCheck --check-prefixes=ALL,N64 %s

; Test the integer returns for all ABI's and byte orders as specified by
; section 5 of MD00305 (MIPS ABIs Described).

; We only test Linux because other OS's use different relocations and I don't
; know if this is correct.

@byte = global i8 zeroinitializer
@word = global i32 zeroinitializer
@dword = global i64 zeroinitializer
@float = global float zeroinitializer
@double = global double zeroinitializer

define i8 @reti8() nounwind {
entry:
        %0 = load volatile i8, ptr @byte
        ret i8 %0
}

; ALL-LABEL: reti8:
; O32-DAG:           lui [[R1:\$[0-9]+]], %hi(byte)
; O32-DAG:           lbu $2, %lo(byte)([[R1]])
; N32-DAG:           lui [[R1:\$[0-9]+]], %hi(byte)
; N32-DAG:           lbu $2, %lo(byte)([[R1]])
; N64-DAG:           lui  [[R1:\$[0-9]+]], %highest(byte)
; N64-DAG:           lbu $2, %lo(byte)([[R1]])

define i32 @reti32() nounwind {
entry:
        %0 = load volatile i32, ptr @word
        ret i32 %0
}

; ALL-LABEL: reti32:
; O32-DAG:           lui [[R1:\$[0-9]+]], %hi(word)
; O32-DAG:           lw $2, %lo(word)([[R1]])
; N32-DAG:           lui [[R1:\$[0-9]+]], %hi(word)
; N32-DAG:           lw $2, %lo(word)([[R1]])
; N64-DAG:           lui [[R1:\$[0-9]+]], %highest(word)
; N64-DAG:           lw $2, %lo(word)([[R1]])

define i64 @reti64() nounwind {
entry:
        %0 = load volatile i64, ptr @dword
        ret i64 %0
}

; ALL-LABEL: reti64:
; On O32, we must use v0 and v1 for the return value
; O32-DAG:           lw $2, %lo(dword)([[R1:\$[0-9]+]])
; O32-DAG:           addiu [[R2:\$[0-9]+]], [[R1]], %lo(dword)
; O32-DAG:           lw $3, 4([[R2]])
; N32-DAG:           ld $2, %lo(dword)([[R1:\$[0-9]+]])
; N64-DAG:           lui  [[R1:\$[0-9]+]], %highest(dword)
; N64-DAG:           ld $2, %lo(dword)([[R1]])