News for hackers. Stuff that matters.
Re:How Rust 1.26 more than tripled the speed of my code by comex on Monday May 14, 2018 @01:38PM (#17067531)
By the way, it's only on x86-64 that the CPU's multiplication instruction always returns both the upper and lower 64 bits (in two different registers).

On, say, ARM64, there are two separate instructions: MUL is the normal one that takes two 64-bit inputs and produces one 64-bit output (the lower half of the product), while UMULH ("Unsigned Multiply High") performs the same multiplication but gives you only the upper half. This way, in the common case where you don't care about the upper half, the CPU doesn't have to waste time calculating it.

Re:How Rust 1.26 more than tripled the speed of my code by monocasa on Monday May 14, 2018 @02:44PM (#17068261)
I wouldn't say that it's only x86. MIPS does the same thing, but doesn't even stick the result in the GPRs, you issue a multiply, and the result ends up in the hi and lo registers that you have to mfhi and mflo to move back into GPRs.
Re:How Rust 1.26 more than tripled the speed of my code by comex on Monday May 14, 2018 @06:46PM (#17070104)
Oh, good point, I've seen that before but forgot about it. Though to be fair, that's 32x32->64, not 64x64->128 :)
Re:How Rust 1.26 more than tripled the speed of my code by monocasa on Monday May 14, 2018 @07:03PM (#17070200)
The combined HI and LO are 64x64->128 on Mips64. You just have to use dmult instead of mult.
Re:How Rust 1.26 more than tripled the speed of my code by stephencanon on Tuesday May 15, 2018 @06:39AM (#17072970)
Huh? IMUL is perfectly happy to give you just the low-half of the product.