* gas/cris/regprefix-err-1.s, gas/cris/rd-regprefix-1.s,
authorHans-Peter Nilsson <hp@axis.com>
Fri, 29 Sep 2000 18:39:31 +0000 (18:39 +0000)
committerHans-Peter Nilsson <hp@axis.com>
Fri, 29 Sep 2000 18:39:31 +0000 (18:39 +0000)
gas/cris/rd-regprefix-1.d, gas/cris/rd-regprefix-1b.d,
gas/cris/us-err-1.s, gas/cris/us-err-2.s, gas/cris/us-err-3.s: New.
* gas/cris/cris.exp: Loop run_dump_test over files matching rd-*.d.

gas/testsuite/gas/cris/cris.exp
gas/testsuite/gas/cris/rd-regprefix-1.d [new file with mode: 0644]
gas/testsuite/gas/cris/rd-regprefix-1.s [new file with mode: 0644]
gas/testsuite/gas/cris/rd-regprefix-1b.d [new file with mode: 0644]
gas/testsuite/gas/cris/regprefix-err-1.s [new file with mode: 0644]
gas/testsuite/gas/cris/us-err-1.s [new file with mode: 0644]
gas/testsuite/gas/cris/us-err-2.s [new file with mode: 0644]
gas/testsuite/gas/cris/us-err-3.s [new file with mode: 0644]

index 4ce70dee629e82a026d0b6fb9242681031360051..46190f3dd3f5e7d1947c4893c8de64eecc609d7c 100644 (file)
@@ -326,6 +326,17 @@ if [istarget cris-*-*] then {
     #untested "disassembling special regs"
     #untested "disassembling unimplemented special regs"
 
+    # *PLEASE* make new "simple" run_dump_test-tests match "rd-*.d", so
+    # they will be picked up automatically through this construct.  This
+    # so you don't need to change cris.exp.  (As perhaps should have been
+    # originally done for cases below, but which is not worth fixing now.)
+    set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/rd-*.d]]
+    for { set i 0 } { $i < [llength $rd_test_list] } { incr i } {
+       # We need to strip the ".d", but can leave the dirname.
+       verbose [file rootname [lindex $rd_test_list $i]]
+       run_dump_test [file rootname [lindex $rd_test_list $i]]
+    }
+
     # Broken word handling got erroneously triggers for this and
     # got out-of-bounds errors.
     # FIXME:  Check closer that this gets the expected results and fix
diff --git a/gas/testsuite/gas/cris/rd-regprefix-1.d b/gas/testsuite/gas/cris/rd-regprefix-1.d
new file mode 100644 (file)
index 0000000..f6b880a
--- /dev/null
@@ -0,0 +1,34 @@
+#objdump: -dr
+#as: --underscore
+#name: Register prefixes 1 defaulted to no.
+
+.*:[   ]+file format .*-cris
+Disassembly of section \.text:
+00000000 <start>:
+[      ]+0:[   ]+6556[  ]+test\.d[      ]+r5
+[      ]+2:[   ]+3496[  ]+move[         ]+r4,ibr
+[      ]+4:[   ]+01a1 e44b[    ]+move\.d[      ]+r4,\[r10\+1\]
+[      ]+8:[   ]+bab9[  ]+jsr[  ]+r10
+[      ]+a:[   ]+607a[  ]+move\.d[      ]+\[r0\],r7
+[      ]+c:[   ]fce1 7ebe[      ]+push[         ]+srp
+[      ]+10:[  ]+74a6[  ]+move[         ]+irp,r4
+[      ]+12:[  ]+40a5 e44b[     ]+move\.d[      ]+r4,\[r0\+r10\.b\]
+[      ]+16:[  ]+6ffd 0000 0000 705a[  ]+move[  ]+ccr,\[pc\+0[  ]+<start>\]
+[      ]+18:[  ]+(R_CRIS_)?32[  ]+r16
+[      ]+1e:[  ]fce1 7ebe[      ]+push[         ]+srp
+[      ]+22:[  ]+60a5 e44b[     ]+move\.d[      ]+r4,\[r0\+r10\.d\]
+[      ]+26:[  ]+6ffd 0000 0000 705a[   ]+move[         ]+ccr,\[pc\+0[  ]+<start>\]
+[      ]+28:[  ]+(R_CRIS_)?32[  ]+r16
+[      ]+2e:[  ]+6556[  ]+test\.d[      ]+r5
+[      ]+30:[  ]+3496[  ]+move[         ]+r4,ibr
+[      ]+32:[  ]+01a1 e44b[     ]+move\.d[      ]+r4,\[r10\+1\]
+[      ]+36:[  ]+bab9[  ]+jsr[  ]+r10
+[      ]+38:[  ]+6f5e 0000 0000[        ]+move\.d[      ]+0[    ]+<start>,r5
+[      ]+3a:[  ]+(R_CRIS_)?32[  ]+r5
+[      ]+3e:[  ]+3f9e 0000 0000[        ]+move[         ]+0[    ]+<start>,ibr
+[      ]+40:[  ]+(R_CRIS_)?32[  ]+r4
+[      ]+44:[  ]+7f0d 0100 0000 e44b[   ]+move\.d[      ]+r4,\[1[       ]+<start\+0x1>\]
+[      ]+46:[  ]+(R_CRIS_)?32[  ]+r10\+0x1
+[      ]+4c:[  ]+3fbd 0000 0000[        ]+jsr[  ]+0[    ]+<start>
+[      ]+4e:[  ]+(R_CRIS_)?32[  ]+r10
+[      ]+\.\.\.
diff --git a/gas/testsuite/gas/cris/rd-regprefix-1.s b/gas/testsuite/gas/cris/rd-regprefix-1.s
new file mode 100644 (file)
index 0000000..2bcbdf8
--- /dev/null
@@ -0,0 +1,41 @@
+; Test (no_)register_prefixes a bit.  Register prefix may or may not be
+; mandated when we get here.
+
+start:
+; Ambiguous.  Depends on default.
+       move.d r5,$r5
+       move r4,$ibr
+       move.d $r4,[r10+1]
+       jsr r10
+       move.d [r0],$r7
+
+; Non-ambiguous, with a prefix.
+
+       push $srp
+       move $irp,$r4
+       move.d $r4,[$r0+$r10.b]
+       move $ccr,[$pc+r16]
+
+       .syntax no_register_prefix
+
+; Some invalid with mandated register prefix; check that they pass.
+
+       push srp
+       move.d r4,[r0+r10.d]
+       move $ccr,[$pc+r16]
+
+; Ambiguity interpreted one way...
+
+       move.d r5,$r5
+       move r4,$ibr
+       move.d $r4,[r10+1]
+       jsr r10
+
+       .syntax register_prefix
+
+; Ambiguity interpreted the other way.
+
+       move.d r5,$r5
+       move r4,$ibr
+       move.d $r4,[r10+1]
+       jsr r10
diff --git a/gas/testsuite/gas/cris/rd-regprefix-1b.d b/gas/testsuite/gas/cris/rd-regprefix-1b.d
new file mode 100644 (file)
index 0000000..af221f2
--- /dev/null
@@ -0,0 +1,43 @@
+#objdump: -dr
+#as: --no-underscore --em=criself
+#source: rd-regprefix-1.s
+#name: Register prefixes 1 defaulted to yes.
+
+# We have to force ELF here, since --no-underscore is invalid with a.out
+# (separately tested).  We make sure we get the target translation to
+# elf32-cris (not elf32-us-cris) as well so we spell out the target name.
+
+.*:[   ]+file format elf32-cris
+Disassembly of section \.text:
+00000000 <start>:
+[      ]+0:[   ]+6f5e 0000 0000[       ]+move\.d[      ]+0[    ]+<start>,\$r5
+[      ]+2:[   ]+(R_CRIS_)?32[         ]+r5
+[      ]+6:[   ]+3f9e 0000 0000[       ]+move[         ]+0[    ]+<start>,\$ibr
+[      ]+8:[   ]+(R_CRIS_)?32[         ]+r4
+[      ]+c:[   ]+7f0d 0100 0000 e44b[  ]+move\.d[      ]+\$r4,\[1[     ]+<start\+0x1>\]
+[      ]+e:[   ]+(R_CRIS_)?32[         ]+r10\+0x1
+[      ]+14:[  ]+3fbd 0000 0000[       ]+jsr[  ]+0[    ]+<start>
+[      ]+16:[  ]+(R_CRIS_)?32[         ]+r10
+[      ]+1a:[  ]+7f0d 0000 0000[       ]+677a[         ]+move\.d[      ]+\[0[  ]+<start>\],\$r7
+[      ]+1c:[  ]+(R_CRIS_)?32[         ]+r0
+[      ]+22:[  ]+fce1 7ebe[    ]+push[         ]+\$srp
+[      ]+26:[  ]+74a6[         ]+move[         ]+\$irp,\$r4
+[      ]+28:[  ]+40a5 e44b[    ]+move\.d[      ]+\$r4,\[\$r0\+\$r10\.b\]
+[      ]+2c:[  ]+6ffd 0000 0000 705a[  ]+move[         ]+\$ccr,\[\$pc\+0[      ]+<start>\]
+[      ]+2e:[  ]+(R_CRIS_)?32[         ]+r16
+[      ]+34:[  ]+fce1 7ebe[    ]+push[         ]+\$srp
+[      ]+38:[  ]+60a5 e44b[    ]+move\.d[      ]+\$r4,\[\$r0\+\$r10\.d\]
+[      ]+3c:[  ]+6ffd 0000 0000 705a[  ]+move[         ]+\$ccr,\[\$pc\+0[      ]+<start>\]
+[      ]+3e:[  ]+(R_CRIS_)?32[         ]+r16
+[      ]+44:[  ]+6556[         ]+test\.d[      ]+\$r5
+[      ]+46:[  ]+3496[         ]+move[         ]+\$r4,\$ibr
+[      ]+48:[  ]+01a1 e44b[    ]+move\.d[      ]+\$r4,\[\$r10\+1\]
+[      ]+4c:[  ]+bab9[         ]+jsr[  ]+\$r10
+[      ]+4e:[  ]+6f5e 0000 0000[       ]+move\.d[      ]+0[    ]+<start>,\$r5
+[      ]+50:[  ]+(R_CRIS_)?32[         ]+r5
+[      ]+54:[  ]+3f9e 0000 0000[       ]+move[         ]+0[    ]+<start>,\$ibr
+[      ]+56:[  ]+(R_CRIS_)?32[         ]+r4
+[      ]+5a:[  ]+7f0d 0100 0000[       ]+e44b[         ]+move\.d[      ]+\$r4,\[1[     ]+<start\+0x1>\]
+[      ]+5c:[  ]+(R_CRIS_)?32[         ]+r10\+0x1
+[      ]+62:[  ]+3fbd 0000 0000[       ]+jsr[  ]+0[    ]+<start>
+[      ]+64:[  ]+(R_CRIS_)?32[         ]+r10
diff --git a/gas/testsuite/gas/cris/regprefix-err-1.s b/gas/testsuite/gas/cris/regprefix-err-1.s
new file mode 100644 (file)
index 0000000..3073c0e
--- /dev/null
@@ -0,0 +1,34 @@
+; Test that we get errors when we require a register prefix.
+
+; { dg-do assemble }
+
+       .syntax register_prefix
+start:
+
+; Some simple tests that we indeed require a register prefix, and some
+; that should not be flagged as syntax errors.
+
+       push srp                ; { dg-error "(Illegal|Invalid) operands" }
+       push r3                 ; { dg-error "(Illegal|Invalid) operands" }
+       move.d $r7,r8           ; { dg-error "(Illegal|Invalid) operands" }
+       move.d r8,[$r11]        ; { dg-error "(Illegal|Invalid) operands" }
+       move.d $r8,[$r11+]
+       move.d $r8,[$r10+$r9.b]
+       move.d $r7,[$r10+[$r1].d]
+       move.d $r7,[$r10+[$r3+].w]
+       move $r8,srp            ; { dg-error "(Illegal|Invalid) operands" }
+       move ccr,$r13           ; { dg-error "(Illegal|Invalid) operands" }
+       movem r4,[$r12+]        ; { dg-error "(Illegal|Invalid) operands" }
+
+; Here we have no ambiguity; r10 can only be a symbol when we reuire a
+; prefix.  It does not just miss a size specifier, e.g. as in [r12+r10.d].
+       move.d $r13,[$r12+r10]
+
+       .syntax no_register_prefix
+
+; Perhaps in this one we should backtrack and retry r10 as a symbol, but
+; the ambiguity is closer to a programming error, so we should catch it as
+; such.
+       move.d $r13,[$r12+r10]  ; { dg-error "(Illegal|Invalid) operands" }
+       move.d r13,[r12+r16]    ; No register named r16 so must be a symbol.
+       nop
diff --git a/gas/testsuite/gas/cris/us-err-1.s b/gas/testsuite/gas/cris/us-err-1.s
new file mode 100644 (file)
index 0000000..cbe7618
--- /dev/null
@@ -0,0 +1,8 @@
+; Test that we get an error with mismatching options.
+
+; { dg-do assemble }
+; { dg-options "--no-underscore --em=crisaout" }
+; { dg-error ".* --no-underscore is invalid with a.out format" "" { target cris-*-* } 0 }
+
+start:
+       nop
diff --git a/gas/testsuite/gas/cris/us-err-2.s b/gas/testsuite/gas/cris/us-err-2.s
new file mode 100644 (file)
index 0000000..d6d9561
--- /dev/null
@@ -0,0 +1,10 @@
+; Test that we get an error when directive does not match option.
+; Make sure we specify ELF so we don't get spurious failures when testing
+; a.out.
+
+; { dg-do assemble }
+; { dg-options "--underscore" }
+
+       .syntax no_leading_underscore ; { dg-error ".* \.syntax no_leading_underscore requires .* `--no-underscore'" }
+start:
+       nop
diff --git a/gas/testsuite/gas/cris/us-err-3.s b/gas/testsuite/gas/cris/us-err-3.s
new file mode 100644 (file)
index 0000000..54ff9f3
--- /dev/null
@@ -0,0 +1,10 @@
+; Test that we get an error when directive does not match option.
+; Make sure we specify ELF so we don't get spurious failures when testing
+; a.out.
+
+; { dg-do assemble }
+; { dg-options "--no-underscore --em=criself" }
+
+       .syntax leading_underscore ; { dg-error ".* \.syntax leading_underscore requires .* `--underscore'" }
+start:
+       nop