From ca47c3987c09df50cd9504652e4a8f6f8656bf94 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 9 Sep 2019 12:31:02 +0200 Subject: [PATCH] re PR target/87853 (_mm_cmpgt_epi8 broken with -funsigned-char) PR target/87853 * config/i386/emmintrin.h (_mm_cmpeq_epi8): Use casts to __v16qi instead of __v16qs. * gcc.target/i386/pr87853.c: New test. From-SVN: r275508 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/emmintrin.h | 2 +- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/pr87853.c | 20 ++++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr87853.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc56822af4d..6c749d2cc3d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2019-09-09 Jakub Jelinek + PR target/87853 + * config/i386/emmintrin.h (_mm_cmpeq_epi8): Use casts to __v16qi + instead of __v16qs. + PR target/91704 * config/i386/avxintrin.h (__v32qs): New typedef. * config/i386/avx2intrin.h (_mm256_cmpgt_epi8): Use casts to __v32qs diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h index f9e7b33b0dd..1683d842c65 100644 --- a/gcc/config/i386/emmintrin.h +++ b/gcc/config/i386/emmintrin.h @@ -1308,7 +1308,7 @@ _mm_xor_si128 (__m128i __A, __m128i __B) extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_cmpeq_epi8 (__m128i __A, __m128i __B) { - return (__m128i) ((__v16qs)__A == (__v16qs)__B); + return (__m128i) ((__v16qi)__A == (__v16qi)__B); } extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d1c448a3a07..ec2872b97df 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-09-09 Jakub Jelinek + PR target/87853 + * gcc.target/i386/pr87853.c: New test. + PR target/91704 * gcc.target/i386/pr91704.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr87853.c b/gcc/testsuite/gcc.target/i386/pr87853.c new file mode 100644 index 00000000000..9a288879679 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr87853.c @@ -0,0 +1,20 @@ +/* PR target/87853 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -funsigned-char -msse2 -mno-sse3 -masm=att" } */ +/* { dg-final { scan-assembler-times "\tpcmpgtb\t%xmm" 2 } } */ +/* { dg-final { scan-assembler-not "\tpsubusb\t" } } */ +/* { dg-final { scan-assembler-not "\tpcmpeqb\t" } } */ + +#include + +__m128i +foo (__m128i x, __m128i y) +{ + return _mm_cmpgt_epi8 (x, y); +} + +__m128i +bar (__m128i x, __m128i y) +{ + return _mm_cmplt_epi8 (x, y); +} -- 2.30.2