Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit17bfd0a

Browse files
committed
Fix tests for a future nightly
Inrust-lang/rust#47743 the SIMD types in the Rust ABI are being switched togetting passed through memory unconditionally rather than through LLVM'simmediate registers. This means that a bunch of our assert_instr invocationsstarted breaking as LLVM has more efficient methods of dealing with memory thanthe instructions themselves.This switches `assert_instr` to unconditionally use a shim that is an `extern`function which should revert back to the previous behavior, using the simd typesas immediates and testing the same.
1 parent68542d9 commit17bfd0a

File tree

1 file changed

+43
-50
lines changed
  • stdsimd-test/assert-instr-macro/src

1 file changed

+43
-50
lines changed

‎stdsimd-test/assert-instr-macro/src/lib.rs‎

Lines changed: 43 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -43,55 +43,48 @@ pub fn assert_instr(
4343
&format!("assert_{}_{}", name.as_ref(), instr.as_ref())[..],
4444
);
4545
let shim_name = syn::Ident::from(format!("{}_shim", name.as_ref()));
46-
let(to_test, test_name) =if invoc.args.len() ==0{
47-
(TokenStream::empty(),&func.ident)
48-
}else{
49-
letmut inputs =Vec::new();
50-
letmut input_vals =Vec::new();
51-
let ret =&func.decl.output;
52-
for argin func.decl.inputs.iter(){
53-
let capture =match*arg{
54-
syn::FnArg::Captured(ref c) => c,
55-
_ =>panic!("arguments must not have patterns"),
56-
};
57-
let ident =match capture.pat{
58-
syn::Pat::Ident(ref i) =>&i.ident,
59-
_ =>panic!("must have bare arguments"),
60-
};
61-
match invoc.args.iter().find(|a| a.0 == ident.as_ref()){
62-
Some(&(_,ref tts)) =>{
63-
input_vals.push(quote!{ #tts});
64-
}
65-
None =>{
66-
inputs.push(capture);
67-
input_vals.push(quote!{ #ident});
68-
}
69-
};
70-
}
46+
letmut inputs =Vec::new();
47+
letmut input_vals =Vec::new();
48+
let ret =&func.decl.output;
49+
for argin func.decl.inputs.iter(){
50+
let capture =match*arg{
51+
syn::FnArg::Captured(ref c) => c,
52+
_ =>panic!("arguments must not have patterns"),
53+
};
54+
let ident =match capture.pat{
55+
syn::Pat::Ident(ref i) =>&i.ident,
56+
_ =>panic!("must have bare arguments"),
57+
};
58+
match invoc.args.iter().find(|a| a.0 == ident.as_ref()){
59+
Some(&(_,ref tts)) =>{
60+
input_vals.push(quote!{ #tts});
61+
}
62+
None =>{
63+
inputs.push(capture);
64+
input_vals.push(quote!{ #ident});
65+
}
66+
};
67+
}
7168

72-
let attrs = func.attrs
73-
.iter()
74-
.filter(|attr|{
75-
attr.path
76-
.segments
77-
.first()
78-
.unwrap()
79-
.value()
80-
.ident
81-
.as_ref()
82-
.starts_with("target")
83-
})
84-
.collect::<Vec<_>>();
85-
let attrs =Append(&attrs);
86-
(
87-
quote!{
88-
#attrs
89-
unsafefn #shim_name(#(#inputs),*) #ret{
90-
#name(#(#input_vals),*)
91-
}
92-
}.into(),
93-
&shim_name,
94-
)
69+
let attrs = func.attrs
70+
.iter()
71+
.filter(|attr|{
72+
attr.path
73+
.segments
74+
.first()
75+
.unwrap()
76+
.value()
77+
.ident
78+
.as_ref()
79+
.starts_with("target")
80+
})
81+
.collect::<Vec<_>>();
82+
let attrs =Append(&attrs);
83+
let to_test =quote!{
84+
#attrs
85+
unsafe externfn #shim_name(#(#inputs),*) #ret{
86+
#name(#(#input_vals),*)
87+
}
9588
};
9689

9790
let tts:TokenStream =quote_spanned!{
@@ -102,8 +95,8 @@ pub fn assert_instr(
10295
fn #assert_name(){
10396
#to_test
10497

105-
::stdsimd_test::assert(#test_nameasusize,
106-
stringify!(#test_name),
98+
::stdsimd_test::assert(#shim_nameasusize,
99+
stringify!(#shim_name),
107100
stringify!(#instr));
108101
}
109102
}.into();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp