[llvm] b9d5351 - [RISCV] Add test showing the current extern_weak lowering
Jessica Clarke via llvm-commits
llvm-commits at lists.llvm.org
Wed May 31 10:48:27 PDT 2023
Author: Jessica Clarke
Date: 2023-05-31T18:48:20+01:00
New Revision: b9d5351be17b6562b461f9cded2f6bcecba28f26
URL: https://github.com/llvm/llvm-project/commit/b9d5351be17b6562b461f9cded2f6bcecba28f26
DIFF: https://github.com/llvm/llvm-project/commit/b9d5351be17b6562b461f9cded2f6bcecba28f26.diff
LOG: [RISCV] Add test showing the current extern_weak lowering
Reviewed By: asb, MaskRay
Differential Revision: https://reviews.llvm.org/D107279
Added:
Modified:
llvm/test/CodeGen/RISCV/codemodel-lowering.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/RISCV/codemodel-lowering.ll b/llvm/test/CodeGen/RISCV/codemodel-lowering.ll
index d3f822186a63..38752b8263a7 100644
--- a/llvm/test/CodeGen/RISCV/codemodel-lowering.ll
+++ b/llvm/test/CodeGen/RISCV/codemodel-lowering.ll
@@ -138,3 +138,23 @@ define float @lower_constantpool(float %a) nounwind {
%1 = fadd float %a, 1.0
ret float %1
}
+
+; Check lowering of extern_weaks
+ at W = extern_weak global i32
+
+define i32 @lower_extern_weak(i32 %a) nounwind {
+; RV32I-SMALL-LABEL: lower_extern_weak:
+; RV32I-SMALL: # %bb.0:
+; RV32I-SMALL-NEXT: lui a0, %hi(W)
+; RV32I-SMALL-NEXT: lw a0, %lo(W)(a0)
+; RV32I-SMALL-NEXT: ret
+;
+; RV32I-MEDIUM-LABEL: lower_extern_weak:
+; RV32I-MEDIUM: # %bb.0:
+; RV32I-MEDIUM-NEXT: .Lpcrel_hi3:
+; RV32I-MEDIUM-NEXT: auipc a0, %pcrel_hi(W)
+; RV32I-MEDIUM-NEXT: lw a0, %pcrel_lo(.Lpcrel_hi3)(a0)
+; RV32I-MEDIUM-NEXT: ret
+ %1 = load volatile i32, ptr @W
+ ret i32 %1
+}
More information about the llvm-commits
mailing list