diff gcc/testsuite/g++.dg/other/sse2-pr85572-2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/g++.dg/other/sse2-pr85572-2.C	Thu Oct 25 07:37:49 2018 +0900
@@ -0,0 +1,45 @@
+// PR target/85572
+// { dg-do run { target i?86-*-* x86_64-*-* } }
+// { dg-options "-O2 -msse2" }
+// { dg-require-effective-target sse2_runtime }
+
+typedef long long V __attribute__((vector_size (16)));
+typedef long long W __attribute__((vector_size (32)));
+
+__attribute__((noipa)) V
+foo (V x)
+{
+  return x < 0 ? -x : x;
+}
+
+__attribute__((noipa)) void
+bar (W *x, W *y)
+{
+  *y = *x < 0 ? -*x : *x;
+}
+
+int
+main ()
+{
+  V a = { 11LL, -15LL };
+  V b = foo (a);
+  if (b[0] != 11LL || b[1] != 15LL)
+    __builtin_abort ();
+  V c = { -123456789123456LL, 654321654321654LL };
+  V d = foo (c);
+  if (d[0] != 123456789123456LL || d[1] != 654321654321654LL)
+    __builtin_abort ();
+  V e = { 0, 1 };
+  V f = foo (e);
+  if (f[0] != 0 || f[1] != 1)
+    __builtin_abort ();
+  W g = { 17LL, -32LL, -123456789123456LL, 654321654321654LL }, h;
+  bar (&g, &h);
+  if (h[0] != 17LL || h[1] != 32LL
+      || h[2] != 123456789123456LL || h[3] != 654321654321654LL)
+    __builtin_abort ();
+  W i = { 0, 1, -1, 0 }, j;
+  bar (&i, &j);
+  if (j[0] != 0 || j[1] != 1 || j[2] != 1 || j[3] != 0)
+    __builtin_abort ();
+}