[PATCH] D83216: [Intrinsic] Add sshl.sat/ushl.sat, saturated shift intrinsics.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 09:43:07 PDT 2020


arsenm added inline comments.


================
Comment at: llvm/include/llvm/Target/GenericOpcodes.td:551
+  let OutOperandList = (outs type0:$dst);
+  let InOperandList = (ins type0:$src1, type0:$src2);
+  let hasSideEffects = 0;
----------------
The shift amount type doesn't have to match the shift value type, so src2 should use type1


================
Comment at: llvm/include/llvm/Target/GenericOpcodes.td:559
+  let OutOperandList = (outs type0:$dst);
+  let InOperandList = (ins type0:$src1, type0:$src2);
+  let hasSideEffects = 0;
----------------
Ditto


================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-sshlsat.mir:17
+    ; GFX6: [[TRUNC1:%[0-9]+]]:_(s7) = G_TRUNC [[COPY1]](s32)
+    ; GFX6: [[SSHLSAT:%[0-9]+]]:_(s7) = G_SSHLSAT [[TRUNC]], [[TRUNC1]]
+    ; GFX6: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SSHLSAT]](s7)
----------------
These all failed to legalize.

You need something like this in AMDGPULegalizerInfo

```
  getActionDefinitionsBuilder({G_SSHLSAT, G_USHLSAT})
    .scalarize(0)
    .clampScalar(0, S32)
    .lower();

```

to actually trigger any of the legalization code


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83216





More information about the llvm-commits mailing list