]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: Fixes for tests including only <x86intrin.h>
authorPaul A. Clarke <pc@us.ibm.com>
Mon, 25 Oct 2021 20:18:33 +0000 (15:18 -0500)
committerPaul A. Clarke <pc@us.ibm.com>
Tue, 26 Oct 2021 17:02:44 +0000 (12:02 -0500)
Tests which only include <x86intrin.h> expect many other include files
to be brought in, but not enough are.

Try to increase compatibility with x86 headers by:
- Create new immintrin.h, including the analogous subset of intrinsics
  headers available for powerpc.
- Create new x86gprintrin.h, serving exclusively as the umbrella for
  bmiintrin.h and bmi2intrin.h.
- Modify x86intrin.h:
  - Include new immintrin.h.
  - Remove mmintrin.h, xmmintrin.h, emmintrin.h, now included indirectly
    from immintrin.h.
  - Remove bmiintrin.h, bmi2intrin.h, now included indirectly from
    x86gprintrin.h (which is now included from immintrin.h).

Add the new files to gcc/config.gcc.

Also, fix up the testcase that provoked PR102719, which requires
Power8 vector support.

Fixes commit 29fb1e831bf1c25e4574bf2f98a9f534e5c67665.

2021-10-25  Paul A. Clarke  <pc@us.ibm.com>

gcc
PR target/102719
* config/rs6000/x86intrin.h: Move some included headers to new
headers.  Include new immintrin.h instead of those headers.
* config/rs6000/immintrin.h: New.
* config/rs6000/x86gprintrin.h: New.
* config.gcc (powerpc*-*-*): Add new headers to extra_headers.

gcc/testsuite
* gcc.target/powerpc/pr78102.c: Fix dg directives to require Power8
vector support.  Also, add -DNO_WARN_X86_INTRINSICS.

gcc/config.gcc
gcc/config/rs6000/immintrin.h [new file with mode: 0644]
gcc/config/rs6000/x86gprintrin.h [new file with mode: 0644]
gcc/config/rs6000/x86intrin.h
gcc/testsuite/gcc.target/powerpc/pr78102.c

index fb1f06f3da89545d42bf523743b8ced1c355bf06..efd1f42ac234d9c73aaf952e229027c36beb4f2f 100644 (file)
@@ -490,7 +490,7 @@ powerpc*-*-*)
        extra_headers="${extra_headers} xmmintrin.h mm_malloc.h emmintrin.h"
        extra_headers="${extra_headers} mmintrin.h x86intrin.h"
        extra_headers="${extra_headers} pmmintrin.h tmmintrin.h smmintrin.h"
-       extra_headers="${extra_headers} nmmintrin.h"
+       extra_headers="${extra_headers} nmmintrin.h immintrin.h x86gprintrin.h"
        extra_headers="${extra_headers} ppu_intrinsics.h spu2vmx.h vec_types.h si2vmx.h"
        extra_headers="${extra_headers} amo.h"
        case x$with_cpu in
diff --git a/gcc/config/rs6000/immintrin.h b/gcc/config/rs6000/immintrin.h
new file mode 100644 (file)
index 0000000..647a5ae
--- /dev/null
@@ -0,0 +1,41 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _IMMINTRIN_H_INCLUDED
+#define _IMMINTRIN_H_INCLUDED
+
+#include <x86gprintrin.h>
+
+#include <mmintrin.h>
+
+#include <xmmintrin.h>
+
+#include <emmintrin.h>
+
+#include <pmmintrin.h>
+
+#include <tmmintrin.h>
+
+#include <smmintrin.h>
+
+#endif /* _IMMINTRIN_H_INCLUDED */
diff --git a/gcc/config/rs6000/x86gprintrin.h b/gcc/config/rs6000/x86gprintrin.h
new file mode 100644 (file)
index 0000000..57ef120
--- /dev/null
@@ -0,0 +1,31 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _X86GPRINTRIN_H_INCLUDED
+#define _X86GPRINTRIN_H_INCLUDED
+
+#include <bmiintrin.h>
+
+#include <bmi2intrin.h>
+
+#endif /* _X86GPRINTRIN_H_INCLUDED.  */
index 6ad2bfcb6dcd5490f677fa9e4352d9aa5ecb318f..e8aa922dcf036736232b27ee430a6572241014b1 100644 (file)
 #define _X86INTRIN_H_INCLUDED
 
 #ifdef __ALTIVEC__
-#include <mmintrin.h>
-
-#include <xmmintrin.h>
-
-#include <emmintrin.h>
+#include <immintrin.h>
 #endif /* __ALTIVEC__ */
 
-#include <bmiintrin.h>
-
-#include <bmi2intrin.h>
-
 #endif /* _X86INTRIN_H_INCLUDED */
index 434e677e1714cb6134b6ab348521276e4881cdd4..0b5091082754db083e2ec7a3a711eca19af42d13 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mvsx" } */
-/* { dg-require-effective-target vsx_hw } */
+/* { dg-options "-O2 -mdejagnu-cpu=power8 -DNO_WARN_X86_INTRINSICS" } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
 #include <x86intrin.h>