[AArch64] PR target/69613: Return zero TARGET_SHIFT_TRUNCATION_MASK when SHIFT_COUNT_...
authorktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Feb 2016 15:59:45 +0000 (15:59 +0000)
committerktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Feb 2016 15:59:45 +0000 (15:59 +0000)
PR target/69613
* config/aarch64/aarch64.c (aarch64_shift_truncation_mask):
Return 0 if !SHIFT_COUNT_TRUNCATED.

* gcc.dg/torture/pr69613.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233744 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr69613.c [new file with mode: 0644]

index 520275a..916c381 100644 (file)
@@ -1,3 +1,9 @@
+2016-02-26  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       PR target/69613
+       * config/aarch64/aarch64.c (aarch64_shift_truncation_mask):
+       Return 0 if !SHIFT_COUNT_TRUNCATED.
+
 2016-02-26  Jakub Jelinek  <jakub@redhat.com>
            Eric Botcazou  <ebotcazou@adacore.com>
 
index 6dc8330..30d6f41 100644 (file)
@@ -11154,7 +11154,8 @@ static unsigned HOST_WIDE_INT
 aarch64_shift_truncation_mask (machine_mode mode)
 {
   return
-    (aarch64_vector_mode_supported_p (mode)
+    (!SHIFT_COUNT_TRUNCATED
+     || aarch64_vector_mode_supported_p (mode)
      || aarch64_vect_struct_mode_p (mode)) ? 0 : (GET_MODE_BITSIZE (mode) - 1);
 }
 
index c03759f..d5b890d 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-26  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       PR target/69613
+       * gcc.dg/torture/pr69613.c: New test.
+
 2016-02-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/69891
diff --git a/gcc/testsuite/gcc.dg/torture/pr69613.c b/gcc/testsuite/gcc.dg/torture/pr69613.c
new file mode 100644 (file)
index 0000000..44f2b0c
--- /dev/null
@@ -0,0 +1,40 @@
+/* PR target/69613.  */
+/* { dg-do run { target int128 } } */
+/* { dg-additional-options "-mavx" { target { i?86-*-* x86_64-*-* } } } */
+
+typedef unsigned short u16;
+typedef unsigned short v32u16 __attribute__ ((vector_size (32)));
+typedef unsigned int u32;
+typedef unsigned int v32u32 __attribute__ ((vector_size (32)));
+typedef unsigned long long u64;
+typedef unsigned long long v32u64 __attribute__ ((vector_size (32)));
+typedef unsigned __int128 u128;
+typedef unsigned __int128 v32u128 __attribute__ ((vector_size (32)));
+
+u128 __attribute__ ((noinline, noclone))
+foo (u32 u32_0, u64 u64_1, u128 u128_1, v32u16 v32u16_0, v32u128 v32u128_0,
+     v32u16 v32u16_1, v32u32 v32u32_1, v32u64 v32u64_1, v32u128 v32u128_1)
+{
+  u128 temp = (v32u128_1[0] << ((-u32_0) & 127));
+  u32 t2 = (u32_0 & 127);
+  v32u128_1[0] = (v32u128_1[0] >> t2);
+
+  v32u128_1[0] ^= temp;
+  v32u128_1 |= (v32u128){ v32u128_0[1] };
+
+  return u64_1 + u128_1 + v32u16_0[0] + v32u16_0[1] + v32u16_1[11]
+        + v32u16_1[12] + v32u16_1[13] + v32u32_1[0] + v32u32_1[1]
+        + v32u32_1[2] + v32u64_1[1] + v32u64_1[2] + v32u64_1[3] + v32u128_1[0]
+        + v32u128_1[1];
+}
+
+int
+main ()
+{
+  u128 x
+      = foo (1, 1, 1, (v32u16){ 1, 1, 1 }, (v32u128){ 1 }, (v32u16){ 1, 1, 1 },
+            (v32u32){ 1 }, (v32u64){ 1, 1, 1 }, (v32u128){ -1 });
+  if (x != 6)
+    __builtin_abort ();
+  return 0;
+}