[llvm] [RISCV][GISel] Support G_PTRTOINT and G_INTTOPTR (PR #69542)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 20:04:06 PDT 2023
================
@@ -122,6 +122,17 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST) {
getActionDefinitionsBuilder(G_PTR_ADD)
.legalFor({{p0, XLenLLT}});
+ getActionDefinitionsBuilder(G_PTRTOINT)
+ .legalFor({XLenLLT, p0})
+ .widenScalarToNextPow2(0, XLen)
+ .clampScalar(0, XLenLLT, XLenLLT);
+
+ getActionDefinitionsBuilder(G_INTTOPTR)
+ .unsupportedIf([&](const LegalityQuery &Query) {
+ return Query.Types[0].getSizeInBits() != Query.Types[1].getSizeInBits();
+ })
----------------
topperc wrote:
Mismatching the size is legal in IR according to the LangRef. So it would need be legalized wouldn't it?
https://github.com/llvm/llvm-project/pull/69542
More information about the llvm-commits
mailing list