Skip to content

Commit 2034fd6

Browse files
committed
Add bypass for x86amx
1 parent cb5e319 commit 2034fd6

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,25 @@ impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> {
361361
}
362362

363363
match self.type_kind(llvm_ty) {
364+
TypeKind::X86_AMX if self.type_kind(rust_ty) == TypeKind::Vector => {
365+
let element_count = self.vector_length(rust_ty);
366+
let element_ty = self.element_type(rust_ty);
367+
368+
let element_size_bits = match self.type_kind(element_ty) {
369+
TypeKind::Half => 16,
370+
TypeKind::Float => 32,
371+
TypeKind::Double => 64,
372+
TypeKind::FP128 => 128,
373+
TypeKind::Integer => self.int_width(element_ty),
374+
TypeKind::Pointer => self.int_width(self.isize_ty()),
375+
_ => bug!(
376+
"Vector element type `{element_ty:?}` not one of integer, float or pointer"
377+
),
378+
};
379+
let vector_size_bits = element_size_bits * element_count as u64;
380+
381+
vector_size_bits == 8192
382+
}
364383
TypeKind::BFloat => rust_ty == self.type_i16(),
365384
TypeKind::Vector => {
366385
let llvm_element_count = self.vector_length(llvm_ty) as u64;

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,15 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
16511651
}
16521652

16531653
match self.type_kind(llvm_ty) {
1654+
TypeKind::X86_AMX => {
1655+
let base_name = if is_argument {
1656+
"llvm.x86.cast.vector.to.tile"
1657+
} else {
1658+
"llvm.x86.cast.tile.to.vector"
1659+
};
1660+
1661+
self.call_intrinsic(base_name, &[rust_ty], &[val])
1662+
}
16541663
TypeKind::Vector if self.element_type(llvm_ty) == self.type_i1() => {
16551664
if is_argument {
16561665
self.trunc_int_to_i1_vector(val, dest_ty)

0 commit comments

Comments
 (0)