]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/90991 (_mm_loadu_ps instrinsic translates to vmovaps in combin...
authorJakub Jelinek <jakub@redhat.com>
Fri, 28 Jun 2019 22:56:27 +0000 (00:56 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 28 Jun 2019 22:56:27 +0000 (00:56 +0200)
Backported from mainline
2019-06-26  Jakub Jelinek  <jakub@redhat.com>

PR target/90991
* config/i386/sse.md
(*<extract_type>_vinsert<shuffletype><extract_suf>_0): Use vmovupd,
vmovups, vmovdqu, vmovdqu32 or vmovdqu64 instead of the aligned
insns if operands[2] is misaligned_operand.

* gcc.target/i386/avx512dq-pr90991-1.c: New test.

From-SVN: r272803

gcc/ChangeLog
gcc/config/i386/sse.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx512dq-pr90991-1.c [new file with mode: 0644]

index 31803992367a89bc3142a653d5bb9876ccc5fe58..c5a7c2eb316fd21eaf20e3554101316fa54abad7 100644 (file)
@@ -1,6 +1,14 @@
 2019-06-29  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-06-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/90991
+       * config/i386/sse.md
+       (*<extract_type>_vinsert<shuffletype><extract_suf>_0): Use vmovupd,
+       vmovups, vmovdqu, vmovdqu32 or vmovdqu64 instead of the aligned
+       insns if operands[2] is misaligned_operand.
+
        2019-06-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/90760
index 6b8298d957ed8967f08eecc1f6c097fdcd6886bb..9b57ffd375195494df68665575329c61eb7bbbd5 100644 (file)
   switch (<MODE>mode)
     {
     case E_V8DFmode:
-      return "vmovapd\t{%2, %x0|%x0, %2}";
+      if (misaligned_operand (operands[2], <ssequartermode>mode))
+       return "vmovupd\t{%2, %x0|%x0, %2}";
+      else
+       return "vmovapd\t{%2, %x0|%x0, %2}";
     case E_V16SFmode:
-      return "vmovaps\t{%2, %x0|%x0, %2}";
+      if (misaligned_operand (operands[2], <ssequartermode>mode))
+       return "vmovups\t{%2, %x0|%x0, %2}";
+      else
+       return "vmovaps\t{%2, %x0|%x0, %2}";
     case E_V8DImode:
-      return which_alternative == 2 ? "vmovdqa64\t{%2, %x0|%x0, %2}"
-                                   : "vmovdqa\t{%2, %x0|%x0, %2}";
+      if (misaligned_operand (operands[2], <ssequartermode>mode))
+       return which_alternative == 2 ? "vmovdqu64\t{%2, %x0|%x0, %2}"
+                                     : "vmovdqu\t{%2, %x0|%x0, %2}";
+      else
+       return which_alternative == 2 ? "vmovdqa64\t{%2, %x0|%x0, %2}"
+                                     : "vmovdqa\t{%2, %x0|%x0, %2}";
     case E_V16SImode:
-      return which_alternative == 2 ? "vmovdqa32\t{%2, %x0|%x0, %2}"
-                                   : "vmovdqa\t{%2, %x0|%x0, %2}";
+      if (misaligned_operand (operands[2], <ssequartermode>mode))
+       return which_alternative == 2 ? "vmovdqu32\t{%2, %x0|%x0, %2}"
+                                     : "vmovdqu\t{%2, %x0|%x0, %2}";
+      else
+       return which_alternative == 2 ? "vmovdqa32\t{%2, %x0|%x0, %2}"
+                                     : "vmovdqa\t{%2, %x0|%x0, %2}";
     default:
       gcc_unreachable ();
     }
index 87934016cb0305652231c683532016991010a48e..b65008ba889e20f0f522189805b9eb035eb7ee32 100644 (file)
@@ -1,6 +1,11 @@
 2019-06-29  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-06-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/90991
+       * gcc.target/i386/avx512dq-pr90991-1.c: New test.
+
        2019-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/90954
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-pr90991-1.c b/gcc/testsuite/gcc.target/i386/avx512dq-pr90991-1.c
new file mode 100644 (file)
index 0000000..6c96812
--- /dev/null
@@ -0,0 +1,47 @@
+/* PR target/90991 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512dq -masm=att" } */
+/* { dg-final { scan-assembler-times "vmovaps\[ \t]\+\\(\[^\n\r]*\\), %xmm0" 1 } } */
+/* { dg-final { scan-assembler-times "vmovapd\[ \t]\+\\(\[^\n\r]*\\), %xmm0" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ \t]\+\\(\[^\n\r]*\\), %xmm0" 1 } } */
+/* { dg-final { scan-assembler-times "vmovups\[ \t]\+\\(\[^\n\r]*\\), %xmm0" 1 } } */
+/* { dg-final { scan-assembler-times "vmovupd\[ \t]\+\\(\[^\n\r]*\\), %xmm0" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \t]\+\\(\[^\n\r]*\\), %xmm0" 1 } } */
+
+#include <x86intrin.h>
+
+__m512
+f1 (void *a)
+{
+  return _mm512_insertf32x4 (_mm512_set1_ps (0.0f), _mm_load_ps (a), 0);
+}
+
+__m512d
+f2 (void *a)
+{
+  return _mm512_insertf64x2 (_mm512_set1_pd (0.0), _mm_load_pd (a), 0);
+}
+
+__m512i
+f3 (void *a)
+{
+  return _mm512_inserti32x4 (_mm512_set1_epi32 (0), _mm_load_si128 (a), 0);
+}
+
+__m512
+f4 (void *a)
+{
+  return _mm512_insertf32x4 (_mm512_set1_ps (0.0f), _mm_loadu_ps (a), 0);
+}
+
+__m512d
+f5 (void *a)
+{
+  return _mm512_insertf64x2 (_mm512_set1_pd (0.0), _mm_loadu_pd (a), 0);
+}
+
+__m512i
+f6 (void *a)
+{
+  return _mm512_inserti32x4 (_mm512_set1_epi32 (0), _mm_loadu_si128 (a), 0);
+}