Skip to content

Commit 8da5d5d

Browse files
committed
[RISCV] Pre-commit test cases for D126986. NFC
1 parent d82b4fe commit 8da5d5d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

llvm/test/CodeGen/RISCV/fold-addi-loadstore.ll

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,39 @@ entry:
317317
%0 = load i64, i64* inttoptr (i64 2044 to i64*)
318318
ret i64 %0
319319
}
320+
321+
define dso_local i32 @load_const_medium() nounwind {
322+
; RV32I-LABEL: load_const_medium:
323+
; RV32I: # %bb.0: # %entry
324+
; RV32I-NEXT: lui a0, 1
325+
; RV32I-NEXT: lw a0, -16(a0)
326+
; RV32I-NEXT: ret
327+
;
328+
; RV64I-LABEL: load_const_medium:
329+
; RV64I: # %bb.0: # %entry
330+
; RV64I-NEXT: lui a0, 1
331+
; RV64I-NEXT: addiw a0, a0, -16
332+
; RV64I-NEXT: lw a0, 0(a0)
333+
; RV64I-NEXT: ret
334+
entry:
335+
%0 = load i32, i32* inttoptr (i64 4080 to i32*)
336+
ret i32 %0
337+
}
338+
339+
define dso_local i32 @load_const_large() nounwind {
340+
; RV32I-LABEL: load_const_large:
341+
; RV32I: # %bb.0: # %entry
342+
; RV32I-NEXT: lui a0, 524288
343+
; RV32I-NEXT: lw a0, -2048(a0)
344+
; RV32I-NEXT: ret
345+
;
346+
; RV64I-LABEL: load_const_large:
347+
; RV64I: # %bb.0: # %entry
348+
; RV64I-NEXT: lui a0, 524288
349+
; RV64I-NEXT: addiw a0, a0, -2048
350+
; RV64I-NEXT: lw a0, 0(a0)
351+
; RV64I-NEXT: ret
352+
entry:
353+
%0 = load i32, i32* inttoptr (i64 2147481600 to i32*)
354+
ret i32 %0
355+
}

0 commit comments

Comments
 (0)