[PATCH] D142278: [LoongArch] Allow %pc_lo12 relocs in JIRL's immediate operand position
Lu Weining via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 22 02:51:04 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaf6c43c8e99b: [LoongArch] Allow %pc_lo12 relocs in JIRL's immediate operand position (authored by WANG Xuerui <git at xen0n.name>, committed by SixWeining).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142278/new/
https://reviews.llvm.org/D142278
Files:
llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
llvm/test/MC/LoongArch/Relocations/relocations.s
Index: llvm/test/MC/LoongArch/Relocations/relocations.s
===================================================================
--- llvm/test/MC/LoongArch/Relocations/relocations.s
+++ llvm/test/MC/LoongArch/Relocations/relocations.s
@@ -74,6 +74,11 @@
# INSTR: addi.d $t1, $t1, %pc_lo12(foo+4)
# FIXUP: fixup A - offset: 0, value: %pc_lo12(foo+4), kind: FK_NONE
+jirl $zero, $t1, %pc_lo12(foo)
+# RELOC: R_LARCH_PCALA_LO12 foo 0x0
+# INSTR: jirl $zero, $t1, %pc_lo12(foo)
+# FIXUP: fixup A - offset: 0, value: %pc_lo12(foo), kind: FK_NONE
+
st.b $t1, $a2, %pc_lo12(foo)
# RELOC: R_LARCH_PCALA_LO12 foo 0x0
# INSTR: st.b $t1, $a2, %pc_lo12(foo)
Index: llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
===================================================================
--- llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
+++ llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
@@ -318,7 +318,8 @@
LoongArchMCExpr::VariantKind VK = LoongArchMCExpr::VK_LoongArch_None;
bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK);
bool IsValidKind = VK == LoongArchMCExpr::VK_LoongArch_None ||
- VK == LoongArchMCExpr::VK_LoongArch_B16;
+ VK == LoongArchMCExpr::VK_LoongArch_B16 ||
+ VK == LoongArchMCExpr::VK_LoongArch_PCALA_LO12;
return IsConstantImm
? isShiftedInt<16, 2>(Imm) && IsValidKind
: LoongArchAsmParser::classifySymbolRef(getImm(), VK) &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142278.491141.patch
Type: text/x-patch
Size: 1500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230122/1886e2bd/attachment.bin>
More information about the llvm-commits
mailing list