The radix 2^51 trick (2017)
chosenplaintext.ca
The radix 2^51 trick (2017)
1–10 of 86 posts
Re: The radix 2^51 trick (2017)
#2Why not give the top limb 64 bits and the other four limbs 48 bits each, then? You can accumulate more additions before normalization, you can take advantage of word alignment during splitting and normalization if your instruction set has anything useful there, and your overflow properties are identical, no?
Re: The radix 2^51 trick (2017)
#3Re: The radix 2^51 trick (2017)
#4I'm seriously doubtful that adc is inherently slower than add on a modern CPU other then the data hazard introduced by the carry bit. I realize the point of the article is the data hazard so this is a really minor nit.
* for add is 0.20 (ie 5 per cycle)
* for adc is 0.50 (ie 2 per cycle)
so it does seem correct.
This seems to be a consequence of `add` being available on ports 0, 1, 5, 6, & B, whereas `adc` is only available on ports 0 & 6
So yes as an individual instruction it’s no worse, but even non-dependent instructions will be worse for OoO execution (which is more realistic than viewing it as a single instruction)
Re: The radix 2^51 trick (2017)
#5Re: The radix 2^51 trick (2017)
#6Re: The radix 2^51 trick (2017)
#7Re: The radix 2^51 trick (2017)
#8Would it be legal for a C(++?) compiler to implement this optimization?
Re: The radix 2^51 trick (2017)
#9This idea has wider applicability than operations on long integers.
Re: The radix 2^51 trick (2017)
#10Would it be legal for a C(++?) compiler to implement this optimization?