@@ -1461,6 +1461,8 @@ class ConvertBuiltin<string name, InstructionSet set> {
14611461 bit IsRounded = !not(!eq(!find(name, "_rt"), -1));
14621462 bit IsBfloat16 = !or(!not(!eq(!find(name, "BF16"), -1)),
14631463 !not(!eq(!find(name, "bfloat16"), -1)));
1464+ bit IsTF32 = !or(!not(!eq(!find(name, "TF32"), -1)),
1465+ !not(!eq(!find(name, "tensor_float32"), -1)));
14641466 FPRoundingMode RoundingMode = !cond(!not(!eq(!find(name, "_rte"), -1)) : RTE,
14651467 !not(!eq(!find(name, "_rtz"), -1)) : RTZ,
14661468 !not(!eq(!find(name, "_rtp"), -1)) : RTP,
@@ -1472,7 +1474,7 @@ class ConvertBuiltin<string name, InstructionSet set> {
14721474def ConvertBuiltins : GenericTable {
14731475 let FilterClass = "ConvertBuiltin";
14741476 let Fields = ["Name", "Set", "IsDestinationSigned", "IsSaturated",
1475- "IsRounded", "IsBfloat16", "RoundingMode"];
1477+ "IsRounded", "IsBfloat16", "IsTF32", " RoundingMode"];
14761478 string TypeOf_Set = "InstructionSet";
14771479 string TypeOf_RoundingMode = "FPRoundingMode";
14781480}
@@ -1556,6 +1558,25 @@ foreach conv = ["FToBF16INTEL", "BF16ToFINTEL"] in {
15561558 def : ConvertBuiltin<!strconcat("__spirv_Convert", conv), OpenCL_std>;
15571559}
15581560
1561+ // cl_intel_tensor_float32_conversions / SPV_INTEL_tensor_float32_conversion
1562+ // Multiclass used to define at the same time both a demangled builtin record
1563+ // and a corresponding convert builtin record.
1564+ multiclass DemangledTF32RoundBuiltin<string name1, string name2> {
1565+ // Create records for scalar and vector conversions.
1566+ foreach i = ["", "2", "3", "4", "8", "16"] in {
1567+ def : DemangledBuiltin<!strconcat("intel_round_", name1, i, name2, i), OpenCL_std, Convert, 1, 1>;
1568+ def : ConvertBuiltin<!strconcat("intel_round_", name1, i, name2, i), OpenCL_std>;
1569+ }
1570+ }
1571+
1572+ defm : DemangledTF32RoundBuiltin<"tensor_float32", "_as_float">;
1573+ defm : DemangledTF32RoundBuiltin<"as_tensor_float32", "_float">;
1574+
1575+ foreach conv = ["FToTF32INTEL"] in {
1576+ def : DemangledBuiltin<!strconcat("__spirv_Round", conv), OpenCL_std, Convert, 1, 1>;
1577+ def : ConvertBuiltin<!strconcat("__spirv_Round", conv), OpenCL_std>;
1578+ }
1579+
15591580//===----------------------------------------------------------------------===//
15601581// Class defining a vector data load/store builtin record used for lowering
15611582// into OpExtInst instruction.
0 commit comments