[PATCH] D158260: [GlobalISel] Add support for *_fpmode intrinsics

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 23:26:54 PDT 2023


sepavloff marked 6 inline comments as done.
sepavloff added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:861
+  MIRBuilder.buildLoadInstr(TargetOpcode::G_LOAD, Dst, Temp, *MMO);
+
+  return LegalizerHelper::Legalized;
----------------
arsenm wrote:
> Need to erase the original instruction
This function is called from `LegalizerHelper::libcall`, which erases the original instruction.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:895
+  RTLIB::Libcall RTLibcall = getStateLibraryFunctionFor(MI, TLI);
+  return createLibcall(MIRBuilder, RTLibcall,
+                       CallLowering::ArgInfo({0}, Type::getVoidTy(Ctx), 0),
----------------
arsenm wrote:
> Didn't erase original instruction?
`LegalizerHelper::libcall` will remove it.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:923
+  RTLIB::Libcall RTLibcall = getStateLibraryFunctionFor(MI, TLI);
+  return createLibcall(MIRBuilder, RTLibcall,
+                       CallLowering::ArgInfo({0}, Type::getVoidTy(Ctx), 0),
----------------
arsenm wrote:
> Didn't erase original instruction?
`LegalizerHelper::libcall` will remove it.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:972-973
   case TargetOpcode::G_INTRINSIC_ROUNDEVEN: {
+    LLT LLTy = MRI.getType(MI.getOperand(0).getReg());
+    unsigned Size = LLTy.getSizeInBits();
     Type *HLTy = getFloatTypeForLLT(Ctx, LLTy);
----------------
arsenm wrote:
> Unrelated?
As `LLTy` is not calculated at the beginning of the function anymore, it should be introduced when needed.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp:123
+  // Skip null mutation.
+  if (!Mutation.second.isValid())
+    return true;
----------------
arsenm wrote:
> Were there really no other typeless G_* instructions before?
`G_RESET_FPMODE` does not have nor input operands, nor output value, this is the first such instruction.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158260/new/

https://reviews.llvm.org/D158260



More information about the llvm-commits mailing list