diff --git a/llvm/test/CodeGen/RISCV/zdinx-boundary-check.ll b/llvm/test/CodeGen/RISCV/zdinx-boundary-check.ll --- a/llvm/test/CodeGen/RISCV/zdinx-boundary-check.ll +++ b/llvm/test/CodeGen/RISCV/zdinx-boundary-check.ll @@ -143,3 +143,41 @@ store double %d, ptr %add.ptr, align 8 ret void } + +@Constants = constant [5 x double] [double 3.140000e+00, double 2.710000e+00, double 1.410000e+00, double 6.200000e-01, double 1.620000e+00], align 16 + +define void @foo6(ptr %p) #0 { +; RV32ZDINX-LABEL: foo6: +; RV32ZDINX: # %bb.0: # %entry +; RV32ZDINX-NEXT: addi sp, sp, -16 +; RV32ZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV32ZDINX-NEXT: lui a1, %hi(Constants) +; RV32ZDINX-NEXT: addi a1, a1, %lo(Constants) +; RV32ZDINX-NEXT: lw a2, 16(a1) +; RV32ZDINX-NEXT: lw a3, 20(a1) +; RV32ZDINX-NEXT: sw a0, 8(sp) +; RV32ZDINX-NEXT: addi a0, a0, 2047 +; RV32ZDINX-NEXT: sw a2, -3(a0) +; RV32ZDINX-NEXT: sw a3, 1(a0) +; RV32ZDINX-NEXT: addi sp, sp, 16 +; RV32ZDINX-NEXT: ret +; +; RV64ZDINX-LABEL: foo6: +; RV64ZDINX: # %bb.0: # %entry +; RV64ZDINX-NEXT: addi sp, sp, -16 +; RV64ZDINX-NEXT: .cfi_def_cfa_offset 16 +; RV64ZDINX-NEXT: lui a1, %hi(Constants+16) +; RV64ZDINX-NEXT: ld a1, %lo(Constants+16)(a1) +; RV64ZDINX-NEXT: sd a0, 8(sp) +; RV64ZDINX-NEXT: sd a1, 2044(a0) +; RV64ZDINX-NEXT: addi sp, sp, 16 +; RV64ZDINX-NEXT: ret +entry: + %p.addr = alloca ptr, align 8 + store ptr %p, ptr %p.addr, align 8 + %0 = load double, ptr getelementptr inbounds ([5 x double], ptr @Constants, i64 0, i64 2), align 16 + %1 = load ptr, ptr %p.addr, align 8 + %add.ptr = getelementptr inbounds i8, ptr %1, i64 2044 + store double %0, ptr %add.ptr, align 8 + ret void +}