From c8e84c7a5f38d46e97debba0eb1ae05f6a2fa39f Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Thu, 2 Dec 2021 12:25:00 +0000 Subject: [PATCH] [IR,TableGen] Add support for vec3 intrinsic arguments Add generic support for vec3 types, and in particular define llvm_v3f32_ty which will be used by AMDGPU's llvm.amdgcn.image.bvh.intersect.ray intrinsic. Differential Revision: https://reviews.llvm.org/D114956 --- llvm/include/llvm/IR/Intrinsics.td | 1 + llvm/lib/IR/Function.cpp | 7 ++++++- llvm/utils/TableGen/IntrinsicEmitter.cpp | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td index 637e6d8..3e15955 100644 --- a/llvm/include/llvm/IR/Intrinsics.td +++ b/llvm/include/llvm/IR/Intrinsics.td @@ -319,6 +319,7 @@ def llvm_v4bf16_ty : LLVMType; // 4 x bfloat (__bf16) def llvm_v8bf16_ty : LLVMType; // 8 x bfloat (__bf16) def llvm_v1f32_ty : LLVMType; // 1 x float def llvm_v2f32_ty : LLVMType; // 2 x float +def llvm_v3f32_ty : LLVMType; // 3 x float def llvm_v4f32_ty : LLVMType; // 4 x float def llvm_v8f32_ty : LLVMType; // 8 x float def llvm_v16f32_ty : LLVMType; // 16 x float diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 82b20a8..63c8545 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -980,7 +980,8 @@ enum IIT_Info { IIT_STRUCT9 = 49, IIT_V256 = 50, IIT_AMX = 51, - IIT_PPCF128 = 52 + IIT_PPCF128 = 52, + IIT_V3 = 53, }; static void DecodeIITType(unsigned &NextElt, ArrayRef Infos, @@ -1056,6 +1057,10 @@ static void DecodeIITType(unsigned &NextElt, ArrayRef Infos, OutputTable.push_back(IITDescriptor::getVector(2, IsScalableVector)); DecodeIITType(NextElt, Infos, Info, OutputTable); return; + case IIT_V3: + OutputTable.push_back(IITDescriptor::getVector(3, IsScalableVector)); + DecodeIITType(NextElt, Infos, Info, OutputTable); + return; case IIT_V4: OutputTable.push_back(IITDescriptor::getVector(4, IsScalableVector)); DecodeIITType(NextElt, Infos, Info, OutputTable); diff --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp index 437b5f0..94e60b3 100644 --- a/llvm/utils/TableGen/IntrinsicEmitter.cpp +++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp @@ -250,7 +250,8 @@ enum IIT_Info { IIT_STRUCT9 = 49, IIT_V256 = 50, IIT_AMX = 51, - IIT_PPCF128 = 52 + IIT_PPCF128 = 52, + IIT_V3 = 53, }; static void EncodeFixedValueType(MVT::SimpleValueType VT, @@ -384,6 +385,7 @@ static void EncodeFixedType(Record *R, std::vector &ArgCodes, default: PrintFatalError("unhandled vector type width in intrinsic!"); case 1: Sig.push_back(IIT_V1); break; case 2: Sig.push_back(IIT_V2); break; + case 3: Sig.push_back(IIT_V3); break; case 4: Sig.push_back(IIT_V4); break; case 8: Sig.push_back(IIT_V8); break; case 16: Sig.push_back(IIT_V16); break; -- 2.7.4