Brendan Dolan-Gavitt Profile picture
Building offsec agents: https://t.co/G9EtnC2Gl3 Associate Prof, NYU Tandon (on leave). PGP https://t.co/3WXr0RfRkv MESS Lab: https://t.co/zGycrX3Gmn

Sep 7, 2022, 12 tweets

Heyyy, so remember how I scanned all those x86-64 pkgs to see if they changed the behavior of floating point math related to handling of subnormal/denormals? And how I didn't bother to check other CPU archs because surely it was a weird x86 thing? Well...

Let's just take a quick look through the gcc source to see if there are any other implementations of crtfastmath.c, just to be safe. Oh. Oh no.

Well, probably they aren't setting CPU floating point state right? Let's just look at them one by one. How about sparc?

My sparc is a little rusty so let's check the manual to find out what "nonstandard" means... well this looks familiar.

How about MIPS? Also enables flush-to-zero via a hardware register.

Alpha? Same story. Maps denorms to zero as well as underflowed outputs.

Itanium was Intel's famously ambitious (and failed) attempt to redesign an architecture from the ground up. Did they take the opportunity to fix this bit of global state? Nope.

[The comment above that constant is my own annotation; the original was undocumented, so I had to go to the IA64 manual to decode the bitfield.]

Loongson is a CPU architecture from China, that is pretty similar to MIPS, and indeed it is similar in this respect too:

But enough with all these old and weird obscure CPUs. How about ARM, which had shipped 100 billion chips as of 2017? I bet you can guess whether it, too, sets FTZ. (community.arm.com/arm-community-…)

Well, ARM is a product of its time (1985) and really a victim of its own success. When they had a chance to redo things in the move to 64-bit (AArch64), maybe they changed this? Welp.

In conclusion, I wish I hadn't looked

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling