Bitwise rotate of integral

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Jan 8 12:35:16 UTC 2019


On Tue, Jan 08, 2019 at 09:15:09AM +0000, Patrick Schluter via Digitalmars-d-learn wrote:
> On Monday, 7 January 2019 at 23:20:57 UTC, H. S. Teoh wrote:
[...]
> > There's a certain pattern that dmd looks for, that it transforms
> > into a ROL instruction. Similarly for ROR.  Deviate too far from
> > this pattern, though, and it might not recognize it as it should.
> > To be sure, always check the disassembly.
> > 
> Are you sure it's dmd looking for the pattern. Playing with the
> godbolt link shows that dmd doesn't generate the rol code (gdc 4.8.2
> neither).

I vaguely remember a bug about this. There is definitely explicit
checking for this in dmd; I don't remember if it was a bug in the
pattern matching code itself, or some other problem, that made it fail.
You may need to specify -O for the code to actually be active. Walter
could point you to the actual function that does this optimization.


T

-- 
Never wrestle a pig. You both get covered in mud, and the pig likes it.


More information about the Digitalmars-d-learn mailing list