1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[X86] AMD Zen 3 has macro fusion

This is an improvement over Zen 2, where only branch fusion is supported,
as per Agner, 21.4 Instruction fusion.
AMD SOG 17h has no mention of fusion.

AMD SOG 19h, 2.9.3 Branch Fusion
The following flag writing instructions support branch fusion
with their reg/reg, reg/imm and reg/mem forms
* CMP
* TEST
* SUB
* ADD
* INC (no fusion with branches dependent on CF)
* DEC (no fusion with branches dependent on CF)
* OR
* AND
* XOR

Agner, 22.4 Instruction fusion
<...> This applies to CMP, TEST, ADD, SUB, AND, OR, XOR, INC, DEC and
all conditional jumps, except if the arithmetic or logic instruction has a rip-relative address or
both an address displacement and an immediate operand.
This commit is contained in:
Roman Lebedev 2021-03-31 14:14:13 +03:00
parent 12a3af85a6
commit 857bede416
2 changed files with 5 additions and 1 deletions

View File

@ -115,6 +115,7 @@ namespace X86 {
Cmp,
// AND
And,
// FIXME: Zen 3 support branch fusion for OR/XOR.
// ADD, SUB
AddSub,
// INC, DEC
@ -183,6 +184,7 @@ namespace X86 {
case X86::AND8rr:
case X86::AND8rr_REV:
return FirstMacroFusionInstKind::And;
// FIXME: Zen 3 support branch fusion for OR/XOR.
// CMP
case X86::CMP16i16:
case X86::CMP16mr:

View File

@ -1090,7 +1090,9 @@ def ProcessorFeatures {
FeaturePKU,
FeatureVAES,
FeatureVPCLMULQDQ];
list<SubtargetFeature> ZN3Tuning = ZNTuning;
list<SubtargetFeature> ZN3AdditionalTuning = [FeatureMacroFusion];
list<SubtargetFeature> ZN3Tuning =
!listconcat(ZNTuning, ZN3AdditionalTuning);
list<SubtargetFeature> ZN3Features =
!listconcat(ZN2Features, ZN3AdditionalFeatures);
}