[PATCH] D86270: [AMDGPU] Use tablegen for argument indices
Sebastian Neubauer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 16 01:33:14 PDT 2020
Flakebi added inline comments.
================
Comment at: llvm/include/llvm/IR/IntrinsicsAMDGPU.td:698
+ int RsrcArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs);
+ int SampArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs, NumRSrcArgs);
int UnormArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs, NumRSrcArgs, 1);
----------------
foad wrote:
> Would it make more sense to daisy-chain these so e.g. SampArgIndex is just !add(RSrcArgIndex, NumRSrcArgs)?
I don’t care much about which variant to use. The more obvious the index of an argument gets, the better.
Here are both variants for comparison:
```
// No daisy-chaining
int DmaskArgIndex = NumDataArgs;
int VAddrArgIndex = !add(NumDataArgs, NumDmaskArgs);
int GradientArgIndex = !add(NumDataArgs, NumDmaskArgs, NumExtraAddrArgs);
int CoordArgIndex = !add(NumDataArgs, NumDmaskArgs, NumExtraAddrArgs, NumGradientArgs);
int LodArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs, -1);
int MipArgIndex = LodArgIndex;
int RsrcArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs);
int SampArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs, NumRSrcArgs);
int UnormArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs, NumRSrcArgs, 1);
int TexFailCtrlArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs, NumRSrcArgs, NumSampArgs);
int CachePolicyArgIndex = !add(TexFailCtrlArgIndex, 1);
// Daisy-chaining
int DmaskArgIndex = NumDataArgs;
int VAddrArgIndex = !add(DmaskArgIndex, NumDmaskArgs);
int GradientArgIndex = !add(VAddrArgIndex, NumExtraAddrArgs);
int CoordArgIndex = !add(GradientArgIndex, NumGradientArgs);
int LodArgIndex = !add(VAddrArgIndex, NumVAddrArgs, -1);
int MipArgIndex = LodArgIndex;
int RsrcArgIndex = !add(VAddrArgIndex, NumVAddrArgs);
int SampArgIndex = !add(RsrcArgIndex, NumRSrcArgs);
int UnormArgIndex = !add(SampArgIndex, 1);
int TexFailCtrlArgIndex = !add(SampArgIndex, NumSampArgs);
int CachePolicyArgIndex = !add(TexFailCtrlArgIndex, 1);
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86270/new/
https://reviews.llvm.org/D86270
More information about the llvm-commits
mailing list