[PATCH] D86393: [GISel] Add combines for unary FP instrs with constant operand

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 16:06:17 PDT 2020


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1443
+  const ConstantFP *MaybeCst = getConstantFPVRegVal(Op, MRI);
+  if (!MaybeCst || !(DstTy == S16 || DstTy == S32 || DstTy == S64))
+    return None;
----------------
Don't need to bother with the type check?


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1459
+  case TargetOpcode::G_FPTRUNC: {
+    if (DstTy == S64) {
+      bool Unused;
----------------
Why special case S64 and not use getFltSemanticForLLT?


================
Comment at: llvm/lib/CodeGen/LowLevelType.cpp:64
+const llvm::fltSemantics &llvm::getFltSemanticForLLT(LLT Ty) {
+  assert(Ty.isScalar() && "Expected a scalar type.");
+  switch (Ty.getSizeInBits()) {
----------------
I would expect this to just do .getScalarSizeInBits


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

https://reviews.llvm.org/D86393



More information about the llvm-commits mailing list