From 8c2fda1d2b06da6f93b21c939762ca118442351b Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 28 Mar 2005 22:34:20 +0000 Subject: [PATCH] gas/ 2005-03-28 David Mosberger H.J. Lu PR 803 NEWS: Mention "-mtune=[itanium1|itanium2]". * config/tc-ia64.c (md): Add tune. (md_parse_option): Accepted "-mtune=[itanium1|itanium2]". (md_show_usage): Add "-mtune=[itanium1|itanium2]". (extra_goodness): Prefer M- and I-unit NOPs for itanium2. F and B unit NOPs are discouraged for McKinley-derived cores. (md_begin): Don't hardcode the "extra_goodness()" function in the comment... (ia64_init): Set md.tune to itanium2. * doc/as.texinfo: Add -mtune=[itanium1|itanium2]". * doc/c-ia64.texi: Likewise. gas/testsuite/ 2005-03-28 H.J. Lu PR 803 * gas/ia64/dv-imply.d: Pass -mtune=itanium1 to as. * gas/ia64/dv-mutex.d : Likewise. * gas/ia64/dv-safe.d: Likewise. * gas/ia64/dv-srlz.d.nop: Likewise. * gas/ia64/ldxmov-1.d: Likewise. * gas/ia64/opc-b.d: Likewise. * gas/ia64/opc-f.d: Likewise. * gas/ia64/opc-i.d: Likewise. * gas/ia64/opc-m.d: Likewise. * gas/ia64/operand-or.d: Likewise. * gas/ia64/pcrel.d: Likewise. * gas/ia64/pseudo.d: Likewise. * gas/ia64/tls.d: Likewise. ld/testsuite/ 2005-03-28 H.J. Lu PR 803 * ld-ia64/ia64.exp: Pass -mtune=itanium1 to as. --- gas/ChangeLog | 18 ++++++++++ gas/NEWS | 2 ++ gas/config/tc-ia64.c | 56 ++++++++++++++++++++++++----- gas/doc/as.texinfo | 1 + gas/doc/c-ia64.texi | 5 +++ gas/testsuite/ChangeLog | 17 +++++++++ gas/testsuite/gas/ia64/dv-imply.d | 2 +- gas/testsuite/gas/ia64/dv-mutex.d | 2 +- gas/testsuite/gas/ia64/dv-safe.d | 2 +- gas/testsuite/gas/ia64/dv-srlz.d | 2 +- gas/testsuite/gas/ia64/ldxmov-1.d | 1 + gas/testsuite/gas/ia64/opc-b.d | 2 +- gas/testsuite/gas/ia64/opc-f.d | 2 +- gas/testsuite/gas/ia64/opc-i.d | 2 +- gas/testsuite/gas/ia64/opc-m.d | 2 +- gas/testsuite/gas/ia64/operand-or.d | 2 +- gas/testsuite/gas/ia64/pcrel.d | 1 + gas/testsuite/gas/ia64/pseudo.d | 2 +- gas/testsuite/gas/ia64/tls.d | 2 +- ld/testsuite/ChangeLog | 5 +++ ld/testsuite/ld-ia64/ia64.exp | 4 +-- 21 files changed, 110 insertions(+), 22 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index d8d85e20d31..3fef8debb58 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,21 @@ +2005-03-28 David Mosberger + H.J. Lu + + PR 803 + NEWS: Mention "-mtune=[itanium1|itanium2]". + + * config/tc-ia64.c (md): Add tune. + (md_parse_option): Accepted "-mtune=[itanium1|itanium2]". + (md_show_usage): Add "-mtune=[itanium1|itanium2]". + (extra_goodness): Prefer M- and I-unit NOPs for itanium2. F and + B unit NOPs are discouraged for McKinley-derived cores. + (md_begin): Don't hardcode the "extra_goodness()" function in + the comment... + (ia64_init): Set md.tune to itanium2. + + * doc/as.texinfo: Add -mtune=[itanium1|itanium2]". + * doc/c-ia64.texi: Likewise. + 2005-03-27 Ian Lance Taylor * config/obj-coff.c (coff_frob_symbol): When crashing because of a diff --git a/gas/NEWS b/gas/NEWS index 5f483b988f9..a0aa0886452 100644 --- a/gas/NEWS +++ b/gas/NEWS @@ -1,5 +1,7 @@ -*- text -*- +* New command line option -mtune=[itanium1|itanium2] for IA64 targets. + Changes in 2.16: * Redefinition of macros now results in an error. diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index b959cdcf919..d96d6f613e7 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -229,6 +229,13 @@ static struct that are predicatable. */ expressionS qp; + /* Optimize for which CPU. */ + enum + { + itanium1, + itanium2 + } tune; + /* What to do when hint.b is used. */ enum { @@ -6957,6 +6964,16 @@ md_parse_option (c, arg) else return 0; } + else if (strncmp (arg, "tune=", 5) == 0) + { + arg += 5; + if (strcmp (arg, "itanium1") == 0) + md.tune = itanium1; + else if (strcmp (arg, "itanium2") == 0) + md.tune = itanium2; + else + return 0; + } else return 0; break; @@ -7069,6 +7086,8 @@ IA-64 options:\n\ EF_IA_64_NOFUNCDESC_CONS_GP)\n\ -milp32|-milp64|-mlp64|-mp64 select data model (default -mlp64)\n\ -mle | -mbe select little- or big-endian byte order (default -mle)\n\ + -mtune=[itanium1|itanium2]\n\ + tune for a specific CPU (default -mtune=itanium2)\n\ -munwind-check=[warning|error]\n\ unwind directive check (default -munwind-check=warning)\n\ -mhint.b=[ok|warning|error]\n\ @@ -7122,11 +7141,30 @@ match (int templ, int type, int slot) static inline int extra_goodness (int templ, int slot) { - if (slot == 1 && match (templ, IA64_TYPE_F, slot)) - return 2; - if (slot == 2 && match (templ, IA64_TYPE_B, slot)) - return 1; - return 0; + switch (md.tune) + { + case itanium1: + if (slot == 1 && match (templ, IA64_TYPE_F, slot)) + return 2; + else if (slot == 2 && match (templ, IA64_TYPE_B, slot)) + return 1; + else + 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 + F-unit and B-unit may cause split-issue or less-than-optimal + branch-prediction. */ + return 2; + else + return 0; + break; + default: + abort (); + return 0; + } } /* This function is called once, at assembler startup time. It sets @@ -7222,10 +7260,9 @@ md_begin () &zero_address_frag); /* Compute the table of best templates. We compute goodness as a - base 4 value, in which each match counts for 3, each F counts - for 2, each B counts for 1. This should maximize the number of - F and B nops in the chosen bundles, which is good because these - pipelines are least likely to be overcommitted. */ + base 4 value, in which each match counts for 3. Match-failures + result in NOPs and we use extra_goodness() to pick the execution + units that are best suited for issuing the NOP. */ for (i = 0; i < IA64_NUM_TYPES; ++i) for (j = 0; j < IA64_NUM_TYPES; ++j) for (k = 0; k < IA64_NUM_TYPES; ++k) @@ -7426,6 +7463,7 @@ ia64_init (argc, argv) /* FIXME: We should change it to unwind_check_error someday. */ md.unwind_check = unwind_check_warning; md.hint_b = hint_b_error; + md.tune = itanium2; } /* Return a string for the target object file format. */ diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index 124419c9693..a3164511e73 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -315,6 +315,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. [@b{-mconstant-gp}|@b{-mauto-pic}] [@b{-milp32}|@b{-milp64}|@b{-mlp64}|@b{-mp64}] [@b{-mle}|@b{mbe}] + [@b{-mtune=itanium1}|@b{-mtune=itanium2}] [@b{-munwind-check=warning}|@b{-munwind-check=error}] [@b{-mhint.b=ok}|@b{-mhint.b=warning}|@b{-mhint.b=error}] [@b{-x}|@b{-xexplicit}] [@b{-xauto}] [@b{-xdebug}] diff --git a/gas/doc/c-ia64.texi b/gas/doc/c-ia64.texi index e548911a770..6b0f3a9515d 100644 --- a/gas/doc/c-ia64.texi +++ b/gas/doc/c-ia64.texi @@ -65,6 +65,11 @@ These options select the byte order. The @code{-mle} option selects little-endi byte order (default) and @code{-mbe} selects big-endian byte order. Note that IA-64 machine code always uses little-endian byte order. +@item -mtune=itanium1 +@item -mtune=itanium2 +Tune for a particular IA-64 CPU, @var{itanium1} or @var{itanium2}. The +default is @var{itanium2}. + @item -munwind-check=warning @item -munwind-check=error These options control what the assembler will do when performing diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 54b64729224..bef8501a4f0 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2005-03-28 H.J. Lu + + PR 803 + * gas/ia64/dv-imply.d: Pass -mtune=itanium1 to as. + * gas/ia64/dv-mutex.d : Likewise. + * gas/ia64/dv-safe.d: Likewise. + * gas/ia64/dv-srlz.d.nop: Likewise. + * gas/ia64/ldxmov-1.d: Likewise. + * gas/ia64/opc-b.d: Likewise. + * gas/ia64/opc-f.d: Likewise. + * gas/ia64/opc-i.d: Likewise. + * gas/ia64/opc-m.d: Likewise. + * gas/ia64/operand-or.d: Likewise. + * gas/ia64/pcrel.d: Likewise. + * gas/ia64/pseudo.d: Likewise. + * gas/ia64/tls.d: Likewise. + 2005-03-24 Hans-Peter Nilsson * gas/cris/range-err-1.s: Adjust expected messages for hosts with diff --git a/gas/testsuite/gas/ia64/dv-imply.d b/gas/testsuite/gas/ia64/dv-imply.d index 27dca39a1c4..30ae379672f 100644 --- a/gas/testsuite/gas/ia64/dv-imply.d +++ b/gas/testsuite/gas/ia64/dv-imply.d @@ -1,4 +1,4 @@ -# as: -xexplicit +# as: -xexplicit -mtune=itanium1 # objdump: -d # name ia64 dv-mutex diff --git a/gas/testsuite/gas/ia64/dv-mutex.d b/gas/testsuite/gas/ia64/dv-mutex.d index 7b59a65101d..66ea0fd03d8 100644 --- a/gas/testsuite/gas/ia64/dv-mutex.d +++ b/gas/testsuite/gas/ia64/dv-mutex.d @@ -1,4 +1,4 @@ -# as: -xexplicit +# as: -xexplicit -mtune=itanium1 # objdump: -d # name ia64 dv-mutex diff --git a/gas/testsuite/gas/ia64/dv-safe.d b/gas/testsuite/gas/ia64/dv-safe.d index 82609657aae..c1da4a4c308 100644 --- a/gas/testsuite/gas/ia64/dv-safe.d +++ b/gas/testsuite/gas/ia64/dv-safe.d @@ -1,4 +1,4 @@ -# as: -xexplicit +# as: -xexplicit -mtune=itanium1 # objdump: -d # name ia64 dv-safe diff --git a/gas/testsuite/gas/ia64/dv-srlz.d b/gas/testsuite/gas/ia64/dv-srlz.d index bd12b51f40d..bf9caa48e6f 100644 --- a/gas/testsuite/gas/ia64/dv-srlz.d +++ b/gas/testsuite/gas/ia64/dv-srlz.d @@ -1,4 +1,4 @@ -# as: -xauto +# as: -xauto -mtune=itanium1 # objdump: -d # name ia64 dv-srlz diff --git a/gas/testsuite/gas/ia64/ldxmov-1.d b/gas/testsuite/gas/ia64/ldxmov-1.d index 93dd2dfe30b..0676d10cdd8 100644 --- a/gas/testsuite/gas/ia64/ldxmov-1.d +++ b/gas/testsuite/gas/ia64/ldxmov-1.d @@ -1,3 +1,4 @@ +#as: -mtune=itanium1 #objdump: -dr #name: ia64 ldxmov-1 diff --git a/gas/testsuite/gas/ia64/opc-b.d b/gas/testsuite/gas/ia64/opc-b.d index cb0973c9718..c2d47821c2a 100644 --- a/gas/testsuite/gas/ia64/opc-b.d +++ b/gas/testsuite/gas/ia64/opc-b.d @@ -1,4 +1,4 @@ -#as: -xnone -mhint.b=ok +#as: -xnone -mhint.b=ok -mtune=itanium1 #objdump: -d #name: ia64 opc-b diff --git a/gas/testsuite/gas/ia64/opc-f.d b/gas/testsuite/gas/ia64/opc-f.d index fa531169aa6..0dfa8811cd1 100644 --- a/gas/testsuite/gas/ia64/opc-f.d +++ b/gas/testsuite/gas/ia64/opc-f.d @@ -1,4 +1,4 @@ -# as: -xnone +# as: -xnone -mtune=itanium1 # objdump: -d --disassemble-zeroes # name: ia64 opc-f diff --git a/gas/testsuite/gas/ia64/opc-i.d b/gas/testsuite/gas/ia64/opc-i.d index 5c2bf0c399b..0bbc2e12969 100644 --- a/gas/testsuite/gas/ia64/opc-i.d +++ b/gas/testsuite/gas/ia64/opc-i.d @@ -1,4 +1,4 @@ -# as: -xnone +# as: -xnone -mtune=itanium1 # objdump: -d # name: ia64 opc-i diff --git a/gas/testsuite/gas/ia64/opc-m.d b/gas/testsuite/gas/ia64/opc-m.d index dcd01959865..7ec2a4274ce 100644 --- a/gas/testsuite/gas/ia64/opc-m.d +++ b/gas/testsuite/gas/ia64/opc-m.d @@ -1,4 +1,4 @@ -# as: -xnone +# as: -xnone -mtune=itanium1 # objdump: -d # name: ia64 opc-m diff --git a/gas/testsuite/gas/ia64/operand-or.d b/gas/testsuite/gas/ia64/operand-or.d index f72793a6451..a40087a853a 100644 --- a/gas/testsuite/gas/ia64/operand-or.d +++ b/gas/testsuite/gas/ia64/operand-or.d @@ -1,4 +1,4 @@ -# as: -xnone +# as: -xnone -mtune=itanium1 # objdump: -d --disassemble-zeroes # name: ia64 operand-or diff --git a/gas/testsuite/gas/ia64/pcrel.d b/gas/testsuite/gas/ia64/pcrel.d index 384ad6a5b10..674060d8bf3 100644 --- a/gas/testsuite/gas/ia64/pcrel.d +++ b/gas/testsuite/gas/ia64/pcrel.d @@ -1,3 +1,4 @@ +#as: -mtune=itanium1 #objdump: -rs #name: ia64 pcrel diff --git a/gas/testsuite/gas/ia64/pseudo.d b/gas/testsuite/gas/ia64/pseudo.d index 67a1103557b..d18159564fd 100644 --- a/gas/testsuite/gas/ia64/pseudo.d +++ b/gas/testsuite/gas/ia64/pseudo.d @@ -1,4 +1,4 @@ -# as: -xnone +# as: -xnone -mtune=itanium1 # objdump: -d # name: ia64 pseudo-ops diff --git a/gas/testsuite/gas/ia64/tls.d b/gas/testsuite/gas/ia64/tls.d index f067e05e630..3f03b25291b 100644 --- a/gas/testsuite/gas/ia64/tls.d +++ b/gas/testsuite/gas/ia64/tls.d @@ -1,4 +1,4 @@ -#as: -xnone +#as: -xnone -mtune=itanium1 #objdump: -dr #name: ia64 tls diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 9833bf26c49..9ae7391003a 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-03-28 H.J. Lu + + PR 803 + * ld-ia64/ia64.exp: Pass -mtune=itanium1 to as. + 2005-03-24 Mark Mitchell * config/default.exp: Do not load libpath.exp if it does not diff --git a/ld/testsuite/ld-ia64/ia64.exp b/ld/testsuite/ld-ia64/ia64.exp index 0af04369274..310bffd6ebb 100644 --- a/ld/testsuite/ld-ia64/ia64.exp +++ b/ld/testsuite/ld-ia64/ia64.exp @@ -35,14 +35,14 @@ if { !([istarget "ia64-*-elf*"] set ia64tests { {"TLS -fpic -shared" "-shared" - "" {tlspic1.s tlspic2.s} + "-mtune=itanium1" {tlspic1.s tlspic2.s} {{readelf -WSsrl tlspic.rd} {objdump -drj.text tlspic.dd} {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} "libtlspic.so"} {"Helper shared library" "-shared" "" {tlslib.s} {} "libtlslib.so"} {"TLS -fpic and -fno-pic exec" - "tmpdir/libtlslib.so" "" {tlsbinpic.s tlsbin.s} + "tmpdir/libtlslib.so" "-mtune=itanium1" {tlsbinpic.s tlsbin.s} {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd} {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} "tlsbin"} -- 2.30.2