xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1//===-- AMDGPUSearchableTables.td - ------------------------*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Resource intrinsics table.
11//===----------------------------------------------------------------------===//
12
13class RsrcIntrinsic<AMDGPURsrcIntrinsic intr> {
14  Intrinsic Intr = !cast<Intrinsic>(intr);
15  bits<8> RsrcArg = intr.RsrcArg;
16  bit IsImage = intr.IsImage;
17}
18
19def RsrcIntrinsics : GenericTable {
20  let FilterClass = "RsrcIntrinsic";
21  let Fields = ["Intr", "RsrcArg", "IsImage"];
22
23  let PrimaryKey = ["Intr"];
24  let PrimaryKeyName = "lookupRsrcIntrinsic";
25}
26
27foreach intr = !listconcat(AMDGPUBufferIntrinsics,
28                           AMDGPUImageDimIntrinsics,
29                           AMDGPUImageDimAtomicIntrinsics) in {
30  def : RsrcIntrinsic<!cast<AMDGPURsrcIntrinsic>(intr)>;
31}
32
33class GcnBufferFormatBase<bits<8> f, bits<8> bpc, bits<8> numc, bits<8> nfmt, bits<8> dfmt> {
34  bits<8> Format = f;
35  bits<8> BitsPerComp = bpc;
36  bits<8> NumComponents = numc;
37  bits<8> NumFormat = nfmt;
38  bits<8> DataFormat = dfmt;
39}
40
41class Gfx9BufferFormat<bits<8> f, bits<8> bpc, bits<8> numc, bits<8> nfmt, bits<8> dfmt> : GcnBufferFormatBase<f, bpc, numc, nfmt, dfmt>;
42class Gfx10PlusBufferFormat<bits<8> f, bits<8> bpc, bits<8> numc, bits<8> nfmt, bits<8> dfmt> : GcnBufferFormatBase<f, bpc, numc, nfmt, dfmt>;
43
44class GcnBufferFormatTable  : GenericTable {
45  let CppTypeName = "GcnBufferFormatInfo";
46  let Fields = ["Format", "BitsPerComp", "NumComponents", "NumFormat", "DataFormat"];
47  let PrimaryKey = ["BitsPerComp", "NumComponents", "NumFormat"];
48}
49
50def Gfx9BufferFormat : GcnBufferFormatTable {
51  let FilterClass = "Gfx9BufferFormat";
52  let PrimaryKeyName = "getGfx9BufferFormatInfo";
53}
54def Gfx10PlusBufferFormat : GcnBufferFormatTable {
55  let FilterClass = "Gfx10PlusBufferFormat";
56  let PrimaryKeyName = "getGfx10PlusBufferFormatInfo";
57}
58
59def getGfx9BufferFormatInfo : SearchIndex {
60  let Table = Gfx9BufferFormat;
61  let Key = ["Format"];
62}
63def getGfx10PlusBufferFormatInfo : SearchIndex {
64  let Table = Gfx10PlusBufferFormat;
65  let Key = ["Format"];
66}
67
68// Buffer formats with equal component sizes (GFX9 and earlier)
69def : Gfx9BufferFormat< /*FORMAT_8_UNORM*/              0x01,  8, 1, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_8*/            1>;
70def : Gfx9BufferFormat< /*FORMAT_8_SNORM*/              0x11,  8, 1, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_8*/            1>;
71def : Gfx9BufferFormat< /*FORMAT_8_USCALED*/            0x21,  8, 1, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8*/            1>;
72def : Gfx9BufferFormat< /*FORMAT_8_SSCALED*/            0x31,  8, 1, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8*/            1>;
73def : Gfx9BufferFormat< /*FORMAT_8_UINT*/               0x41,  8, 1, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_8*/            1>;
74def : Gfx9BufferFormat< /*FORMAT_8_SINT*/               0x51,  8, 1, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_8*/            1>;
75def : Gfx9BufferFormat< /*FORMAT_16_UNORM*/             0x02, 16, 1, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_16*/           2>;
76def : Gfx9BufferFormat< /*FORMAT_16_SNORM*/             0x12, 16, 1, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_16*/           2>;
77def : Gfx9BufferFormat< /*FORMAT_16_USCALED*/           0x22, 16, 1, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16*/           2>;
78def : Gfx9BufferFormat< /*FORMAT_16_SSCALED*/           0x32, 16, 1, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16*/           2>;
79def : Gfx9BufferFormat< /*FORMAT_16_UINT*/              0x42, 16, 1, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_16*/           2>;
80def : Gfx9BufferFormat< /*FORMAT_16_SINT*/              0x52, 16, 1, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_16*/           2>;
81def : Gfx9BufferFormat< /*FORMAT_16_FLOAT*/             0x72, 16, 1, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_16*/           2>;
82def : Gfx9BufferFormat< /*FORMAT_8_8_UNORM*/            0x03,  8, 2, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_8_8*/          3>;
83def : Gfx9BufferFormat< /*FORMAT_8_8_SNORM*/            0x13,  8, 2, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_8_8*/          3>;
84def : Gfx9BufferFormat< /*FORMAT_8_8_USCALED*/          0x23,  8, 2, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8_8*/          3>;
85def : Gfx9BufferFormat< /*FORMAT_8_8_SSCALED*/          0x33,  8, 2, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8_8*/          3>;
86def : Gfx9BufferFormat< /*FORMAT_8_8_UINT*/             0x43,  8, 2, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_8_8*/          3>;
87def : Gfx9BufferFormat< /*FORMAT_8_8_SINT*/             0x53,  8, 2, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_8_8*/          3>;
88def : Gfx9BufferFormat< /*FORMAT_32_UINT*/              0x44, 32, 1, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_32*/           4>;
89def : Gfx9BufferFormat< /*FORMAT_32_SINT*/              0x54, 32, 1, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_32*/           4>;
90def : Gfx9BufferFormat< /*FORMAT_32_FLOAT*/             0x74, 32, 1, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_32*/           4>;
91def : Gfx9BufferFormat< /*FORMAT_16_16_UNORM*/          0x05, 16, 2, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_16_16*/        5>;
92def : Gfx9BufferFormat< /*FORMAT_16_16_SNORM*/          0x15, 16, 2, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_16_16*/        5>;
93def : Gfx9BufferFormat< /*FORMAT_16_16_USCALED*/        0x25, 16, 2, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16_16*/        5>;
94def : Gfx9BufferFormat< /*FORMAT_16_16_SSCALED*/        0x35, 16, 2, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16_16*/        5>;
95def : Gfx9BufferFormat< /*FORMAT_16_16_UINT*/           0x45, 16, 2, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_16_16*/        5>;
96def : Gfx9BufferFormat< /*FORMAT_16_16_SINT*/           0x55, 16, 2, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_16_16*/        5>;
97def : Gfx9BufferFormat< /*FORMAT_16_16_FLOAT*/          0x75, 16, 2, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_16_16*/        5>;
98def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_UNORM*/        0x0A,  8, 4, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_8_8_8_8*/     10>;
99def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_SNORM*/        0x1A,  8, 4, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_8_8_8_8*/     10>;
100def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_USCALED*/      0x2A,  8, 4, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8_8_8_8*/     10>;
101def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_SSCALED*/      0x3A,  8, 4, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8_8_8_8*/     10>;
102def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_UINT*/         0x4A,  8, 4, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_8_8_8_8*/     10>;
103def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_SINT*/         0x5A,  8, 4, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_8_8_8_8*/     10>;
104def : Gfx9BufferFormat< /*FORMAT_32_32_UINT*/           0x4B, 32, 2, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_32_32*/       11>;
105def : Gfx9BufferFormat< /*FORMAT_32_32_SINT*/           0x5B, 32, 2, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_32_32*/       11>;
106def : Gfx9BufferFormat< /*FORMAT_32_32_FLOAT*/          0x7B, 32, 2, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_32_32*/       11>;
107def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_UNORM*/    0x0C, 16, 4, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_16_16_16_16*/ 12>;
108def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_SNORM*/    0x1C, 16, 4, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_16_16_16_16*/ 12>;
109def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_USCALED*/  0x2C, 16, 4, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16_16_16_16*/ 12>;
110def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_SSCALED*/  0x3C, 16, 4, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16_16_16_16*/ 12>;
111def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_UINT*/     0x4C, 16, 4, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_16_16_16_16*/ 12>;
112def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_SINT*/     0x5C, 16, 4, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_16_16_16_16*/ 12>;
113def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_FLOAT*/    0x7C, 16, 4, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_16_16_16_16*/ 12>;
114def : Gfx9BufferFormat< /*FORMAT_32_32_32_UINT*/        0x4D, 32, 3, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_32_32_32*/    13>;
115def : Gfx9BufferFormat< /*FORMAT_32_32_32_SINT*/        0x5D, 32, 3, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_32_32_32*/    13>;
116def : Gfx9BufferFormat< /*FORMAT_32_32_32_FLOAT*/       0x7D, 32, 3, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_32_32_32*/    13>;
117def : Gfx9BufferFormat< /*FORMAT_32_32_32_32_UINT*/     0x4E, 32, 4, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_32_32_32_32*/ 14>;
118def : Gfx9BufferFormat< /*FORMAT_32_32_32_32_SINT*/     0x5E, 32, 4, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_32_32_32_32*/ 14>;
119def : Gfx9BufferFormat< /*FORMAT_32_32_32_32_FLOAT*/    0x7E, 32, 4, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_32_32_32_32*/ 14>;
120
121// Buffer formats with equal component sizes (GFX10 and later)
122def : Gfx10PlusBufferFormat< /*FORMAT_8_UNORM*/              0x01,  8, 1, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_8*/            1>;
123def : Gfx10PlusBufferFormat< /*FORMAT_8_SNORM*/              0x02,  8, 1, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_8*/            1>;
124def : Gfx10PlusBufferFormat< /*FORMAT_8_USCALED*/            0x03,  8, 1, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8*/            1>;
125def : Gfx10PlusBufferFormat< /*FORMAT_8_SSCALED*/            0x04,  8, 1, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8*/            1>;
126def : Gfx10PlusBufferFormat< /*FORMAT_8_UINT*/               0x05,  8, 1, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_8*/            1>;
127def : Gfx10PlusBufferFormat< /*FORMAT_8_SINT*/               0x06,  8, 1, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_8*/            1>;
128def : Gfx10PlusBufferFormat< /*FORMAT_16_UNORM*/             0x07, 16, 1, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_16*/           2>;
129def : Gfx10PlusBufferFormat< /*FORMAT_16_SNORM*/             0x08, 16, 1, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_16*/           2>;
130def : Gfx10PlusBufferFormat< /*FORMAT_16_USCALED*/           0x09, 16, 1, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16*/           2>;
131def : Gfx10PlusBufferFormat< /*FORMAT_16_SSCALED*/           0x0A, 16, 1, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16*/           2>;
132def : Gfx10PlusBufferFormat< /*FORMAT_16_UINT*/              0x0B, 16, 1, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_16*/           2>;
133def : Gfx10PlusBufferFormat< /*FORMAT_16_SINT*/              0x0C, 16, 1, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_16*/           2>;
134def : Gfx10PlusBufferFormat< /*FORMAT_16_FLOAT*/             0x0D, 16, 1, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_16*/           2>;
135def : Gfx10PlusBufferFormat< /*FORMAT_8_8_UNORM*/            0x0E,  8, 2, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_8_8*/          3>;
136def : Gfx10PlusBufferFormat< /*FORMAT_8_8_SNORM*/            0x0F,  8, 2, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_8_8*/          3>;
137def : Gfx10PlusBufferFormat< /*FORMAT_8_8_USCALED*/          0x10,  8, 2, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8_8*/          3>;
138def : Gfx10PlusBufferFormat< /*FORMAT_8_8_SSCALED*/          0x11,  8, 2, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8_8*/          3>;
139def : Gfx10PlusBufferFormat< /*FORMAT_8_8_UINT*/             0x12,  8, 2, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_8_8*/          3>;
140def : Gfx10PlusBufferFormat< /*FORMAT_8_8_SINT*/             0x13,  8, 2, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_8_8*/          3>;
141def : Gfx10PlusBufferFormat< /*FORMAT_32_UINT*/              0x14, 32, 1, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_32*/           4>;
142def : Gfx10PlusBufferFormat< /*FORMAT_32_SINT*/              0x15, 32, 1, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_32*/           4>;
143def : Gfx10PlusBufferFormat< /*FORMAT_32_FLOAT*/             0x16, 32, 1, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_32*/           4>;
144def : Gfx10PlusBufferFormat< /*FORMAT_16_16_UNORM*/          0x17, 16, 2, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_16_16*/        5>;
145def : Gfx10PlusBufferFormat< /*FORMAT_16_16_SNORM*/          0x18, 16, 2, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_16_16*/        5>;
146def : Gfx10PlusBufferFormat< /*FORMAT_16_16_USCALED*/        0x19, 16, 2, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16_16*/        5>;
147def : Gfx10PlusBufferFormat< /*FORMAT_16_16_SSCALED*/        0x1A, 16, 2, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16_16*/        5>;
148def : Gfx10PlusBufferFormat< /*FORMAT_16_16_UINT*/           0x1B, 16, 2, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_16_16*/        5>;
149def : Gfx10PlusBufferFormat< /*FORMAT_16_16_SINT*/           0x1C, 16, 2, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_16_16*/        5>;
150def : Gfx10PlusBufferFormat< /*FORMAT_16_16_FLOAT*/          0x1D, 16, 2, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_16_16*/        5>;
151def : Gfx10PlusBufferFormat< /*FORMAT_8_8_8_8_UNORM*/        0x38,  8, 4, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_8_8_8_8*/     10>;
152def : Gfx10PlusBufferFormat< /*FORMAT_8_8_8_8_SNORM*/        0x39,  8, 4, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_8_8_8_8*/     10>;
153def : Gfx10PlusBufferFormat< /*FORMAT_8_8_8_8_USCALED*/      0x3A,  8, 4, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8_8_8_8*/     10>;
154def : Gfx10PlusBufferFormat< /*FORMAT_8_8_8_8_SSCALED*/      0x3B,  8, 4, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8_8_8_8*/     10>;
155def : Gfx10PlusBufferFormat< /*FORMAT_8_8_8_8_UINT*/         0x3C,  8, 4, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_8_8_8_8*/     10>;
156def : Gfx10PlusBufferFormat< /*FORMAT_8_8_8_8_SINT*/         0x3D,  8, 4, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_8_8_8_8*/     10>;
157def : Gfx10PlusBufferFormat< /*FORMAT_32_32_UINT*/           0x3E, 32, 2, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_32_32*/       11>;
158def : Gfx10PlusBufferFormat< /*FORMAT_32_32_SINT*/           0x3F, 32, 2, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_32_32*/       11>;
159def : Gfx10PlusBufferFormat< /*FORMAT_32_32_FLOAT*/          0x40, 32, 2, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_32_32*/       11>;
160def : Gfx10PlusBufferFormat< /*FORMAT_16_16_16_16_UNORM*/    0x41, 16, 4, /*NUM_FORMAT_UNORM*/   0, /*DATA_FORMAT_16_16_16_16*/ 12>;
161def : Gfx10PlusBufferFormat< /*FORMAT_16_16_16_16_SNORM*/    0x42, 16, 4, /*NUM_FORMAT_SNORM*/   1, /*DATA_FORMAT_16_16_16_16*/ 12>;
162def : Gfx10PlusBufferFormat< /*FORMAT_16_16_16_16_USCALED*/  0x43, 16, 4, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16_16_16_16*/ 12>;
163def : Gfx10PlusBufferFormat< /*FORMAT_16_16_16_16_SSCALED*/  0x44, 16, 4, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16_16_16_16*/ 12>;
164def : Gfx10PlusBufferFormat< /*FORMAT_16_16_16_16_UINT*/     0x45, 16, 4, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_16_16_16_16*/ 12>;
165def : Gfx10PlusBufferFormat< /*FORMAT_16_16_16_16_SINT*/     0x46, 16, 4, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_16_16_16_16*/ 12>;
166def : Gfx10PlusBufferFormat< /*FORMAT_16_16_16_16_FLOAT*/    0x47, 16, 4, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_16_16_16_16*/ 12>;
167def : Gfx10PlusBufferFormat< /*FORMAT_32_32_32_UINT*/        0x48, 32, 3, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_32_32_32*/    13>;
168def : Gfx10PlusBufferFormat< /*FORMAT_32_32_32_SINT*/        0x49, 32, 3, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_32_32_32*/    13>;
169def : Gfx10PlusBufferFormat< /*FORMAT_32_32_32_FLOAT*/       0x4A, 32, 3, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_32_32_32*/    13>;
170def : Gfx10PlusBufferFormat< /*FORMAT_32_32_32_32_UINT*/     0x4B, 32, 4, /*NUM_FORMAT_UINT*/    4, /*DATA_FORMAT_32_32_32_32*/ 14>;
171def : Gfx10PlusBufferFormat< /*FORMAT_32_32_32_32_SINT*/     0x4C, 32, 4, /*NUM_FORMAT_SINT*/    5, /*DATA_FORMAT_32_32_32_32*/ 14>;
172def : Gfx10PlusBufferFormat< /*FORMAT_32_32_32_32_FLOAT*/    0x4D, 32, 4, /*NUM_FORMAT_FLOAT*/   7, /*DATA_FORMAT_32_32_32_32*/ 14>;
173
174class SourceOfDivergence<Intrinsic intr> {
175  Intrinsic Intr = intr;
176}
177
178def SourcesOfDivergence : GenericTable {
179  let FilterClass = "SourceOfDivergence";
180  let Fields = ["Intr"];
181
182  let PrimaryKey = ["Intr"];
183  let PrimaryKeyName = "lookupSourceOfDivergence";
184}
185
186def : SourceOfDivergence<int_amdgcn_workitem_id_x>;
187def : SourceOfDivergence<int_amdgcn_workitem_id_y>;
188def : SourceOfDivergence<int_amdgcn_workitem_id_z>;
189def : SourceOfDivergence<int_amdgcn_interp_mov>;
190def : SourceOfDivergence<int_amdgcn_interp_p1>;
191def : SourceOfDivergence<int_amdgcn_interp_p2>;
192def : SourceOfDivergence<int_amdgcn_interp_p1_f16>;
193def : SourceOfDivergence<int_amdgcn_interp_p2_f16>;
194def : SourceOfDivergence<int_amdgcn_mbcnt_hi>;
195def : SourceOfDivergence<int_amdgcn_mbcnt_lo>;
196def : SourceOfDivergence<int_r600_read_tidig_x>;
197def : SourceOfDivergence<int_r600_read_tidig_y>;
198def : SourceOfDivergence<int_r600_read_tidig_z>;
199def : SourceOfDivergence<int_amdgcn_atomic_inc>;
200def : SourceOfDivergence<int_amdgcn_atomic_dec>;
201def : SourceOfDivergence<int_amdgcn_global_atomic_csub>;
202def : SourceOfDivergence<int_amdgcn_global_atomic_fadd>;
203def : SourceOfDivergence<int_amdgcn_global_atomic_fmin>;
204def : SourceOfDivergence<int_amdgcn_global_atomic_fmax>;
205def : SourceOfDivergence<int_amdgcn_flat_atomic_fadd>;
206def : SourceOfDivergence<int_amdgcn_flat_atomic_fmin>;
207def : SourceOfDivergence<int_amdgcn_flat_atomic_fmax>;
208def : SourceOfDivergence<int_amdgcn_ds_fadd>;
209def : SourceOfDivergence<int_amdgcn_ds_fmin>;
210def : SourceOfDivergence<int_amdgcn_ds_fmax>;
211def : SourceOfDivergence<int_amdgcn_buffer_atomic_swap>;
212def : SourceOfDivergence<int_amdgcn_buffer_atomic_add>;
213def : SourceOfDivergence<int_amdgcn_buffer_atomic_sub>;
214def : SourceOfDivergence<int_amdgcn_buffer_atomic_smin>;
215def : SourceOfDivergence<int_amdgcn_buffer_atomic_umin>;
216def : SourceOfDivergence<int_amdgcn_buffer_atomic_smax>;
217def : SourceOfDivergence<int_amdgcn_buffer_atomic_umax>;
218def : SourceOfDivergence<int_amdgcn_buffer_atomic_and>;
219def : SourceOfDivergence<int_amdgcn_buffer_atomic_or>;
220def : SourceOfDivergence<int_amdgcn_buffer_atomic_xor>;
221def : SourceOfDivergence<int_amdgcn_buffer_atomic_cmpswap>;
222def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_swap>;
223def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_add>;
224def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_sub>;
225def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_smin>;
226def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_umin>;
227def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_smax>;
228def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_umax>;
229def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_and>;
230def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_or>;
231def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_xor>;
232def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_inc>;
233def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_dec>;
234def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_fadd>;
235def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_fmin>;
236def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_fmax>;
237def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_cmpswap>;
238def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_swap>;
239def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_add>;
240def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_sub>;
241def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_smin>;
242def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_umin>;
243def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_smax>;
244def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_umax>;
245def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_and>;
246def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_or>;
247def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_xor>;
248def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_inc>;
249def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_dec>;
250def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_fadd>;
251def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_fmin>;
252def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_fmax>;
253def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_cmpswap>;
254def : SourceOfDivergence<int_amdgcn_buffer_atomic_csub>;
255def : SourceOfDivergence<int_amdgcn_ps_live>;
256def : SourceOfDivergence<int_amdgcn_live_mask>;
257def : SourceOfDivergence<int_amdgcn_ds_swizzle>;
258def : SourceOfDivergence<int_amdgcn_ds_ordered_add>;
259def : SourceOfDivergence<int_amdgcn_ds_ordered_swap>;
260def : SourceOfDivergence<int_amdgcn_permlane16>;
261def : SourceOfDivergence<int_amdgcn_permlanex16>;
262def : SourceOfDivergence<int_amdgcn_mov_dpp>;
263def : SourceOfDivergence<int_amdgcn_mov_dpp8>;
264def : SourceOfDivergence<int_amdgcn_update_dpp>;
265def : SourceOfDivergence<int_amdgcn_writelane>;
266
267def : SourceOfDivergence<int_amdgcn_mfma_f32_4x4x1f32>;
268def : SourceOfDivergence<int_amdgcn_mfma_f32_4x4x1f32>;
269def : SourceOfDivergence<int_amdgcn_mfma_f32_4x4x4f16>;
270def : SourceOfDivergence<int_amdgcn_mfma_i32_4x4x4i8>;
271def : SourceOfDivergence<int_amdgcn_mfma_f32_4x4x2bf16>;
272def : SourceOfDivergence<int_amdgcn_mfma_f32_16x16x1f32>;
273def : SourceOfDivergence<int_amdgcn_mfma_f32_16x16x4f32>;
274def : SourceOfDivergence<int_amdgcn_mfma_f32_16x16x4f16>;
275def : SourceOfDivergence<int_amdgcn_mfma_f32_16x16x16f16>;
276def : SourceOfDivergence<int_amdgcn_mfma_i32_16x16x4i8>;
277def : SourceOfDivergence<int_amdgcn_mfma_i32_16x16x16i8>;
278def : SourceOfDivergence<int_amdgcn_mfma_f32_16x16x2bf16>;
279def : SourceOfDivergence<int_amdgcn_mfma_f32_16x16x8bf16>;
280def : SourceOfDivergence<int_amdgcn_mfma_f32_32x32x1f32>;
281def : SourceOfDivergence<int_amdgcn_mfma_f32_32x32x2f32>;
282def : SourceOfDivergence<int_amdgcn_mfma_f32_32x32x4f16>;
283def : SourceOfDivergence<int_amdgcn_mfma_f32_32x32x8f16>;
284def : SourceOfDivergence<int_amdgcn_mfma_i32_32x32x4i8>;
285def : SourceOfDivergence<int_amdgcn_mfma_i32_32x32x8i8>;
286def : SourceOfDivergence<int_amdgcn_mfma_f32_32x32x2bf16>;
287def : SourceOfDivergence<int_amdgcn_mfma_f32_32x32x4bf16>;
288def : SourceOfDivergence<int_amdgcn_mfma_f32_32x32x4bf16_1k>;
289def : SourceOfDivergence<int_amdgcn_mfma_f32_16x16x4bf16_1k>;
290def : SourceOfDivergence<int_amdgcn_mfma_f32_4x4x4bf16_1k>;
291def : SourceOfDivergence<int_amdgcn_mfma_f32_32x32x8bf16_1k>;
292def : SourceOfDivergence<int_amdgcn_mfma_f32_16x16x16bf16_1k>;
293def : SourceOfDivergence<int_amdgcn_mfma_f64_16x16x4f64>;
294def : SourceOfDivergence<int_amdgcn_mfma_f64_4x4x4f64>;
295
296// The dummy boolean output is divergent from the IR's perspective,
297// but the mask results are uniform. These produce a divergent and
298// uniform result, so the returned struct is collectively divergent.
299// isAlwaysUniform can override the extract of the uniform component.
300def : SourceOfDivergence<int_amdgcn_if>;
301def : SourceOfDivergence<int_amdgcn_else>;
302def : SourceOfDivergence<int_amdgcn_loop>;
303
304foreach intr = AMDGPUImageDimAtomicIntrinsics in
305def : SourceOfDivergence<intr>;
306