bug report x86-64 code: je / jbe

Iain Buclaw ibuclaw at gdcproject.org
Mon Jun 19 09:54:32 UTC 2023


On Sunday, 18 June 2023 at 02:55:32 UTC, Cecil Ward wrote:
> On Friday, 16 June 2023 at 13:12:06 UTC, Iain Buclaw wrote:
>>
>> Redundant jump? Yes, arguably. Leads to wrong runtime? Doesn't 
>> look that way.
>
> Completely agree with Iain, it’s not incorrect code, I wasn’t 
> intending to suggest that. I’d just say suboptimal, and not the 
> very best code generation possible.

By the way, I suspect it's related to this problem report.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96435

Taken from upstream DMD comment (I suspect is still not fixed in 
either DMD, possibly LDC too but haven't checked).

https://issues.dlang.org/show_bug.cgi?id=20148#c3

Essentially, every read of a boolean gets turned into 
`(*(ubyte*)&b) & 1`.

This *could* be limited to `@safe` code, or just accessing field 
members of a union I suppose.


More information about the D.gnu mailing list