From 952c3f51ac994f5e98aa829076609124cf9e5243 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Mon, 12 Sep 2016 16:32:02 +0200 Subject: [PATCH] S/390: Add alternate processor names. This patch adds alternate CPU names which adhere to the number of the architecture document. So instead of having z196, zEC12, and z13 you can use arch9, arch10, and arch11. The old cpu names stay valid and should primarily be used. The alternate names are supposed to improve compatibility with the IBM XL compiler toolchain which uses the arch numbering. opcodes/ChangeLog: 2016-09-12 Andreas Krebbel * s390-mkopc.c (main): Support alternate arch strings. gas/ChangeLog: 2016-09-12 Andreas Krebbel * config/tc-s390.c (s390_parse_cpu): Support alternate arch strings. * doc/as.texinfo: Document new arch strings. * doc/c-s390.texi: Likewise. --- gas/ChangeLog | 7 +++++++ gas/config/tc-s390.c | 44 +++++++++++++++++++++++++++++++------------- gas/doc/as.texinfo | 8 +++++--- gas/doc/c-s390.texi | 40 +++++++++++++++++++++++++++------------- opcodes/ChangeLog | 4 ++++ opcodes/s390-mkopc.c | 26 +++++++++++++++++--------- 6 files changed, 91 insertions(+), 38 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index c2dadcb..6544175 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,12 @@ 2016-09-12 Andreas Krebbel + * config/tc-s390.c (s390_parse_cpu): Support alternate arch + strings. + * doc/as.texinfo: Document new arch strings. + * doc/c-s390.texi: Likewise. + +2016-09-12 Andreas Krebbel + * config/tc-s390.c: Set all facitily bits by default 2016-09-12 Patrick Steuer diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index ec3c5e5..356bbb0 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -272,20 +272,24 @@ s390_parse_cpu (const char * arg, static struct { const char * name; - unsigned int len; + unsigned int name_len; + const char * alt_name; + unsigned int alt_name_len; unsigned int flags; } cpu_table[S390_OPCODE_MAXCPU] = { - { STRING_COMMA_LEN ("g5"), 0 }, - { STRING_COMMA_LEN ("g6"), 0 }, - { STRING_COMMA_LEN ("z900"), 0 }, - { STRING_COMMA_LEN ("z990"), 0 }, - { STRING_COMMA_LEN ("z9-109"), 0 }, - { STRING_COMMA_LEN ("z9-ec"), 0 }, - { STRING_COMMA_LEN ("z10"), 0 }, - { STRING_COMMA_LEN ("z196"), 0 }, - { STRING_COMMA_LEN ("zEC12"), S390_INSTR_FLAG_HTM }, - { STRING_COMMA_LEN ("z13"), S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX } + { STRING_COMMA_LEN ("g5"), STRING_COMMA_LEN ("arch3"), 0 }, + { STRING_COMMA_LEN ("g6"), STRING_COMMA_LEN (""), 0 }, + { STRING_COMMA_LEN ("z900"), STRING_COMMA_LEN ("arch5"), 0 }, + { STRING_COMMA_LEN ("z990"), STRING_COMMA_LEN ("arch6"), 0 }, + { STRING_COMMA_LEN ("z9-109"), STRING_COMMA_LEN (""), 0 }, + { STRING_COMMA_LEN ("z9-ec"), STRING_COMMA_LEN ("arch7"), 0 }, + { STRING_COMMA_LEN ("z10"), STRING_COMMA_LEN ("arch8"), 0 }, + { STRING_COMMA_LEN ("z196"), STRING_COMMA_LEN ("arch9"), 0 }, + { STRING_COMMA_LEN ("zEC12"), STRING_COMMA_LEN ("arch10"), + S390_INSTR_FLAG_HTM }, + { STRING_COMMA_LEN ("z13"), STRING_COMMA_LEN ("arch11"), + S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX } }; static struct { @@ -312,18 +316,32 @@ s390_parse_cpu (const char * arg, { for (icpu = 0; icpu < S390_OPCODE_MAXCPU; icpu++) { - unsigned int l; + unsigned int l, l_alt; + + l = cpu_table[icpu].name_len; - l = cpu_table[icpu].len; if (strncmp (arg, cpu_table[icpu].name, l) == 0 && (arg[l] == 0 || arg[l] == '+')) { arg += l; break; } + + l_alt = cpu_table[icpu].alt_name_len; + + if (l_alt > 0 + && strncmp (arg, cpu_table[icpu].alt_name, l_alt) == 0 + && (arg[l_alt] == 0 || arg[l_alt] == '+')) + { + arg += l_alt; + break; + } } } + if (icpu == S390_OPCODE_MAXCPU) + return S390_OPCODE_MAXCPU; + ilp_bak = input_line_pointer; if (icpu != S390_OPCODE_MAXCPU) { diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index 9ebfda0..d09e0d4 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -1654,9 +1654,11 @@ Select the word size, either 31/32 bits or 64 bits. Select the architecture mode, either the Enterprise System Architecture (esa) or the z/Architecture mode (zarch). @item -march=@var{processor} -Specify which s390 processor variant is the target, @samp{g6}, @samp{g6}, -@samp{z900}, @samp{z990}, @samp{z9-109}, @samp{z9-ec}, @samp{z10}, -@samp{z196}, @samp{zEC12}, or @samp{z13}. +Specify which s390 processor variant is the target, @samp{g5} (or +@samp{arch3}), @samp{g6}, @samp{z900} (or @samp{arch5}), @samp{z990} (or +@samp{arch6}), @samp{z9-109}, @samp{z9-ec} (or @samp{arch7}), @samp{z10} (or +@samp{arch8}), @samp{z196} (or @samp{arch9}), @samp{zEC12} (or @samp{arch10}), +or @samp{z13} (or @samp{arch11}). @item -mregnames @itemx -mno-regnames Allow or disallow symbolic names for registers. diff --git a/gas/doc/c-s390.texi b/gas/doc/c-s390.texi index e3277cb..1cbf308 100644 --- a/gas/doc/c-s390.texi +++ b/gas/doc/c-s390.texi @@ -14,9 +14,11 @@ @cindex s390 support The s390 version of @code{@value{AS}} supports two architectures modes -and seven chip levels. The architecture modes are the Enterprise System +and ten chip levels. The architecture modes are the Enterprise System Architecture (ESA) and the newer z/Architecture mode. The chip levels -are g5, g6, z900, z990, z9-109, z9-ec, z10, z196, zEC12, and z13. +are g5 (or arch3), g6, z900 (or arch5), z990 (or arch6), z9-109, z9-ec +(or arch7), z10 (or arch8), z196 (or arch9), zEC12 (or arch10), and +z13 (or arch11). @menu * s390 Options:: Command-line Options. @@ -58,19 +60,31 @@ message. @item -march=@var{CPU} This option specifies the target processor. The following processor names are recognized: -@code{g5}, +@code{g5} (or @code{arch3}), @code{g6}, -@code{z900}, -@code{z990}, +@code{z900} (or @code{arch5}), +@code{z990} (or @code{arch6}), @code{z9-109}, -@code{z9-ec}, -@code{z10}, -@code{z196}, -@code{zEC12}, and -@code{z13}. -Assembling an instruction that is not supported on the target processor -results in an error message. Do not specify @code{g5} or @code{g6} -with @samp{-mzarch}. +@code{z9-ec} (or @code{arch7}), +@code{z10} (or @code{arch8}), +@code{z196} (or @code{arch9}), +@code{zEC12} (or @code{arch10}) and +@code{z13} (or @code{arch11}). + +Assembling an instruction that is not supported on the target +processor results in an error message. + +The processor names starting with @code{arch} refer to the edition +number in the Principle of Operations manual. They can be used as +alternate processor names and have been added for compatibility with +the IBM XL compiler. + +@code{arch3}, @code{g5} and @code{g6} cannot be used with the +@samp{-mzarch} option since the z/Architecture mode is not supported +on these processor levels. + +There is no @code{arch4} option supported. @code{arch4} matches +@code{-march=arch5 -mesa}. @cindex @samp{-mregnames} option, s390 @item -mregnames diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index b36b52e..82eeec3 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2016-09-12 Andreas Krebbel + + * s390-mkopc.c (main): Support alternate arch strings. + 2016-09-12 Patrick Steuer * s390-opc.txt: Fix kmctr instruction type. diff --git a/opcodes/s390-mkopc.c b/opcodes/s390-mkopc.c index 08ed56d..d8ac610 100644 --- a/opcodes/s390-mkopc.c +++ b/opcodes/s390-mkopc.c @@ -334,7 +334,7 @@ main (void) char *str; if (currentLine[0] == '#' || currentLine[0] == '\n') - continue; + continue; memset (opcode, 0, 8); num_matched = sscanf (currentLine, "%15s %15s %15s \"%79[^\"]\" %15s %15s %79[^\n]", @@ -346,25 +346,33 @@ main (void) exit (1); } - if (strcmp (cpu_string, "g5") == 0) + if (strcmp (cpu_string, "g5") == 0 + || strcmp (cpu_string, "arch3") == 0) min_cpu = S390_OPCODE_G5; else if (strcmp (cpu_string, "g6") == 0) min_cpu = S390_OPCODE_G6; - else if (strcmp (cpu_string, "z900") == 0) + else if (strcmp (cpu_string, "z900") == 0 + || strcmp (cpu_string, "arch5") == 0) min_cpu = S390_OPCODE_Z900; - else if (strcmp (cpu_string, "z990") == 0) + else if (strcmp (cpu_string, "z990") == 0 + || strcmp (cpu_string, "arch6") == 0) min_cpu = S390_OPCODE_Z990; else if (strcmp (cpu_string, "z9-109") == 0) min_cpu = S390_OPCODE_Z9_109; - else if (strcmp (cpu_string, "z9-ec") == 0) + else if (strcmp (cpu_string, "z9-ec") == 0 + || strcmp (cpu_string, "arch7") == 0) min_cpu = S390_OPCODE_Z9_EC; - else if (strcmp (cpu_string, "z10") == 0) + else if (strcmp (cpu_string, "z10") == 0 + || strcmp (cpu_string, "arch8") == 0) min_cpu = S390_OPCODE_Z10; - else if (strcmp (cpu_string, "z196") == 0) + else if (strcmp (cpu_string, "z196") == 0 + || strcmp (cpu_string, "arch9") == 0) min_cpu = S390_OPCODE_Z196; - else if (strcmp (cpu_string, "zEC12") == 0) + else if (strcmp (cpu_string, "zEC12") == 0 + || strcmp (cpu_string, "arch10") == 0) min_cpu = S390_OPCODE_ZEC12; - else if (strcmp (cpu_string, "z13") == 0) + else if (strcmp (cpu_string, "z13") == 0 + || strcmp (cpu_string, "arch11") == 0) min_cpu = S390_OPCODE_Z13; else { fprintf (stderr, "Couldn't parse cpu string %s\n", cpu_string); -- 2.7.4