Skip to content

Commit

Permalink
add usize as a x86-intel primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyizhang-1 committed Jul 26, 2024
1 parent a355a66 commit 01d38b0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
12 changes: 6 additions & 6 deletions crates/core_arch/src/x86_64/amx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub unsafe fn _tile_storeconfig(mem_addr: *mut i8) {
#[rustc_legacy_const_generics(0)]
#[target_feature(enable = "amx-tile")]
#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
pub unsafe fn _tile_loadd<const dst: i8>(base: *const i8, stride: i64) {
pub unsafe fn _tile_loadd<const dst: i8>(base: *const i8, stride: usize) {
static_assert_uimm_bits!(dst, 3);
tileloadd64(dst, base, stride);
}
Expand All @@ -55,7 +55,7 @@ pub unsafe fn _tile_release() {
#[rustc_legacy_const_generics(0)]
#[target_feature(enable = "amx-tile")]
#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
pub unsafe fn _tile_stored<const dst: i8>(base: *mut i8, stride: i64) {
pub unsafe fn _tile_stored<const dst: i8>(base: *mut i8, stride: usize) {
static_assert_uimm_bits!(dst, 3);
tilestored64(dst, base, stride);
}
Expand All @@ -70,7 +70,7 @@ pub unsafe fn _tile_stored<const dst: i8>(base: *mut i8, stride: i64) {
#[rustc_legacy_const_generics(0)]
#[target_feature(enable = "amx-tile")]
#[unstable(feature = "x86_amx_intrinsics", issue = "126622")]
pub unsafe fn _tile_stream_loadd<const dst: i8>(base: *const i8, stride: i64) {
pub unsafe fn _tile_stream_loadd<const dst: i8>(base: *const i8, stride: usize) {
static_assert_uimm_bits!(dst, 3);
tileloaddt164(dst, base, stride);
}
Expand Down Expand Up @@ -244,13 +244,13 @@ extern "C" {
#[link_name = "llvm.x86.sttilecfg"]
fn sttilecfg(mem_addr: *mut i8);
#[link_name = "llvm.x86.tileloadd64"]
fn tileloadd64(dst: i8, base: *const i8, stride: i64);
fn tileloadd64(dst: i8, base: *const i8, stride: usize);
#[link_name = "llvm.x86.tileloaddt164"]
fn tileloaddt164(dst: i8, base: *const i8, stride: i64);
fn tileloaddt164(dst: i8, base: *const i8, stride: usize);
#[link_name = "llvm.x86.tilerelease"]
fn tilerelease();
#[link_name = "llvm.x86.tilestored64"]
fn tilestored64(dst: i8, base: *mut i8, stride: i64);
fn tilestored64(dst: i8, base: *mut i8, stride: usize);
#[link_name = "llvm.x86.tilezero"]
fn tilezero(dst: i8);
#[link_name = "llvm.x86.tdpbf16ps"]
Expand Down
1 change: 1 addition & 0 deletions crates/stdarch-verify/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ fn to_type(t: &syn::Type) -> proc_macro2::TokenStream {
"u32" => quote! { &U32 },
"u64" => quote! { &U64 },
"u128" => quote! { &U128 },
"usize" => quote! { &USIZE },
"u8" => quote! { &U8 },
"p8" => quote! { &P8 },
"p16" => quote! { &P16 },
Expand Down
7 changes: 5 additions & 2 deletions crates/stdarch-verify/tests/x86-intel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ use std::collections::{BTreeMap, HashMap, HashSet};
use std::fs::File;
use std::io;
use std::io::{BufWriter, Write};
use std::usize;

use serde::Deserialize;

const PRINT_INSTRUCTION_VIOLATIONS: bool = false;
const PRINT_MISSING_LISTS: bool = false;
const PRINT_MISSING_LISTS_MARKDOWN: bool = false;
const SS: u8 = (8 * core::mem::size_of::<usize>()) as u8;

struct Function {
name: &'static str,
Expand All @@ -35,6 +37,7 @@ static U16: Type = Type::PrimUnsigned(16);
static U32: Type = Type::PrimUnsigned(32);
static U64: Type = Type::PrimUnsigned(64);
static U128: Type = Type::PrimUnsigned(128);
static USIZE: Type = Type::PrimUnsigned(SS);
static ORDERING: Type = Type::Ordering;

static M128: Type = Type::M128;
Expand Down Expand Up @@ -716,15 +719,15 @@ fn equate(
(&Type::PrimSigned(8), "__int8" | "constexpr int" | "char") => {}
(&Type::PrimSigned(16), "__int16" | "short") => {}
(&Type::PrimSigned(32), "__int32" | "const int" | "int") => {}
(&Type::PrimSigned(64), "__int64" | "long long" | "size_t") => {}
(&Type::PrimSigned(64), "__int64" | "long long") => {}
(&Type::PrimUnsigned(8), "unsigned char") => {}
(&Type::PrimUnsigned(16), "unsigned short") => {}
(&Type::BFloat16, "__bfloat16") => {}
(
&Type::PrimUnsigned(32),
"unsigned __int32" | "unsigned int" | "unsigned long" | "const unsigned int",
) => {}
(&Type::PrimUnsigned(64), "unsigned __int64") => {}
(&Type::PrimUnsigned(64), "unsigned __int64" | "size_t") => {}

(&Type::M128, "__m128") => {}
(&Type::M128BH, "__m128bh") => {}
Expand Down

0 comments on commit 01d38b0

Please sign in to comment.