aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/Mips/Fast-ISel/retabi.ll
blob: d271aef9b70492be23f7440640827959fbc3ff8c (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
; RUN: llc -march=mipsel -relocation-model=pic -O0 -mips-fast-isel -fast-isel-abort -mcpu=mips32r2 \
; RUN:     < %s | FileCheck %s

@i = global i32 75, align 4
@s = global i16 -345, align 2
@c = global i8 118, align 1
@f = global float 0x40BE623360000000, align 4
@d = global double 1.298330e+03, align 8

; Function Attrs: nounwind
define i32 @reti() {
entry:
; CHECK-LABEL: reti:
  %0 = load i32* @i, align 4
  ret i32 %0
; CHECK:        lui     $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
; CHECK:        addiu   $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
; CHECK:        addu    $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
; CHECK:        lw      $[[REG_I_ADDR:[0-9]+]], %got(i)($[[REG_GP]])
; CHECK:        lw      $2, 0($[[REG_I_ADDR]])
; CHECK:        jr      $ra
}

; Function Attrs: nounwind
define signext i16 @rets() {
entry:
; CHECK-LABEL: rets:
  %0 = load i16* @s, align 2
  ret i16 %0
; CHECK:        lui     $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
; CHECK:        addiu   $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
; CHECK:        addu    $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
; CHECK:        lw      $[[REG_S_ADDR:[0-9]+]], %got(s)($[[REG_GP]])
; CHECK:        lhu     $[[REG_S:[0-9]+]], 0($[[REG_S_ADDR]])
; CHECK:        seh     $2, $[[REG_S]]
; CHECK:        jr      $ra
}

; Function Attrs: nounwind
define signext i8 @retc() {
entry:
; CHECK-LABEL: retc:
  %0 = load i8* @c, align 1
  ret i8 %0
; CHECK:        lui     $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
; CHECK:        addiu   $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
; CHECK:        addu    $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
; CHECK:        lw      $[[REG_C_ADDR:[0-9]+]], %got(c)($[[REG_GP]])
; CHECK:        lbu     $[[REG_C:[0-9]+]], 0($[[REG_C_ADDR]])
; CHECK:        seb     $2, $[[REG_C]]
; CHECK:        jr      $ra
}

; Function Attrs: nounwind
define float @retf() {
entry:
; CHECK-LABEL: retf:
  %0 = load float* @f, align 4
  ret float %0
; CHECK:        lui     $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
; CHECK:        addiu   $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
; CHECK:        addu    $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
; CHECK:        lw      $[[REG_F_ADDR:[0-9]+]], %got(f)($[[REG_GP]])
; CHECK:        lwc1    $f0, 0($[[REG_F_ADDR]])
; CHECK:        jr      $ra
}

; Function Attrs: nounwind
define double @retd() {
entry:
; CHECK-LABEL: retd:
  %0 = load double* @d, align 8
  ret double %0
; CHECK:        lui     $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
; CHECK:        addiu   $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
; CHECK:        addu    $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
; CHECK:        lw      $[[REG_D_ADDR:[0-9]+]], %got(d)($[[REG_GP]])
; CHECK:        ldc1    $f0, 0($[[REG_D_ADDR]])
; CHECK:        jr      $ra
}