3 ms·
LLVM properly generates ADC code when you use __addcarry_u64 contrary to GCC[1] which generates really dumb code with setc/mov in and out of carry. However __ad
by mratsim 7y ago
LLVM properly generates ADC code when you use __addcarry_u64 contrary to GCC[1] which generates really dumb code with setc/mov in and out of carry.
However __addcarryx_u64 which is supposed to generate ADCX and ADOX is not properly handled and only generates ADC.
For the iXYZ themselves, the carries are properly handled and it can generate mulx at least: https://github.com/herumi/mcl/blob/master/src/asm/x86-64.bmi2.s#L104 https://github.com/herumi/mcl/blob/master/src/asm/x86-64.bmi... (from straight LLVM IR). I don't think ADCX/ADOX are possible though even in LLVM IR.
I think you are mixing with one comment on the GCC mailing list about GCC not having the adequate representation of carry and even less a representation that can separate a carry and overflow chains[2]
[1] https://gcc.godbolt.org/z/2h768y https://gcc.godbolt.org/z/2h768y
[2] https://gcc.gnu.org/legacy-ml/gcc-help/2017-08/msg00100.html https://gcc.gnu.org/legacy-ml/gcc-help/2017-08/msg00100.html
- remcob 7y agoThere's a nearly identical issue in LLVM [1]. So neither are currently able to handle ADCX/ADOX in their IR and can only support it through inline assembly. I was hoping LLVM could maybe bypass this IR limitation for the iXYZ types and generate the optimal instruction sequence, but from your assembly it looks like that doesn't happen either. [1] https://bugs.llvm.org/show_bug.cgi?id=41546#c1 https://bugs.llvm.org/show_bug.cgi?id=41546#c1