1 // Copyright 2021 The Tint Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 //////////////////////////////////////////////////////////////////////////////// 16 // File generated by tools/intrinsic-gen 17 // using the template: 18 // src/sem/intrinsic_type.cc.tmpl 19 // and the intrinsic defintion file: 20 // src/intrinsics.def 21 // 22 // Do not modify this file directly 23 //////////////////////////////////////////////////////////////////////////////// 24 25 #include "src/sem/intrinsic_type.h" 26 27 #include <sstream> 28 29 namespace tint { 30 namespace sem { 31 ParseIntrinsicType(const std::string & name)32IntrinsicType ParseIntrinsicType(const std::string& name) { 33 if (name == "abs") { 34 return IntrinsicType::kAbs; 35 } 36 if (name == "acos") { 37 return IntrinsicType::kAcos; 38 } 39 if (name == "all") { 40 return IntrinsicType::kAll; 41 } 42 if (name == "any") { 43 return IntrinsicType::kAny; 44 } 45 if (name == "arrayLength") { 46 return IntrinsicType::kArrayLength; 47 } 48 if (name == "asin") { 49 return IntrinsicType::kAsin; 50 } 51 if (name == "atan") { 52 return IntrinsicType::kAtan; 53 } 54 if (name == "atan2") { 55 return IntrinsicType::kAtan2; 56 } 57 if (name == "ceil") { 58 return IntrinsicType::kCeil; 59 } 60 if (name == "clamp") { 61 return IntrinsicType::kClamp; 62 } 63 if (name == "cos") { 64 return IntrinsicType::kCos; 65 } 66 if (name == "cosh") { 67 return IntrinsicType::kCosh; 68 } 69 if (name == "countOneBits") { 70 return IntrinsicType::kCountOneBits; 71 } 72 if (name == "cross") { 73 return IntrinsicType::kCross; 74 } 75 if (name == "determinant") { 76 return IntrinsicType::kDeterminant; 77 } 78 if (name == "distance") { 79 return IntrinsicType::kDistance; 80 } 81 if (name == "dot") { 82 return IntrinsicType::kDot; 83 } 84 if (name == "dpdx") { 85 return IntrinsicType::kDpdx; 86 } 87 if (name == "dpdxCoarse") { 88 return IntrinsicType::kDpdxCoarse; 89 } 90 if (name == "dpdxFine") { 91 return IntrinsicType::kDpdxFine; 92 } 93 if (name == "dpdy") { 94 return IntrinsicType::kDpdy; 95 } 96 if (name == "dpdyCoarse") { 97 return IntrinsicType::kDpdyCoarse; 98 } 99 if (name == "dpdyFine") { 100 return IntrinsicType::kDpdyFine; 101 } 102 if (name == "exp") { 103 return IntrinsicType::kExp; 104 } 105 if (name == "exp2") { 106 return IntrinsicType::kExp2; 107 } 108 if (name == "faceForward") { 109 return IntrinsicType::kFaceForward; 110 } 111 if (name == "floor") { 112 return IntrinsicType::kFloor; 113 } 114 if (name == "fma") { 115 return IntrinsicType::kFma; 116 } 117 if (name == "fract") { 118 return IntrinsicType::kFract; 119 } 120 if (name == "frexp") { 121 return IntrinsicType::kFrexp; 122 } 123 if (name == "fwidth") { 124 return IntrinsicType::kFwidth; 125 } 126 if (name == "fwidthCoarse") { 127 return IntrinsicType::kFwidthCoarse; 128 } 129 if (name == "fwidthFine") { 130 return IntrinsicType::kFwidthFine; 131 } 132 if (name == "ignore") { 133 return IntrinsicType::kIgnore; 134 } 135 if (name == "inverseSqrt") { 136 return IntrinsicType::kInverseSqrt; 137 } 138 if (name == "isFinite") { 139 return IntrinsicType::kIsFinite; 140 } 141 if (name == "isInf") { 142 return IntrinsicType::kIsInf; 143 } 144 if (name == "isNan") { 145 return IntrinsicType::kIsNan; 146 } 147 if (name == "isNormal") { 148 return IntrinsicType::kIsNormal; 149 } 150 if (name == "ldexp") { 151 return IntrinsicType::kLdexp; 152 } 153 if (name == "length") { 154 return IntrinsicType::kLength; 155 } 156 if (name == "log") { 157 return IntrinsicType::kLog; 158 } 159 if (name == "log2") { 160 return IntrinsicType::kLog2; 161 } 162 if (name == "max") { 163 return IntrinsicType::kMax; 164 } 165 if (name == "min") { 166 return IntrinsicType::kMin; 167 } 168 if (name == "mix") { 169 return IntrinsicType::kMix; 170 } 171 if (name == "modf") { 172 return IntrinsicType::kModf; 173 } 174 if (name == "normalize") { 175 return IntrinsicType::kNormalize; 176 } 177 if (name == "pack2x16float") { 178 return IntrinsicType::kPack2x16float; 179 } 180 if (name == "pack2x16snorm") { 181 return IntrinsicType::kPack2x16snorm; 182 } 183 if (name == "pack2x16unorm") { 184 return IntrinsicType::kPack2x16unorm; 185 } 186 if (name == "pack4x8snorm") { 187 return IntrinsicType::kPack4x8snorm; 188 } 189 if (name == "pack4x8unorm") { 190 return IntrinsicType::kPack4x8unorm; 191 } 192 if (name == "pow") { 193 return IntrinsicType::kPow; 194 } 195 if (name == "reflect") { 196 return IntrinsicType::kReflect; 197 } 198 if (name == "refract") { 199 return IntrinsicType::kRefract; 200 } 201 if (name == "reverseBits") { 202 return IntrinsicType::kReverseBits; 203 } 204 if (name == "round") { 205 return IntrinsicType::kRound; 206 } 207 if (name == "select") { 208 return IntrinsicType::kSelect; 209 } 210 if (name == "sign") { 211 return IntrinsicType::kSign; 212 } 213 if (name == "sin") { 214 return IntrinsicType::kSin; 215 } 216 if (name == "sinh") { 217 return IntrinsicType::kSinh; 218 } 219 if (name == "smoothStep") { 220 return IntrinsicType::kSmoothStep; 221 } 222 if (name == "sqrt") { 223 return IntrinsicType::kSqrt; 224 } 225 if (name == "step") { 226 return IntrinsicType::kStep; 227 } 228 if (name == "storageBarrier") { 229 return IntrinsicType::kStorageBarrier; 230 } 231 if (name == "tan") { 232 return IntrinsicType::kTan; 233 } 234 if (name == "tanh") { 235 return IntrinsicType::kTanh; 236 } 237 if (name == "transpose") { 238 return IntrinsicType::kTranspose; 239 } 240 if (name == "trunc") { 241 return IntrinsicType::kTrunc; 242 } 243 if (name == "unpack2x16float") { 244 return IntrinsicType::kUnpack2x16float; 245 } 246 if (name == "unpack2x16snorm") { 247 return IntrinsicType::kUnpack2x16snorm; 248 } 249 if (name == "unpack2x16unorm") { 250 return IntrinsicType::kUnpack2x16unorm; 251 } 252 if (name == "unpack4x8snorm") { 253 return IntrinsicType::kUnpack4x8snorm; 254 } 255 if (name == "unpack4x8unorm") { 256 return IntrinsicType::kUnpack4x8unorm; 257 } 258 if (name == "workgroupBarrier") { 259 return IntrinsicType::kWorkgroupBarrier; 260 } 261 if (name == "textureDimensions") { 262 return IntrinsicType::kTextureDimensions; 263 } 264 if (name == "textureGather") { 265 return IntrinsicType::kTextureGather; 266 } 267 if (name == "textureGatherCompare") { 268 return IntrinsicType::kTextureGatherCompare; 269 } 270 if (name == "textureNumLayers") { 271 return IntrinsicType::kTextureNumLayers; 272 } 273 if (name == "textureNumLevels") { 274 return IntrinsicType::kTextureNumLevels; 275 } 276 if (name == "textureNumSamples") { 277 return IntrinsicType::kTextureNumSamples; 278 } 279 if (name == "textureSample") { 280 return IntrinsicType::kTextureSample; 281 } 282 if (name == "textureSampleBias") { 283 return IntrinsicType::kTextureSampleBias; 284 } 285 if (name == "textureSampleCompare") { 286 return IntrinsicType::kTextureSampleCompare; 287 } 288 if (name == "textureSampleCompareLevel") { 289 return IntrinsicType::kTextureSampleCompareLevel; 290 } 291 if (name == "textureSampleGrad") { 292 return IntrinsicType::kTextureSampleGrad; 293 } 294 if (name == "textureSampleLevel") { 295 return IntrinsicType::kTextureSampleLevel; 296 } 297 if (name == "textureStore") { 298 return IntrinsicType::kTextureStore; 299 } 300 if (name == "textureLoad") { 301 return IntrinsicType::kTextureLoad; 302 } 303 if (name == "atomicLoad") { 304 return IntrinsicType::kAtomicLoad; 305 } 306 if (name == "atomicStore") { 307 return IntrinsicType::kAtomicStore; 308 } 309 if (name == "atomicAdd") { 310 return IntrinsicType::kAtomicAdd; 311 } 312 if (name == "atomicSub") { 313 return IntrinsicType::kAtomicSub; 314 } 315 if (name == "atomicMax") { 316 return IntrinsicType::kAtomicMax; 317 } 318 if (name == "atomicMin") { 319 return IntrinsicType::kAtomicMin; 320 } 321 if (name == "atomicAnd") { 322 return IntrinsicType::kAtomicAnd; 323 } 324 if (name == "atomicOr") { 325 return IntrinsicType::kAtomicOr; 326 } 327 if (name == "atomicXor") { 328 return IntrinsicType::kAtomicXor; 329 } 330 if (name == "atomicExchange") { 331 return IntrinsicType::kAtomicExchange; 332 } 333 if (name == "atomicCompareExchangeWeak") { 334 return IntrinsicType::kAtomicCompareExchangeWeak; 335 } 336 return IntrinsicType::kNone; 337 } 338 str(IntrinsicType i)339const char* str(IntrinsicType i) { 340 switch (i) { 341 case IntrinsicType::kNone: 342 return "<none>"; 343 case IntrinsicType::kAbs: 344 return "abs"; 345 case IntrinsicType::kAcos: 346 return "acos"; 347 case IntrinsicType::kAll: 348 return "all"; 349 case IntrinsicType::kAny: 350 return "any"; 351 case IntrinsicType::kArrayLength: 352 return "arrayLength"; 353 case IntrinsicType::kAsin: 354 return "asin"; 355 case IntrinsicType::kAtan: 356 return "atan"; 357 case IntrinsicType::kAtan2: 358 return "atan2"; 359 case IntrinsicType::kCeil: 360 return "ceil"; 361 case IntrinsicType::kClamp: 362 return "clamp"; 363 case IntrinsicType::kCos: 364 return "cos"; 365 case IntrinsicType::kCosh: 366 return "cosh"; 367 case IntrinsicType::kCountOneBits: 368 return "countOneBits"; 369 case IntrinsicType::kCross: 370 return "cross"; 371 case IntrinsicType::kDeterminant: 372 return "determinant"; 373 case IntrinsicType::kDistance: 374 return "distance"; 375 case IntrinsicType::kDot: 376 return "dot"; 377 case IntrinsicType::kDpdx: 378 return "dpdx"; 379 case IntrinsicType::kDpdxCoarse: 380 return "dpdxCoarse"; 381 case IntrinsicType::kDpdxFine: 382 return "dpdxFine"; 383 case IntrinsicType::kDpdy: 384 return "dpdy"; 385 case IntrinsicType::kDpdyCoarse: 386 return "dpdyCoarse"; 387 case IntrinsicType::kDpdyFine: 388 return "dpdyFine"; 389 case IntrinsicType::kExp: 390 return "exp"; 391 case IntrinsicType::kExp2: 392 return "exp2"; 393 case IntrinsicType::kFaceForward: 394 return "faceForward"; 395 case IntrinsicType::kFloor: 396 return "floor"; 397 case IntrinsicType::kFma: 398 return "fma"; 399 case IntrinsicType::kFract: 400 return "fract"; 401 case IntrinsicType::kFrexp: 402 return "frexp"; 403 case IntrinsicType::kFwidth: 404 return "fwidth"; 405 case IntrinsicType::kFwidthCoarse: 406 return "fwidthCoarse"; 407 case IntrinsicType::kFwidthFine: 408 return "fwidthFine"; 409 case IntrinsicType::kIgnore: 410 return "ignore"; 411 case IntrinsicType::kInverseSqrt: 412 return "inverseSqrt"; 413 case IntrinsicType::kIsFinite: 414 return "isFinite"; 415 case IntrinsicType::kIsInf: 416 return "isInf"; 417 case IntrinsicType::kIsNan: 418 return "isNan"; 419 case IntrinsicType::kIsNormal: 420 return "isNormal"; 421 case IntrinsicType::kLdexp: 422 return "ldexp"; 423 case IntrinsicType::kLength: 424 return "length"; 425 case IntrinsicType::kLog: 426 return "log"; 427 case IntrinsicType::kLog2: 428 return "log2"; 429 case IntrinsicType::kMax: 430 return "max"; 431 case IntrinsicType::kMin: 432 return "min"; 433 case IntrinsicType::kMix: 434 return "mix"; 435 case IntrinsicType::kModf: 436 return "modf"; 437 case IntrinsicType::kNormalize: 438 return "normalize"; 439 case IntrinsicType::kPack2x16float: 440 return "pack2x16float"; 441 case IntrinsicType::kPack2x16snorm: 442 return "pack2x16snorm"; 443 case IntrinsicType::kPack2x16unorm: 444 return "pack2x16unorm"; 445 case IntrinsicType::kPack4x8snorm: 446 return "pack4x8snorm"; 447 case IntrinsicType::kPack4x8unorm: 448 return "pack4x8unorm"; 449 case IntrinsicType::kPow: 450 return "pow"; 451 case IntrinsicType::kReflect: 452 return "reflect"; 453 case IntrinsicType::kRefract: 454 return "refract"; 455 case IntrinsicType::kReverseBits: 456 return "reverseBits"; 457 case IntrinsicType::kRound: 458 return "round"; 459 case IntrinsicType::kSelect: 460 return "select"; 461 case IntrinsicType::kSign: 462 return "sign"; 463 case IntrinsicType::kSin: 464 return "sin"; 465 case IntrinsicType::kSinh: 466 return "sinh"; 467 case IntrinsicType::kSmoothStep: 468 return "smoothStep"; 469 case IntrinsicType::kSqrt: 470 return "sqrt"; 471 case IntrinsicType::kStep: 472 return "step"; 473 case IntrinsicType::kStorageBarrier: 474 return "storageBarrier"; 475 case IntrinsicType::kTan: 476 return "tan"; 477 case IntrinsicType::kTanh: 478 return "tanh"; 479 case IntrinsicType::kTranspose: 480 return "transpose"; 481 case IntrinsicType::kTrunc: 482 return "trunc"; 483 case IntrinsicType::kUnpack2x16float: 484 return "unpack2x16float"; 485 case IntrinsicType::kUnpack2x16snorm: 486 return "unpack2x16snorm"; 487 case IntrinsicType::kUnpack2x16unorm: 488 return "unpack2x16unorm"; 489 case IntrinsicType::kUnpack4x8snorm: 490 return "unpack4x8snorm"; 491 case IntrinsicType::kUnpack4x8unorm: 492 return "unpack4x8unorm"; 493 case IntrinsicType::kWorkgroupBarrier: 494 return "workgroupBarrier"; 495 case IntrinsicType::kTextureDimensions: 496 return "textureDimensions"; 497 case IntrinsicType::kTextureGather: 498 return "textureGather"; 499 case IntrinsicType::kTextureGatherCompare: 500 return "textureGatherCompare"; 501 case IntrinsicType::kTextureNumLayers: 502 return "textureNumLayers"; 503 case IntrinsicType::kTextureNumLevels: 504 return "textureNumLevels"; 505 case IntrinsicType::kTextureNumSamples: 506 return "textureNumSamples"; 507 case IntrinsicType::kTextureSample: 508 return "textureSample"; 509 case IntrinsicType::kTextureSampleBias: 510 return "textureSampleBias"; 511 case IntrinsicType::kTextureSampleCompare: 512 return "textureSampleCompare"; 513 case IntrinsicType::kTextureSampleCompareLevel: 514 return "textureSampleCompareLevel"; 515 case IntrinsicType::kTextureSampleGrad: 516 return "textureSampleGrad"; 517 case IntrinsicType::kTextureSampleLevel: 518 return "textureSampleLevel"; 519 case IntrinsicType::kTextureStore: 520 return "textureStore"; 521 case IntrinsicType::kTextureLoad: 522 return "textureLoad"; 523 case IntrinsicType::kAtomicLoad: 524 return "atomicLoad"; 525 case IntrinsicType::kAtomicStore: 526 return "atomicStore"; 527 case IntrinsicType::kAtomicAdd: 528 return "atomicAdd"; 529 case IntrinsicType::kAtomicSub: 530 return "atomicSub"; 531 case IntrinsicType::kAtomicMax: 532 return "atomicMax"; 533 case IntrinsicType::kAtomicMin: 534 return "atomicMin"; 535 case IntrinsicType::kAtomicAnd: 536 return "atomicAnd"; 537 case IntrinsicType::kAtomicOr: 538 return "atomicOr"; 539 case IntrinsicType::kAtomicXor: 540 return "atomicXor"; 541 case IntrinsicType::kAtomicExchange: 542 return "atomicExchange"; 543 case IntrinsicType::kAtomicCompareExchangeWeak: 544 return "atomicCompareExchangeWeak"; 545 } 546 return "<unknown>"; 547 } 548 operator <<(std::ostream & out,IntrinsicType i)549std::ostream& operator<<(std::ostream& out, IntrinsicType i) { 550 out << str(i); 551 return out; 552 } 553 554 } // namespace sem 555 } // namespace tint 556