[PATCH] D110231: [AMDGPU] Add constrained shift pattern matches.

Abinav Puthan Purayil via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 29 18:49:41 PDT 2021


abinavpp added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIInstructions.td:2516
+multiclass ConstrainedShiftPat<int width> {
+  defvar mask = !sub(width, 1);
+  defvar ty = !cast<ValueType>("i" # width);
----------------
foad wrote:
> `!sub(!shl(1, width), 1)`, surely?
This mask is used to perform modulo width using `and`, i.e. 'RHS % width'. See clang's ScalarExprEmitter::ConstrainShiftValue() which is invoked by shift codegen `if (CGF.getLangOpts().OpenCL)`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110231



More information about the llvm-commits mailing list