Skip to content

Commit c8e84c7

Browse files
committed
[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
1 parent bc7dacf commit c8e84c7

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ def llvm_v4bf16_ty : LLVMType<v4bf16>; // 4 x bfloat (__bf16)
319319
def llvm_v8bf16_ty : LLVMType<v8bf16>; // 8 x bfloat (__bf16)
320320
def llvm_v1f32_ty : LLVMType<v1f32>; // 1 x float
321321
def llvm_v2f32_ty : LLVMType<v2f32>; // 2 x float
322+
def llvm_v3f32_ty : LLVMType<v3f32>; // 3 x float
322323
def llvm_v4f32_ty : LLVMType<v4f32>; // 4 x float
323324
def llvm_v8f32_ty : LLVMType<v8f32>; // 8 x float
324325
def llvm_v16f32_ty : LLVMType<v16f32>; // 16 x float

llvm/lib/IR/Function.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,8 @@ enum IIT_Info {
980980
IIT_STRUCT9 = 49,
981981
IIT_V256 = 50,
982982
IIT_AMX = 51,
983-
IIT_PPCF128 = 52
983+
IIT_PPCF128 = 52,
984+
IIT_V3 = 53,
984985
};
985986

986987
static void DecodeIITType(unsigned &NextElt, ArrayRef<unsigned char> Infos,
@@ -1056,6 +1057,10 @@ static void DecodeIITType(unsigned &NextElt, ArrayRef<unsigned char> Infos,
10561057
OutputTable.push_back(IITDescriptor::getVector(2, IsScalableVector));
10571058
DecodeIITType(NextElt, Infos, Info, OutputTable);
10581059
return;
1060+
case IIT_V3:
1061+
OutputTable.push_back(IITDescriptor::getVector(3, IsScalableVector));
1062+
DecodeIITType(NextElt, Infos, Info, OutputTable);
1063+
return;
10591064
case IIT_V4:
10601065
OutputTable.push_back(IITDescriptor::getVector(4, IsScalableVector));
10611066
DecodeIITType(NextElt, Infos, Info, OutputTable);

llvm/utils/TableGen/IntrinsicEmitter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ enum IIT_Info {
250250
IIT_STRUCT9 = 49,
251251
IIT_V256 = 50,
252252
IIT_AMX = 51,
253-
IIT_PPCF128 = 52
253+
IIT_PPCF128 = 52,
254+
IIT_V3 = 53,
254255
};
255256

256257
static void EncodeFixedValueType(MVT::SimpleValueType VT,
@@ -384,6 +385,7 @@ static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
384385
default: PrintFatalError("unhandled vector type width in intrinsic!");
385386
case 1: Sig.push_back(IIT_V1); break;
386387
case 2: Sig.push_back(IIT_V2); break;
388+
case 3: Sig.push_back(IIT_V3); break;
387389
case 4: Sig.push_back(IIT_V4); break;
388390
case 8: Sig.push_back(IIT_V8); break;
389391
case 16: Sig.push_back(IIT_V16); break;

0 commit comments

Comments
 (0)