[PATCH] D93305: [AMDGPU][GlobalISel] Add combiner for generating G_FMAD

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 15:43:39 PST 2020


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3145-3146
+  Type* Tp = nullptr;
+  if (TypeSize == 16)
+    Tp = Type::getBFloatTy(C);
+  if (TypeSize == 32)
----------------
Using bf16 here instead of regular half is wrong. We also have a utility function to get the FP type from the LLT


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3159
+
+  bool isIEE = DenormMode == DenormalMode::getIEEE();
+  bool HasFMAD = !isIEE;
----------------
Checking the denormal mode here isn't right. The denormal mode only impacts whether this should be used for AMDGPU and isn't a generic property


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3185-3187
+  if (MIMul->getOpcode() != TargetOpcode::G_FMUL)
+    return false;
+  return true;
----------------
return compare directly


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3196
+  Builder.setInstrAndDebugLoc(MI);
+  Builder.buildFMAD(MI.getOperand(0).getReg(), Reg1, Reg2, Reg3);
+  MI.eraseFromParent();
----------------
The matching logic here implies this should be able to use fma also


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

https://reviews.llvm.org/D93305



More information about the llvm-commits mailing list