aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2018-10-05 11:41:41 +0900
committerStafford Horne <shorne@gmail.com>2018-10-05 11:41:42 +0900
commit07f5f4c683879e844d20d0d4963bbaf1b7cd47b9 (patch)
tree872d6d64ac1dd790d76b214c2f7ae0150d51bdbb /sim/testsuite
parentc8e98e3692cec125b92c995d8f881d9bdf1fac00 (diff)
downloadgdb-07f5f4c683879e844d20d0d4963bbaf1b7cd47b9.zip
gdb-07f5f4c683879e844d20d0d4963bbaf1b7cd47b9.tar.gz
gdb-07f5f4c683879e844d20d0d4963bbaf1b7cd47b9.tar.bz2
or1k: Add the l.muld, l.muldu, l.macu, l.msbu insns
Also fix the incorrect definitions of multiply and divide carry and overflow float. Changes to the instructions are made in the .cpu file, then we regenerate the binutils and sim files. The changes also required a few fixups for tests and additional sim helpers. cpu/ChangeLog: yyyy-mm-dd Richard Henderson <rth@twiddle.net> Stafford Horne <shorne@gmail.com> * or1korbis.cpu (insn-opcode-mac): Add opcodes for MACU and MSBU. (insn-opcode-alu-regreg): Add opcodes for MULD and MULDU. (l-mul): Fix overflow support and indentation. (l-mulu): Fix overflow support and indentation. (l-muld, l-muldu, l-msbu, l-macu): New instructions. (l-div); Remove incorrect carry behavior. (l-divu): Fix carry and overflow behavior. (l-mac): Add overflow support. (l-msb, l-msbu): Add carry and overflow support. opcodes/ChangeLog: yyyy-mm-dd Richard Henderson <rth@twiddle.net> Stafford Horne <shorne@gmail.com> * or1k-desc.c: Regenerate. * or1k-desc.h: Regenerate. * or1k-opc.c: Regenerate. * or1k-opc.h: Regenerate. * or1k-opinst.c: Regenerate. sim/common/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * cgen-ops.h (ADDCFDI): New function, add carry flag DI variant. (ADDOFDI): New function, add overflow flag DI variant. (SUBCFDI): New function, subtract carry flag DI variant. (SUBOFDI): New function, subtract overflow flag DI variant. sim/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * or1k/cpu.h: Regenerate. * or1k/decode.c: Regenerate. * or1k/decode.h: Regenerate. * or1k/model.c: Regenerate. * or1k/sem-switch.c: Regenerate. * or1k/sem.c: Regenerate: sim/testsuite/sim/or1k/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * div.S: Fix tests to match correct overflow/carry semantics. * mul.S: Likewise. gas/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * testsuite/gas/or1k/allinsn.s: Add instruction tests for l.muld, l.muldu, l.macu, l.msb, l.msbu. * testsuite/gas/or1k/allinsn.d: Add test results for new instructions.
Diffstat (limited to 'sim/testsuite')
-rw-r--r--sim/testsuite/sim/or1k/ChangeLog5
-rw-r--r--sim/testsuite/sim/or1k/div.S12
-rw-r--r--sim/testsuite/sim/or1k/mul.S109
3 files changed, 61 insertions, 65 deletions
diff --git a/sim/testsuite/sim/or1k/ChangeLog b/sim/testsuite/sim/or1k/ChangeLog
index 028d387..7a79bde 100644
--- a/sim/testsuite/sim/or1k/ChangeLog
+++ b/sim/testsuite/sim/or1k/ChangeLog
@@ -1,3 +1,8 @@
+2018-10-05 Stafford Horne <shorne@gmail.com>
+
+ * div.S: Fix tests to match correct overflow/carry semantics.
+ * mul.S: Likewise.
+
2017-12-12 Peter Gavin <pgavin@gmail.com>
Stafford Horne <shorne@gmail.com>
diff --git a/sim/testsuite/sim/or1k/div.S b/sim/testsuite/sim/or1k/div.S
index e1e28d5..a3202e9 100644
--- a/sim/testsuite/sim/or1k/div.S
+++ b/sim/testsuite/sim/or1k/div.S
@@ -75,30 +75,30 @@
# output: report(0x0000000c);\n
# output: report(0x00000000);\n
# output: report(0xfffffffd);\n
-# output: report(0x00000001);\n
# output: report(0x00000000);\n
+# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xfffffff4);\n
# output: report(0x00000000);\n
# output: report(0xfffffffd);\n
-# output: report(0x00000001);\n
# output: report(0x00000000);\n
+# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0x0000000c);\n
# output: report(0x00000000);\n
# output: report(0xfffffffd);\n
-# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: report(0x00000001);\n
+# output: report(0x00000001);\n
# output: \n
# output: report(0xfffffff4);\n
# output: report(0x00000000);\n
# output: report(0xfffffffd);\n
-# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: report(0x00000001);\n
+# output: report(0x00000001);\n
# output: \n
# output: report(0x0000000c);\n
# output: report(0x00000003);\n
@@ -233,7 +233,7 @@ start_tests:
TEST_INST_I32_I32 l.div, 0x0000000c, 0xfffffffd
TEST_INST_I32_I32 l.div, 0x0000000b, 0xfffffffd
- /* Divide by zero. This will set the carry flag. */
+ /* Divide by zero. This will set the overflow flag. */
TEST_INST_I32_I32 l.div, 0x0000000c, 0x00000000
TEST_INST_I32_I32 l.div, 0xfffffff4, 0x00000000
@@ -241,7 +241,7 @@ start_tests:
SET_SPR_SR_FLAGS SPR_SR_OVE, r2, r3
- /* Divide by zero. This will set the carry flag and trigger an
+ /* Divide by zero. This will set the overflow flag and trigger an
exception. */
TEST_INST_I32_I32 l.div, 0x0000000c, 0x00000000
TEST_INST_I32_I32 l.div, 0xfffffff4, 0x00000000
diff --git a/sim/testsuite/sim/or1k/mul.S b/sim/testsuite/sim/or1k/mul.S
index 964badd..70bbc41 100644
--- a/sim/testsuite/sim/or1k/mul.S
+++ b/sim/testsuite/sim/or1k/mul.S
@@ -40,56 +40,56 @@
# output: report(0x00010000);\n
# output: report(0x00010000);\n
# output: report(0x00000000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xfffffffe);\n
# output: report(0xfffffffd);\n
# output: report(0x00000006);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xffff7fff);\n
# output: report(0xffff0002);\n
# output: report(0x7ffffffe);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xffff7fff);\n
# output: report(0xffff0000);\n
# output: report(0x80010000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xffff0000);\n
# output: report(0xfffeffff);\n
# output: report(0x00010000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0x00000002);\n
# output: report(0xfffffffd);\n
# output: report(0xfffffffa);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xffff8000);\n
# output: report(0x00010000);\n
# output: report(0x80000000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xffff7fff);\n
# output: report(0x00010000);\n
# output: report(0x7fff0000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: \n
@@ -110,14 +110,14 @@
# output: report(0x00000002);\n
# output: report(0xfffffffd);\n
# output: report(0xfffffffa);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xffff7fff);\n
# output: report(0xffff0000);\n
# output: report(0x80010000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000001);\n
# output: report(0x00000001);\n
# output: \n
@@ -145,56 +145,56 @@
# output: report(0x00040000);\n
# output: report(0x00004000);\n
# output: report(0x00000000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xfffffffe);\n
# output: report(0x0000fffd);\n
# output: report(0x00000006);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xfffefffe);\n
# output: report(0x00008001);\n
# output: report(0x7ffffffe);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xfffe0000);\n
# output: report(0x0000bfff);\n
# output: report(0x80020000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xfffdfffe);\n
# output: report(0x00008000);\n
# output: report(0x00010000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0x00000002);\n
# output: report(0x0000fffd);\n
# output: report(0xfffffffa);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0x00010000);\n
# output: report(0x00008000);\n
# output: report(0x80000000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xfffdfffc);\n
# output: report(0x00004000);\n
# output: report(0x7fff0000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000001);\n
# output: report(0x00000000);\n
# output: \n
@@ -215,14 +215,14 @@
# output: report(0xfffffffe);\n
# output: report(0x0000fffd);\n
# output: report(0x00000006);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: report(0x00000000);\n
# output: \n
# output: report(0xfffdfffe);\n
# output: report(0x00008000);\n
# output: report(0x00010000);\n
-# output: report(0x00000001);\n
+# output: report(0x00000000);\n
# output: report(0x00000001);\n
# output: report(0x00000001);\n
# output: \n
@@ -322,14 +322,14 @@
# output: report(0xfffffffa);\n
# output: report(0x00000001);\n
# output: report(0x00000000);\n
-# output: report(0x00000000);\n
+# output: report(0x00000001);\n
# output: \n
# output: report(0xffff7fff);\n
# output: report(0xffff0000);\n
# output: report(0x80010000);\n
# output: report(0x00000001);\n
# output: report(0x00000000);\n
-# output: report(0x00000000);\n
+# output: report(0x00000001);\n
# output: \n
# output: exit(0)\n
@@ -375,21 +375,19 @@ start_tests:
set the overflow, but not the carry flag . */
TEST_INST_I32_I32 l.mul, 0x00008000, 0x00010000
- /* Multiply two large positive numbers. This should set both the
- carry and overflow flags (even though the result is not a
- negative number. */
+ /* Multiply two large positive numbers. This should set the
+ overflow flags (even though the result is not a negative
+ number. */
TEST_INST_I32_I32 l.mul, 0x00010000, 0x00010000
- /* Multiply two small negative numbers. This will set the carry
- flag, but not the overflow flag. */
+ /* Multiply two small negative numbers. This will set no flags. */
TEST_INST_I32_I32 l.mul, 0xfffffffe, 0xfffffffd
- /* Multiply two quite large negative numbers. This will set the
- carry flag, but not the overflow flag. */
+ /* Multiply two quite large negative numbers. This will no flags. */
TEST_INST_I32_I32 l.mul, 0xffff7fff, 0xffff0002
/* Multiply two slightly too large negative numbers. This should
- set both the overflow, and the carry flags */
+ set the overflow flag. */
TEST_INST_I32_I32 l.mul, 0xffff7fff, 0xffff0000
/* Multiply two large negative numbers. This should set the
@@ -398,18 +396,15 @@ start_tests:
TEST_INST_I32_I32 l.mul, 0xffff0000, 0xfffeffff
/* Multiply one small negative number and one small positive
- number. This will set the carry flag, but not the overflow
- flag. */
+ number. This will set the no flags. */
TEST_INST_I32_I32 l.mul, 0x00000002, 0xfffffffd
/* Multiply one quite large negative number and one quite large
- positive number. This will set the carry, but not the
- overflow flag. */
+ positive number. This will set no flags. */
TEST_INST_I32_I32 l.mul, 0xffff8000, 0x00010000
/* Multiply one slightly too large negative number and one slightly
- too large positive number. This should set both the carry and
- overflow flags. */
+ too large positive number. This should set the overflow flag. */
TEST_INST_I32_I32 l.mul, 0xffff7fff, 0x00010000
/* Multiply the largest negative number by positive unity. This
@@ -423,10 +418,11 @@ start_tests:
/* Check that an overflow alone causes a RANGE Exception. */
TEST_INST_I32_I32 l.mul, 0x00008000, 0x00010000
- /* Check that a carry alone does not cause a RANGE Exception. */
+ /* Check multiply of a negative and positive does not cause a RANGE
+ Exception. */
TEST_INST_I32_I32 l.mul, 0x00000002, 0xfffffffd
- /* Check that carry and overflow together cause an exception. */
+ /* Check that negative overflow causes a RANGE exception. */
TEST_INST_I32_I32 l.mul, 0xffff7fff, 0xffff0000
CLEAR_SPR_SR_FLAGS SPR_SR_OVE, r2, r3
@@ -445,41 +441,35 @@ start_tests:
set the overflow, but not the carry flag. */
TEST_INST_I32_I16 l.muli, 0x00020000, 0x4000
- /* Multiply two large positive numbers. This should set both the
- carry and overflow flags (even though the result is not a
- negative number. */
+ /* Multiply two large positive numbers. This should set the
+ overflow flag, even though the result is not a negative number. */
TEST_INST_I32_I16 l.muli, 0x00040000, 0x4000
- /* Multiply two small negative numbers. This should set the
- carry flag, but not the overflow flag. */
+ /* Multiply two small negative numbers. This should set no flags. */
TEST_INST_I32_I16 l.muli, 0xfffffffe, 0xfffd
- /* Multiply two quite large negative numbers. This will set the
- carry, but not the overflow flag. */
+ /* Multiply two quite large negative numbers. This will set no
+ flags. */
TEST_INST_I32_I16 l.muli, 0xfffefffe, 0x8001
/* Multiply two slightly too large negative numbers. This should
- set both the overflow, and the carry flags */
+ set the overflow flag. */
TEST_INST_I32_I16 l.muli, 0xfffe0000, 0xbfff
- /* Multiply two large negative numbers. This should set the both
- the carry and overflow flags (even though the result is a
- positive number. */
+ /* Multiply two large negative numbers. This should set the
+ overflow flag, even though the result is a positive number. */
TEST_INST_I32_I16 l.muli, 0xfffdfffe, 0x8000
/* Multiply one small negative number and one small positive
- number. This will set the carry flag, but not the overflow
- flag. */
+ number. This will set no flags. */
TEST_INST_I32_I16 l.muli, 0x00000002, 0xfffd
/* Multiply one quite large negative number and one quite large
- positive number. This will set the carry flag, but not the
- overflow flag. */
+ positive number. This will set no flags. */
TEST_INST_I32_I16 l.muli, 0x00010000, 0x8000
/* Multiply one slightly too large negative number and one slightly
- too large positive number. This should set both the carry and
- overflow flags. */
+ too large positive number. This will set the overflow flag. */
TEST_INST_I32_I16 l.muli, 0xfffdfffc, 0x4000
/* Multiply the largest negative number by positive unity. Should
@@ -493,10 +483,11 @@ start_tests:
/* Check that an overflow alone causes a RANGE Exception. */
TEST_INST_I32_I16 l.muli, 0x00020000, 0x4000
- /* Check that a carry alone does not cause a RANGE Exception. */
+ /* Check that two negatives will not cause a RANGE Exception. */
TEST_INST_I32_I16 l.muli, 0xfffffffe, 0xfffd
- /* Check that carry and overflow together cause an exception. */
+ /* Check that multiply of larget negative and positive numbers causes
+ a RANGE exception and overflow. */
TEST_INST_I32_I16 l.muli, 0xfffdfffe, 0x8000
CLEAR_SPR_SR_FLAGS SPR_SR_OVE, r2, r3
@@ -561,11 +552,11 @@ start_tests:
does not cause a RANGE Exception. */
TEST_INST_I32_I32 l.mulu, 0x00008000, 0x00010000
- /* Check that a carry alone does not cause a RANGE Exception. */
+ /* Check that a carry causes a RANGE Exception. */
TEST_INST_I32_I32 l.mulu, 0x00000002, 0xfffffffd
/* Check that what would cause an overflow and carry in 2's
- complement does not cause a RANGE Exception. */
+ complement causes a RANGE Exception. */
TEST_INST_I32_I32 l.mulu, 0xffff7fff, 0xffff0000
CLEAR_SPR_SR_FLAGS SPR_SR_OVE, r2, r3