[PATCH] D155484: [AArch64] Global Isel Funnel Shift Lowering

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 06:53:41 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp:1032-1034
+  APInt Amount = APInt(64, MI.getOpcode() == TargetOpcode::G_FSHL
+                       ? BitWidth - VRegAndVal->Value.getSExtValue()
+                       : VRegAndVal->Value.getSExtValue(), true);
----------------
Can just construct without the =


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp:1036-1064
+  // If the instruction is G_FSHR, has a 64-bit G_CONSTANT for shift amount
+  // in the range of 0 <-> BitWidth, it is legal
+  if (ShiftTy.getSizeInBits() == 64 &&
+      MI.getOpcode() == TargetOpcode::G_FSHR && 
+      Amount.ult(BitWidth) &&
+      Amount.uge(0)) {
+    return true;
----------------
Could this just be an optimization combine instead? You're ultimately just falling back to the default legalization


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155484



More information about the llvm-commits mailing list