i386: Fix some -O0 avx2intrin.h and xopintrin.h intrinsic macros [PR94046]
authorJakub Jelinek <jakub@redhat.com>
Thu, 5 Mar 2020 18:44:42 +0000 (19:44 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 5 Mar 2020 18:44:42 +0000 (19:44 +0100)
commit3a0e583bf17240e55fee7b490e13753cca52bfe1
tree43d445803ae3e1590a9cd9d45774e207d73a72ae
parent2d22ab64c4774d7d30c7e014652b28a13d744aec
i386: Fix some -O0 avx2intrin.h and xopintrin.h intrinsic macros [PR94046]

As the testcases show, the macros we have for -O0 for intrinsics that require
constant argument(s) should first cast the argument to the type the -O1+
inline uses and afterwards to whatever type e.g. a builtin needs.
The PR reported one which violated this, and I've grepped for all double-casts
and grepped out from that meaningful casts where the __m{128,256,512}{,d,i}
first cast is cast to same sized __v* type and has the same kind of element
type (float, double, integral).  These 7 macros were using different casts,
and I've double checked them against the inline function types.

2020-03-05  Jakub Jelinek  <jakub@redhat.com>

PR target/94046
* config/i386/avx2intrin.h (_mm_mask_i32gather_ps): Fix first cast of
SRC and MASK arguments to __m128 from __m128d.
(_mm256_mask_i32gather_ps): Fix first cast of MASK argument to __m256
from __m256d.
(_mm_mask_i64gather_ps): Fix first cast of MASK argument to __m128
from __m128d.
* config/i386/xopintrin.h (_mm_permute2_pd): Fix first cast of C
argument to __m128i from __m128d.
(_mm256_permute2_pd): Fix first cast of C argument to __m256i from
__m256d.
(_mm_permute2_ps): Fix first cast of C argument to __m128i from __m128.
(_mm256_permute2_ps): Fix first cast of C argument to __m256i from
__m256.

* g++.target/i386/pr94046-1.C: New test.
* g++.target/i386/pr94046-2.C: New test.
gcc/ChangeLog
gcc/config/i386/avx2intrin.h
gcc/config/i386/xopintrin.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.target/i386/pr94046-1.C [new file with mode: 0644]
gcc/testsuite/g++.target/i386/pr94046-2.C [new file with mode: 0644]