From 9d5cdeeee64f2b8227446fc42d4e0c90a3e5c51b Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Thu, 9 Dec 2010 23:57:21 +0000 Subject: [PATCH] gas/ * config/tc-mips.c (file_ase_mips16): Adjust comment. (append_insn): Update file_ase_mips16. (mips_after_parse_args): Don't set file_ase_mips16 here. gas/testsuite/ * gas/mips/elf_ase_mips16.d: Update test for new MIPS16 ASE flag semantics. * gas/mips/elf_ase_mips16-2.d: New test. * gas/mips/nop.s: Source for the new test. * gas/mips/mips.exp: Run the new test. binutils/testsuite/ * lib/binutils-common.exp (regexp_diff): Implement inverse matching, requested by `!'. --- binutils/testsuite/ChangeLog | 5 +++++ binutils/testsuite/lib/binutils-common.exp | 25 +++++++++++++++------- gas/ChangeLog | 6 ++++++ gas/config/tc-mips.c | 6 +++--- gas/testsuite/ChangeLog | 8 +++++++ .../mips/{elf_ase_mips16.d => elf_ase_mips16-2.d} | 4 ++-- gas/testsuite/gas/mips/elf_ase_mips16.d | 2 +- gas/testsuite/gas/mips/mips.exp | 5 ++++- gas/testsuite/gas/mips/nop.s | 1 + 9 files changed, 47 insertions(+), 15 deletions(-) copy gas/testsuite/gas/mips/{elf_ase_mips16.d => elf_ase_mips16-2.d} (70%) create mode 100644 gas/testsuite/gas/mips/nop.s diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index e044acc13..1e5801b95 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-12-09 Maciej W. Rozycki + + * lib/binutils-common.exp (regexp_diff): Implement inverse + matching, requested by `!'. + 2010-11-20 Richard Sandiford * lib/binutils-common.exp (regexp_diff): New procedure. diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index 2f8b42652..424ca3d7c 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -167,7 +167,9 @@ proc is_elf64 { binary_file } { # REGEXP # Skip all lines in FILE_1 until the first that matches REGEXP. # -# Other # lines are comments. Skip empty lines in both files. +# Other # lines are comments. Regexp lines starting with the `!' character +# specify inverse matching (use `\!' for literal matching against a leading +# `!'). Skip empty lines in both files. # # The first optional argument is a list of regexp substitutions of the form: # @@ -235,12 +237,15 @@ proc regexp_diff { file_1 file_2 args } { set diff_pass 1 break } + set negated [expr { [string index $line_b 0] eq "!" }] + set line_bx [string range $line_b $negated end] + set n [expr { $negated ? "! " : "" }] # Substitute on the reference. foreach {name value} $ref_subst { - regsub -- $name $line_b $value line_b + regsub -- $name $line_bx $value line_bx } - verbose "looking for \"^$line_b$\"" 3 - while { ![regexp "^$line_b$" "$line_a"] } { + verbose "looking for $n\"^$line_bx$\"" 3 + while { [expr [regexp "^$line_bx$" "$line_a"] == $negated] } { verbose "skipping \"$line_a\"" 3 if { [gets $file_a line_a] == $eof } { set end_1 1 @@ -270,14 +275,18 @@ proc regexp_diff { file_1 file_2 args } { set differences 1 break } else { + set negated [expr { [string index $line_b 0] eq "!" }] + set line_bx [string range $line_b $negated end] + set n [expr { $negated ? "! " : "" }] + set s [expr { $negated ? " " : "" }] # Substitute on the reference. foreach {name value} $ref_subst { - regsub -- $name $line_b $value line_b + regsub -- $name $line_bx $value line_bx } - verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3 - if { ![regexp "^$line_b$" "$line_a"] } { + verbose "regexp $n\"^$line_bx$\"\nline \"$line_a\"" 3 + if { [expr [regexp "^$line_bx$" "$line_a"] == $negated] } { send_log "regexp_diff match failure\n" - send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n" + send_log "regexp $n\"^$line_bx$\"\nline $s\"$line_a\"\n" verbose "regexp_diff match failure\n" 3 set differences 1 } diff --git a/gas/ChangeLog b/gas/ChangeLog index ce56b30fc..fae5743f3 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,11 @@ 2010-12-09 Maciej W. Rozycki + * config/tc-mips.c (file_ase_mips16): Adjust comment. + (append_insn): Update file_ase_mips16. + (mips_after_parse_args): Don't set file_ase_mips16 here. + +2010-12-09 Maciej W. Rozycki + * config/tc-mips.c (macro) : Remove dedicated return points. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 0473b10d4..64a0717d9 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -282,8 +282,7 @@ unsigned long mips_cprmask[4]; /* MIPS ISA we are using for this output file. */ static int file_mips_isa = ISA_UNKNOWN; -/* True if -mips16 was passed or implied by arguments passed on the - command line (e.g., by -march). */ +/* True if any MIPS16 code was produced. */ static int file_ase_mips16; #define ISA_SUPPORTS_MIPS16E (mips_opts.isa == ISA_MIPS32 \ @@ -2811,6 +2810,8 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr, /* Mark instruction labels in mips16 mode. */ mips16_mark_labels (); + file_ase_mips16 |= mips_opts.mips16; + prev_pinfo = history[0].insn_mo->pinfo; pinfo = ip->insn_mo->pinfo; @@ -12045,7 +12046,6 @@ mips_after_parse_args (void) mips_cpu_info_from_isa (mips_opts.isa)->name); file_mips_isa = mips_opts.isa; - file_ase_mips16 = mips_opts.mips16; file_ase_mips3d = mips_opts.ase_mips3d; file_ase_mdmx = mips_opts.ase_mdmx; file_ase_smartmips = mips_opts.ase_smartmips; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 8fff99dda..3675cbc27 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,5 +1,13 @@ 2010-12-09 Maciej W. Rozycki + * gas/mips/elf_ase_mips16.d: Update test for new MIPS16 ASE flag + semantics. + * gas/mips/elf_ase_mips16-2.d: New test. + * gas/mips/nop.s: Source for the new test. + * gas/mips/mips.exp: Run the new test. + +2010-12-09 Maciej W. Rozycki + * gas/mips/jal-svr4pic.d: Also use wildcard address matching in relocations. * gas/mips/mips1@jal-svr4pic.d: Likewise. diff --git a/gas/testsuite/gas/mips/elf_ase_mips16.d b/gas/testsuite/gas/mips/elf_ase_mips16-2.d similarity index 70% copy from gas/testsuite/gas/mips/elf_ase_mips16.d copy to gas/testsuite/gas/mips/elf_ase_mips16-2.d index 74bb9873e..89b28b0f4 100644 --- a/gas/testsuite/gas/mips/elf_ase_mips16.d +++ b/gas/testsuite/gas/mips/elf_ase_mips16-2.d @@ -1,5 +1,5 @@ -# name: ELF MIPS16 ASE markings -# source: empty.s +# name: ELF MIPS16 ASE markings 2 +# source: nop.s # objdump: -p # as: -32 -mips16 diff --git a/gas/testsuite/gas/mips/elf_ase_mips16.d b/gas/testsuite/gas/mips/elf_ase_mips16.d index 74bb9873e..89fbc5bd1 100644 --- a/gas/testsuite/gas/mips/elf_ase_mips16.d +++ b/gas/testsuite/gas/mips/elf_ase_mips16.d @@ -4,5 +4,5 @@ # as: -32 -mips16 .*:.*file format.*mips.* -private flags = [0-9a-f]*[4-7c-f]......: .*[[,]mips16[],].* +!private flags = .*mips16.* diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 6e98082c9..7075f9dd8 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -743,7 +743,10 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "elf_arch_mips64r2" # Verify that ASE markings are handled properly. - if { !$no_mips16 } { run_dump_test "elf_ase_mips16" } + if { !$no_mips16 } { + run_dump_test "elf_ase_mips16" + run_dump_test "elf_ase_mips16-2" + } run_dump_test "mips-gp32-fp32-pic" run_dump_test "mips-gp32-fp64-pic" diff --git a/gas/testsuite/gas/mips/nop.s b/gas/testsuite/gas/mips/nop.s new file mode 100644 index 000000000..4e7fe2f0a --- /dev/null +++ b/gas/testsuite/gas/mips/nop.s @@ -0,0 +1 @@ + nop -- 2.11.4.GIT