1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc < %s -mtriple=riscv32 -global-isel -code-model=small \
3 ; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV32-SMALL
4 ; RUN: llc < %s -mtriple=riscv32 -global-isel -code-model=medium \
5 ; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV32-MEDIUM
6 ; RUN: llc < %s -mtriple=riscv32 -global-isel -relocation-model=pic \
7 ; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV32-PIC
8 ; RUN: llc < %s -mtriple=riscv64 -global-isel -code-model=small \
9 ; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV64-SMALL
10 ; RUN: llc < %s -mtriple=riscv64 -global-isel -code-model=medium \
11 ; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV64-MEDIUM
12 ; RUN: llc < %s -mtriple=riscv64 -global-isel -relocation-model=pic \
13 ; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV64-PIC
15 define void @constpool_f32(ptr %p) {
16 ; RV32-SMALL-LABEL: constpool_f32:
17 ; RV32-SMALL: # %bb.0:
18 ; RV32-SMALL-NEXT: lui a1, %hi(.LCPI0_0)
19 ; RV32-SMALL-NEXT: lw a1, %lo(.LCPI0_0)(a1)
20 ; RV32-SMALL-NEXT: sw a1, 0(a0)
21 ; RV32-SMALL-NEXT: ret
23 ; RV32-MEDIUM-LABEL: constpool_f32:
24 ; RV32-MEDIUM: # %bb.0:
25 ; RV32-MEDIUM-NEXT: .Lpcrel_hi0:
26 ; RV32-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI0_0)
27 ; RV32-MEDIUM-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi0)(a1)
28 ; RV32-MEDIUM-NEXT: sw a1, 0(a0)
29 ; RV32-MEDIUM-NEXT: ret
31 ; RV32-PIC-LABEL: constpool_f32:
33 ; RV32-PIC-NEXT: .Lpcrel_hi0:
34 ; RV32-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI0_0)
35 ; RV32-PIC-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi0)(a1)
36 ; RV32-PIC-NEXT: sw a1, 0(a0)
39 ; RV64-SMALL-LABEL: constpool_f32:
40 ; RV64-SMALL: # %bb.0:
41 ; RV64-SMALL-NEXT: lui a1, %hi(.LCPI0_0)
42 ; RV64-SMALL-NEXT: lw a1, %lo(.LCPI0_0)(a1)
43 ; RV64-SMALL-NEXT: sw a1, 0(a0)
44 ; RV64-SMALL-NEXT: ret
46 ; RV64-MEDIUM-LABEL: constpool_f32:
47 ; RV64-MEDIUM: # %bb.0:
48 ; RV64-MEDIUM-NEXT: .Lpcrel_hi0:
49 ; RV64-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI0_0)
50 ; RV64-MEDIUM-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi0)(a1)
51 ; RV64-MEDIUM-NEXT: sw a1, 0(a0)
52 ; RV64-MEDIUM-NEXT: ret
54 ; RV64-PIC-LABEL: constpool_f32:
56 ; RV64-PIC-NEXT: .Lpcrel_hi0:
57 ; RV64-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI0_0)
58 ; RV64-PIC-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi0)(a1)
59 ; RV64-PIC-NEXT: sw a1, 0(a0)
61 store float 1.0, ptr %p
65 define void @constpool_f64(ptr %p) {
66 ; RV32-SMALL-LABEL: constpool_f64:
67 ; RV32-SMALL: # %bb.0:
68 ; RV32-SMALL-NEXT: lui a1, %hi(.LCPI1_0)
69 ; RV32-SMALL-NEXT: addi a1, a1, %lo(.LCPI1_0)
70 ; RV32-SMALL-NEXT: lw a2, 0(a1)
71 ; RV32-SMALL-NEXT: lw a1, 4(a1)
72 ; RV32-SMALL-NEXT: sw a2, 0(a0)
73 ; RV32-SMALL-NEXT: sw a1, 4(a0)
74 ; RV32-SMALL-NEXT: ret
76 ; RV32-MEDIUM-LABEL: constpool_f64:
77 ; RV32-MEDIUM: # %bb.0:
78 ; RV32-MEDIUM-NEXT: .Lpcrel_hi1:
79 ; RV32-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI1_0)
80 ; RV32-MEDIUM-NEXT: addi a1, a1, %pcrel_lo(.Lpcrel_hi1)
81 ; RV32-MEDIUM-NEXT: lw a2, 0(a1)
82 ; RV32-MEDIUM-NEXT: lw a1, 4(a1)
83 ; RV32-MEDIUM-NEXT: sw a2, 0(a0)
84 ; RV32-MEDIUM-NEXT: sw a1, 4(a0)
85 ; RV32-MEDIUM-NEXT: ret
87 ; RV32-PIC-LABEL: constpool_f64:
89 ; RV32-PIC-NEXT: .Lpcrel_hi1:
90 ; RV32-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI1_0)
91 ; RV32-PIC-NEXT: addi a1, a1, %pcrel_lo(.Lpcrel_hi1)
92 ; RV32-PIC-NEXT: lw a2, 0(a1)
93 ; RV32-PIC-NEXT: lw a1, 4(a1)
94 ; RV32-PIC-NEXT: sw a2, 0(a0)
95 ; RV32-PIC-NEXT: sw a1, 4(a0)
98 ; RV64-SMALL-LABEL: constpool_f64:
99 ; RV64-SMALL: # %bb.0:
100 ; RV64-SMALL-NEXT: lui a1, %hi(.LCPI1_0)
101 ; RV64-SMALL-NEXT: ld a1, %lo(.LCPI1_0)(a1)
102 ; RV64-SMALL-NEXT: sd a1, 0(a0)
103 ; RV64-SMALL-NEXT: ret
105 ; RV64-MEDIUM-LABEL: constpool_f64:
106 ; RV64-MEDIUM: # %bb.0:
107 ; RV64-MEDIUM-NEXT: .Lpcrel_hi1:
108 ; RV64-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI1_0)
109 ; RV64-MEDIUM-NEXT: ld a1, %pcrel_lo(.Lpcrel_hi1)(a1)
110 ; RV64-MEDIUM-NEXT: sd a1, 0(a0)
111 ; RV64-MEDIUM-NEXT: ret
113 ; RV64-PIC-LABEL: constpool_f64:
115 ; RV64-PIC-NEXT: .Lpcrel_hi1:
116 ; RV64-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI1_0)
117 ; RV64-PIC-NEXT: ld a1, %pcrel_lo(.Lpcrel_hi1)(a1)
118 ; RV64-PIC-NEXT: sd a1, 0(a0)
120 store double 1.0, ptr %p