[PATCH] D150677: [GlobalIsel][X86] Legalize G_CTPOP and G_CTLZ

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 08:44:52 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/test/CodeGen/X86/GlobalISel/legalize-leading-zeros.mir:43
+    ; CHECK: [[DEF:%[0-9]+]]:_(s8) = IMPLICIT_DEF
+    ; CHECK-NEXT: [[CTLZ:%[0-9]+]]:_(s16) = G_CTLZ [[DEF]](s8)
+    ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[CTLZ]](s16)
----------------
tschuett wrote:
> The input is s8 and the output is s16.
I think you're running into the over-constrained API problem. I think it only works as you would expect if you legalize the first operand and the second operand second. The current API cannot express your desired changes for both types at the same time, and the LegalizerHelper currently doesn't handle arbitrary requests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150677



More information about the llvm-commits mailing list