Skip to content

Commit e947072

Browse files
feat: added vector types to support intrinsics that does not represent a
vector register as an array of fundamental types
1 parent 6e190b2 commit e947072

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

crates/intrinsic-test/src/arm/types.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType {
1212
self.metadata
1313
.get("type")
1414
.expect("Failed to extract the C typename in Aarch!")
15+
.replace("*", "")
16+
.replace(" ", "")
17+
.trim()
1518
.to_string()
1619
}
1720

crates/intrinsic-test/src/common/intrinsic_helpers.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub enum TypeKind {
2626
Poly,
2727
Void,
2828
Mask,
29+
Vector,
2930
}
3031

3132
impl FromStr for TypeKind {
@@ -43,6 +44,7 @@ impl FromStr for TypeKind {
4344
"uint" | "unsigned" | "UI8" | "UI16" | "UI32" | "UI64" => Ok(Self::Int(Sign::Unsigned)),
4445
"void" => Ok(Self::Void),
4546
"MASK" => Ok(Self::Mask),
47+
"M64" | "M128" | "M256" | "M512" => Ok(Self::Vector),
4648
_ => Err(format!("Impossible to parse argument kind {s}")),
4749
}
4850
}
@@ -63,6 +65,7 @@ impl fmt::Display for TypeKind {
6365
Self::Char(Sign::Signed) => "char",
6466
Self::Char(Sign::Unsigned) => "unsigned char",
6567
Self::Mask => "mask",
68+
Self::Vector => "vector",
6669
}
6770
)
6871
}
@@ -84,10 +87,13 @@ impl TypeKind {
8487
/// Gets the rust prefix for the type kind i.e. i, u, f.
8588
pub fn rust_prefix(&self) -> &str {
8689
match self {
90+
Self::BFloat => "bf",
8791
Self::Float => "f",
8892
Self::Int(Sign::Signed) => "i",
8993
Self::Int(Sign::Unsigned) => "u",
9094
Self::Poly => "u",
95+
Self::Char(Sign::Unsigned) => "u",
96+
Self::Char(Sign::Signed) => "i",
9197
_ => unreachable!("Unused type kind: {:#?}", self),
9298
}
9399
}

0 commit comments

Comments
 (0)