aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2016-09-14 07:10:49 -0700
committerJose E. Marchesi <jose.marchesi@oracle.com>2016-09-14 07:10:49 -0700
commit46a2d504dd875caf60f9be191a55c9ff676bcd5c (patch)
tree8cfbcceec843973e7f39e5b7f9d630bb1f4557c3 /gas/testsuite
parent5d9bbb73c1df68741048c3d0f837b50c289ea608 (diff)
downloadgdb-46a2d504dd875caf60f9be191a55c9ff676bcd5c.zip
gdb-46a2d504dd875caf60f9be191a55c9ff676bcd5c.tar.gz
gdb-46a2d504dd875caf60f9be191a55c9ff676bcd5c.tar.bz2
gas: detect DCTI couples in sparc
Before SPARC V9 the effect of having a delayed branch instruction in the delay slot of a conditional delayed branch was undefined. In SPARC V9 DCTI couples are well defined. However, starting with the UltraSPARC Architecture 2005, DCTI couples (of all kind) are deprecated and should not be used, as they may be slow or behave differently to what the programmer expects. This patch adds a new command line option --dcti-couples-detect to `as', disabled by default, that makes the assembler to warn the user if an unpredictable DCTI couple is found. Tests and documentation are included. gas/ChangeLog: 2016-09-14 Jose E. Marchesi <jose.marchesi@oracle.com> * config/tc-sparc.c (md_assemble): Detect and warning on unpredictable DCTI couples in certain arches. (dcti_couples_detect): New global. (md_longopts): Add command line option -dcti-couples-detect. (md_show_usage): Document -dcti-couples-detect. (md_parse_option): Handle OPTION_DCTI_COUPLES_DETECT. * testsuite/gas/sparc/sparc.exp (gas_64_check): Run dcti-couples-v8, dcti-couples-v9 and dcti-couples-v9c tests. * testsuite/gas/sparc/dcti-couples.s: New file. * testsuite/gas/sparc/dcti-couples-v9c.d: Likewise. * testsuite/gas/sparc/dcti-couples-v8.d: Likewise. * testsuite/gas/sparc/dcti-couples-v9.d: Likewise. * testsuite/gas/sparc/dcti-couples-v9c.l: Likewise. * testsuite/gas/sparc/dcti-couples-v8.l: Likewise. * doc/as.texinfo (Overview): Document --dcti-couples-detect. * doc/c-sparc.texi (Sparc-Opts): Likewise.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/sparc/dcti-couples-v8.d4
-rw-r--r--gas/testsuite/gas/sparc/dcti-couples-v8.l2
-rw-r--r--gas/testsuite/gas/sparc/dcti-couples-v9.d16
-rw-r--r--gas/testsuite/gas/sparc/dcti-couples-v9c.d4
-rw-r--r--gas/testsuite/gas/sparc/dcti-couples-v9c.l3
-rw-r--r--gas/testsuite/gas/sparc/dcti-couples.s13
-rw-r--r--gas/testsuite/gas/sparc/sparc.exp3
7 files changed, 45 insertions, 0 deletions
diff --git a/gas/testsuite/gas/sparc/dcti-couples-v8.d b/gas/testsuite/gas/sparc/dcti-couples-v8.d
new file mode 100644
index 0000000..606ce7b
--- /dev/null
+++ b/gas/testsuite/gas/sparc/dcti-couples-v8.d
@@ -0,0 +1,4 @@
+#as: -Av8 --dcti-couples-detect
+#name: dcti couples (v8)
+#source: dcti-couples.s
+#error-output: dcti-couples-v8.l
diff --git a/gas/testsuite/gas/sparc/dcti-couples-v8.l b/gas/testsuite/gas/sparc/dcti-couples-v8.l
new file mode 100644
index 0000000..e3a4e43
--- /dev/null
+++ b/gas/testsuite/gas/sparc/dcti-couples-v8.l
@@ -0,0 +1,2 @@
+.*dcti-couples.s: Assembler messages:
+.*dcti-couples.s:5:.*unpredictable DCTI couple
diff --git a/gas/testsuite/gas/sparc/dcti-couples-v9.d b/gas/testsuite/gas/sparc/dcti-couples-v9.d
new file mode 100644
index 0000000..1641aa2
--- /dev/null
+++ b/gas/testsuite/gas/sparc/dcti-couples-v9.d
@@ -0,0 +1,16 @@
+#as: -Av9 --dcti-couples-detect
+#objdump: -dr
+#name: dcti couples (v9)
+#source: dcti-couples.s
+
+.*: +file format .*sparc.*
+
+Disassembly of section .text:
+
+0+ <.text>:
+ 0: 1a 80 00 03 bcc 0xc
+ 4: 10 80 00 02 b 0xc
+ 8: 01 00 00 00 nop
+ c: 10 80 00 00 b 0xc
+ 10: 10 bf ff ff b 0xc
+ 14: 01 00 00 00 nop
diff --git a/gas/testsuite/gas/sparc/dcti-couples-v9c.d b/gas/testsuite/gas/sparc/dcti-couples-v9c.d
new file mode 100644
index 0000000..1e1b625
--- /dev/null
+++ b/gas/testsuite/gas/sparc/dcti-couples-v9c.d
@@ -0,0 +1,4 @@
+#as: -Av9c --dcti-couples-detect
+#name: dcti couples (v9c+)
+#source: dcti-couples.s
+#error-output: dcti-couples-v9c.l
diff --git a/gas/testsuite/gas/sparc/dcti-couples-v9c.l b/gas/testsuite/gas/sparc/dcti-couples-v9c.l
new file mode 100644
index 0000000..985daac
--- /dev/null
+++ b/gas/testsuite/gas/sparc/dcti-couples-v9c.l
@@ -0,0 +1,3 @@
+.*dcti-couples.s: Assembler messages:
+.*dcti-couples.s:5:.*unpredictable DCTI couple
+.*dcti-couples.s:12:.*unpredictable DCTI couple
diff --git a/gas/testsuite/gas/sparc/dcti-couples.s b/gas/testsuite/gas/sparc/dcti-couples.s
new file mode 100644
index 0000000..9db550b
--- /dev/null
+++ b/gas/testsuite/gas/sparc/dcti-couples.s
@@ -0,0 +1,13 @@
+ # The execution order of the following DCTI couple is
+ # unpredictable in arches prior to V9, and also in arches
+ # starting with V9C.
+ bcc 1f
+ b 1f
+ nop
+1:
+ # The following DCTI couple is deprecated starting with V9C
+ # (UltraSPARC Architecture 2005) but it is ok in previous
+ # arches.
+ b 1b
+ b 1b
+ nop
diff --git a/gas/testsuite/gas/sparc/sparc.exp b/gas/testsuite/gas/sparc/sparc.exp
index 8cb0904..607f53e 100644
--- a/gas/testsuite/gas/sparc/sparc.exp
+++ b/gas/testsuite/gas/sparc/sparc.exp
@@ -98,6 +98,9 @@ if [istarget sparc*-*-*] {
run_dump_test "v9branch5"
run_dump_test "pr19910-1"
run_list_test "pr19910-2"
+ run_dump_test "dcti-couples-v8"
+ run_dump_test "dcti-couples-v9"
+ run_dump_test "dcti-couples-v9c"
}
if [istarget sparc-*-vxworks*] {