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

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 30 01:18:19 PDT 2021


foad 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);
----------------
abinavpp wrote:
> 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)`.
You are right of course, sorry for the noise.


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