Time to move std.experimental.checkedint to std.checkedint ?
Vladimir Panteleev
thecybershadow.lists at gmail.com
Wed Mar 31 06:54:22 UTC 2021
On Wednesday, 31 March 2021 at 06:34:04 UTC, Walter Bright wrote:
> On 3/30/2021 10:30 PM, Vladimir Panteleev wrote:
>> On Wednesday, 31 March 2021 at 05:25:48 UTC, Walter Bright
>> wrote:
>>> It's a win because it uses the address decoder logic which is
>>> separate from the arithmetic logic unit. This enables it to
>>> be done in parallel with the ALU.
>>
>> Is this still true for modern CPUs?
>
> See https://www.agner.org/optimize/optimizing_assembly.pdf page
> 135.
Thanks!
It also says that LEA may be slower than ADD on some CPUs.
I wrote a small benchmark using the assembler code from a few
posts ago. It takes the same time on my AMD CPU, but the ADD is
indeed slower than the LEA on the old Intel CPU on the server. :)
Unfortunately I don't have access to a modern Intel CPU to test.
>>> Although not relevant for this particular example, it also
>>> doesn't need another register for the intermediate value.
>> Haven't CPUs used register renaming for a long time now? It's
>> also pretty rare to see x86_64 code that uses all registers.
>
> If you use a register that needs to be saved on the stack, it's
> going to cost.
Sure, but why would you do that? If I'm reading the ABI spec
correctly, almost all registers belong to the callee, and don't
need to be saved/restored, and there's probably little reason to
call a function in the middle of such a computation and therefore
save the interim value on the stack.
More information about the Digitalmars-d
mailing list