@@ -58,6 +58,10 @@ pub fn assert_instr(
58
58
& format ! ( "stdarch_test_shim_{}_{}" , name, instr_str) ,
59
59
name. span ( ) ,
60
60
) ;
61
+ let shim_name_ptr = syn:: Ident :: new (
62
+ & format ! ( "stdarch_test_shim_{}_{}_ptr" , name, instr_str) . to_ascii_uppercase ( ) ,
63
+ name. span ( ) ,
64
+ ) ;
61
65
let mut inputs = Vec :: new ( ) ;
62
66
let mut input_vals = Vec :: new ( ) ;
63
67
let mut const_vals = Vec :: new ( ) ;
@@ -125,6 +129,9 @@ pub fn assert_instr(
125
129
} ;
126
130
let shim_name_str = format ! ( "{}{}" , shim_name, assert_name) ;
127
131
let to_test = quote ! {
132
+
133
+ const #shim_name_ptr : * const u8 = #shim_name_str. as_ptr( ) ;
134
+
128
135
#attrs
129
136
#[ no_mangle]
130
137
#[ inline( never) ]
@@ -140,17 +147,7 @@ pub fn assert_instr(
140
147
// generate some code that's hopefully very tight in terms of
141
148
// codegen but is otherwise unique to prevent code from being
142
149
// folded.
143
- //
144
- // This is avoided on Wasm32 right now since these functions aren't
145
- // inlined which breaks our tests since each intrinsic looks like it
146
- // calls functions. Turns out functions aren't similar enough to get
147
- // merged on wasm32 anyway. This bug is tracked at
148
- // rust-lang/rust#74320.
149
- #[ cfg( not( target_arch = "wasm32" ) ) ]
150
- :: stdarch_test:: _DONT_DEDUP. store(
151
- std:: mem:: transmute( #shim_name_str. as_bytes( ) . as_ptr( ) ) ,
152
- std:: sync:: atomic:: Ordering :: Relaxed ,
153
- ) ;
150
+ :: stdarch_test:: _DONT_DEDUP = #shim_name_ptr;
154
151
#name:: <#( #const_vals) , * >( #( #input_vals) , * )
155
152
}
156
153
} ;
0 commit comments