@@ -257,7 +257,6 @@ fn parse_dumpbin(output: &str) -> HashMap<String, Vec<Function>> {
257
257
ret
258
258
}
259
259
260
-
261
260
#[ wasm_bindgen( module = "child_process" ) ]
262
261
extern "C" {
263
262
#[ wasm_bindgen( js_name = execSync) ]
@@ -420,26 +419,29 @@ pub fn assert(fnptr: usize, fnname: &str, expected: &str) {
420
419
break ;
421
420
}
422
421
423
- let instruction_limit = match expected {
424
- // cpuid returns a pretty big aggregate structure so excempt it from
425
- // the slightly more restrictive 22 instructions below
426
- "cpuid" => 30 ,
427
-
428
- // Apparently on Windows LLVM generates a bunch of saves/restores of
429
- // xmm registers around these intstructions which blows the 20
430
- // limit below. As it seems dictates by Windows's abi (I
431
- // guess?) we probably can't do much about it...
432
- "vzeroall" | "vzeroupper" if cfg ! ( windows) => 30 ,
433
-
434
- // Intrinsics using `cvtpi2ps` are typically "composites" and in some
435
- // cases exceed the limit.
436
- "cvtpi2ps" => 25 ,
437
-
438
- // Original limit was 20 instructions, but ARM DSP Intrinsics are
439
- // exactly 20 instructions long. So bump the limit to 22 instead of
440
- // adding here a long list of expections.
441
- _ => 22 ,
442
- } ;
422
+ let instruction_limit = std:: env:: var ( "STDSIMD_ASSERT_INSTR_LIMIT" )
423
+ . map ( |v| v. parse ( ) . unwrap ( ) )
424
+ . unwrap_or_else ( |_| match expected {
425
+ // cpuid returns a pretty big aggregate structure so exempt it from
426
+ // the slightly more restrictive 22 instructions below
427
+ "cpuid" => 30 ,
428
+
429
+ // Apparently on Windows LLVM generates a bunch of saves/restores
430
+ // of xmm registers around these intstructions which
431
+ // blows the 20 limit below. As it seems dictates by
432
+ // Windows's abi (I guess?) we probably can't do much
433
+ // about it...
434
+ "vzeroall" | "vzeroupper" if cfg ! ( windows) => 30 ,
435
+
436
+ // Intrinsics using `cvtpi2ps` are typically "composites" and in
437
+ // some cases exceed the limit.
438
+ "cvtpi2ps" => 25 ,
439
+
440
+ // Original limit was 20 instructions, but ARM DSP Intrinsics are
441
+ // exactly 20 instructions long. So bump the limit to 22 instead of
442
+ // adding here a long list of exceptions.
443
+ _ => 22 ,
444
+ } ) ;
443
445
let probably_only_one_instruction = instrs. len ( ) < instruction_limit;
444
446
445
447
if found && probably_only_one_instruction && !inlining_failed {
0 commit comments