[PATCH] D99283: [GlobalISel] Combine and (lshr x, cst), mask -> ubfx x, cst, width

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 20 13:41:33 PDT 2021


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.cpp:282-285
+  // Only legal for s32 and s64.
+  LLT Ty = MRI.getType(Dst);
+  if (Ty != LLT::scalar(32) && Ty != LLT::scalar(64))
+    return false;
----------------
This is the only target specific thing here which can be replaced with a legality check on UBFX


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.cpp:308
+    auto LSBCst = B.buildConstant(Ty, LSBImm);
+    B.buildInstr(TargetOpcode::G_UBFX, {Dst}, {ShiftSrc, LSBCst, WidthCst});
+  };
----------------
buildUbfx?


================
Comment at: llvm/test/CodeGen/AArch64/GlobalISel/form-bitfield-extract-from-and.mir:3
+# RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-combiner --aarch64postlegalizercombinerhelper-only-enable-rule="bitfield_extract_from_and" -verify-machineinstrs %s -o - | FileCheck %s
+# REQUIRES: asserts
+
----------------
Why does this need asserts?


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

https://reviews.llvm.org/D99283



More information about the llvm-commits mailing list