From 8ab30b9778a46cbf0a0853c78cd799b9afca61c5 Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Tue, 3 Apr 2018 19:06:28 +0000 Subject: [PATCH] emmintrin.h (_mm_cvtpd_epi32): Use __vector rather than vector. [gcc] 2018-04-03 Bill Schmidt * config/rs6000/emmintrin.h (_mm_cvtpd_epi32): Use __vector rather than vector. (_mm_cvtpd_ps): Likewise. (_mm_cvttpd_epi32): Likewise. * config/rs6000/mmintrin.h (_mm_unpacklo_pi8): Likewise. * config/rs6000/xmmintrin.h: For strict-ANSI C++ or C11, undefine vector, pixel, and bool following altivec.h include. [gcc/testsuite] 2018-04-03 Bill Schmidt * gcc.target/powerpc/powerpc.exp: Add .C suffix for main loop. * gcc.target/powerpc/undef-bool-1.C: New file. * gcc.target/powerpc/undef-bool-2.c: New file. From-SVN: r259050 --- gcc/ChangeLog | 10 ++++++++++ gcc/config/rs6000/emmintrin.h | 6 +++--- gcc/config/rs6000/mmintrin.h | 2 +- gcc/config/rs6000/xmmintrin.h | 12 ++++++++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.target/powerpc/powerpc.exp | 2 +- gcc/testsuite/gcc.target/powerpc/undef-bool-1.C | 13 +++++++++++++ gcc/testsuite/gcc.target/powerpc/undef-bool-2.c | 15 +++++++++++++++ 8 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/undef-bool-1.C create mode 100644 gcc/testsuite/gcc.target/powerpc/undef-bool-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 82f61551f8f..fea1bed40d1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-04-03 Bill Schmidt + + * config/rs6000/emmintrin.h (_mm_cvtpd_epi32): Use __vector rather + than vector. + (_mm_cvtpd_ps): Likewise. + (_mm_cvttpd_epi32): Likewise. + * config/rs6000/mmintrin.h (_mm_unpacklo_pi8): Likewise. + * config/rs6000/xmmintrin.h: For strict-ANSI C++ or C11, undefine + vector, pixel, and bool following altivec.h include. + 2018-04-03 Martin Sebor * doc/extend.texi (Common Function Attributes): Clarify. diff --git a/gcc/config/rs6000/emmintrin.h b/gcc/config/rs6000/emmintrin.h index 3dcda0d37b1..8d4545136e1 100644 --- a/gcc/config/rs6000/emmintrin.h +++ b/gcc/config/rs6000/emmintrin.h @@ -885,7 +885,7 @@ _mm_cvtpd_epi32 (__m128d __A) #ifdef _ARCH_PWR8 temp = vec_mergeo (temp, temp); - result = (__v4si)vec_vpkudum ((vector long)temp, (vector long)vzero); + result = (__v4si)vec_vpkudum ((__vector long)temp, (__vector long)vzero); #else { const __v16qu pkperm = {0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0a, 0x0b, @@ -919,7 +919,7 @@ _mm_cvtpd_ps (__m128d __A) #ifdef _ARCH_PWR8 temp = vec_mergeo (temp, temp); - result = (__v4sf)vec_vpkudum ((vector long)temp, (vector long)vzero); + result = (__v4sf)vec_vpkudum ((__vector long)temp, (__vector long)vzero); #else { const __v16qu pkperm = {0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0a, 0x0b, @@ -947,7 +947,7 @@ _mm_cvttpd_epi32 (__m128d __A) #ifdef _ARCH_PWR8 temp = vec_mergeo (temp, temp); - result = (__v4si)vec_vpkudum ((vector long)temp, (vector long)vzero); + result = (__v4si)vec_vpkudum ((__vector long)temp, (__vector long)vzero); #else { const __v16qu pkperm = {0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0a, 0x0b, diff --git a/gcc/config/rs6000/mmintrin.h b/gcc/config/rs6000/mmintrin.h index 6ae0e0007fe..b15dd9bf242 100644 --- a/gcc/config/rs6000/mmintrin.h +++ b/gcc/config/rs6000/mmintrin.h @@ -317,7 +317,7 @@ _mm_unpacklo_pi8 (__m64 __m1, __m64 __m2) a = (__vector unsigned char)vec_splats (__m1); b = (__vector unsigned char)vec_splats (__m2); c = vec_mergel (a, b); - return (__builtin_unpack_vector_int128 ((vector __int128_t)c, 1)); + return (__builtin_unpack_vector_int128 ((__vector __int128_t)c, 1)); #else __m64_union m1, m2, res; diff --git a/gcc/config/rs6000/xmmintrin.h b/gcc/config/rs6000/xmmintrin.h index aa2823f5f48..43d03ea0591 100644 --- a/gcc/config/rs6000/xmmintrin.h +++ b/gcc/config/rs6000/xmmintrin.h @@ -58,6 +58,18 @@ #define _XMMINTRIN_H_INCLUDED #include + +/* Avoid collisions between altivec.h and strict adherence to C++ and + C11 standards. This should eventually be done inside altivec.h itself, + but only after testing a full distro build. */ +#if defined(__STRICT_ANSI__) && (defined(__cplusplus) || \ + (defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 201112L)) +#undef vector +#undef pixel +#undef bool +#endif + #include /* We need type definitions from the MMX header file. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 220fd8f3e8d..4bd6d261d65 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-04-03 Bill Schmidt + + * gcc.target/powerpc/powerpc.exp: Add .C suffix for main loop. + * gcc.target/powerpc/undef-bool-1.C: New file. + * gcc.target/powerpc/undef-bool-2.c: New file. + 2018-04-03 Paolo Carlini PR c++/84768 diff --git a/gcc/testsuite/gcc.target/powerpc/powerpc.exp b/gcc/testsuite/gcc.target/powerpc/powerpc.exp index fdb3e931d71..498315c90a1 100644 --- a/gcc/testsuite/gcc.target/powerpc/powerpc.exp +++ b/gcc/testsuite/gcc.target/powerpc/powerpc.exp @@ -35,7 +35,7 @@ if ![info exists DEFAULT_CFLAGS] then { dg-init # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ "" $DEFAULT_CFLAGS set SAVRES_TEST_OPTS [list -Os -O2 {-Os -mno-multiple} {-O2 -mno-multiple}] diff --git a/gcc/testsuite/gcc.target/powerpc/undef-bool-1.C b/gcc/testsuite/gcc.target/powerpc/undef-bool-1.C new file mode 100644 index 00000000000..5bdd6a31e64 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/undef-bool-1.C @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -std=c++11 -DNO_WARN_X86_INTRINSICS" } */ + +/* Test to ensure that "bool" gets undef'd in xmmintrin.h when + we require strict ANSI. */ + +#include + +bool foo (int x) +{ + return x == 2; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/undef-bool-2.c b/gcc/testsuite/gcc.target/powerpc/undef-bool-2.c new file mode 100644 index 00000000000..3cab936f89f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/undef-bool-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -std=c11 -DNO_WARN_X86_INTRINSICS" } */ + +/* Test to ensure that "bool" gets undef'd in xmmintrin.h when + we require strict ANSI. Subsequent use of bool needs stdbool.h. + altivec.h should eventually avoid defining bool, vector, and + pixel, following distro testing. */ + +#include + +bool foo (int x) /* { dg-error "unknown type name 'bool'; did you mean '_Bool'?" } */ +{ + return x == 2; +} + -- 2.30.2