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 Gfx10BufferFormat<bits<8> f, bits<8> bpc, bits<8> numc, bits<8> nfmt, bits<8> dfmt> : GcnBufferFormatBase<f, bpc, numc, nfmt, dfmt>; 43class Gfx11PlusBufferFormat<bits<8> f, bits<8> bpc, bits<8> numc, bits<8> nfmt, bits<8> dfmt> : GcnBufferFormatBase<f, bpc, numc, nfmt, dfmt>; 44 45class GcnBufferFormatTable : GenericTable { 46 let CppTypeName = "GcnBufferFormatInfo"; 47 let Fields = ["Format", "BitsPerComp", "NumComponents", "NumFormat", "DataFormat"]; 48 let PrimaryKey = ["BitsPerComp", "NumComponents", "NumFormat"]; 49} 50 51def Gfx9BufferFormat : GcnBufferFormatTable { 52 let FilterClass = "Gfx9BufferFormat"; 53 let PrimaryKeyName = "getGfx9BufferFormatInfo"; 54} 55def Gfx10BufferFormat : GcnBufferFormatTable { 56 let FilterClass = "Gfx10BufferFormat"; 57 let PrimaryKeyName = "getGfx10BufferFormatInfo"; 58} 59def Gfx11PlusBufferFormat : GcnBufferFormatTable { 60 let FilterClass = "Gfx11PlusBufferFormat"; 61 let PrimaryKeyName = "getGfx11PlusBufferFormatInfo"; 62} 63 64def getGfx9BufferFormatInfo : SearchIndex { 65 let Table = Gfx9BufferFormat; 66 let Key = ["Format"]; 67} 68def getGfx10BufferFormatInfo : SearchIndex { 69 let Table = Gfx10BufferFormat; 70 let Key = ["Format"]; 71} 72def getGfx11PlusBufferFormatInfo : SearchIndex { 73 let Table = Gfx11PlusBufferFormat; 74 let Key = ["Format"]; 75} 76 77// Buffer formats with equal component sizes (GFX9 and earlier) 78def : Gfx9BufferFormat< /*FORMAT_8_UNORM*/ 0x01, 8, 1, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_8*/ 1>; 79def : Gfx9BufferFormat< /*FORMAT_8_SNORM*/ 0x11, 8, 1, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_8*/ 1>; 80def : Gfx9BufferFormat< /*FORMAT_8_USCALED*/ 0x21, 8, 1, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8*/ 1>; 81def : Gfx9BufferFormat< /*FORMAT_8_SSCALED*/ 0x31, 8, 1, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8*/ 1>; 82def : Gfx9BufferFormat< /*FORMAT_8_UINT*/ 0x41, 8, 1, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_8*/ 1>; 83def : Gfx9BufferFormat< /*FORMAT_8_SINT*/ 0x51, 8, 1, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_8*/ 1>; 84def : Gfx9BufferFormat< /*FORMAT_16_UNORM*/ 0x02, 16, 1, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_16*/ 2>; 85def : Gfx9BufferFormat< /*FORMAT_16_SNORM*/ 0x12, 16, 1, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_16*/ 2>; 86def : Gfx9BufferFormat< /*FORMAT_16_USCALED*/ 0x22, 16, 1, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16*/ 2>; 87def : Gfx9BufferFormat< /*FORMAT_16_SSCALED*/ 0x32, 16, 1, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16*/ 2>; 88def : Gfx9BufferFormat< /*FORMAT_16_UINT*/ 0x42, 16, 1, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_16*/ 2>; 89def : Gfx9BufferFormat< /*FORMAT_16_SINT*/ 0x52, 16, 1, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_16*/ 2>; 90def : Gfx9BufferFormat< /*FORMAT_16_FLOAT*/ 0x72, 16, 1, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_16*/ 2>; 91def : Gfx9BufferFormat< /*FORMAT_8_8_UNORM*/ 0x03, 8, 2, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_8_8*/ 3>; 92def : Gfx9BufferFormat< /*FORMAT_8_8_SNORM*/ 0x13, 8, 2, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_8_8*/ 3>; 93def : Gfx9BufferFormat< /*FORMAT_8_8_USCALED*/ 0x23, 8, 2, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8_8*/ 3>; 94def : Gfx9BufferFormat< /*FORMAT_8_8_SSCALED*/ 0x33, 8, 2, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8_8*/ 3>; 95def : Gfx9BufferFormat< /*FORMAT_8_8_UINT*/ 0x43, 8, 2, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_8_8*/ 3>; 96def : Gfx9BufferFormat< /*FORMAT_8_8_SINT*/ 0x53, 8, 2, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_8_8*/ 3>; 97def : Gfx9BufferFormat< /*FORMAT_32_UINT*/ 0x44, 32, 1, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32*/ 4>; 98def : Gfx9BufferFormat< /*FORMAT_32_SINT*/ 0x54, 32, 1, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32*/ 4>; 99def : Gfx9BufferFormat< /*FORMAT_32_FLOAT*/ 0x74, 32, 1, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32*/ 4>; 100def : Gfx9BufferFormat< /*FORMAT_16_16_UNORM*/ 0x05, 16, 2, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_16_16*/ 5>; 101def : Gfx9BufferFormat< /*FORMAT_16_16_SNORM*/ 0x15, 16, 2, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_16_16*/ 5>; 102def : Gfx9BufferFormat< /*FORMAT_16_16_USCALED*/ 0x25, 16, 2, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16_16*/ 5>; 103def : Gfx9BufferFormat< /*FORMAT_16_16_SSCALED*/ 0x35, 16, 2, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16_16*/ 5>; 104def : Gfx9BufferFormat< /*FORMAT_16_16_UINT*/ 0x45, 16, 2, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_16_16*/ 5>; 105def : Gfx9BufferFormat< /*FORMAT_16_16_SINT*/ 0x55, 16, 2, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_16_16*/ 5>; 106def : Gfx9BufferFormat< /*FORMAT_16_16_FLOAT*/ 0x75, 16, 2, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_16_16*/ 5>; 107def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_UNORM*/ 0x0A, 8, 4, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_8_8_8_8*/ 10>; 108def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_SNORM*/ 0x1A, 8, 4, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_8_8_8_8*/ 10>; 109def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_USCALED*/ 0x2A, 8, 4, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8_8_8_8*/ 10>; 110def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_SSCALED*/ 0x3A, 8, 4, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8_8_8_8*/ 10>; 111def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_UINT*/ 0x4A, 8, 4, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_8_8_8_8*/ 10>; 112def : Gfx9BufferFormat< /*FORMAT_8_8_8_8_SINT*/ 0x5A, 8, 4, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_8_8_8_8*/ 10>; 113def : Gfx9BufferFormat< /*FORMAT_32_32_UINT*/ 0x4B, 32, 2, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32_32*/ 11>; 114def : Gfx9BufferFormat< /*FORMAT_32_32_SINT*/ 0x5B, 32, 2, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32_32*/ 11>; 115def : Gfx9BufferFormat< /*FORMAT_32_32_FLOAT*/ 0x7B, 32, 2, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32_32*/ 11>; 116def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_UNORM*/ 0x0C, 16, 4, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_16_16_16_16*/ 12>; 117def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_SNORM*/ 0x1C, 16, 4, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_16_16_16_16*/ 12>; 118def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_USCALED*/ 0x2C, 16, 4, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16_16_16_16*/ 12>; 119def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_SSCALED*/ 0x3C, 16, 4, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16_16_16_16*/ 12>; 120def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_UINT*/ 0x4C, 16, 4, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_16_16_16_16*/ 12>; 121def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_SINT*/ 0x5C, 16, 4, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_16_16_16_16*/ 12>; 122def : Gfx9BufferFormat< /*FORMAT_16_16_16_16_FLOAT*/ 0x7C, 16, 4, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_16_16_16_16*/ 12>; 123def : Gfx9BufferFormat< /*FORMAT_32_32_32_UINT*/ 0x4D, 32, 3, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32_32_32*/ 13>; 124def : Gfx9BufferFormat< /*FORMAT_32_32_32_SINT*/ 0x5D, 32, 3, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32_32_32*/ 13>; 125def : Gfx9BufferFormat< /*FORMAT_32_32_32_FLOAT*/ 0x7D, 32, 3, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32_32_32*/ 13>; 126def : Gfx9BufferFormat< /*FORMAT_32_32_32_32_UINT*/ 0x4E, 32, 4, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32_32_32_32*/ 14>; 127def : Gfx9BufferFormat< /*FORMAT_32_32_32_32_SINT*/ 0x5E, 32, 4, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32_32_32_32*/ 14>; 128def : Gfx9BufferFormat< /*FORMAT_32_32_32_32_FLOAT*/ 0x7E, 32, 4, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32_32_32_32*/ 14>; 129 130// Buffer formats with equal component sizes (GFX10 and later) 131multiclass Gfx10PlusBufferFormat<bits<8> f, bits<8> bpc, bits<8> numc, bits<8> nfmt, bits<8> dfmt> { 132 def : Gfx10BufferFormat<f, bpc, numc, nfmt, dfmt>; 133 def : Gfx11PlusBufferFormat<f, bpc, numc, nfmt, dfmt>; 134} 135defm : Gfx10PlusBufferFormat< /*FORMAT_8_UNORM*/ 0x01, 8, 1, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_8*/ 1>; 136defm : Gfx10PlusBufferFormat< /*FORMAT_8_SNORM*/ 0x02, 8, 1, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_8*/ 1>; 137defm : Gfx10PlusBufferFormat< /*FORMAT_8_USCALED*/ 0x03, 8, 1, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8*/ 1>; 138defm : Gfx10PlusBufferFormat< /*FORMAT_8_SSCALED*/ 0x04, 8, 1, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8*/ 1>; 139defm : Gfx10PlusBufferFormat< /*FORMAT_8_UINT*/ 0x05, 8, 1, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_8*/ 1>; 140defm : Gfx10PlusBufferFormat< /*FORMAT_8_SINT*/ 0x06, 8, 1, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_8*/ 1>; 141defm : Gfx10PlusBufferFormat< /*FORMAT_16_UNORM*/ 0x07, 16, 1, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_16*/ 2>; 142defm : Gfx10PlusBufferFormat< /*FORMAT_16_SNORM*/ 0x08, 16, 1, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_16*/ 2>; 143defm : Gfx10PlusBufferFormat< /*FORMAT_16_USCALED*/ 0x09, 16, 1, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16*/ 2>; 144defm : Gfx10PlusBufferFormat< /*FORMAT_16_SSCALED*/ 0x0A, 16, 1, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16*/ 2>; 145defm : Gfx10PlusBufferFormat< /*FORMAT_16_UINT*/ 0x0B, 16, 1, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_16*/ 2>; 146defm : Gfx10PlusBufferFormat< /*FORMAT_16_SINT*/ 0x0C, 16, 1, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_16*/ 2>; 147defm : Gfx10PlusBufferFormat< /*FORMAT_16_FLOAT*/ 0x0D, 16, 1, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_16*/ 2>; 148defm : Gfx10PlusBufferFormat< /*FORMAT_8_8_UNORM*/ 0x0E, 8, 2, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_8_8*/ 3>; 149defm : Gfx10PlusBufferFormat< /*FORMAT_8_8_SNORM*/ 0x0F, 8, 2, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_8_8*/ 3>; 150defm : Gfx10PlusBufferFormat< /*FORMAT_8_8_USCALED*/ 0x10, 8, 2, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8_8*/ 3>; 151defm : Gfx10PlusBufferFormat< /*FORMAT_8_8_SSCALED*/ 0x11, 8, 2, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8_8*/ 3>; 152defm : Gfx10PlusBufferFormat< /*FORMAT_8_8_UINT*/ 0x12, 8, 2, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_8_8*/ 3>; 153defm : Gfx10PlusBufferFormat< /*FORMAT_8_8_SINT*/ 0x13, 8, 2, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_8_8*/ 3>; 154defm : Gfx10PlusBufferFormat< /*FORMAT_32_UINT*/ 0x14, 32, 1, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32*/ 4>; 155defm : Gfx10PlusBufferFormat< /*FORMAT_32_SINT*/ 0x15, 32, 1, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32*/ 4>; 156defm : Gfx10PlusBufferFormat< /*FORMAT_32_FLOAT*/ 0x16, 32, 1, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32*/ 4>; 157defm : Gfx10PlusBufferFormat< /*FORMAT_16_16_UNORM*/ 0x17, 16, 2, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_16_16*/ 5>; 158defm : Gfx10PlusBufferFormat< /*FORMAT_16_16_SNORM*/ 0x18, 16, 2, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_16_16*/ 5>; 159defm : Gfx10PlusBufferFormat< /*FORMAT_16_16_USCALED*/ 0x19, 16, 2, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16_16*/ 5>; 160defm : Gfx10PlusBufferFormat< /*FORMAT_16_16_SSCALED*/ 0x1A, 16, 2, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16_16*/ 5>; 161defm : Gfx10PlusBufferFormat< /*FORMAT_16_16_UINT*/ 0x1B, 16, 2, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_16_16*/ 5>; 162defm : Gfx10PlusBufferFormat< /*FORMAT_16_16_SINT*/ 0x1C, 16, 2, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_16_16*/ 5>; 163defm : Gfx10PlusBufferFormat< /*FORMAT_16_16_FLOAT*/ 0x1D, 16, 2, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_16_16*/ 5>; 164 165// Buffer formats with equal component sizes (GFX10 only) 166def : Gfx10BufferFormat< /*FORMAT_8_8_8_8_UNORM*/ 0x38, 8, 4, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_8_8_8_8*/ 10>; 167def : Gfx10BufferFormat< /*FORMAT_8_8_8_8_SNORM*/ 0x39, 8, 4, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_8_8_8_8*/ 10>; 168def : Gfx10BufferFormat< /*FORMAT_8_8_8_8_USCALED*/ 0x3A, 8, 4, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8_8_8_8*/ 10>; 169def : Gfx10BufferFormat< /*FORMAT_8_8_8_8_SSCALED*/ 0x3B, 8, 4, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8_8_8_8*/ 10>; 170def : Gfx10BufferFormat< /*FORMAT_8_8_8_8_UINT*/ 0x3C, 8, 4, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_8_8_8_8*/ 10>; 171def : Gfx10BufferFormat< /*FORMAT_8_8_8_8_SINT*/ 0x3D, 8, 4, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_8_8_8_8*/ 10>; 172def : Gfx10BufferFormat< /*FORMAT_32_32_UINT*/ 0x3E, 32, 2, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32_32*/ 11>; 173def : Gfx10BufferFormat< /*FORMAT_32_32_SINT*/ 0x3F, 32, 2, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32_32*/ 11>; 174def : Gfx10BufferFormat< /*FORMAT_32_32_FLOAT*/ 0x40, 32, 2, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32_32*/ 11>; 175def : Gfx10BufferFormat< /*FORMAT_16_16_16_16_UNORM*/ 0x41, 16, 4, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_16_16_16_16*/ 12>; 176def : Gfx10BufferFormat< /*FORMAT_16_16_16_16_SNORM*/ 0x42, 16, 4, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_16_16_16_16*/ 12>; 177def : Gfx10BufferFormat< /*FORMAT_16_16_16_16_USCALED*/ 0x43, 16, 4, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16_16_16_16*/ 12>; 178def : Gfx10BufferFormat< /*FORMAT_16_16_16_16_SSCALED*/ 0x44, 16, 4, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16_16_16_16*/ 12>; 179def : Gfx10BufferFormat< /*FORMAT_16_16_16_16_UINT*/ 0x45, 16, 4, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_16_16_16_16*/ 12>; 180def : Gfx10BufferFormat< /*FORMAT_16_16_16_16_SINT*/ 0x46, 16, 4, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_16_16_16_16*/ 12>; 181def : Gfx10BufferFormat< /*FORMAT_16_16_16_16_FLOAT*/ 0x47, 16, 4, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_16_16_16_16*/ 12>; 182def : Gfx10BufferFormat< /*FORMAT_32_32_32_UINT*/ 0x48, 32, 3, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32_32_32*/ 13>; 183def : Gfx10BufferFormat< /*FORMAT_32_32_32_SINT*/ 0x49, 32, 3, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32_32_32*/ 13>; 184def : Gfx10BufferFormat< /*FORMAT_32_32_32_FLOAT*/ 0x4A, 32, 3, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32_32_32*/ 13>; 185def : Gfx10BufferFormat< /*FORMAT_32_32_32_32_UINT*/ 0x4B, 32, 4, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32_32_32_32*/ 14>; 186def : Gfx10BufferFormat< /*FORMAT_32_32_32_32_SINT*/ 0x4C, 32, 4, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32_32_32_32*/ 14>; 187def : Gfx10BufferFormat< /*FORMAT_32_32_32_32_FLOAT*/ 0x4D, 32, 4, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32_32_32_32*/ 14>; 188 189// Buffer formats with equal component sizes (GFX11 and later) 190def : Gfx11PlusBufferFormat< /*FORMAT_8_8_8_8_UNORM*/ 0x2A, 8, 4, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_8_8_8_8*/ 10>; 191def : Gfx11PlusBufferFormat< /*FORMAT_8_8_8_8_SNORM*/ 0x2B, 8, 4, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_8_8_8_8*/ 10>; 192def : Gfx11PlusBufferFormat< /*FORMAT_8_8_8_8_USCALED*/ 0x2C, 8, 4, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_8_8_8_8*/ 10>; 193def : Gfx11PlusBufferFormat< /*FORMAT_8_8_8_8_SSCALED*/ 0x2D, 8, 4, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_8_8_8_8*/ 10>; 194def : Gfx11PlusBufferFormat< /*FORMAT_8_8_8_8_UINT*/ 0x2E, 8, 4, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_8_8_8_8*/ 10>; 195def : Gfx11PlusBufferFormat< /*FORMAT_8_8_8_8_SINT*/ 0x2F, 8, 4, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_8_8_8_8*/ 10>; 196def : Gfx11PlusBufferFormat< /*FORMAT_32_32_UINT*/ 0x30, 32, 2, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32_32*/ 11>; 197def : Gfx11PlusBufferFormat< /*FORMAT_32_32_SINT*/ 0x31, 32, 2, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32_32*/ 11>; 198def : Gfx11PlusBufferFormat< /*FORMAT_32_32_FLOAT*/ 0x32, 32, 2, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32_32*/ 11>; 199def : Gfx11PlusBufferFormat< /*FORMAT_16_16_16_16_UNORM*/ 0x33, 16, 4, /*NUM_FORMAT_UNORM*/ 0, /*DATA_FORMAT_16_16_16_16*/ 12>; 200def : Gfx11PlusBufferFormat< /*FORMAT_16_16_16_16_SNORM*/ 0x34, 16, 4, /*NUM_FORMAT_SNORM*/ 1, /*DATA_FORMAT_16_16_16_16*/ 12>; 201def : Gfx11PlusBufferFormat< /*FORMAT_16_16_16_16_USCALED*/ 0x35, 16, 4, /*NUM_FORMAT_USCALED*/ 2, /*DATA_FORMAT_16_16_16_16*/ 12>; 202def : Gfx11PlusBufferFormat< /*FORMAT_16_16_16_16_SSCALED*/ 0x36, 16, 4, /*NUM_FORMAT_SSCALED*/ 3, /*DATA_FORMAT_16_16_16_16*/ 12>; 203def : Gfx11PlusBufferFormat< /*FORMAT_16_16_16_16_UINT*/ 0x37, 16, 4, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_16_16_16_16*/ 12>; 204def : Gfx11PlusBufferFormat< /*FORMAT_16_16_16_16_SINT*/ 0x38, 16, 4, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_16_16_16_16*/ 12>; 205def : Gfx11PlusBufferFormat< /*FORMAT_16_16_16_16_FLOAT*/ 0x39, 16, 4, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_16_16_16_16*/ 12>; 206def : Gfx11PlusBufferFormat< /*FORMAT_32_32_32_UINT*/ 0x3A, 32, 3, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32_32_32*/ 13>; 207def : Gfx11PlusBufferFormat< /*FORMAT_32_32_32_SINT*/ 0x3B, 32, 3, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32_32_32*/ 13>; 208def : Gfx11PlusBufferFormat< /*FORMAT_32_32_32_FLOAT*/ 0x3C, 32, 3, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32_32_32*/ 13>; 209def : Gfx11PlusBufferFormat< /*FORMAT_32_32_32_32_UINT*/ 0x3D, 32, 4, /*NUM_FORMAT_UINT*/ 4, /*DATA_FORMAT_32_32_32_32*/ 14>; 210def : Gfx11PlusBufferFormat< /*FORMAT_32_32_32_32_SINT*/ 0x3E, 32, 4, /*NUM_FORMAT_SINT*/ 5, /*DATA_FORMAT_32_32_32_32*/ 14>; 211def : Gfx11PlusBufferFormat< /*FORMAT_32_32_32_32_FLOAT*/ 0x3F, 32, 4, /*NUM_FORMAT_FLOAT*/ 7, /*DATA_FORMAT_32_32_32_32*/ 14>; 212 213class SourceOfDivergence<Intrinsic intr> { 214 Intrinsic Intr = intr; 215} 216 217def SourcesOfDivergence : GenericTable { 218 let FilterClass = "SourceOfDivergence"; 219 let Fields = ["Intr"]; 220 221 let PrimaryKey = ["Intr"]; 222 let PrimaryKeyName = "lookupSourceOfDivergence"; 223} 224 225def : SourceOfDivergence<int_amdgcn_workitem_id_x>; 226def : SourceOfDivergence<int_amdgcn_workitem_id_y>; 227def : SourceOfDivergence<int_amdgcn_workitem_id_z>; 228def : SourceOfDivergence<int_amdgcn_interp_mov>; 229def : SourceOfDivergence<int_amdgcn_interp_p1>; 230def : SourceOfDivergence<int_amdgcn_interp_p2>; 231def : SourceOfDivergence<int_amdgcn_interp_p1_f16>; 232def : SourceOfDivergence<int_amdgcn_interp_p2_f16>; 233def : SourceOfDivergence<int_amdgcn_lds_direct_load>; 234def : SourceOfDivergence<int_amdgcn_lds_param_load>; 235def : SourceOfDivergence<int_amdgcn_mbcnt_hi>; 236def : SourceOfDivergence<int_amdgcn_mbcnt_lo>; 237def : SourceOfDivergence<int_r600_read_tidig_x>; 238def : SourceOfDivergence<int_r600_read_tidig_y>; 239def : SourceOfDivergence<int_r600_read_tidig_z>; 240def : SourceOfDivergence<int_amdgcn_atomic_cond_sub_u32>; 241def : SourceOfDivergence<int_amdgcn_global_atomic_csub>; 242def : SourceOfDivergence<int_amdgcn_global_atomic_fadd>; 243def : SourceOfDivergence<int_amdgcn_global_atomic_fmin>; 244def : SourceOfDivergence<int_amdgcn_global_atomic_fmax>; 245def : SourceOfDivergence<int_amdgcn_global_atomic_fmin_num>; 246def : SourceOfDivergence<int_amdgcn_global_atomic_fmax_num>; 247def : SourceOfDivergence<int_amdgcn_global_atomic_ordered_add_b64>; 248def : SourceOfDivergence<int_amdgcn_flat_atomic_fadd>; 249def : SourceOfDivergence<int_amdgcn_flat_atomic_fmin>; 250def : SourceOfDivergence<int_amdgcn_flat_atomic_fmax>; 251def : SourceOfDivergence<int_amdgcn_flat_atomic_fmin_num>; 252def : SourceOfDivergence<int_amdgcn_flat_atomic_fmax_num>; 253def : SourceOfDivergence<int_amdgcn_global_atomic_fadd_v2bf16>; 254def : SourceOfDivergence<int_amdgcn_flat_atomic_fadd_v2bf16>; 255def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_swap>; 256def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_add>; 257def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_sub>; 258def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_smin>; 259def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_umin>; 260def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_smax>; 261def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_umax>; 262def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_and>; 263def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_or>; 264def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_xor>; 265def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_inc>; 266def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_dec>; 267def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_fadd>; 268def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_fmin>; 269def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_fmax>; 270def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_cmpswap>; 271def : SourceOfDivergence<int_amdgcn_raw_buffer_atomic_cond_sub_u32>; 272def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_swap>; 273def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_add>; 274def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_sub>; 275def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_smin>; 276def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_umin>; 277def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_smax>; 278def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_umax>; 279def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_and>; 280def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_or>; 281def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_xor>; 282def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_inc>; 283def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_dec>; 284def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_fadd>; 285def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_fmin>; 286def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_fmax>; 287def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_cmpswap>; 288def : SourceOfDivergence<int_amdgcn_raw_ptr_buffer_atomic_cond_sub_u32>; 289def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_swap>; 290def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_add>; 291def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_sub>; 292def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_smin>; 293def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_umin>; 294def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_smax>; 295def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_umax>; 296def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_and>; 297def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_or>; 298def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_xor>; 299def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_inc>; 300def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_dec>; 301def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_fadd>; 302def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_fmin>; 303def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_fmax>; 304def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_cmpswap>; 305def : SourceOfDivergence<int_amdgcn_struct_buffer_atomic_cond_sub_u32>; 306def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_swap>; 307def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_add>; 308def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_sub>; 309def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_smin>; 310def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_umin>; 311def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_smax>; 312def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_umax>; 313def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_and>; 314def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_or>; 315def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_xor>; 316def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_inc>; 317def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_dec>; 318def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_fadd>; 319def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_fmin>; 320def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_fmax>; 321def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_cmpswap>; 322def : SourceOfDivergence<int_amdgcn_struct_ptr_buffer_atomic_cond_sub_u32>; 323def : SourceOfDivergence<int_amdgcn_ps_live>; 324def : SourceOfDivergence<int_amdgcn_live_mask>; 325def : SourceOfDivergence<int_amdgcn_ds_swizzle>; 326def : SourceOfDivergence<int_amdgcn_ds_ordered_add>; 327def : SourceOfDivergence<int_amdgcn_ds_ordered_swap>; 328def : SourceOfDivergence<int_amdgcn_permlane16>; 329def : SourceOfDivergence<int_amdgcn_permlanex16>; 330def : SourceOfDivergence<int_amdgcn_permlane16_var>; 331def : SourceOfDivergence<int_amdgcn_permlanex16_var>; 332def : SourceOfDivergence<int_amdgcn_mov_dpp>; 333def : SourceOfDivergence<int_amdgcn_mov_dpp8>; 334def : SourceOfDivergence<int_amdgcn_update_dpp>; 335def : SourceOfDivergence<int_amdgcn_writelane>; 336 337foreach intr = AMDGPUMFMAIntrinsics908 in 338def : SourceOfDivergence<intr>; 339foreach intr = AMDGPUMFMAIntrinsics90A in 340def : SourceOfDivergence<intr>; 341foreach intr = AMDGPUMFMAIntrinsics940 in 342def : SourceOfDivergence<intr>; 343foreach intr = AMDGPUWMMAIntrinsicsGFX11 in 344def : SourceOfDivergence<intr>; 345foreach intr = AMDGPUWMMAIntrinsicsGFX12 in 346def : SourceOfDivergence<intr>; 347 348def : SourceOfDivergence<int_amdgcn_global_load_tr_b64>; 349def : SourceOfDivergence<int_amdgcn_global_load_tr_b128>; 350 351// The dummy boolean output is divergent from the IR's perspective, 352// but the mask results are uniform. These produce a divergent and 353// uniform result, so the returned struct is collectively divergent. 354// isAlwaysUniform can override the extract of the uniform component. 355def : SourceOfDivergence<int_amdgcn_if>; 356def : SourceOfDivergence<int_amdgcn_else>; 357def : SourceOfDivergence<int_amdgcn_loop>; 358def : SourceOfDivergence<int_amdgcn_inverse_ballot>; 359 360foreach intr = AMDGPUImageDimAtomicIntrinsics in 361def : SourceOfDivergence<intr>; 362 363class AlwaysUniform<Intrinsic intr> { 364 Intrinsic Intr = intr; 365} 366 367def UniformIntrinsics : GenericTable { 368 let FilterClass = "AlwaysUniform"; 369 let Fields = ["Intr"]; 370 371 let PrimaryKey = ["Intr"]; 372 let PrimaryKeyName = "lookupAlwaysUniform"; 373} 374 375def : AlwaysUniform<int_amdgcn_readfirstlane>; 376def : AlwaysUniform<int_amdgcn_readlane>; 377def : AlwaysUniform<int_amdgcn_icmp>; 378def : AlwaysUniform<int_amdgcn_fcmp>; 379def : AlwaysUniform<int_amdgcn_ballot>; 380def : AlwaysUniform<int_amdgcn_if_break>; 381