Skip to content

Commit 08f895d

Browse files
committed
Move x86::arch_ty onto Level impl
1 parent d60a97e commit 08f895d

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

fearless_simd_gen/src/arch/x86.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
use crate::types::{ScalarType, VecType};
5-
use proc_macro2::{Ident, Span, TokenStream};
5+
use proc_macro2::{Ident, TokenStream};
66
use quote::{format_ident, quote};
77

88
pub(crate) fn translate_op(op: &str) -> Option<&'static str> {
@@ -28,17 +28,6 @@ pub(crate) fn translate_op(op: &str) -> Option<&'static str> {
2828
})
2929
}
3030

31-
pub(crate) fn arch_ty(ty: &VecType) -> Ident {
32-
let suffix = match (ty.scalar, ty.scalar_bits) {
33-
(ScalarType::Float, 32) => "",
34-
(ScalarType::Float, 64) => "d",
35-
(ScalarType::Float, _) => unimplemented!(),
36-
(ScalarType::Unsigned | ScalarType::Int | ScalarType::Mask, _) => "i",
37-
};
38-
let name = format!("__m{}{}", ty.scalar_bits * ty.len, suffix);
39-
Ident::new(&name, Span::call_site())
40-
}
41-
4231
pub(crate) fn expr(op: &str, ty: &VecType, args: &[TokenStream]) -> TokenStream {
4332
if let Some(op_name) = translate_op(op) {
4433
let sign_aware = matches!(op, "max" | "min");

fearless_simd_gen/src/mk_x86.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
use crate::arch::x86::{
5-
self, arch_ty, cast_ident, coarse_type, extend_intrinsic, float_compare_method,
6-
intrinsic_ident, op_suffix, pack_intrinsic, set1_intrinsic, simple_intrinsic,
7-
simple_sign_unaware_intrinsic, unpack_intrinsic,
5+
self, cast_ident, coarse_type, extend_intrinsic, float_compare_method, intrinsic_ident,
6+
op_suffix, pack_intrinsic, set1_intrinsic, simple_intrinsic, simple_sign_unaware_intrinsic,
7+
unpack_intrinsic,
88
};
99
use crate::generic::{
1010
generic_as_array, generic_block_combine, generic_block_split, generic_from_array,
@@ -42,7 +42,14 @@ impl Level for X86 {
4242
}
4343

4444
fn arch_ty(&self, vec_ty: &VecType) -> TokenStream {
45-
arch_ty(vec_ty).into_token_stream()
45+
let suffix = match (vec_ty.scalar, vec_ty.scalar_bits) {
46+
(ScalarType::Float, 32) => "",
47+
(ScalarType::Float, 64) => "d",
48+
(ScalarType::Float, _) => unimplemented!(),
49+
(ScalarType::Unsigned | ScalarType::Int | ScalarType::Mask, _) => "i",
50+
};
51+
let name = format!("__m{}{}", vec_ty.scalar_bits * vec_ty.len, suffix);
52+
Ident::new(&name, Span::call_site()).into_token_stream()
4653
}
4754

4855
fn token_doc(&self) -> &'static str {

0 commit comments

Comments
 (0)