1fd4e5da5Sopenharmony_ci// Copyright (c) 2017-2019 Google LLC 2fd4e5da5Sopenharmony_ci// 3fd4e5da5Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License"); 4fd4e5da5Sopenharmony_ci// you may not use this file except in compliance with the License. 5fd4e5da5Sopenharmony_ci// You may obtain a copy of the License at 6fd4e5da5Sopenharmony_ci// 7fd4e5da5Sopenharmony_ci// http://www.apache.org/licenses/LICENSE-2.0 8fd4e5da5Sopenharmony_ci// 9fd4e5da5Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software 10fd4e5da5Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS, 11fd4e5da5Sopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12fd4e5da5Sopenharmony_ci// See the License for the specific language governing permissions and 13fd4e5da5Sopenharmony_ci// limitations under the License. 14fd4e5da5Sopenharmony_ci 15fd4e5da5Sopenharmony_ci#include <string> 16fd4e5da5Sopenharmony_ci#include <vector> 17fd4e5da5Sopenharmony_ci 18fd4e5da5Sopenharmony_ci#include "OpenCLDebugInfo100.h" 19fd4e5da5Sopenharmony_ci#include "gmock/gmock.h" 20fd4e5da5Sopenharmony_ci#include "source/util/string_utils.h" 21fd4e5da5Sopenharmony_ci#include "test/test_fixture.h" 22fd4e5da5Sopenharmony_ci#include "test/unit_spirv.h" 23fd4e5da5Sopenharmony_ci 24fd4e5da5Sopenharmony_ci// This file tests the correctness of encoding and decoding of instructions 25fd4e5da5Sopenharmony_ci// involving the OpenCL.DebugInfo.100 extended instruction set. 26fd4e5da5Sopenharmony_ci// Validation is not checked here. 27fd4e5da5Sopenharmony_ci 28fd4e5da5Sopenharmony_cinamespace spvtools { 29fd4e5da5Sopenharmony_cinamespace { 30fd4e5da5Sopenharmony_ci 31fd4e5da5Sopenharmony_ciusing spvtest::Concatenate; 32fd4e5da5Sopenharmony_ciusing spvtest::MakeInstruction; 33fd4e5da5Sopenharmony_ciusing testing::Eq; 34fd4e5da5Sopenharmony_ciusing utils::MakeVector; 35fd4e5da5Sopenharmony_ci 36fd4e5da5Sopenharmony_ci// Test values of enums vs. what is written in the spec. 37fd4e5da5Sopenharmony_ci 38fd4e5da5Sopenharmony_ciTEST(ExtInstCLDebugInfo, InstructionValues) { 39fd4e5da5Sopenharmony_ci EXPECT_EQ(0, OpenCLDebugInfo100DebugInfoNone); 40fd4e5da5Sopenharmony_ci EXPECT_EQ(1, OpenCLDebugInfo100DebugCompilationUnit); 41fd4e5da5Sopenharmony_ci EXPECT_EQ(2, OpenCLDebugInfo100DebugTypeBasic); 42fd4e5da5Sopenharmony_ci EXPECT_EQ(3, OpenCLDebugInfo100DebugTypePointer); 43fd4e5da5Sopenharmony_ci EXPECT_EQ(4, OpenCLDebugInfo100DebugTypeQualifier); 44fd4e5da5Sopenharmony_ci EXPECT_EQ(5, OpenCLDebugInfo100DebugTypeArray); 45fd4e5da5Sopenharmony_ci EXPECT_EQ(6, OpenCLDebugInfo100DebugTypeVector); 46fd4e5da5Sopenharmony_ci EXPECT_EQ(7, OpenCLDebugInfo100DebugTypedef); 47fd4e5da5Sopenharmony_ci EXPECT_EQ(8, OpenCLDebugInfo100DebugTypeFunction); 48fd4e5da5Sopenharmony_ci EXPECT_EQ(9, OpenCLDebugInfo100DebugTypeEnum); 49fd4e5da5Sopenharmony_ci EXPECT_EQ(10, OpenCLDebugInfo100DebugTypeComposite); 50fd4e5da5Sopenharmony_ci EXPECT_EQ(11, OpenCLDebugInfo100DebugTypeMember); 51fd4e5da5Sopenharmony_ci EXPECT_EQ(12, OpenCLDebugInfo100DebugTypeInheritance); 52fd4e5da5Sopenharmony_ci EXPECT_EQ(13, OpenCLDebugInfo100DebugTypePtrToMember); 53fd4e5da5Sopenharmony_ci EXPECT_EQ(14, OpenCLDebugInfo100DebugTypeTemplate); 54fd4e5da5Sopenharmony_ci EXPECT_EQ(15, OpenCLDebugInfo100DebugTypeTemplateParameter); 55fd4e5da5Sopenharmony_ci EXPECT_EQ(16, OpenCLDebugInfo100DebugTypeTemplateTemplateParameter); 56fd4e5da5Sopenharmony_ci EXPECT_EQ(17, OpenCLDebugInfo100DebugTypeTemplateParameterPack); 57fd4e5da5Sopenharmony_ci EXPECT_EQ(18, OpenCLDebugInfo100DebugGlobalVariable); 58fd4e5da5Sopenharmony_ci EXPECT_EQ(19, OpenCLDebugInfo100DebugFunctionDeclaration); 59fd4e5da5Sopenharmony_ci EXPECT_EQ(20, OpenCLDebugInfo100DebugFunction); 60fd4e5da5Sopenharmony_ci EXPECT_EQ(21, OpenCLDebugInfo100DebugLexicalBlock); 61fd4e5da5Sopenharmony_ci EXPECT_EQ(22, OpenCLDebugInfo100DebugLexicalBlockDiscriminator); 62fd4e5da5Sopenharmony_ci EXPECT_EQ(23, OpenCLDebugInfo100DebugScope); 63fd4e5da5Sopenharmony_ci EXPECT_EQ(24, OpenCLDebugInfo100DebugNoScope); 64fd4e5da5Sopenharmony_ci EXPECT_EQ(25, OpenCLDebugInfo100DebugInlinedAt); 65fd4e5da5Sopenharmony_ci EXPECT_EQ(26, OpenCLDebugInfo100DebugLocalVariable); 66fd4e5da5Sopenharmony_ci EXPECT_EQ(27, OpenCLDebugInfo100DebugInlinedVariable); 67fd4e5da5Sopenharmony_ci EXPECT_EQ(28, OpenCLDebugInfo100DebugDeclare); 68fd4e5da5Sopenharmony_ci EXPECT_EQ(29, OpenCLDebugInfo100DebugValue); 69fd4e5da5Sopenharmony_ci EXPECT_EQ(30, OpenCLDebugInfo100DebugOperation); 70fd4e5da5Sopenharmony_ci EXPECT_EQ(31, OpenCLDebugInfo100DebugExpression); 71fd4e5da5Sopenharmony_ci EXPECT_EQ(32, OpenCLDebugInfo100DebugMacroDef); 72fd4e5da5Sopenharmony_ci EXPECT_EQ(33, OpenCLDebugInfo100DebugMacroUndef); 73fd4e5da5Sopenharmony_ci EXPECT_EQ(34, OpenCLDebugInfo100DebugImportedEntity); 74fd4e5da5Sopenharmony_ci EXPECT_EQ(35, OpenCLDebugInfo100DebugSource); 75fd4e5da5Sopenharmony_ci} 76fd4e5da5Sopenharmony_ci 77fd4e5da5Sopenharmony_ciTEST(ExtInstCLDebugInfo, InfoFlagValues) { 78fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 0, OpenCLDebugInfo100FlagIsProtected); 79fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 1, OpenCLDebugInfo100FlagIsPrivate); 80fd4e5da5Sopenharmony_ci EXPECT_EQ(((1 << 0) | (1 << 1)), OpenCLDebugInfo100FlagIsPublic); 81fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 2, OpenCLDebugInfo100FlagIsLocal); 82fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 3, OpenCLDebugInfo100FlagIsDefinition); 83fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 4, OpenCLDebugInfo100FlagFwdDecl); 84fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 5, OpenCLDebugInfo100FlagArtificial); 85fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 6, OpenCLDebugInfo100FlagExplicit); 86fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 7, OpenCLDebugInfo100FlagPrototyped); 87fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 8, OpenCLDebugInfo100FlagObjectPointer); 88fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 9, OpenCLDebugInfo100FlagStaticMember); 89fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 10, OpenCLDebugInfo100FlagIndirectVariable); 90fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 11, OpenCLDebugInfo100FlagLValueReference); 91fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 12, OpenCLDebugInfo100FlagRValueReference); 92fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 13, OpenCLDebugInfo100FlagIsOptimized); 93fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 14, OpenCLDebugInfo100FlagIsEnumClass); 94fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 15, OpenCLDebugInfo100FlagTypePassByValue); 95fd4e5da5Sopenharmony_ci EXPECT_EQ(1 << 16, OpenCLDebugInfo100FlagTypePassByReference); 96fd4e5da5Sopenharmony_ci} 97fd4e5da5Sopenharmony_ci 98fd4e5da5Sopenharmony_ciTEST(ExtInstCLDebugInfo, BaseTypeAttributeEndodingValues) { 99fd4e5da5Sopenharmony_ci EXPECT_EQ(0, OpenCLDebugInfo100Unspecified); 100fd4e5da5Sopenharmony_ci EXPECT_EQ(1, OpenCLDebugInfo100Address); 101fd4e5da5Sopenharmony_ci EXPECT_EQ(2, OpenCLDebugInfo100Boolean); 102fd4e5da5Sopenharmony_ci EXPECT_EQ(3, OpenCLDebugInfo100Float); 103fd4e5da5Sopenharmony_ci EXPECT_EQ(4, OpenCLDebugInfo100Signed); 104fd4e5da5Sopenharmony_ci EXPECT_EQ(5, OpenCLDebugInfo100SignedChar); 105fd4e5da5Sopenharmony_ci EXPECT_EQ(6, OpenCLDebugInfo100Unsigned); 106fd4e5da5Sopenharmony_ci EXPECT_EQ(7, OpenCLDebugInfo100UnsignedChar); 107fd4e5da5Sopenharmony_ci} 108fd4e5da5Sopenharmony_ci 109fd4e5da5Sopenharmony_ciTEST(ExtInstCLDebugInfo, CompositeTypeValues) { 110fd4e5da5Sopenharmony_ci EXPECT_EQ(0, OpenCLDebugInfo100Class); 111fd4e5da5Sopenharmony_ci EXPECT_EQ(1, OpenCLDebugInfo100Structure); 112fd4e5da5Sopenharmony_ci EXPECT_EQ(2, OpenCLDebugInfo100Union); 113fd4e5da5Sopenharmony_ci} 114fd4e5da5Sopenharmony_ci 115fd4e5da5Sopenharmony_ciTEST(ExtInstCLDebugInfo, TypeQualifierValues) { 116fd4e5da5Sopenharmony_ci EXPECT_EQ(0, OpenCLDebugInfo100ConstType); 117fd4e5da5Sopenharmony_ci EXPECT_EQ(1, OpenCLDebugInfo100VolatileType); 118fd4e5da5Sopenharmony_ci EXPECT_EQ(2, OpenCLDebugInfo100RestrictType); 119fd4e5da5Sopenharmony_ci EXPECT_EQ(3, OpenCLDebugInfo100AtomicType); 120fd4e5da5Sopenharmony_ci} 121fd4e5da5Sopenharmony_ci 122fd4e5da5Sopenharmony_ciTEST(ExtInstCLDebugInfo, DebugOperationValues) { 123fd4e5da5Sopenharmony_ci EXPECT_EQ(0, OpenCLDebugInfo100Deref); 124fd4e5da5Sopenharmony_ci EXPECT_EQ(1, OpenCLDebugInfo100Plus); 125fd4e5da5Sopenharmony_ci EXPECT_EQ(2, OpenCLDebugInfo100Minus); 126fd4e5da5Sopenharmony_ci EXPECT_EQ(3, OpenCLDebugInfo100PlusUconst); 127fd4e5da5Sopenharmony_ci EXPECT_EQ(4, OpenCLDebugInfo100BitPiece); 128fd4e5da5Sopenharmony_ci EXPECT_EQ(5, OpenCLDebugInfo100Swap); 129fd4e5da5Sopenharmony_ci EXPECT_EQ(6, OpenCLDebugInfo100Xderef); 130fd4e5da5Sopenharmony_ci EXPECT_EQ(7, OpenCLDebugInfo100StackValue); 131fd4e5da5Sopenharmony_ci EXPECT_EQ(8, OpenCLDebugInfo100Constu); 132fd4e5da5Sopenharmony_ci EXPECT_EQ(9, OpenCLDebugInfo100Fragment); 133fd4e5da5Sopenharmony_ci} 134fd4e5da5Sopenharmony_ci 135fd4e5da5Sopenharmony_ciTEST(ExtInstCLDebugInfo, ImportedEntityValues) { 136fd4e5da5Sopenharmony_ci EXPECT_EQ(0, OpenCLDebugInfo100ImportedModule); 137fd4e5da5Sopenharmony_ci EXPECT_EQ(1, OpenCLDebugInfo100ImportedDeclaration); 138fd4e5da5Sopenharmony_ci} 139fd4e5da5Sopenharmony_ci 140fd4e5da5Sopenharmony_ci// Test round trip through assembler and disassembler. 141fd4e5da5Sopenharmony_ci 142fd4e5da5Sopenharmony_cistruct InstructionCase { 143fd4e5da5Sopenharmony_ci uint32_t opcode; 144fd4e5da5Sopenharmony_ci std::string name; 145fd4e5da5Sopenharmony_ci std::string operands; 146fd4e5da5Sopenharmony_ci std::vector<uint32_t> expected_operands; 147fd4e5da5Sopenharmony_ci}; 148fd4e5da5Sopenharmony_ci 149fd4e5da5Sopenharmony_ciusing ExtInstCLDebugInfo100RoundTripTest = 150fd4e5da5Sopenharmony_ci spvtest::TextToBinaryTestBase<::testing::TestWithParam<InstructionCase>>; 151fd4e5da5Sopenharmony_ciusing ExtInstCLDebugInfo100RoundTripTestExplicit = spvtest::TextToBinaryTest; 152fd4e5da5Sopenharmony_ci 153fd4e5da5Sopenharmony_ciTEST_P(ExtInstCLDebugInfo100RoundTripTest, ParameterizedExtInst) { 154fd4e5da5Sopenharmony_ci const std::string input = 155fd4e5da5Sopenharmony_ci "%1 = OpExtInstImport \"OpenCL.DebugInfo.100\"\n" 156fd4e5da5Sopenharmony_ci "%3 = OpExtInst %2 %1 " + 157fd4e5da5Sopenharmony_ci GetParam().name + GetParam().operands + "\n"; 158fd4e5da5Sopenharmony_ci // First make sure it assembles correctly. 159fd4e5da5Sopenharmony_ci std::cout << input << std::endl; 160fd4e5da5Sopenharmony_ci EXPECT_THAT( 161fd4e5da5Sopenharmony_ci CompiledInstructions(input), 162fd4e5da5Sopenharmony_ci Eq(Concatenate( 163fd4e5da5Sopenharmony_ci {MakeInstruction(spv::Op::OpExtInstImport, {1}, 164fd4e5da5Sopenharmony_ci MakeVector("OpenCL.DebugInfo.100")), 165fd4e5da5Sopenharmony_ci MakeInstruction(spv::Op::OpExtInst, {2, 3, 1, GetParam().opcode}, 166fd4e5da5Sopenharmony_ci GetParam().expected_operands)}))) 167fd4e5da5Sopenharmony_ci << input; 168fd4e5da5Sopenharmony_ci // Now check the round trip through the disassembler. 169fd4e5da5Sopenharmony_ci EXPECT_THAT(EncodeAndDecodeSuccessfully(input), input) << input; 170fd4e5da5Sopenharmony_ci} 171fd4e5da5Sopenharmony_ci 172fd4e5da5Sopenharmony_ci#define EPREFIX "Debug" 173fd4e5da5Sopenharmony_ci 174fd4e5da5Sopenharmony_ci#define CASE_0(Enum) \ 175fd4e5da5Sopenharmony_ci { \ 176fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, "", {} \ 177fd4e5da5Sopenharmony_ci } 178fd4e5da5Sopenharmony_ci 179fd4e5da5Sopenharmony_ci#define CASE_ILL(Enum, L0, L1) \ 180fd4e5da5Sopenharmony_ci { \ 181fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 182fd4e5da5Sopenharmony_ci " %4 " #L0 " " #L1, { \ 183fd4e5da5Sopenharmony_ci 4, L0, L1 \ 184fd4e5da5Sopenharmony_ci } \ 185fd4e5da5Sopenharmony_ci } 186fd4e5da5Sopenharmony_ci 187fd4e5da5Sopenharmony_ci#define CASE_IL(Enum, L0) \ 188fd4e5da5Sopenharmony_ci { \ 189fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " %4 " #L0, { \ 190fd4e5da5Sopenharmony_ci 4, L0 \ 191fd4e5da5Sopenharmony_ci } \ 192fd4e5da5Sopenharmony_ci } 193fd4e5da5Sopenharmony_ci 194fd4e5da5Sopenharmony_ci#define CASE_I(Enum) \ 195fd4e5da5Sopenharmony_ci { \ 196fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " %4", { 4 } \ 197fd4e5da5Sopenharmony_ci } 198fd4e5da5Sopenharmony_ci 199fd4e5da5Sopenharmony_ci#define CASE_II(Enum) \ 200fd4e5da5Sopenharmony_ci { \ 201fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " %4 %5", { 4, 5 } \ 202fd4e5da5Sopenharmony_ci } 203fd4e5da5Sopenharmony_ci 204fd4e5da5Sopenharmony_ci#define CASE_III(Enum) \ 205fd4e5da5Sopenharmony_ci { \ 206fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " %4 %5 %6", { \ 207fd4e5da5Sopenharmony_ci 4, 5, 6 \ 208fd4e5da5Sopenharmony_ci } \ 209fd4e5da5Sopenharmony_ci } 210fd4e5da5Sopenharmony_ci 211fd4e5da5Sopenharmony_ci#define CASE_IIII(Enum) \ 212fd4e5da5Sopenharmony_ci { \ 213fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " %4 %5 %6 %7", { \ 214fd4e5da5Sopenharmony_ci 4, 5, 6, 7 \ 215fd4e5da5Sopenharmony_ci } \ 216fd4e5da5Sopenharmony_ci } 217fd4e5da5Sopenharmony_ci 218fd4e5da5Sopenharmony_ci#define CASE_IIIII(Enum) \ 219fd4e5da5Sopenharmony_ci { \ 220fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " %4 %5 %6 %7 %8", \ 221fd4e5da5Sopenharmony_ci { \ 222fd4e5da5Sopenharmony_ci 4, 5, 6, 7, 8 \ 223fd4e5da5Sopenharmony_ci } \ 224fd4e5da5Sopenharmony_ci } 225fd4e5da5Sopenharmony_ci 226fd4e5da5Sopenharmony_ci#define CASE_IIIIII(Enum) \ 227fd4e5da5Sopenharmony_ci { \ 228fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 229fd4e5da5Sopenharmony_ci " %4 %5 %6 %7 %8 %9", { \ 230fd4e5da5Sopenharmony_ci 4, 5, 6, 7, 8, 9 \ 231fd4e5da5Sopenharmony_ci } \ 232fd4e5da5Sopenharmony_ci } 233fd4e5da5Sopenharmony_ci 234fd4e5da5Sopenharmony_ci#define CASE_IIIIIII(Enum) \ 235fd4e5da5Sopenharmony_ci { \ 236fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 237fd4e5da5Sopenharmony_ci " %4 %5 %6 %7 %8 %9 %10", { \ 238fd4e5da5Sopenharmony_ci 4, 5, 6, 7, 8, 9, 10 \ 239fd4e5da5Sopenharmony_ci } \ 240fd4e5da5Sopenharmony_ci } 241fd4e5da5Sopenharmony_ci 242fd4e5da5Sopenharmony_ci#define CASE_IIILLI(Enum, L0, L1) \ 243fd4e5da5Sopenharmony_ci { \ 244fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 245fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7", { \ 246fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7 \ 247fd4e5da5Sopenharmony_ci } \ 248fd4e5da5Sopenharmony_ci } 249fd4e5da5Sopenharmony_ci 250fd4e5da5Sopenharmony_ci#define CASE_IIILLIF(Enum, L0, L1, Fstr, Fnum) \ 251fd4e5da5Sopenharmony_ci { \ 252fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 253fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 " Fstr, { \ 254fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, Fnum \ 255fd4e5da5Sopenharmony_ci } \ 256fd4e5da5Sopenharmony_ci } 257fd4e5da5Sopenharmony_ci 258fd4e5da5Sopenharmony_ci#define CASE_IIILLIFL(Enum, L0, L1, Fstr, Fnum, L2) \ 259fd4e5da5Sopenharmony_ci { \ 260fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 261fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 " Fstr " " #L2, { \ 262fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, Fnum, L2 \ 263fd4e5da5Sopenharmony_ci } \ 264fd4e5da5Sopenharmony_ci } 265fd4e5da5Sopenharmony_ci 266fd4e5da5Sopenharmony_ci#define CASE_IIILLIL(Enum, L0, L1, L2) \ 267fd4e5da5Sopenharmony_ci { \ 268fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 269fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 " #L2, { \ 270fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, L2 \ 271fd4e5da5Sopenharmony_ci } \ 272fd4e5da5Sopenharmony_ci } 273fd4e5da5Sopenharmony_ci 274fd4e5da5Sopenharmony_ci#define CASE_IE(Enum, E0) \ 275fd4e5da5Sopenharmony_ci { \ 276fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " %4 " #E0, { \ 277fd4e5da5Sopenharmony_ci 4, uint32_t(OpenCLDebugInfo100##E0) \ 278fd4e5da5Sopenharmony_ci } \ 279fd4e5da5Sopenharmony_ci } 280fd4e5da5Sopenharmony_ci 281fd4e5da5Sopenharmony_ci#define CASE_IEIILLI(Enum, E0, L1, L2) \ 282fd4e5da5Sopenharmony_ci { \ 283fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 284fd4e5da5Sopenharmony_ci " %4 " #E0 " %5 %6 " #L1 " " #L2 " %7", { \ 285fd4e5da5Sopenharmony_ci 4, uint32_t(OpenCLDebugInfo100##E0), 5, 6, L1, L2, 7 \ 286fd4e5da5Sopenharmony_ci } \ 287fd4e5da5Sopenharmony_ci } 288fd4e5da5Sopenharmony_ci 289fd4e5da5Sopenharmony_ci#define CASE_IIE(Enum, E0) \ 290fd4e5da5Sopenharmony_ci { \ 291fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " %4 %5 " #E0, { \ 292fd4e5da5Sopenharmony_ci 4, 5, uint32_t(OpenCLDebugInfo100##E0) \ 293fd4e5da5Sopenharmony_ci } \ 294fd4e5da5Sopenharmony_ci } 295fd4e5da5Sopenharmony_ci 296fd4e5da5Sopenharmony_ci#define CASE_ISF(Enum, S0, Fstr, Fnum) \ 297fd4e5da5Sopenharmony_ci { \ 298fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 299fd4e5da5Sopenharmony_ci " %4 " #S0 " " Fstr, { \ 300fd4e5da5Sopenharmony_ci 4, uint32_t(spv::StorageClass::S0), Fnum \ 301fd4e5da5Sopenharmony_ci } \ 302fd4e5da5Sopenharmony_ci } 303fd4e5da5Sopenharmony_ci 304fd4e5da5Sopenharmony_ci#define CASE_LII(Enum, L0) \ 305fd4e5da5Sopenharmony_ci { \ 306fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " " #L0 " %4 %5", \ 307fd4e5da5Sopenharmony_ci { \ 308fd4e5da5Sopenharmony_ci L0, 4, 5 \ 309fd4e5da5Sopenharmony_ci } \ 310fd4e5da5Sopenharmony_ci } 311fd4e5da5Sopenharmony_ci 312fd4e5da5Sopenharmony_ci#define CASE_LLIe(Enum, L0, L1, RawEnumName, RawEnumValue) \ 313fd4e5da5Sopenharmony_ci { \ 314fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 315fd4e5da5Sopenharmony_ci " " #L0 " " #L1 " %4 " RawEnumName, { \ 316fd4e5da5Sopenharmony_ci L0, L1, 4, (uint32_t)RawEnumValue \ 317fd4e5da5Sopenharmony_ci } \ 318fd4e5da5Sopenharmony_ci } 319fd4e5da5Sopenharmony_ci 320fd4e5da5Sopenharmony_ci#define CASE_ILI(Enum, L0) \ 321fd4e5da5Sopenharmony_ci { \ 322fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " %4 " #L0 " %5", \ 323fd4e5da5Sopenharmony_ci { \ 324fd4e5da5Sopenharmony_ci 4, L0, 5 \ 325fd4e5da5Sopenharmony_ci } \ 326fd4e5da5Sopenharmony_ci } 327fd4e5da5Sopenharmony_ci 328fd4e5da5Sopenharmony_ci#define CASE_ILII(Enum, L0) \ 329fd4e5da5Sopenharmony_ci { \ 330fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 331fd4e5da5Sopenharmony_ci " %4 " #L0 " %5 %6", { \ 332fd4e5da5Sopenharmony_ci 4, L0, 5, 6 \ 333fd4e5da5Sopenharmony_ci } \ 334fd4e5da5Sopenharmony_ci } 335fd4e5da5Sopenharmony_ci 336fd4e5da5Sopenharmony_ci#define CASE_ILLII(Enum, L0, L1) \ 337fd4e5da5Sopenharmony_ci { \ 338fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 339fd4e5da5Sopenharmony_ci " %4 " #L0 " " #L1 " %5 %6", { \ 340fd4e5da5Sopenharmony_ci 4, L0, L1, 5, 6 \ 341fd4e5da5Sopenharmony_ci } \ 342fd4e5da5Sopenharmony_ci } 343fd4e5da5Sopenharmony_ci 344fd4e5da5Sopenharmony_ci#define CASE_IIILLIIF(Enum, L0, L1, Fstr, Fnum) \ 345fd4e5da5Sopenharmony_ci { \ 346fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 347fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr, { \ 348fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, 8, Fnum \ 349fd4e5da5Sopenharmony_ci } \ 350fd4e5da5Sopenharmony_ci } 351fd4e5da5Sopenharmony_ci 352fd4e5da5Sopenharmony_ci#define CASE_IIILLIIFII(Enum, L0, L1, Fstr, Fnum) \ 353fd4e5da5Sopenharmony_ci { \ 354fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 355fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr " %9 %10", { \ 356fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, 8, Fnum, 9, 10 \ 357fd4e5da5Sopenharmony_ci } \ 358fd4e5da5Sopenharmony_ci } 359fd4e5da5Sopenharmony_ci 360fd4e5da5Sopenharmony_ci#define CASE_IIILLIIFIIII(Enum, L0, L1, Fstr, Fnum) \ 361fd4e5da5Sopenharmony_ci { \ 362fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 363fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr " %9 %10 %11 %12", { \ 364fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, 8, Fnum, 9, 10, 11, 12 \ 365fd4e5da5Sopenharmony_ci } \ 366fd4e5da5Sopenharmony_ci } 367fd4e5da5Sopenharmony_ci 368fd4e5da5Sopenharmony_ci#define CASE_IIILLIIFIIIIII(Enum, L0, L1, Fstr, Fnum) \ 369fd4e5da5Sopenharmony_ci { \ 370fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 371fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr " %9 %10 %11 %12 %13 %14", { \ 372fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, 8, Fnum, 9, 10, 11, 12, 13, 14 \ 373fd4e5da5Sopenharmony_ci } \ 374fd4e5da5Sopenharmony_ci } 375fd4e5da5Sopenharmony_ci 376fd4e5da5Sopenharmony_ci#define CASE_IEILLIIIF(Enum, E0, L0, L1, Fstr, Fnum) \ 377fd4e5da5Sopenharmony_ci { \ 378fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 379fd4e5da5Sopenharmony_ci " %4 " #E0 " %5 " #L0 " " #L1 " %6 %7 %8 " Fstr, { \ 380fd4e5da5Sopenharmony_ci 4, uint32_t(OpenCLDebugInfo100##E0), 5, L0, L1, 6, 7, 8, Fnum \ 381fd4e5da5Sopenharmony_ci } \ 382fd4e5da5Sopenharmony_ci } 383fd4e5da5Sopenharmony_ci 384fd4e5da5Sopenharmony_ci#define CASE_IEILLIIIFI(Enum, E0, L0, L1, Fstr, Fnum) \ 385fd4e5da5Sopenharmony_ci { \ 386fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 387fd4e5da5Sopenharmony_ci " %4 " #E0 " %5 " #L0 " " #L1 " %6 %7 %8 " Fstr " %9", { \ 388fd4e5da5Sopenharmony_ci 4, uint32_t(OpenCLDebugInfo100##E0), 5, L0, L1, 6, 7, 8, Fnum, 9 \ 389fd4e5da5Sopenharmony_ci } \ 390fd4e5da5Sopenharmony_ci } 391fd4e5da5Sopenharmony_ci 392fd4e5da5Sopenharmony_ci#define CASE_IEILLIIIFII(Enum, E0, L0, L1, Fstr, Fnum) \ 393fd4e5da5Sopenharmony_ci { \ 394fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 395fd4e5da5Sopenharmony_ci " %4 " #E0 " %5 " #L0 " " #L1 " %6 %7 %8 " Fstr " %9 %10", { \ 396fd4e5da5Sopenharmony_ci 4, uint32_t(OpenCLDebugInfo100##E0), 5, L0, L1, 6, 7, 8, Fnum, 9, 10 \ 397fd4e5da5Sopenharmony_ci } \ 398fd4e5da5Sopenharmony_ci } 399fd4e5da5Sopenharmony_ci 400fd4e5da5Sopenharmony_ci#define CASE_IEILLIIIFIII(Enum, E0, L0, L1, Fstr, Fnum) \ 401fd4e5da5Sopenharmony_ci { \ 402fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 403fd4e5da5Sopenharmony_ci " %4 " #E0 " %5 " #L0 " " #L1 " %6 %7 %8 " Fstr " %9 %10 %11", { \ 404fd4e5da5Sopenharmony_ci 4, uint32_t(OpenCLDebugInfo100##E0), 5, L0, L1, 6, 7, 8, Fnum, 9, 10, 11 \ 405fd4e5da5Sopenharmony_ci } \ 406fd4e5da5Sopenharmony_ci } 407fd4e5da5Sopenharmony_ci 408fd4e5da5Sopenharmony_ci#define CASE_IEILLIIIFIIII(Enum, E0, L0, L1, Fstr, Fnum) \ 409fd4e5da5Sopenharmony_ci { \ 410fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 411fd4e5da5Sopenharmony_ci " %4 " #E0 " %5 " #L0 " " #L1 " %6 %7 %8 " Fstr " %9 %10 %11 %12", { \ 412fd4e5da5Sopenharmony_ci 4, uint32_t(OpenCLDebugInfo100##E0), 5, L0, L1, 6, 7, 8, Fnum, 9, 10, \ 413fd4e5da5Sopenharmony_ci 11, 12 \ 414fd4e5da5Sopenharmony_ci } \ 415fd4e5da5Sopenharmony_ci } 416fd4e5da5Sopenharmony_ci 417fd4e5da5Sopenharmony_ci#define CASE_IIILLIIIF(Enum, L0, L1, Fstr, Fnum) \ 418fd4e5da5Sopenharmony_ci { \ 419fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 420fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 %8 %9 " Fstr, { \ 421fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, 8, 9, Fnum \ 422fd4e5da5Sopenharmony_ci } \ 423fd4e5da5Sopenharmony_ci } 424fd4e5da5Sopenharmony_ci 425fd4e5da5Sopenharmony_ci#define CASE_IIILLIIIFI(Enum, L0, L1, Fstr, Fnum) \ 426fd4e5da5Sopenharmony_ci { \ 427fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 428fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 %8 %9 " Fstr " %10", { \ 429fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, 8, 9, Fnum, 10 \ 430fd4e5da5Sopenharmony_ci } \ 431fd4e5da5Sopenharmony_ci } 432fd4e5da5Sopenharmony_ci 433fd4e5da5Sopenharmony_ci#define CASE_IIIIF(Enum, Fstr, Fnum) \ 434fd4e5da5Sopenharmony_ci { \ 435fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 436fd4e5da5Sopenharmony_ci " %4 %5 %6 %7 " Fstr, { \ 437fd4e5da5Sopenharmony_ci 4, 5, 6, 7, Fnum \ 438fd4e5da5Sopenharmony_ci } \ 439fd4e5da5Sopenharmony_ci } 440fd4e5da5Sopenharmony_ci 441fd4e5da5Sopenharmony_ci#define CASE_IIILL(Enum, L0, L1) \ 442fd4e5da5Sopenharmony_ci { \ 443fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 444fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1, { \ 445fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1 \ 446fd4e5da5Sopenharmony_ci } \ 447fd4e5da5Sopenharmony_ci } 448fd4e5da5Sopenharmony_ci 449fd4e5da5Sopenharmony_ci#define CASE_IIIILL(Enum, L0, L1) \ 450fd4e5da5Sopenharmony_ci { \ 451fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 452fd4e5da5Sopenharmony_ci " %4 %5 %6 %7 " #L0 " " #L1, { \ 453fd4e5da5Sopenharmony_ci 4, 5, 6, 7, L0, L1 \ 454fd4e5da5Sopenharmony_ci } \ 455fd4e5da5Sopenharmony_ci } 456fd4e5da5Sopenharmony_ci 457fd4e5da5Sopenharmony_ci#define CASE_IILLI(Enum, L0, L1) \ 458fd4e5da5Sopenharmony_ci { \ 459fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 460fd4e5da5Sopenharmony_ci " %4 %5 " #L0 " " #L1 " %6", { \ 461fd4e5da5Sopenharmony_ci 4, 5, L0, L1, 6 \ 462fd4e5da5Sopenharmony_ci } \ 463fd4e5da5Sopenharmony_ci } 464fd4e5da5Sopenharmony_ci 465fd4e5da5Sopenharmony_ci#define CASE_IILLII(Enum, L0, L1) \ 466fd4e5da5Sopenharmony_ci { \ 467fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 468fd4e5da5Sopenharmony_ci " %4 %5 " #L0 " " #L1 " %6 %7", { \ 469fd4e5da5Sopenharmony_ci 4, 5, L0, L1, 6, 7 \ 470fd4e5da5Sopenharmony_ci } \ 471fd4e5da5Sopenharmony_ci } 472fd4e5da5Sopenharmony_ci 473fd4e5da5Sopenharmony_ci#define CASE_IILLIII(Enum, L0, L1) \ 474fd4e5da5Sopenharmony_ci { \ 475fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 476fd4e5da5Sopenharmony_ci " %4 %5 " #L0 " " #L1 " %6 %7 %8", { \ 477fd4e5da5Sopenharmony_ci 4, 5, L0, L1, 6, 7, 8 \ 478fd4e5da5Sopenharmony_ci } \ 479fd4e5da5Sopenharmony_ci } 480fd4e5da5Sopenharmony_ci 481fd4e5da5Sopenharmony_ci#define CASE_IILLIIII(Enum, L0, L1) \ 482fd4e5da5Sopenharmony_ci { \ 483fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 484fd4e5da5Sopenharmony_ci " %4 %5 " #L0 " " #L1 " %6 %7 %8 %9", { \ 485fd4e5da5Sopenharmony_ci 4, 5, L0, L1, 6, 7, 8, 9 \ 486fd4e5da5Sopenharmony_ci } \ 487fd4e5da5Sopenharmony_ci } 488fd4e5da5Sopenharmony_ci 489fd4e5da5Sopenharmony_ci#define CASE_IIILLIIFLI(Enum, L0, L1, Fstr, Fnum, L2) \ 490fd4e5da5Sopenharmony_ci { \ 491fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 492fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr " " #L2 " %9", { \ 493fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, 8, Fnum, L2, 9 \ 494fd4e5da5Sopenharmony_ci } \ 495fd4e5da5Sopenharmony_ci } 496fd4e5da5Sopenharmony_ci 497fd4e5da5Sopenharmony_ci#define CASE_IIILLIIFLII(Enum, L0, L1, Fstr, Fnum, L2) \ 498fd4e5da5Sopenharmony_ci { \ 499fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 500fd4e5da5Sopenharmony_ci " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr " " #L2 " %9 %10", { \ 501fd4e5da5Sopenharmony_ci 4, 5, 6, L0, L1, 7, 8, Fnum, L2, 9, 10 \ 502fd4e5da5Sopenharmony_ci } \ 503fd4e5da5Sopenharmony_ci } 504fd4e5da5Sopenharmony_ci 505fd4e5da5Sopenharmony_ci#define CASE_E(Enum, E0) \ 506fd4e5da5Sopenharmony_ci { \ 507fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " " #E0, { \ 508fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100##E0) \ 509fd4e5da5Sopenharmony_ci } \ 510fd4e5da5Sopenharmony_ci } 511fd4e5da5Sopenharmony_ci 512fd4e5da5Sopenharmony_ci#define CASE_EI(Enum, E0) \ 513fd4e5da5Sopenharmony_ci { \ 514fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " " #E0 " %4", { \ 515fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100##E0), 4 \ 516fd4e5da5Sopenharmony_ci } \ 517fd4e5da5Sopenharmony_ci } 518fd4e5da5Sopenharmony_ci 519fd4e5da5Sopenharmony_ci#define CASE_EII(Enum, E0) \ 520fd4e5da5Sopenharmony_ci { \ 521fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " " #E0 " %4 %5", \ 522fd4e5da5Sopenharmony_ci { \ 523fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100##E0), 4, 5 \ 524fd4e5da5Sopenharmony_ci } \ 525fd4e5da5Sopenharmony_ci } 526fd4e5da5Sopenharmony_ci 527fd4e5da5Sopenharmony_ci#define CASE_EIII(Enum, E0) \ 528fd4e5da5Sopenharmony_ci { \ 529fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 530fd4e5da5Sopenharmony_ci " " #E0 " %4 %5 %6", { \ 531fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100##E0), 4, 5, 6 \ 532fd4e5da5Sopenharmony_ci } \ 533fd4e5da5Sopenharmony_ci } 534fd4e5da5Sopenharmony_ci 535fd4e5da5Sopenharmony_ci#define CASE_EIIII(Enum, E0) \ 536fd4e5da5Sopenharmony_ci { \ 537fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 538fd4e5da5Sopenharmony_ci " " #E0 " %4 %5 %6 %7", { \ 539fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100##E0), 4, 5, 6, 7 \ 540fd4e5da5Sopenharmony_ci } \ 541fd4e5da5Sopenharmony_ci } 542fd4e5da5Sopenharmony_ci 543fd4e5da5Sopenharmony_ci#define CASE_EIIIII(Enum, E0) \ 544fd4e5da5Sopenharmony_ci { \ 545fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 546fd4e5da5Sopenharmony_ci " " #E0 " %4 %5 %6 %7 %8", { \ 547fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100##E0), 4, 5, 6, 7, 8 \ 548fd4e5da5Sopenharmony_ci } \ 549fd4e5da5Sopenharmony_ci } 550fd4e5da5Sopenharmony_ci 551fd4e5da5Sopenharmony_ci#define CASE_EL(Enum, E0, L0) \ 552fd4e5da5Sopenharmony_ci { \ 553fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, " " #E0 " " #L0, { \ 554fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100##E0), L0 \ 555fd4e5da5Sopenharmony_ci } \ 556fd4e5da5Sopenharmony_ci } 557fd4e5da5Sopenharmony_ci 558fd4e5da5Sopenharmony_ci#define CASE_ELL(Enum, E0, L0, L1) \ 559fd4e5da5Sopenharmony_ci { \ 560fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100Debug##Enum), EPREFIX #Enum, \ 561fd4e5da5Sopenharmony_ci " " #E0 " " #L0 " " #L1, { \ 562fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100##E0), L0, L1 \ 563fd4e5da5Sopenharmony_ci } \ 564fd4e5da5Sopenharmony_ci } 565fd4e5da5Sopenharmony_ci 566fd4e5da5Sopenharmony_ci// OpenCL.DebugInfo.100 4.1 Missing Debugging Information 567fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugInfoNone, 568fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 569fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 570fd4e5da5Sopenharmony_ci CASE_0(InfoNone), // enum value 0 571fd4e5da5Sopenharmony_ci }))); 572fd4e5da5Sopenharmony_ci 573fd4e5da5Sopenharmony_ci// OpenCL.DebugInfo.100 4.2 Compilation Unit 574fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 575fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugCompilationUnit, ExtInstCLDebugInfo100RoundTripTest, 576fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 577fd4e5da5Sopenharmony_ci CASE_LLIe(CompilationUnit, 100, 42, "HLSL", spv::SourceLanguage::HLSL), 578fd4e5da5Sopenharmony_ci }))); 579fd4e5da5Sopenharmony_ci 580fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 581fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugSource, ExtInstCLDebugInfo100RoundTripTest, 582fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 583fd4e5da5Sopenharmony_ci // TODO(dneto): Should this be a list of sourc texts, 584fd4e5da5Sopenharmony_ci // to accommodate length limits? 585fd4e5da5Sopenharmony_ci CASE_I(Source), 586fd4e5da5Sopenharmony_ci CASE_II(Source), 587fd4e5da5Sopenharmony_ci }))); 588fd4e5da5Sopenharmony_ci 589fd4e5da5Sopenharmony_ci// OpenCL.DebugInfo.100 4.3 Type instructions 590fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypeBasic, 591fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 592fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 593fd4e5da5Sopenharmony_ci CASE_IIE(TypeBasic, Unspecified), 594fd4e5da5Sopenharmony_ci CASE_IIE(TypeBasic, Address), 595fd4e5da5Sopenharmony_ci CASE_IIE(TypeBasic, Boolean), 596fd4e5da5Sopenharmony_ci CASE_IIE(TypeBasic, Float), 597fd4e5da5Sopenharmony_ci CASE_IIE(TypeBasic, Signed), 598fd4e5da5Sopenharmony_ci CASE_IIE(TypeBasic, SignedChar), 599fd4e5da5Sopenharmony_ci CASE_IIE(TypeBasic, Unsigned), 600fd4e5da5Sopenharmony_ci CASE_IIE(TypeBasic, UnsignedChar), 601fd4e5da5Sopenharmony_ci }))); 602fd4e5da5Sopenharmony_ci 603fd4e5da5Sopenharmony_ci// The FlagIsPublic is value is (1 << 0) | (1 << 2) which is the same 604fd4e5da5Sopenharmony_ci// as the bitwise-OR of FlagIsProtected and FlagIsPrivate. 605fd4e5da5Sopenharmony_ci// The disassembler will emit the compound expression instead. 606fd4e5da5Sopenharmony_ci// There is no simple fix for this. This enum is not really a mask 607fd4e5da5Sopenharmony_ci// for the bottom two bits. 608fd4e5da5Sopenharmony_ciTEST_F(ExtInstCLDebugInfo100RoundTripTestExplicit, FlagIsPublic) { 609fd4e5da5Sopenharmony_ci const std::string prefix = 610fd4e5da5Sopenharmony_ci "%1 = OpExtInstImport \"DebugInfo\"\n" 611fd4e5da5Sopenharmony_ci "%3 = OpExtInst %2 %1 DebugTypePointer %4 Private "; 612fd4e5da5Sopenharmony_ci const std::string input = prefix + "FlagIsPublic\n"; 613fd4e5da5Sopenharmony_ci const std::string expected = prefix + "FlagIsProtected|FlagIsPrivate\n"; 614fd4e5da5Sopenharmony_ci // First make sure it assembles correctly. 615fd4e5da5Sopenharmony_ci EXPECT_THAT(CompiledInstructions(input), 616fd4e5da5Sopenharmony_ci Eq(Concatenate( 617fd4e5da5Sopenharmony_ci {MakeInstruction(spv::Op::OpExtInstImport, {1}, 618fd4e5da5Sopenharmony_ci MakeVector("DebugInfo")), 619fd4e5da5Sopenharmony_ci MakeInstruction(spv::Op::OpExtInst, 620fd4e5da5Sopenharmony_ci {2, 3, 1, OpenCLDebugInfo100DebugTypePointer, 621fd4e5da5Sopenharmony_ci 4, uint32_t(spv::StorageClass::Private), 622fd4e5da5Sopenharmony_ci OpenCLDebugInfo100FlagIsPublic})}))) 623fd4e5da5Sopenharmony_ci << input; 624fd4e5da5Sopenharmony_ci // Now check the round trip through the disassembler. 625fd4e5da5Sopenharmony_ci EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(expected)) << input; 626fd4e5da5Sopenharmony_ci} 627fd4e5da5Sopenharmony_ci 628fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 629fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugTypePointer, ExtInstCLDebugInfo100RoundTripTest, 630fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 631fd4e5da5Sopenharmony_ci 632fd4e5da5Sopenharmony_ci //// Use each flag independently. 633fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagIsProtected", 634fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsProtected)), 635fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagIsPrivate", 636fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 637fd4e5da5Sopenharmony_ci 638fd4e5da5Sopenharmony_ci // FlagIsPublic is tested above. 639fd4e5da5Sopenharmony_ci 640fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagIsLocal", 641fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsLocal)), 642fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagIsDefinition", 643fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsDefinition)), 644fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagFwdDecl", 645fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagFwdDecl)), 646fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagArtificial", 647fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagArtificial)), 648fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagExplicit", 649fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagExplicit)), 650fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagPrototyped", 651fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagPrototyped)), 652fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagObjectPointer", 653fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagObjectPointer)), 654fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagStaticMember", 655fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagStaticMember)), 656fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagIndirectVariable", 657fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIndirectVariable)), 658fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagLValueReference", 659fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagLValueReference)), 660fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagIsOptimized", 661fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized)), 662fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagIsEnumClass", 663fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsEnumClass)), 664fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagTypePassByValue", 665fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagTypePassByValue)), 666fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Private, "FlagTypePassByReference", 667fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagTypePassByReference)), 668fd4e5da5Sopenharmony_ci 669fd4e5da5Sopenharmony_ci //// Use flags in combination, and try different storage classes. 670fd4e5da5Sopenharmony_ci CASE_ISF(TypePointer, Function, "FlagIsProtected|FlagIsPrivate", 671fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsProtected) | 672fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 673fd4e5da5Sopenharmony_ci CASE_ISF( 674fd4e5da5Sopenharmony_ci TypePointer, Workgroup, 675fd4e5da5Sopenharmony_ci "FlagIsPrivate|FlagFwdDecl|FlagIndirectVariable|FlagIsOptimized", 676fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate) | 677fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagFwdDecl) | 678fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIndirectVariable) | 679fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized)), 680fd4e5da5Sopenharmony_ci 681fd4e5da5Sopenharmony_ci }))); 682fd4e5da5Sopenharmony_ci 683fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypeQualifier, 684fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 685fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 686fd4e5da5Sopenharmony_ci CASE_IE(TypeQualifier, ConstType), 687fd4e5da5Sopenharmony_ci CASE_IE(TypeQualifier, VolatileType), 688fd4e5da5Sopenharmony_ci CASE_IE(TypeQualifier, RestrictType), 689fd4e5da5Sopenharmony_ci CASE_IE(TypeQualifier, AtomicType), 690fd4e5da5Sopenharmony_ci }))); 691fd4e5da5Sopenharmony_ci 692fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypeArray, 693fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 694fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 695fd4e5da5Sopenharmony_ci CASE_II(TypeArray), 696fd4e5da5Sopenharmony_ci CASE_III(TypeArray), 697fd4e5da5Sopenharmony_ci CASE_IIII(TypeArray), 698fd4e5da5Sopenharmony_ci CASE_IIIII(TypeArray), 699fd4e5da5Sopenharmony_ci }))); 700fd4e5da5Sopenharmony_ci 701fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypeVector, 702fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 703fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 704fd4e5da5Sopenharmony_ci CASE_IL(TypeVector, 2), 705fd4e5da5Sopenharmony_ci CASE_IL(TypeVector, 3), 706fd4e5da5Sopenharmony_ci CASE_IL(TypeVector, 4), 707fd4e5da5Sopenharmony_ci CASE_IL(TypeVector, 16), 708fd4e5da5Sopenharmony_ci }))); 709fd4e5da5Sopenharmony_ci 710fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypedef, 711fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 712fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 713fd4e5da5Sopenharmony_ci CASE_IIILLI(Typedef, 12, 13), 714fd4e5da5Sopenharmony_ci CASE_IIILLI(Typedef, 14, 99), 715fd4e5da5Sopenharmony_ci }))); 716fd4e5da5Sopenharmony_ci 717fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypeFunction, 718fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 719fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 720fd4e5da5Sopenharmony_ci CASE_EI(TypeFunction, FlagIsProtected), 721fd4e5da5Sopenharmony_ci CASE_EII(TypeFunction, FlagIsDefinition), 722fd4e5da5Sopenharmony_ci CASE_EIII(TypeFunction, FlagArtificial), 723fd4e5da5Sopenharmony_ci CASE_EIIII(TypeFunction, FlagExplicit), 724fd4e5da5Sopenharmony_ci CASE_EIIIII(TypeFunction, FlagIsPrivate), 725fd4e5da5Sopenharmony_ci }))); 726fd4e5da5Sopenharmony_ci 727fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 728fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugTypeEnum, ExtInstCLDebugInfo100RoundTripTest, 729fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 730fd4e5da5Sopenharmony_ci CASE_IIILLIIFII( 731fd4e5da5Sopenharmony_ci TypeEnum, 12, 13, 732fd4e5da5Sopenharmony_ci "FlagIsPrivate|FlagFwdDecl|FlagIndirectVariable|FlagIsOptimized", 733fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate) | 734fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagFwdDecl) | 735fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIndirectVariable) | 736fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized)), 737fd4e5da5Sopenharmony_ci CASE_IIILLIIFIIII(TypeEnum, 17, 18, "FlagStaticMember", 738fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagStaticMember)), 739fd4e5da5Sopenharmony_ci CASE_IIILLIIFIIIIII(TypeEnum, 99, 1, "FlagStaticMember", 740fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagStaticMember)), 741fd4e5da5Sopenharmony_ci }))); 742fd4e5da5Sopenharmony_ci 743fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 744fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugTypeComposite, ExtInstCLDebugInfo100RoundTripTest, 745fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 746fd4e5da5Sopenharmony_ci CASE_IEILLIIIF( 747fd4e5da5Sopenharmony_ci TypeComposite, Class, 12, 13, 748fd4e5da5Sopenharmony_ci "FlagIsPrivate|FlagFwdDecl|FlagIndirectVariable|FlagIsOptimized", 749fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate) | 750fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagFwdDecl) | 751fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIndirectVariable) | 752fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized)), 753fd4e5da5Sopenharmony_ci // Cover all tag values: Class, Structure, Union 754fd4e5da5Sopenharmony_ci CASE_IEILLIIIF(TypeComposite, Class, 12, 13, "FlagIsPrivate", 755fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 756fd4e5da5Sopenharmony_ci CASE_IEILLIIIF(TypeComposite, Structure, 12, 13, "FlagIsPrivate", 757fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 758fd4e5da5Sopenharmony_ci CASE_IEILLIIIF(TypeComposite, Union, 12, 13, "FlagIsPrivate", 759fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 760fd4e5da5Sopenharmony_ci // Now add members 761fd4e5da5Sopenharmony_ci CASE_IEILLIIIFI(TypeComposite, Class, 9, 10, "FlagIsPrivate", 762fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 763fd4e5da5Sopenharmony_ci CASE_IEILLIIIFII(TypeComposite, Class, 9, 10, "FlagIsPrivate", 764fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 765fd4e5da5Sopenharmony_ci CASE_IEILLIIIFIII(TypeComposite, Class, 9, 10, "FlagIsPrivate", 766fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 767fd4e5da5Sopenharmony_ci CASE_IEILLIIIFIIII(TypeComposite, Class, 9, 10, "FlagIsPrivate", 768fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 769fd4e5da5Sopenharmony_ci }))); 770fd4e5da5Sopenharmony_ci 771fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 772fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugTypeMember, ExtInstCLDebugInfo100RoundTripTest, 773fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 774fd4e5da5Sopenharmony_ci CASE_IIILLIIIF(TypeMember, 12, 13, "FlagIsPrivate", 775fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 776fd4e5da5Sopenharmony_ci CASE_IIILLIIIF(TypeMember, 99, 100, "FlagIsPrivate|FlagFwdDecl", 777fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate) | 778fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagFwdDecl)), 779fd4e5da5Sopenharmony_ci // Add the optional Id argument. 780fd4e5da5Sopenharmony_ci CASE_IIILLIIIFI(TypeMember, 12, 13, "FlagIsPrivate", 781fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 782fd4e5da5Sopenharmony_ci }))); 783fd4e5da5Sopenharmony_ci 784fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 785fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugTypeInheritance, ExtInstCLDebugInfo100RoundTripTest, 786fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 787fd4e5da5Sopenharmony_ci CASE_IIIIF(TypeInheritance, "FlagIsPrivate", 788fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate)), 789fd4e5da5Sopenharmony_ci CASE_IIIIF(TypeInheritance, "FlagIsPrivate|FlagFwdDecl", 790fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsPrivate) | 791fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagFwdDecl)), 792fd4e5da5Sopenharmony_ci }))); 793fd4e5da5Sopenharmony_ci 794fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypePtrToMember, 795fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 796fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 797fd4e5da5Sopenharmony_ci CASE_II(TypePtrToMember), 798fd4e5da5Sopenharmony_ci }))); 799fd4e5da5Sopenharmony_ci 800fd4e5da5Sopenharmony_ci// OpenCL.DebugInfo.100 4.4 Templates 801fd4e5da5Sopenharmony_ci 802fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypeTemplate, 803fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 804fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 805fd4e5da5Sopenharmony_ci CASE_II(TypeTemplate), 806fd4e5da5Sopenharmony_ci CASE_III(TypeTemplate), 807fd4e5da5Sopenharmony_ci CASE_IIII(TypeTemplate), 808fd4e5da5Sopenharmony_ci CASE_IIIII(TypeTemplate), 809fd4e5da5Sopenharmony_ci }))); 810fd4e5da5Sopenharmony_ci 811fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypeTemplateParameter, 812fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 813fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 814fd4e5da5Sopenharmony_ci CASE_IIIILL(TypeTemplateParameter, 1, 2), 815fd4e5da5Sopenharmony_ci CASE_IIIILL(TypeTemplateParameter, 99, 102), 816fd4e5da5Sopenharmony_ci CASE_IIIILL(TypeTemplateParameter, 10, 7), 817fd4e5da5Sopenharmony_ci }))); 818fd4e5da5Sopenharmony_ci 819fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypeTemplateTemplateParameter, 820fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 821fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 822fd4e5da5Sopenharmony_ci CASE_IIILL(TypeTemplateTemplateParameter, 1, 2), 823fd4e5da5Sopenharmony_ci CASE_IIILL(TypeTemplateTemplateParameter, 99, 102), 824fd4e5da5Sopenharmony_ci CASE_IIILL(TypeTemplateTemplateParameter, 10, 7), 825fd4e5da5Sopenharmony_ci }))); 826fd4e5da5Sopenharmony_ci 827fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugTypeTemplateParameterPack, 828fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 829fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 830fd4e5da5Sopenharmony_ci CASE_IILLI(TypeTemplateParameterPack, 1, 2), 831fd4e5da5Sopenharmony_ci CASE_IILLII(TypeTemplateParameterPack, 99, 102), 832fd4e5da5Sopenharmony_ci CASE_IILLIII(TypeTemplateParameterPack, 10, 7), 833fd4e5da5Sopenharmony_ci CASE_IILLIIII(TypeTemplateParameterPack, 10, 7), 834fd4e5da5Sopenharmony_ci }))); 835fd4e5da5Sopenharmony_ci 836fd4e5da5Sopenharmony_ci// OpenCL.DebugInfo.100 4.5 Global Variables 837fd4e5da5Sopenharmony_ci 838fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 839fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugGlobalVariable, ExtInstCLDebugInfo100RoundTripTest, 840fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 841fd4e5da5Sopenharmony_ci CASE_IIILLIIIF(GlobalVariable, 1, 2, "FlagIsOptimized", 842fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized)), 843fd4e5da5Sopenharmony_ci CASE_IIILLIIIF(GlobalVariable, 42, 43, "FlagIsOptimized", 844fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized)), 845fd4e5da5Sopenharmony_ci CASE_IIILLIIIFI(GlobalVariable, 1, 2, "FlagIsOptimized", 846fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized)), 847fd4e5da5Sopenharmony_ci CASE_IIILLIIIFI(GlobalVariable, 42, 43, "FlagIsOptimized", 848fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized)), 849fd4e5da5Sopenharmony_ci }))); 850fd4e5da5Sopenharmony_ci 851fd4e5da5Sopenharmony_ci// OpenCL.DebugInfo.100 4.6 Functions 852fd4e5da5Sopenharmony_ci 853fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 854fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugFunctionDeclaration, 855fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 856fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 857fd4e5da5Sopenharmony_ci CASE_IIILLIIF(FunctionDeclaration, 1, 2, "FlagIsOptimized", 858fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized)), 859fd4e5da5Sopenharmony_ci CASE_IIILLIIF(FunctionDeclaration, 42, 43, "FlagFwdDecl", 860fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagFwdDecl)), 861fd4e5da5Sopenharmony_ci }))); 862fd4e5da5Sopenharmony_ci 863fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 864fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugFunction, ExtInstCLDebugInfo100RoundTripTest, 865fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 866fd4e5da5Sopenharmony_ci CASE_IIILLIIFLI(Function, 1, 2, "FlagIsOptimized", 867fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized), 3), 868fd4e5da5Sopenharmony_ci CASE_IIILLIIFLI(Function, 42, 43, "FlagFwdDecl", 869fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagFwdDecl), 44), 870fd4e5da5Sopenharmony_ci // Add the optional declaration Id. 871fd4e5da5Sopenharmony_ci CASE_IIILLIIFLII(Function, 1, 2, "FlagIsOptimized", 872fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagIsOptimized), 3), 873fd4e5da5Sopenharmony_ci CASE_IIILLIIFLII(Function, 42, 43, "FlagFwdDecl", 874fd4e5da5Sopenharmony_ci uint32_t(OpenCLDebugInfo100FlagFwdDecl), 44), 875fd4e5da5Sopenharmony_ci }))); 876fd4e5da5Sopenharmony_ci 877fd4e5da5Sopenharmony_ci// OpenCL.DebugInfo.100 4.7 Local Information 878fd4e5da5Sopenharmony_ci 879fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugLexicalBlock, 880fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 881fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 882fd4e5da5Sopenharmony_ci CASE_ILLII(LexicalBlock, 1, 2), 883fd4e5da5Sopenharmony_ci CASE_ILLII(LexicalBlock, 42, 43), 884fd4e5da5Sopenharmony_ci }))); 885fd4e5da5Sopenharmony_ci 886fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugLexicalBlockDiscriminator, 887fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 888fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 889fd4e5da5Sopenharmony_ci CASE_ILI(LexicalBlockDiscriminator, 1), 890fd4e5da5Sopenharmony_ci CASE_ILI(LexicalBlockDiscriminator, 42), 891fd4e5da5Sopenharmony_ci }))); 892fd4e5da5Sopenharmony_ci 893fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugScope, 894fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 895fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 896fd4e5da5Sopenharmony_ci CASE_I(Scope), 897fd4e5da5Sopenharmony_ci CASE_II(Scope), 898fd4e5da5Sopenharmony_ci }))); 899fd4e5da5Sopenharmony_ci 900fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugNoScope, 901fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 902fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 903fd4e5da5Sopenharmony_ci CASE_0(NoScope), 904fd4e5da5Sopenharmony_ci }))); 905fd4e5da5Sopenharmony_ci 906fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugInlinedAt, 907fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 908fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 909fd4e5da5Sopenharmony_ci CASE_LII(InlinedAt, 1), 910fd4e5da5Sopenharmony_ci CASE_LII(InlinedAt, 42), 911fd4e5da5Sopenharmony_ci }))); 912fd4e5da5Sopenharmony_ci 913fd4e5da5Sopenharmony_ci// OpenCL.DebugInfo.100 4.8 Local Variables 914fd4e5da5Sopenharmony_ci 915fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 916fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugLocalVariable, ExtInstCLDebugInfo100RoundTripTest, 917fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 918fd4e5da5Sopenharmony_ci CASE_IIILLIF(LocalVariable, 1, 2, "FlagIsPrivate", 919fd4e5da5Sopenharmony_ci OpenCLDebugInfo100FlagIsPrivate), 920fd4e5da5Sopenharmony_ci CASE_IIILLIF(LocalVariable, 4, 5, "FlagIsProtected", 921fd4e5da5Sopenharmony_ci OpenCLDebugInfo100FlagIsProtected), 922fd4e5da5Sopenharmony_ci CASE_IIILLIFL(LocalVariable, 9, 99, "FlagIsProtected", 923fd4e5da5Sopenharmony_ci OpenCLDebugInfo100FlagIsProtected, 195), 924fd4e5da5Sopenharmony_ci CASE_IIILLIFL(LocalVariable, 19, 199, "FlagIsPrivate", 925fd4e5da5Sopenharmony_ci OpenCLDebugInfo100FlagIsPrivate, 195), 926fd4e5da5Sopenharmony_ci }))); 927fd4e5da5Sopenharmony_ci 928fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugInlinedVariable, 929fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 930fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 931fd4e5da5Sopenharmony_ci CASE_II(InlinedVariable), 932fd4e5da5Sopenharmony_ci }))); 933fd4e5da5Sopenharmony_ci 934fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugDebugDeclare, 935fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 936fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 937fd4e5da5Sopenharmony_ci CASE_III(Declare), 938fd4e5da5Sopenharmony_ci }))); 939fd4e5da5Sopenharmony_ci 940fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 941fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugDebugValue, ExtInstCLDebugInfo100RoundTripTest, 942fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 943fd4e5da5Sopenharmony_ci CASE_IIII(Value), 944fd4e5da5Sopenharmony_ci CASE_IIIII(Value), 945fd4e5da5Sopenharmony_ci CASE_IIIIII(Value), 946fd4e5da5Sopenharmony_ci // Test up to 3 id parameters. We can always try more. 947fd4e5da5Sopenharmony_ci CASE_IIIIIII(Value), 948fd4e5da5Sopenharmony_ci }))); 949fd4e5da5Sopenharmony_ci 950fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugDebugOperation, 951fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 952fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 953fd4e5da5Sopenharmony_ci CASE_E(Operation, Deref), 954fd4e5da5Sopenharmony_ci CASE_E(Operation, Plus), 955fd4e5da5Sopenharmony_ci CASE_E(Operation, Minus), 956fd4e5da5Sopenharmony_ci CASE_EL(Operation, PlusUconst, 1), 957fd4e5da5Sopenharmony_ci CASE_EL(Operation, PlusUconst, 42), 958fd4e5da5Sopenharmony_ci CASE_ELL(Operation, BitPiece, 1, 2), 959fd4e5da5Sopenharmony_ci CASE_ELL(Operation, BitPiece, 4, 5), 960fd4e5da5Sopenharmony_ci CASE_E(Operation, Swap), 961fd4e5da5Sopenharmony_ci CASE_E(Operation, Xderef), 962fd4e5da5Sopenharmony_ci CASE_E(Operation, StackValue), 963fd4e5da5Sopenharmony_ci CASE_EL(Operation, Constu, 1), 964fd4e5da5Sopenharmony_ci CASE_EL(Operation, Constu, 42), 965fd4e5da5Sopenharmony_ci CASE_ELL(Operation, Fragment, 100, 200), 966fd4e5da5Sopenharmony_ci CASE_ELL(Operation, Fragment, 8, 9), 967fd4e5da5Sopenharmony_ci }))); 968fd4e5da5Sopenharmony_ci 969fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugDebugExpression, 970fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 971fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 972fd4e5da5Sopenharmony_ci CASE_0(Expression), 973fd4e5da5Sopenharmony_ci CASE_I(Expression), 974fd4e5da5Sopenharmony_ci CASE_II(Expression), 975fd4e5da5Sopenharmony_ci CASE_III(Expression), 976fd4e5da5Sopenharmony_ci CASE_IIII(Expression), 977fd4e5da5Sopenharmony_ci CASE_IIIII(Expression), 978fd4e5da5Sopenharmony_ci CASE_IIIIII(Expression), 979fd4e5da5Sopenharmony_ci CASE_IIIIIII(Expression), 980fd4e5da5Sopenharmony_ci }))); 981fd4e5da5Sopenharmony_ci 982fd4e5da5Sopenharmony_ci// OpenCL.DebugInfo.100 4.9 Macros 983fd4e5da5Sopenharmony_ci 984fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugMacroDef, 985fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 986fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 987fd4e5da5Sopenharmony_ci CASE_ILI(MacroDef, 1), 988fd4e5da5Sopenharmony_ci CASE_ILI(MacroDef, 42), 989fd4e5da5Sopenharmony_ci CASE_ILII(MacroDef, 1), 990fd4e5da5Sopenharmony_ci CASE_ILII(MacroDef, 42), 991fd4e5da5Sopenharmony_ci }))); 992fd4e5da5Sopenharmony_ci 993fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(OpenCLDebugInfo100DebugMacroUndef, 994fd4e5da5Sopenharmony_ci ExtInstCLDebugInfo100RoundTripTest, 995fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 996fd4e5da5Sopenharmony_ci CASE_ILI(MacroUndef, 1), 997fd4e5da5Sopenharmony_ci CASE_ILI(MacroUndef, 42), 998fd4e5da5Sopenharmony_ci }))); 999fd4e5da5Sopenharmony_ci 1000fd4e5da5Sopenharmony_ci// OpenCL.DebugInfo.100 4.10 Imported Entities 1001fd4e5da5Sopenharmony_ci 1002fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P( 1003fd4e5da5Sopenharmony_ci OpenCLDebugInfo100DebugImportedEntity, ExtInstCLDebugInfo100RoundTripTest, 1004fd4e5da5Sopenharmony_ci ::testing::ValuesIn(std::vector<InstructionCase>({ 1005fd4e5da5Sopenharmony_ci // ID Name 1006fd4e5da5Sopenharmony_ci // Literal Tag 1007fd4e5da5Sopenharmony_ci // ID Source 1008fd4e5da5Sopenharmony_ci // ID Entity 1009fd4e5da5Sopenharmony_ci // Literal Number Line 1010fd4e5da5Sopenharmony_ci // Literal Number Column 1011fd4e5da5Sopenharmony_ci // ID Parent 1012fd4e5da5Sopenharmony_ci CASE_IEIILLI(ImportedEntity, ImportedModule, 67, 68), 1013fd4e5da5Sopenharmony_ci CASE_IEIILLI(ImportedEntity, ImportedDeclaration, 42, 43), 1014fd4e5da5Sopenharmony_ci }))); 1015fd4e5da5Sopenharmony_ci 1016fd4e5da5Sopenharmony_ci#undef EPREFIX 1017fd4e5da5Sopenharmony_ci#undef CASE_0 1018fd4e5da5Sopenharmony_ci#undef CASE_ILL 1019fd4e5da5Sopenharmony_ci#undef CASE_IL 1020fd4e5da5Sopenharmony_ci#undef CASE_I 1021fd4e5da5Sopenharmony_ci#undef CASE_II 1022fd4e5da5Sopenharmony_ci#undef CASE_III 1023fd4e5da5Sopenharmony_ci#undef CASE_IIII 1024fd4e5da5Sopenharmony_ci#undef CASE_IIIII 1025fd4e5da5Sopenharmony_ci#undef CASE_IIIIII 1026fd4e5da5Sopenharmony_ci#undef CASE_IIIIIII 1027fd4e5da5Sopenharmony_ci#undef CASE_IIILLI 1028fd4e5da5Sopenharmony_ci#undef CASE_IIILLIL 1029fd4e5da5Sopenharmony_ci#undef CASE_IE 1030fd4e5da5Sopenharmony_ci#undef CASE_IEIILLI 1031fd4e5da5Sopenharmony_ci#undef CASE_IIE 1032fd4e5da5Sopenharmony_ci#undef CASE_ISF 1033fd4e5da5Sopenharmony_ci#undef CASE_LII 1034fd4e5da5Sopenharmony_ci#undef CASE_LLIe 1035fd4e5da5Sopenharmony_ci#undef CASE_ILI 1036fd4e5da5Sopenharmony_ci#undef CASE_ILII 1037fd4e5da5Sopenharmony_ci#undef CASE_ILLII 1038fd4e5da5Sopenharmony_ci#undef CASE_IIILLIF 1039fd4e5da5Sopenharmony_ci#undef CASE_IIILLIFL 1040fd4e5da5Sopenharmony_ci#undef CASE_IIILLIIF 1041fd4e5da5Sopenharmony_ci#undef CASE_IIILLIIFII 1042fd4e5da5Sopenharmony_ci#undef CASE_IIILLIIFIIII 1043fd4e5da5Sopenharmony_ci#undef CASE_IIILLIIFIIIIII 1044fd4e5da5Sopenharmony_ci#undef CASE_IEILLIIIF 1045fd4e5da5Sopenharmony_ci#undef CASE_IEILLIIIFI 1046fd4e5da5Sopenharmony_ci#undef CASE_IEILLIIIFII 1047fd4e5da5Sopenharmony_ci#undef CASE_IEILLIIIFIII 1048fd4e5da5Sopenharmony_ci#undef CASE_IEILLIIIFIIII 1049fd4e5da5Sopenharmony_ci#undef CASE_IIILLIIIF 1050fd4e5da5Sopenharmony_ci#undef CASE_IIILLIIIFI 1051fd4e5da5Sopenharmony_ci#undef CASE_IIIIF 1052fd4e5da5Sopenharmony_ci#undef CASE_IIILL 1053fd4e5da5Sopenharmony_ci#undef CASE_IIIILL 1054fd4e5da5Sopenharmony_ci#undef CASE_IILLI 1055fd4e5da5Sopenharmony_ci#undef CASE_IILLII 1056fd4e5da5Sopenharmony_ci#undef CASE_IILLIII 1057fd4e5da5Sopenharmony_ci#undef CASE_IILLIIII 1058fd4e5da5Sopenharmony_ci#undef CASE_IIILLIIFLI 1059fd4e5da5Sopenharmony_ci#undef CASE_IIILLIIFLII 1060fd4e5da5Sopenharmony_ci#undef CASE_E 1061fd4e5da5Sopenharmony_ci#undef CASE_EI 1062fd4e5da5Sopenharmony_ci#undef CASE_EII 1063fd4e5da5Sopenharmony_ci#undef CASE_EIII 1064fd4e5da5Sopenharmony_ci#undef CASE_EIIII 1065fd4e5da5Sopenharmony_ci#undef CASE_EIIIII 1066fd4e5da5Sopenharmony_ci#undef CASE_EL 1067fd4e5da5Sopenharmony_ci#undef CASE_ELL 1068fd4e5da5Sopenharmony_ci 1069fd4e5da5Sopenharmony_ci} // namespace 1070fd4e5da5Sopenharmony_ci} // namespace spvtools 1071