File tree 2 files changed +10
-5
lines changed
stdsimd-test/assert-instr-macro/src
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -574,9 +574,9 @@ pub const _MM_HINT_NTA: i8 = 0;
574
574
#[ inline( always) ]
575
575
#[ target_feature = "+sse" ]
576
576
#[ cfg_attr( test, assert_instr( prefetcht0, strategy = _MM_HINT_T0) ) ]
577
- // #[cfg_attr(test, assert_instr(prefetcht1, strategy = _MM_HINT_T1))]
578
- // #[cfg_attr(test, assert_instr(prefetcht2, strategy = _MM_HINT_T2))]
579
- // #[cfg_attr(test, assert_instr(prefetchnta, strategy = _MM_HINT_NTA))]
577
+ #[ cfg_attr( test, assert_instr( prefetcht1, strategy = _MM_HINT_T1) ) ]
578
+ #[ cfg_attr( test, assert_instr( prefetcht2, strategy = _MM_HINT_T2) ) ]
579
+ #[ cfg_attr( test, assert_instr( prefetchnta, strategy = _MM_HINT_NTA) ) ]
580
580
pub unsafe fn _mm_prefetch ( p : * const c_void , strategy : i8 ) {
581
581
// The `strategy` must be a compile-time constant, so we use a short form of
582
582
// `constify_imm8!` for now.
Original file line number Diff line number Diff line change @@ -40,7 +40,9 @@ pub fn assert_instr(attr: proc_macro::TokenStream,
40
40
( quote ! { #[ ignore] } ) . into ( )
41
41
} ;
42
42
let name = & func. ident ;
43
- let assert_name = syn:: Ident :: from ( & format ! ( "assert_{}" , name. sym. as_str( ) ) [ ..] ) ;
43
+ let assert_name = syn:: Ident :: from ( & format ! ( "assert_{}_{}" ,
44
+ name. sym. as_str( ) ,
45
+ instr. sym. as_str( ) ) [ ..] ) ;
44
46
let shim_name = syn:: Ident :: from ( & format ! ( "{}_shim" , name. sym. as_str( ) ) [ ..] ) ;
45
47
let ( to_test, test_name) = if invoc. args . len ( ) == 0 {
46
48
( TokenStream :: empty ( ) , & func. ident )
@@ -67,7 +69,10 @@ pub fn assert_instr(attr: proc_macro::TokenStream,
67
69
}
68
70
} ;
69
71
}
70
- let attrs = Append ( & item. attrs ) ;
72
+ let attrs = item. attrs . iter ( ) . filter ( |attr| {
73
+ attr. path . segments . get ( 0 ) . item ( ) . ident . sym . as_str ( ) . starts_with ( "target" )
74
+ } ) . collect :: < Vec < _ > > ( ) ;
75
+ let attrs = Append ( & attrs) ;
71
76
( quote ! {
72
77
#attrs
73
78
unsafe fn #shim_name( #( #inputs) , * ) #ret {
You can’t perform that action at this time.
0 commit comments