]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
usmul.c: New test.
authorBernd Schmidt <bernd.schmidt@analog.com>
Sun, 20 Nov 2005 18:25:59 +0000 (18:25 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Sun, 20 Nov 2005 18:25:59 +0000 (18:25 +0000)
* gcc.c-torture/execute/usmul.c: New test.

From-SVN: r107257

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/usmul.c [new file with mode: 0644]

index edc8723f0204ab57d69ee2f82b2d7f1eac5672f4..c8414a319e791d8fac6e87c40e073ca108ee0021 100644 (file)
@@ -1,3 +1,7 @@
+2005-11-20  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+       * gcc.c-torture/execute/usmul.c: New test.
+
 2005-11-19  James A. Morrison  <phython@gcc.gnu.org>
 
        * gcc.dg/tree-ssa/vrp22.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/usmul.c b/gcc/testsuite/gcc.c-torture/execute/usmul.c
new file mode 100644 (file)
index 0000000..28501b5
--- /dev/null
@@ -0,0 +1,33 @@
+int __attribute__ ((noinline)) foo (short x, unsigned short y)
+{
+  return x * y;
+}
+
+int __attribute__ ((noinline)) bar (unsigned short x, short y)
+{
+  return x * y;
+}
+
+int main ()
+{
+  if (foo (-2, 0xffff) != -131070)
+    abort ();
+  if (foo (2, 0xffff) != 131070)
+    abort ();
+  if (foo (-32768, 0x8000) != -1073741824)
+    abort ();
+  if (foo (32767, 0x8000) != 1073709056)
+    abort ();
+
+  if (bar (0xffff, -2) != -131070)
+    abort ();
+  if (bar (0xffff, 2) != 131070)
+    abort ();
+  if (bar (0x8000, -32768) != -1073741824)
+    abort ();
+  if (bar (0x8000, 32767) != 1073709056)
+    abort ();
+
+  exit (0);
+}
+