@@ -831,7 +831,7 @@ let TargetPrefix = "nvvm" in {
831831//
832832// Sad
833833//
834- let IntrProperties = [IntrNoMem, Commutative, IntrSpeculatable] in {
834+ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
835835 foreach sign = ["", "u"] in {
836836 def int_nvvm_sad_ # sign # s : NVVMBuiltin,
837837 DefaultAttrsIntrinsic<[llvm_i16_ty], [llvm_i16_ty, llvm_i16_ty, llvm_i16_ty]>;
@@ -1150,41 +1150,40 @@ let TargetPrefix = "nvvm" in {
11501150 def int_nvvm_bf2h_rn # ftz : NVVMBuiltin,
11511151 DefaultAttrsIntrinsic<[llvm_i16_ty], [llvm_bfloat_ty]>;
11521152 }
1153- }
1154- let IntrProperties = [IntrNoMem, IntrNoCallback] in {
1153+
11551154 foreach rnd = ["rn", "rz"] in {
11561155 foreach relu = ["", "_relu"] in {
11571156 def int_nvvm_ff2bf16x2_ # rnd # relu : NVVMBuiltin,
1158- Intrinsic <[llvm_v2bf16_ty], [llvm_float_ty, llvm_float_ty]>;
1157+ DefaultAttrsIntrinsic <[llvm_v2bf16_ty], [llvm_float_ty, llvm_float_ty]>;
11591158
11601159 def int_nvvm_ff2f16x2_ # rnd # relu : NVVMBuiltin,
1161- Intrinsic <[llvm_v2f16_ty], [llvm_float_ty, llvm_float_ty]>;
1160+ DefaultAttrsIntrinsic <[llvm_v2f16_ty], [llvm_float_ty, llvm_float_ty]>;
11621161
11631162 def int_nvvm_f2bf16_ # rnd # relu : NVVMBuiltin,
1164- Intrinsic <[llvm_bfloat_ty], [llvm_float_ty]>;
1163+ DefaultAttrsIntrinsic <[llvm_bfloat_ty], [llvm_float_ty]>;
11651164 }
11661165 }
11671166
11681167 foreach satfinite = ["", "_satfinite"] in {
11691168 def int_nvvm_f2tf32_rna # satfinite : NVVMBuiltin,
1170- Intrinsic <[llvm_i32_ty], [llvm_float_ty]>;
1169+ DefaultAttrsIntrinsic <[llvm_i32_ty], [llvm_float_ty]>;
11711170
11721171 foreach rnd = ["rn", "rz"] in
11731172 foreach relu = ["", "_relu"] in
11741173 def int_nvvm_f2tf32_ # rnd # relu # satfinite : NVVMBuiltin,
1175- Intrinsic <[llvm_i32_ty], [llvm_float_ty]>;
1174+ DefaultAttrsIntrinsic <[llvm_i32_ty], [llvm_float_ty]>;
11761175 }
11771176
11781177 foreach type = ["e4m3x2", "e5m2x2"] in {
11791178 foreach relu = ["", "_relu"] in {
11801179 def int_nvvm_ff_to_ # type # _rn # relu : NVVMBuiltin,
1181- Intrinsic <[llvm_i16_ty], [llvm_float_ty, llvm_float_ty]>;
1180+ DefaultAttrsIntrinsic <[llvm_i16_ty], [llvm_float_ty, llvm_float_ty]>;
11821181
11831182 def int_nvvm_f16x2_to_ # type # _rn # relu : NVVMBuiltin,
1184- Intrinsic <[llvm_i16_ty], [llvm_v2f16_ty]>;
1183+ DefaultAttrsIntrinsic <[llvm_i16_ty], [llvm_v2f16_ty]>;
11851184
11861185 def int_nvvm_ # type # _to_f16x2_rn # relu : NVVMBuiltin,
1187- Intrinsic <[llvm_v2f16_ty], [llvm_i16_ty]>;
1186+ DefaultAttrsIntrinsic <[llvm_v2f16_ty], [llvm_i16_ty]>;
11881187 }
11891188 }
11901189
@@ -1222,8 +1221,9 @@ let TargetPrefix = "nvvm" in {
12221221 }
12231222
12241223 def int_nvvm_ue8m0x2_to_bf16x2 : NVVMBuiltin,
1225- Intrinsic<[llvm_v2bf16_ty], [llvm_i16_ty]>;
1226- }
1224+ DefaultAttrsIntrinsic<[llvm_v2bf16_ty], [llvm_i16_ty]>;
1225+
1226+ } // IntrProperties = [IntrNoMem, IntrSpeculatable]
12271227
12281228// FNS
12291229 def int_nvvm_fns : NVVMBuiltin,
@@ -1440,18 +1440,22 @@ def int_nvvm_internal_addrspace_wrap :
14401440
14411441// Move intrinsics, used in nvvm internally
14421442
1443- def int_nvvm_move_i16 : Intrinsic<[llvm_i16_ty], [llvm_i16_ty], [IntrNoMem]>;
1444- def int_nvvm_move_i32 : Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoMem]>;
1445- def int_nvvm_move_i64 : Intrinsic<[llvm_i64_ty], [llvm_i64_ty], [IntrNoMem]>;
1446- def int_nvvm_move_float : Intrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
1447- def int_nvvm_move_double : Intrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
1448- def int_nvvm_move_ptr : Intrinsic<[llvm_anyptr_ty], [llvm_anyptr_ty], [IntrNoMem, NoCapture<ArgIndex<0>>]>;
1443+ let IntrProperties = [IntrNoMem] in {
1444+ def int_nvvm_move_i16 : DefaultAttrsIntrinsic<[llvm_i16_ty], [llvm_i16_ty]>;
1445+ def int_nvvm_move_i32 : DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty]>;
1446+ def int_nvvm_move_i64 : DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty]>;
1447+ def int_nvvm_move_float : DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty]>;
1448+ def int_nvvm_move_double : DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty]>;
1449+ def int_nvvm_move_ptr : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [llvm_anyptr_ty]>;
1450+ }
14491451
14501452// For getting the handle from a texture or surface variable
1451- def int_nvvm_texsurf_handle
1452- : Intrinsic<[llvm_i64_ty], [llvm_metadata_ty, llvm_anyptr_ty], [IntrNoMem]>;
1453- def int_nvvm_texsurf_handle_internal
1454- : Intrinsic<[llvm_i64_ty], [llvm_anyptr_ty], [IntrNoMem]>;
1453+ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
1454+ def int_nvvm_texsurf_handle
1455+ : DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_metadata_ty, llvm_anyptr_ty]>;
1456+ def int_nvvm_texsurf_handle_internal
1457+ : DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_anyptr_ty]>;
1458+ }
14551459
14561460/// Error / Warn
14571461def int_nvvm_compiler_error : Intrinsic<[], [llvm_anyptr_ty]>;
@@ -1472,106 +1476,111 @@ foreach i = 0...31 in
14721476 DefaultAttrsIntrinsic<[llvm_i32_ty], [],
14731477 [IntrNoMem, IntrSpeculatable, NoUndef<RetIndex>]>;
14741478
1479+ //
1480+ // Texture Fetch
1481+ //
1482+ let IntrProperties = [IntrReadMem] in {
1483+ foreach is_unified = [true, false] in {
1484+ defvar mode = !if(is_unified, "_unified", "");
1485+ defvar addr_args = !if(is_unified, [llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty]);
14751486
1476- foreach is_unified = [true, false] in {
1477- defvar mode = !if(is_unified, "_unified", "");
1478- defvar addr_args = !if(is_unified, [llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty]);
1479-
1480- // Texture Fetch
1481- foreach vec = [V4F32, V4S32, V4U32] in {
1482- foreach is_array = [true, false] in {
1483- defvar array = !if(is_array, "_array", "");
1484- defvar array_args = !if(is_array, [llvm_i32_ty], []<LLVMType>);
1485-
1486- def int_nvvm_tex # mode # _1d # array # _ # vec.Name # _s32
1487- : Intrinsic<vec.Types,
1488- !listconcat(addr_args, array_args, !listsplat(llvm_i32_ty, 1))>;
1489- def int_nvvm_tex # mode # _1d # array # _ # vec.Name # _f32
1490- : Intrinsic<vec.Types,
1491- !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 1))>;
1492- def int_nvvm_tex # mode # _1d # array # _level_ # vec.Name # _f32
1493- : Intrinsic<vec.Types,
1494- !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 2))>;
1495- def int_nvvm_tex # mode # _1d # array # _grad_ # vec.Name # _f32
1496- : Intrinsic<vec.Types,
1497- !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 3))>;
1498-
1499- def int_nvvm_tex # mode # _2d # array # _ # vec.Name # _s32
1500- : Intrinsic<vec.Types,
1501- !listconcat(addr_args, array_args, !listsplat(llvm_i32_ty, 2))>;
1502- def int_nvvm_tex # mode # _2d # array # _ # vec.Name # _f32
1503- : Intrinsic<vec.Types,
1504- !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 2))>;
1505- def int_nvvm_tex # mode # _2d # array # _level_ # vec.Name # _f32
1506- : Intrinsic<vec.Types,
1507- !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 3))>;
1508- def int_nvvm_tex # mode # _2d # array # _grad_ # vec.Name # _f32
1509- : Intrinsic<vec.Types,
1510- !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 6))>;
1487+ foreach vec = [V4F32, V4S32, V4U32] in {
1488+ foreach is_array = [true, false] in {
1489+ defvar array = !if(is_array, "_array", "");
1490+ defvar array_args = !if(is_array, [llvm_i32_ty], []<LLVMType>);
15111491
1512- if !not(is_array) then {
1513- def int_nvvm_tex # mode # _3d_ # vec.Name # _s32
1492+ def int_nvvm_tex # mode # _1d # array # _ # vec.Name # _s32
15141493 : Intrinsic<vec.Types,
1515- !listconcat(addr_args, !listsplat(llvm_i32_ty, 3 ))>;
1516- def int_nvvm_tex # mode # _3d_ # vec.Name # _f32
1494+ !listconcat(addr_args, array_args, !listsplat(llvm_i32_ty, 1 ))>;
1495+ def int_nvvm_tex # mode # _1d # array # _ # vec.Name # _f32
15171496 : Intrinsic<vec.Types,
1518- !listconcat(addr_args, !listsplat(llvm_float_ty, 3 ))>;
1519- def int_nvvm_tex # mode # _3d_level_ # vec.Name # _f32
1497+ !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 1 ))>;
1498+ def int_nvvm_tex # mode # _1d # array # _level_ # vec.Name # _f32
15201499 : Intrinsic<vec.Types,
1521- !listconcat(addr_args, !listsplat(llvm_float_ty, 4 ))>;
1522- def int_nvvm_tex # mode # _3d_grad_ # vec.Name # _f32
1500+ !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 2 ))>;
1501+ def int_nvvm_tex # mode # _1d # array # _grad_ # vec.Name # _f32
15231502 : Intrinsic<vec.Types,
1524- !listconcat(addr_args, !listsplat(llvm_float_ty, 9))>;
1525- }
1503+ !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 3))>;
15261504
1527- def int_nvvm_tex # mode # _cube # array # _ # vec.Name # _f32
1528- : Intrinsic<vec.Types,
1529- !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 3))>;
1530- def int_nvvm_tex # mode # _cube # array # _level_ # vec.Name # _f32
1531- : Intrinsic<vec.Types,
1532- !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 4))>;
1505+ def int_nvvm_tex # mode # _2d # array # _ # vec.Name # _s32
1506+ : Intrinsic<vec.Types,
1507+ !listconcat(addr_args, array_args, !listsplat(llvm_i32_ty, 2))>;
1508+ def int_nvvm_tex # mode # _2d # array # _ # vec.Name # _f32
1509+ : Intrinsic<vec.Types,
1510+ !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 2))>;
1511+ def int_nvvm_tex # mode # _2d # array # _level_ # vec.Name # _f32
1512+ : Intrinsic<vec.Types,
1513+ !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 3))>;
1514+ def int_nvvm_tex # mode # _2d # array # _grad_ # vec.Name # _f32
1515+ : Intrinsic<vec.Types,
1516+ !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 6))>;
1517+
1518+ if !not(is_array) then {
1519+ def int_nvvm_tex # mode # _3d_ # vec.Name # _s32
1520+ : Intrinsic<vec.Types,
1521+ !listconcat(addr_args, !listsplat(llvm_i32_ty, 3))>;
1522+ def int_nvvm_tex # mode # _3d_ # vec.Name # _f32
1523+ : Intrinsic<vec.Types,
1524+ !listconcat(addr_args, !listsplat(llvm_float_ty, 3))>;
1525+ def int_nvvm_tex # mode # _3d_level_ # vec.Name # _f32
1526+ : Intrinsic<vec.Types,
1527+ !listconcat(addr_args, !listsplat(llvm_float_ty, 4))>;
1528+ def int_nvvm_tex # mode # _3d_grad_ # vec.Name # _f32
1529+ : Intrinsic<vec.Types,
1530+ !listconcat(addr_args, !listsplat(llvm_float_ty, 9))>;
1531+ }
15331532
1534- if is_unified then
1535- def int_nvvm_tex # mode # _cube # array # _grad_ # vec.Name # _f32
1533+ def int_nvvm_tex # mode # _cube # array # _ # vec.Name # _f32
1534+ : Intrinsic<vec.Types,
1535+ !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 3))>;
1536+ def int_nvvm_tex # mode # _cube # array # _level_ # vec.Name # _f32
15361537 : Intrinsic<vec.Types,
1537- !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 9))>;
1538- } // is_array
1538+ !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 4))>;
15391539
1540- foreach comp = ["r", "g", "b", "a"] in {
1541- def int_nvvm_tld4 # mode # _ # comp # _2d_ # vec.Name # _f32
1542- : Intrinsic<vec.Types,
1543- !listconcat(addr_args, !listsplat(llvm_float_ty, 2))>;
1544- } // comp
1545- } // vec
1546- } // is_unified
1540+ if is_unified then
1541+ def int_nvvm_tex # mode # _cube # array # _grad_ # vec.Name # _f32
1542+ : Intrinsic<vec.Types,
1543+ !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 9))>;
1544+ } // is_array
1545+
1546+ foreach comp = ["r", "g", "b", "a"] in {
1547+ def int_nvvm_tld4 # mode # _ # comp # _2d_ # vec.Name # _f32
1548+ : Intrinsic<vec.Types,
1549+ !listconcat(addr_args, !listsplat(llvm_float_ty, 2))>;
1550+ } // comp
1551+ } // vec
1552+ } // is_unified
1553+ } // IntrProperties = [IntrReadMem]
15471554
15481555//=== Surface Load
1549- foreach clamp = ["clamp", "trap", "zero"] in {
1550- foreach vec = [TV_I8, TV_I16, TV_I32, TV_I64,
1551- TV_V2I8, TV_V2I16, TV_V2I32, TV_V2I64,
1552- TV_V4I8, TV_V4I16, TV_V4I32] in {
1556+ let IntrProperties = [IntrReadMem] in {
1557+ foreach clamp = ["clamp", "trap", "zero"] in {
1558+ foreach vec = [TV_I8, TV_I16, TV_I32, TV_I64,
1559+ TV_V2I8, TV_V2I16, TV_V2I32, TV_V2I64,
1560+ TV_V4I8, TV_V4I16, TV_V4I32] in {
15531561
1554- def int_nvvm_suld_1d_ # vec.Name # _ # clamp
1555- : Intrinsic<vec.Types,
1556- [llvm_i64_ty, llvm_i32_ty]>;
1562+ def int_nvvm_suld_1d_ # vec.Name # _ # clamp
1563+ : Intrinsic<vec.Types,
1564+ [llvm_i64_ty, llvm_i32_ty]>;
15571565
1558- def int_nvvm_suld_1d_array_ # vec.Name # _ # clamp
1559- : Intrinsic<vec.Types,
1560- [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty]>;
1566+ def int_nvvm_suld_1d_array_ # vec.Name # _ # clamp
1567+ : Intrinsic<vec.Types,
1568+ [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty]>;
15611569
1562- def int_nvvm_suld_2d_ # vec.Name # _ # clamp
1563- : Intrinsic<vec.Types,
1564- [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty]>;
1570+ def int_nvvm_suld_2d_ # vec.Name # _ # clamp
1571+ : Intrinsic<vec.Types,
1572+ [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty]>;
15651573
1566- def int_nvvm_suld_2d_array_ # vec.Name # _ # clamp
1567- : Intrinsic<vec.Types,
1568- [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty]>;
1574+ def int_nvvm_suld_2d_array_ # vec.Name # _ # clamp
1575+ : Intrinsic<vec.Types,
1576+ [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty]>;
15691577
1570- def int_nvvm_suld_3d_ # vec.Name # _ # clamp
1571- : Intrinsic<vec.Types,
1572- [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty]>;
1573- } // vec
1574- } // clamp
1578+ def int_nvvm_suld_3d_ # vec.Name # _ # clamp
1579+ : Intrinsic<vec.Types,
1580+ [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty]>;
1581+ } // vec
1582+ } // clamp
1583+ } // IntrProperties = [IntrReadMem]
15751584
15761585//===- Texture Query ------------------------------------------------------===//
15771586
0 commit comments