@@ -831,7 +831,7 @@ let TargetPrefix = "nvvm" in {
831
831
//
832
832
// Sad
833
833
//
834
- let IntrProperties = [IntrNoMem, Commutative, IntrSpeculatable] in {
834
+ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
835
835
foreach sign = ["", "u"] in {
836
836
def int_nvvm_sad_ # sign # s : NVVMBuiltin,
837
837
DefaultAttrsIntrinsic<[llvm_i16_ty], [llvm_i16_ty, llvm_i16_ty, llvm_i16_ty]>;
@@ -1150,41 +1150,40 @@ let TargetPrefix = "nvvm" in {
1150
1150
def int_nvvm_bf2h_rn # ftz : NVVMBuiltin,
1151
1151
DefaultAttrsIntrinsic<[llvm_i16_ty], [llvm_bfloat_ty]>;
1152
1152
}
1153
- }
1154
- let IntrProperties = [IntrNoMem, IntrNoCallback] in {
1153
+
1155
1154
foreach rnd = ["rn", "rz"] in {
1156
1155
foreach relu = ["", "_relu"] in {
1157
1156
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]>;
1159
1158
1160
1159
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]>;
1162
1161
1163
1162
def int_nvvm_f2bf16_ # rnd # relu : NVVMBuiltin,
1164
- Intrinsic <[llvm_bfloat_ty], [llvm_float_ty]>;
1163
+ DefaultAttrsIntrinsic <[llvm_bfloat_ty], [llvm_float_ty]>;
1165
1164
}
1166
1165
}
1167
1166
1168
1167
foreach satfinite = ["", "_satfinite"] in {
1169
1168
def int_nvvm_f2tf32_rna # satfinite : NVVMBuiltin,
1170
- Intrinsic <[llvm_i32_ty], [llvm_float_ty]>;
1169
+ DefaultAttrsIntrinsic <[llvm_i32_ty], [llvm_float_ty]>;
1171
1170
1172
1171
foreach rnd = ["rn", "rz"] in
1173
1172
foreach relu = ["", "_relu"] in
1174
1173
def int_nvvm_f2tf32_ # rnd # relu # satfinite : NVVMBuiltin,
1175
- Intrinsic <[llvm_i32_ty], [llvm_float_ty]>;
1174
+ DefaultAttrsIntrinsic <[llvm_i32_ty], [llvm_float_ty]>;
1176
1175
}
1177
1176
1178
1177
foreach type = ["e4m3x2", "e5m2x2"] in {
1179
1178
foreach relu = ["", "_relu"] in {
1180
1179
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]>;
1182
1181
1183
1182
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]>;
1185
1184
1186
1185
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]>;
1188
1187
}
1189
1188
}
1190
1189
@@ -1222,8 +1221,9 @@ let TargetPrefix = "nvvm" in {
1222
1221
}
1223
1222
1224
1223
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]
1227
1227
1228
1228
// FNS
1229
1229
def int_nvvm_fns : NVVMBuiltin,
@@ -1440,18 +1440,22 @@ def int_nvvm_internal_addrspace_wrap :
1440
1440
1441
1441
// Move intrinsics, used in nvvm internally
1442
1442
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
+ }
1449
1451
1450
1452
// 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
+ }
1455
1459
1456
1460
/// Error / Warn
1457
1461
def int_nvvm_compiler_error : Intrinsic<[], [llvm_anyptr_ty]>;
@@ -1472,106 +1476,111 @@ foreach i = 0...31 in
1472
1476
DefaultAttrsIntrinsic<[llvm_i32_ty], [],
1473
1477
[IntrNoMem, IntrSpeculatable, NoUndef<RetIndex>]>;
1474
1478
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]);
1475
1486
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>);
1511
1491
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
1514
1493
: 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
1517
1496
: 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
1520
1499
: 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
1523
1502
: Intrinsic<vec.Types,
1524
- !listconcat(addr_args, !listsplat(llvm_float_ty, 9))>;
1525
- }
1503
+ !listconcat(addr_args, array_args, !listsplat(llvm_float_ty, 3))>;
1526
1504
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
+ }
1533
1532
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
1536
1537
: 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))>;
1539
1539
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]
1547
1554
1548
1555
//=== 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 {
1553
1561
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]>;
1557
1565
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]>;
1561
1569
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]>;
1565
1573
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]>;
1569
1577
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]
1575
1584
1576
1585
//===- Texture Query ------------------------------------------------------===//
1577
1586
0 commit comments