This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Intrinsics for ADCX

Hi Richard,

> Frankly I don't understand the point of these instructions
> being added to the ISA at all.  I would have understood an
> add-with-carry that did *not* modify the flags at all, but
> two separate ones that modify C and O separately is just
> downright strange.
If there is only one carry in flight, they all are equivalent although
ADOX is a little less useful in loops.
If there are two carries in flight, that’s where the new instructions
show their benefit, since they allow accumulation without destroying
each other (see next comment).
For any number of carries beyond two, you have to start saving
restoring carry bits and it degenerates to the first case for some of

> But to the point: I don't understand the point of having
> this as a builtin.  Is the code generated by this builtin
> any better than plain C?
I think this is just like a practice to introduce new intrinsics for new insns.
I doubt, that we may generate such things automatically:
c1 = 0;
c2 = 0;
c1 = _adcx64( & res[i], src[i], src2[i], c1);
c1 = _adcx64( & res[i+1], src[i+1], src2[i+1], c1);
c2 = _adcx64( & res[i], src[i], src2[i], c2);
c2 = _adcx64( & res[i+1], src[i+1], src2[i+1], c2);

> And if you're going to have the builtin, why is this restricted
> to adx anyway?  You obviously can produce the same results with
> the good old fashioned adc instruction as well.
We have one intrinsic for both ADCX/ADOX. So, we just picked up first
one to use when exanding the built-in

> Which begs the question of why you've got a separate pattern
> for the adx anyway.  If the insn is so much better, it ought to
> be used in the same pattern we use for adc now.
I believe, we may introduce global variant of ADCX, which may be
expanded into either of ADC/ADCX/ADOX on x86 and into analogs
on the other ports.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]