Mark function pointer as AVX-aware

⚓ Rust    📅 2025-11-28    👤 surdeus    👁️ 2      

surdeus

Hi!

I am writing a JIT that compiles functions:

type JitFn = fn(*mut Context, *mut State, u64, *const u64) -> bool;

When I call such a function, rust generates this code (compiled with -Ctarget-cpu=native):

vzeroupper
call *(%rax)

This single vzeroupper is currently taking up 13% of the execution time according to perf. Is there any way to mark the function pointer as AVX-enabled, so that the vzeroupper can be omitted?

1 post - 1 participant

Read full topic

🏷️ Rust_feed