Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ bool RISCVMergeBaseOffsetOpt::foldIntoMemoryOps(MachineInstr &Hi,
case RISCV::LHU:
case RISCV::LWU:
case RISCV::LD:
case RISCV::LD_RV32:
case RISCV::FLH:
case RISCV::FLW:
case RISCV::FLD:
Expand All @@ -418,6 +419,7 @@ bool RISCVMergeBaseOffsetOpt::foldIntoMemoryOps(MachineInstr &Hi,
case RISCV::SW:
case RISCV::SW_INX:
case RISCV::SD:
case RISCV::SD_RV32:
case RISCV::FSH:
case RISCV::FSW:
case RISCV::FSD: {
Expand Down
30 changes: 30 additions & 0 deletions llvm/test/CodeGen/RISCV/fold-addi-loadstore-zilsd.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -mattr=+zdinx,+zilsd -verify-machineinstrs \
; RUN: -code-model=medium < %s | FileCheck %s

@g_0 = global double 0.0

define double @load_g_0() nounwind {
; CHECK-LABEL: load_g_0:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: .Lpcrel_hi0:
; CHECK-NEXT: auipc a0, %pcrel_hi(g_0)
; CHECK-NEXT: ld a0, %pcrel_lo(.Lpcrel_hi0)(a0)
; CHECK-NEXT: ret
entry:
%0 = load double, ptr @g_0
ret double %0
}

define void @store_g_0() nounwind {
; CHECK-LABEL: store_g_0:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: .Lpcrel_hi1:
; CHECK-NEXT: auipc a0, %pcrel_hi(g_0)
; CHECK-NEXT: fcvt.d.w a2, zero
; CHECK-NEXT: sd a2, %pcrel_lo(.Lpcrel_hi1)(a0)
; CHECK-NEXT: ret
entry:
store double 0.0, ptr @g_0
ret void
}