Query compiler optimizations for target-cpus

โš“ Rust    ๐Ÿ“… 2025-08-15    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 4      

surdeus

I had a question, but was able to find an answer and thought I would write it down here in case anyone else has use for it (hello, future self โ€“ I see I forgot I had already looked this up, again).

Basically we were looking at some optimizations the other day and wondered if there was some way to easily be able to see what version of simd optimizations could/would be used, given a target-cpu.

First use rustc โ€“print target-cpus to get a list of recognized cpu types. Next, given a target-cpu, run rustc โ€“print cfg -C target-cpu=<target-cpu>, which will show what cfgโ€™s will be set by the compiler for that target-cpu, which includes simd types.

2 posts - 2 participants

Read full topic

๐Ÿท๏ธ Rust_feed