Skip to content

Commit a4eca16

Browse files
committed
Add test: constant pool test for 1234.5
1 parent 7c868d7 commit a4eca16

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

llvm/test/CodeGen/RISCV/GlobalISel/constantpool.ll

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,112 @@ define void @constpool_f64(ptr %p) {
108108
store double 1.0, ptr %p
109109
ret void
110110
}
111+
112+
define void @constpool_f32_1234_5(ptr %p) {
113+
; RV32-SMALL-LABEL: constpool_f32_1234_5:
114+
; RV32-SMALL: # %bb.0:
115+
; RV32-SMALL-NEXT: lui a1, %hi(.LCPI2_0)
116+
; RV32-SMALL-NEXT: lw a1, %lo(.LCPI2_0)(a1)
117+
; RV32-SMALL-NEXT: sw a1, 0(a0)
118+
; RV32-SMALL-NEXT: ret
119+
;
120+
; RV32-MEDIUM-LABEL: constpool_f32_1234_5:
121+
; RV32-MEDIUM: # %bb.0:
122+
; RV32-MEDIUM-NEXT: .Lpcrel_hi1:
123+
; RV32-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI2_0)
124+
; RV32-MEDIUM-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi1)(a1)
125+
; RV32-MEDIUM-NEXT: sw a1, 0(a0)
126+
; RV32-MEDIUM-NEXT: ret
127+
;
128+
; RV32-PIC-LABEL: constpool_f32_1234_5:
129+
; RV32-PIC: # %bb.0:
130+
; RV32-PIC-NEXT: .Lpcrel_hi1:
131+
; RV32-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI2_0)
132+
; RV32-PIC-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi1)(a1)
133+
; RV32-PIC-NEXT: sw a1, 0(a0)
134+
; RV32-PIC-NEXT: ret
135+
;
136+
; RV64-SMALL-LABEL: constpool_f32_1234_5:
137+
; RV64-SMALL: # %bb.0:
138+
; RV64-SMALL-NEXT: lui a1, %hi(.LCPI2_0)
139+
; RV64-SMALL-NEXT: lw a1, %lo(.LCPI2_0)(a1)
140+
; RV64-SMALL-NEXT: sw a1, 0(a0)
141+
; RV64-SMALL-NEXT: ret
142+
;
143+
; RV64-MEDIUM-LABEL: constpool_f32_1234_5:
144+
; RV64-MEDIUM: # %bb.0:
145+
; RV64-MEDIUM-NEXT: .Lpcrel_hi0:
146+
; RV64-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI2_0)
147+
; RV64-MEDIUM-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi0)(a1)
148+
; RV64-MEDIUM-NEXT: sw a1, 0(a0)
149+
; RV64-MEDIUM-NEXT: ret
150+
;
151+
; RV64-PIC-LABEL: constpool_f32_1234_5:
152+
; RV64-PIC: # %bb.0:
153+
; RV64-PIC-NEXT: .Lpcrel_hi0:
154+
; RV64-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI2_0)
155+
; RV64-PIC-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi0)(a1)
156+
; RV64-PIC-NEXT: sw a1, 0(a0)
157+
; RV64-PIC-NEXT: ret
158+
store float 1.234500e+03, ptr %p
159+
ret void
160+
}
161+
162+
define void @constpool_f64_1234_5(ptr %p) {
163+
; RV32-SMALL-LABEL: constpool_f64_1234_5:
164+
; RV32-SMALL: # %bb.0:
165+
; RV32-SMALL-NEXT: lui a1, %hi(.LCPI3_0)
166+
; RV32-SMALL-NEXT: addi a1, a1, %lo(.LCPI3_0)
167+
; RV32-SMALL-NEXT: lw a2, 0(a1)
168+
; RV32-SMALL-NEXT: lw a1, 4(a1)
169+
; RV32-SMALL-NEXT: sw a2, 0(a0)
170+
; RV32-SMALL-NEXT: sw a1, 4(a0)
171+
; RV32-SMALL-NEXT: ret
172+
;
173+
; RV32-MEDIUM-LABEL: constpool_f64_1234_5:
174+
; RV32-MEDIUM: # %bb.0:
175+
; RV32-MEDIUM-NEXT: .Lpcrel_hi2:
176+
; RV32-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI3_0)
177+
; RV32-MEDIUM-NEXT: addi a1, a1, %pcrel_lo(.Lpcrel_hi2)
178+
; RV32-MEDIUM-NEXT: lw a2, 0(a1)
179+
; RV32-MEDIUM-NEXT: lw a1, 4(a1)
180+
; RV32-MEDIUM-NEXT: sw a2, 0(a0)
181+
; RV32-MEDIUM-NEXT: sw a1, 4(a0)
182+
; RV32-MEDIUM-NEXT: ret
183+
;
184+
; RV32-PIC-LABEL: constpool_f64_1234_5:
185+
; RV32-PIC: # %bb.0:
186+
; RV32-PIC-NEXT: .Lpcrel_hi2:
187+
; RV32-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI3_0)
188+
; RV32-PIC-NEXT: addi a1, a1, %pcrel_lo(.Lpcrel_hi2)
189+
; RV32-PIC-NEXT: lw a2, 0(a1)
190+
; RV32-PIC-NEXT: lw a1, 4(a1)
191+
; RV32-PIC-NEXT: sw a2, 0(a0)
192+
; RV32-PIC-NEXT: sw a1, 4(a0)
193+
; RV32-PIC-NEXT: ret
194+
;
195+
; RV64-SMALL-LABEL: constpool_f64_1234_5:
196+
; RV64-SMALL: # %bb.0:
197+
; RV64-SMALL-NEXT: lui a1, %hi(.LCPI3_0)
198+
; RV64-SMALL-NEXT: ld a1, %lo(.LCPI3_0)(a1)
199+
; RV64-SMALL-NEXT: sd a1, 0(a0)
200+
; RV64-SMALL-NEXT: ret
201+
;
202+
; RV64-MEDIUM-LABEL: constpool_f64_1234_5:
203+
; RV64-MEDIUM: # %bb.0:
204+
; RV64-MEDIUM-NEXT: .Lpcrel_hi1:
205+
; RV64-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI3_0)
206+
; RV64-MEDIUM-NEXT: ld a1, %pcrel_lo(.Lpcrel_hi1)(a1)
207+
; RV64-MEDIUM-NEXT: sd a1, 0(a0)
208+
; RV64-MEDIUM-NEXT: ret
209+
;
210+
; RV64-PIC-LABEL: constpool_f64_1234_5:
211+
; RV64-PIC: # %bb.0:
212+
; RV64-PIC-NEXT: .Lpcrel_hi1:
213+
; RV64-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI3_0)
214+
; RV64-PIC-NEXT: ld a1, %pcrel_lo(.Lpcrel_hi1)(a1)
215+
; RV64-PIC-NEXT: sd a1, 0(a0)
216+
; RV64-PIC-NEXT: ret
217+
store double 1.234500e+03, ptr %p
218+
ret void
219+
}

0 commit comments

Comments
 (0)