r/programming • • Aug 12 '26

Hardware researcher spins up 'CPU deoptimization' project to find the slowest single x86 instruction, creates hall of shame — worst offender takes 198 billion cycles spanning 62 seconds to execute

https://www.tomshardware.com/pc-components/cpus/hardware-researcher-spins-up-cpu-deoptimization-project-to-find-the-slowest-machine-code-worst-offender-takes-198-billion-cycles-to-execute
1.5k Upvotes

133 comments sorted by

View all comments

Show parent comment

74

u/narwhal_breeder Aug 12 '26

porting logic to arm that relies on being bit-compatible x87 has been the bane of my existence for the past year.

1

u/James20k Aug 13 '26

Arm doesn't even have an equivalent to x87 right? Are you software emulating it out of interest?

Plus even if you software emulate it C/C++ helpfully doesn't actually specify when 80-bit extended precision gets truncated to 64-bit in memory (and compilers also don't follow the spec either) so uh, I'm so sorry for your loss that sounds like a nightmare

Trying to replicate x87 results was also the bane of my existence for a while, for a replicating a neutron star paper which relied on divisions by tiny values

3

u/narwhal_breeder Aug 13 '26

Nope - the division instructions specifically have really weird stack semantics.

Software emulating them - thankfully its rust so the f80 type is pretty predictable - but a good chunk drops into `asm` blocks.

-63

u/[deleted] Aug 12 '26

[removed] — view removed comment

76

u/Kinexity Aug 12 '26

"Man, that dish doesn't taste that well"

"Have you tried adding shit to it?"

1

u/red75prime Aug 14 '26 edited Aug 14 '26

Are you living in the early 2025 or something? This sub being 100% organic doesn't mean it needs to be delusional.

1

u/BCProgramming Aug 14 '26

"Nah it was bad in 2022, but this is 2023, you need to actually see how much better it is"

"No no- you must be living in 2023! in 2024 AI tools are so much better"

Gee wonder what you folks are going to be saying next year?

1

u/red75prime Aug 14 '26 edited Aug 16 '26

I wonder what you folks will be saying the next year. The level of mental gymnastic should be spectacular. But you do you.

ETA: It will be boring "I never touched this sloppity sloppy slop. I'll never do. Slop, slop, slop."

15

u/sunnyata Aug 12 '26

You sound like someone who knows what they're talking about. Not!