# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/binutils/gas-prefer-M-unit-slots.patch.ia64 # Copyright (C) 2025 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- # # This patch modifies the IA-64 bundle assignment logic in gas to prefer picking # M-unit slots to I-unit slots for instructions that can go to both. # # This prevents unnecessary I-unit slot contention around MII bundles. # diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index fe33e3cb5e7..0ef887e10c9 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -7208,12 +7208,14 @@ extra_goodness (int templ, int slot) return 0; break; case itanium2: - if (match (templ, IA64_TYPE_M, slot) - || match (templ, IA64_TYPE_I, slot)) - /* Favor M- and I-unit NOPs. We definitely want to avoid + if (match (templ, IA64_TYPE_M, slot)) + /* Favor M-unit NOPs and I-unit NOPs, in order. M-units are + cheaper that I-units. We definitely want to avoid F-unit and B-unit may cause split-issue or less-than-optimal branch-prediction. */ return 2; + if (match (templ, IA64_TYPE_I, slot)) + return 1; else return 0; break; @@ -7343,7 +7345,7 @@ md_begin (void) if (match (t, j, 1)) { if ((t == 2 && j == IA64_TYPE_X) || match (t, k, 2)) - goodness = 3 + 3 + 3; + goodness = 3 + 3 + 3 + (t == 0x4 || t == 0x5 || t == 0xc); else goodness = 3 + 3 + extra_goodness (t, 2); }