View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0036517||FPC||Compiler||public||2020-01-04 23:42||2020-05-06 14:55|
|Status||closed||Resolution||no change required|
|Summary||0036517: Add AMD CPU Ryzen target|
|Description||The XCHG optimisation (https://bugs.freepascal.org/view.php?id=36511 - thx J. Gareth Moreton!) makes assumptions on the CPU target but unfortunately there is no AMD Ryzen target.|
Might also makes sense for other optimizations as AMD != Intel and therefore several instructions are faster/slower or should be avoided (e.g. RDRAND on unpatched CPU firmwares).
|Steps To Reproduce||According to https://www.agner.org/optimize/instruction_tables.pdf the XCHG is as fast as the MOV operation (tested on first gen of AMD Ryzen).|
|Tags||No tags attached.|
|Fixed in Revision|
I did notice that XCHG was generally better-implemented on AMD processors than Intel. For the case of XCHG, I think Ryzen will get the XCHG optimisation because it's considered "greater than" Core I.
One thing to be careful of though is that the processors are internally listed in order of earliest to latest, so if Ryzen appears, it has to be treated as better at everything or worse at everything compared to another entry.
Still, sometimes people might know the AMD processors better than the Intel ones, and Ryzen can be internally considered a synonym to Cascade Lake, for example. Might need some discussion though to decide exactly how this should be implemented.
P.S. I've been using Agner as my reference as well.
||IIRC AMD uses register renaming for xchg and always did.|
||So far, there are no specific optimizations for Ryzen, for all Zen based AMD CPUs and Intel Haswell and newer, using -CpCOREAVX2 -OpCOREAVX2 is fine.|
|2020-01-04 23:42||NoName||New Issue|
|2020-01-05 01:58||J. Gareth Moreton||Note Added: 0120225|
|2020-01-05 01:59||J. Gareth Moreton||Note Edited: 0120225||View Revisions|
|2020-01-05 09:59||Thaddy de Koning||Note Added: 0120227|
|2020-01-06 22:21||Florian||Assigned To||=> Florian|
|2020-01-06 22:21||Florian||Status||new => resolved|
|2020-01-06 22:21||Florian||Resolution||open => no change required|
|2020-01-06 22:21||Florian||FPCTarget||=> -|
|2020-01-06 22:21||Florian||Note Added: 0120243|
|2020-05-06 14:55||NoName||Status||resolved => closed|