loongson-muldiv-1.c: New test.
authorRichard Sandiford <rdsandiford@googlemail.com>
Thu, 13 Nov 2008 22:49:37 +0000 (22:49 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 13 Nov 2008 22:49:37 +0000 (22:49 +0000)
gcc/testsuite/
* gcc.target/mips/loongson-muldiv-1.c: New test.
* gcc.target/mips/loongson-muldiv-2.c: Likewise.

From-SVN: r141836

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/loongson-muldiv-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/loongson-muldiv-2.c [new file with mode: 0644]

index 6b423ed..af455e8 100644 (file)
@@ -1,3 +1,8 @@
+2008-11-13  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * gcc.target/mips/loongson-muldiv-1.c: New test.
+       * gcc.target/mips/loongson-muldiv-2.c: Likewise.
+
 2008-11-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/27017
diff --git a/gcc/testsuite/gcc.target/mips/loongson-muldiv-1.c b/gcc/testsuite/gcc.target/mips/loongson-muldiv-1.c
new file mode 100644 (file)
index 0000000..d8293b2
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-mips-options "-O2 -march=loongson2e" } */
+
+typedef int st;
+typedef unsigned int ut;
+
+NOMIPS16 st smul (st x, st y) { return x * y; }
+NOMIPS16 st sdiv (st x, st y) { return x / y + x % y; }
+
+NOMIPS16 ut umul (ut x, ut y) { return x * y; }
+NOMIPS16 ut udiv (ut x, ut y) { return x / y + x % y; }
+
+/* { dg-final { scan-assembler-times "\tmultu.g\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tdivu.g\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tmodu.g\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tdiv.g\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tmod.g\t" 1 } } */
diff --git a/gcc/testsuite/gcc.target/mips/loongson-muldiv-2.c b/gcc/testsuite/gcc.target/mips/loongson-muldiv-2.c
new file mode 100644 (file)
index 0000000..4953292
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-mips-options "-O2 -march=loongson2e -mgp64" } */
+
+typedef long long st;
+typedef unsigned long long ut;
+
+NOMIPS16 st smul (st x, st y) { return x * y; }
+NOMIPS16 st sdiv (st x, st y) { return x / y + x % y; }
+
+NOMIPS16 ut umul (ut x, ut y) { return x * y; }
+NOMIPS16 ut udiv (ut x, ut y) { return x / y + x % y; }
+
+/* { dg-final { scan-assembler-times "\tdmultu.g\t" 2 } } */
+/* { dg-final { scan-assembler-times "\tddivu.g\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tdmodu.g\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tddiv.g\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tdmod.g\t" 1 } } */