Skip to content

Commit eb87fb1

Browse files
committed
update codegen due to LLVM7 upgrade
1 parent 51904cd commit eb87fb1

File tree

2 files changed

+33
-37
lines changed

2 files changed

+33
-37
lines changed

coresimd/x86/sse.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,8 @@ pub unsafe fn _mm_loadr_ps(p: *const f32) -> __m128 {
13481348
// On i586 (no SSE2) it just generates plain MOV instructions.
13491349
#[cfg_attr(
13501350
all(test, any(target_arch = "x86_64", target_feature = "sse2")),
1351-
assert_instr(movhpd)
1351+
// assert_instr(movhpd)
1352+
assert_instr(movhps) // LLVM7 prefers single-precision instructions
13521353
)]
13531354
pub unsafe fn _mm_storeh_pi(p: *mut __m64, a: __m128) {
13541355
#[cfg(target_arch = "x86")]

crates/stdsimd-verify/src/lib.rs

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ pub fn x86_functions(input: TokenStream) -> TokenStream {
8383
required_const: &[#(#required_const),*],
8484
}
8585
}
86-
})
87-
.collect::<Vec<_>>();
86+
}).collect::<Vec<_>>();
8887

8988
let ret = quote! { #input: &[Function] = &[#(#functions),*]; };
9089
// println!("{}", ret);
@@ -93,28 +92,30 @@ pub fn x86_functions(input: TokenStream) -> TokenStream {
9392

9493
fn to_type(t: &syn::Type) -> proc_macro2::TokenStream {
9594
match *t {
96-
syn::Type::Path(ref p) => match extract_path_ident(&p.path).to_string().as_ref() {
97-
"__m128" => quote! { &M128 },
98-
"__m128d" => quote! { &M128D },
99-
"__m128i" => quote! { &M128I },
100-
"__m256" => quote! { &M256 },
101-
"__m256d" => quote! { &M256D },
102-
"__m256i" => quote! { &M256I },
103-
"__m64" => quote! { &M64 },
104-
"bool" => quote! { &BOOL },
105-
"f32" => quote! { &F32 },
106-
"f64" => quote! { &F64 },
107-
"i16" => quote! { &I16 },
108-
"i32" => quote! { &I32 },
109-
"i64" => quote! { &I64 },
110-
"i8" => quote! { &I8 },
111-
"u16" => quote! { &U16 },
112-
"u32" => quote! { &U32 },
113-
"u64" => quote! { &U64 },
114-
"u8" => quote! { &U8 },
115-
"CpuidResult" => quote! { &CPUID },
116-
s => panic!("unspported type: {}", s),
117-
},
95+
syn::Type::Path(ref p) => {
96+
match extract_path_ident(&p.path).to_string().as_ref() {
97+
"__m128" => quote! { &M128 },
98+
"__m128d" => quote! { &M128D },
99+
"__m128i" => quote! { &M128I },
100+
"__m256" => quote! { &M256 },
101+
"__m256d" => quote! { &M256D },
102+
"__m256i" => quote! { &M256I },
103+
"__m64" => quote! { &M64 },
104+
"bool" => quote! { &BOOL },
105+
"f32" => quote! { &F32 },
106+
"f64" => quote! { &F64 },
107+
"i16" => quote! { &I16 },
108+
"i32" => quote! { &I32 },
109+
"i64" => quote! { &I64 },
110+
"i8" => quote! { &I8 },
111+
"u16" => quote! { &U16 },
112+
"u32" => quote! { &U32 },
113+
"u64" => quote! { &U64 },
114+
"u8" => quote! { &U8 },
115+
"CpuidResult" => quote! { &CPUID },
116+
s => panic!("unspported type: {}", s),
117+
}
118+
}
118119
syn::Type::Ptr(syn::TypePtr { ref elem, .. })
119120
| syn::Type::Reference(syn::TypeReference { ref elem, .. }) => {
120121
let tokens = to_type(&elem);
@@ -183,8 +184,7 @@ fn find_instrs(attrs: &[syn::Attribute]) -> Vec<syn::Ident> {
183184
}
184185
}
185186
_ => None,
186-
})
187-
.filter_map(|nested| match nested {
187+
}).filter_map(|nested| match nested {
188188
syn::NestedMeta::Meta(syn::Meta::List(i)) => {
189189
if i.ident == "assert_instr" {
190190
i.nested.into_iter().next()
@@ -193,12 +193,10 @@ fn find_instrs(attrs: &[syn::Attribute]) -> Vec<syn::Ident> {
193193
}
194194
}
195195
_ => None,
196-
})
197-
.filter_map(|nested| match nested {
196+
}).filter_map(|nested| match nested {
198197
syn::NestedMeta::Meta(syn::Meta::Word(i)) => Some(i),
199198
_ => None,
200-
})
201-
.collect()
199+
}).collect()
202200
}
203201

204202
fn find_target_feature(attrs: &[syn::Attribute]) -> Option<syn::Lit> {
@@ -214,13 +212,11 @@ fn find_target_feature(attrs: &[syn::Attribute]) -> Option<syn::Lit> {
214212
}
215213
}
216214
_ => None,
217-
})
218-
.flat_map(|list| list)
215+
}).flat_map(|list| list)
219216
.filter_map(|nested| match nested {
220217
syn::NestedMeta::Meta(m) => Some(m),
221218
syn::NestedMeta::Literal(_) => None,
222-
})
223-
.filter_map(|m| match m {
219+
}).filter_map(|m| match m {
224220
syn::Meta::NameValue(i) => {
225221
if i.ident == "enable" {
226222
Some(i.lit)
@@ -229,8 +225,7 @@ fn find_target_feature(attrs: &[syn::Attribute]) -> Option<syn::Lit> {
229225
}
230226
}
231227
_ => None,
232-
})
233-
.next()
228+
}).next()
234229
}
235230

236231
fn find_required_const(attrs: &[syn::Attribute]) -> Vec<usize> {

0 commit comments

Comments
 (0)