Skip to content

Commit 6d765b7

Browse files
committed
support tile builtins
1 parent 4380568 commit 6d765b7

File tree

1 file changed

+90
-17
lines changed

1 file changed

+90
-17
lines changed

src/intrinsic/llvm.rs

Lines changed: 90 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,23 +1322,96 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
13221322
"llvm.x86.avx512fp16.mask.vfmadd.cph.256" => "__builtin_ia32_vfmaddcph256_mask3",
13231323
"llvm.x86.avx512fp16.mask.vfcmadd.cph.128" => "__builtin_ia32_vfcmaddcph128_mask3",
13241324
"llvm.x86.avx512fp16.mask.vfmadd.cph.128" => "__builtin_ia32_vfmaddcph128_mask3",
1325-
1326-
// TODO: support the tile builtins:
1327-
"llvm.x86.ldtilecfg" => "__builtin_trap",
1328-
"llvm.x86.sttilecfg" => "__builtin_trap",
1329-
"llvm.x86.tileloadd64" => "__builtin_trap",
1330-
"llvm.x86.tilerelease" => "__builtin_trap",
1331-
"llvm.x86.tilestored64" => "__builtin_trap",
1332-
"llvm.x86.tileloaddt164" => "__builtin_trap",
1333-
"llvm.x86.tilezero" => "__builtin_trap",
1334-
"llvm.x86.tdpbf16ps" => "__builtin_trap",
1335-
"llvm.x86.tdpbssd" => "__builtin_trap",
1336-
"llvm.x86.tdpbsud" => "__builtin_trap",
1337-
"llvm.x86.tdpbusd" => "__builtin_trap",
1338-
"llvm.x86.tdpbuud" => "__builtin_trap",
1339-
"llvm.x86.tdpfp16ps" => "__builtin_trap",
1340-
"llvm.x86.tcmmimfp16ps" => "__builtin_trap",
1341-
"llvm.x86.tcmmrlfp16ps" => "__builtin_trap",
1325+
"llvm.x86.ldtilecfg" => {
1326+
let gcc_name = "__builtin_ia32_ldtilecfg";
1327+
let func = cx.context.get_target_builtin_function(gcc_name);
1328+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1329+
return func;
1330+
}
1331+
"llvm.x86.sttilecfg" => {
1332+
let gcc_name = "__builtin_ia32_sttilecfg";
1333+
let func = cx.context.get_target_builtin_function(gcc_name);
1334+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1335+
return func;
1336+
}
1337+
"llvm.x86.tileloadd64" => {
1338+
let gcc_name = "__builtin_ia32_tileloadd64";
1339+
let func = cx.context.get_target_builtin_function(gcc_name);
1340+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1341+
return func;
1342+
}
1343+
"llvm.x86.tilestored64" => {
1344+
let gcc_name = "__builtin_ia32_tilestored64";
1345+
let func = cx.context.get_target_builtin_function(gcc_name);
1346+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1347+
return func;
1348+
}
1349+
"llvm.x86.tilerelease" => {
1350+
let gcc_name = "__builtin_ia32_tilerelease";
1351+
let func = cx.context.get_target_builtin_function(gcc_name);
1352+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1353+
return func;
1354+
}
1355+
"llvm.x86.tileloaddt164" => {
1356+
let gcc_name = "__builtin_ia32_tileloaddt164";
1357+
let func = cx.context.get_target_builtin_function(gcc_name);
1358+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1359+
return func;
1360+
}
1361+
"llvm.x86.tilezero" => {
1362+
let gcc_name = "__builtin_ia32_tilezero";
1363+
let func = cx.context.get_target_builtin_function(gcc_name);
1364+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1365+
return func;
1366+
}
1367+
"llvm.x86.tdpbf16ps" => {
1368+
let gcc_name = "__builtin_ia32_tdpbf16ps";
1369+
let func = cx.context.get_target_builtin_function(gcc_name);
1370+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1371+
return func;
1372+
}
1373+
"llvm.x86.tdpbssd" => {
1374+
let gcc_name = "__builtin_ia32_tdpbssd";
1375+
let func = cx.context.get_target_builtin_function(gcc_name);
1376+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1377+
return func;
1378+
}
1379+
"llvm.x86.tdpbsud" => {
1380+
let gcc_name = "__builtin_ia32_tdpbsud";
1381+
let func = cx.context.get_target_builtin_function(gcc_name);
1382+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1383+
return func;
1384+
}
1385+
"llvm.x86.tdpbusd" => {
1386+
let gcc_name = "__builtin_ia32_tdpbusd";
1387+
let func = cx.context.get_target_builtin_function(gcc_name);
1388+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1389+
return func;
1390+
}
1391+
"llvm.x86.tdpbuud" => {
1392+
let gcc_name = "__builtin_ia32_tdpbuud";
1393+
let func = cx.context.get_target_builtin_function(gcc_name);
1394+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1395+
return func;
1396+
}
1397+
"llvm.x86.tdpfp16ps" => {
1398+
let gcc_name = "__builtin_ia32_tdpfp16ps";
1399+
let func = cx.context.get_target_builtin_function(gcc_name);
1400+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1401+
return func;
1402+
}
1403+
"llvm.x86.tcmmimfp16ps" => {
1404+
let gcc_name = "__builtin_ia32_tcmmimfp16ps";
1405+
let func = cx.context.get_target_builtin_function(gcc_name);
1406+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1407+
return func;
1408+
}
1409+
"llvm.x86.tcmmrlfp16ps" => {
1410+
let gcc_name = "__builtin_ia32_tcmmrlfp16ps";
1411+
let func = cx.context.get_target_builtin_function(gcc_name);
1412+
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
1413+
return func;
1414+
}
13421415

13431416
// NOTE: this file is generated by https://github.com/GuillaumeGomez/llvmint/blob/master/generate_list.py
13441417
_ => include!("archs.rs"),

0 commit comments

Comments
 (0)