subtle
subtle copied to clipboard
test+fix: Add asm testing and fix `core_hint_black_box`
trafficstars
Per this zulip discussion and rust-lang/rust#140341 and in contrast to the discussion on #107, read_volatile (and all other equivalent functions in the standard library) should provide strict fewer optimization barriers than black_box.
In service of testing this, I've added a script which makes sure the assembly instructions of a simple case are approximately the expected length across most common architectures.
Also read_volatile is never going to be const, and it would be nice to constify this library (which will hopefully be my next PR if this one is accepted).