From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2078) id EAC753857828; Mon, 7 Jun 2021 04:38:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAC753857828 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: hongtao Liu To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-8517] Fix ICE of insn does not satisfy its constraints. X-Act-Checkin: gcc X-Git-Author: liuhongt X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 505fb2363bd6c7bceaf85ccb1cf1d0b28c6457fc X-Git-Newrev: c064e787b10069e3de56bd3d0d1a34a1a09086ea Message-Id: <20210607043804.EAC753857828@sourceware.org> Date: Mon, 7 Jun 2021 04:38:04 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2021 04:38:05 -0000 https://gcc.gnu.org/g:c064e787b10069e3de56bd3d0d1a34a1a09086ea commit r11-8517-gc064e787b10069e3de56bd3d0d1a34a1a09086ea Author: liuhongt Date: Thu Jun 3 16:38:32 2021 +0800 Fix ICE of insn does not satisfy its constraints. evex encoding vpmovzxbx needs both AVX512BW and AVX512VL which means constraint "Yw" should be used instead of constraint "v". gcc/ChangeLog: PR target/100885 * config/i386/sse.md (*sse4_1_zero_extendv8qiv8hi2_3): Refine constraints. (v4siv4di2): Delete constraints for define_expand. gcc/testsuite/ChangeLog: PR target/100885 * g++.target/i386/pr100885.C: New test. Diff: --- gcc/config/i386/sse.md | 8 +- gcc/testsuite/g++.target/i386/pr100885.C | 144 +++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 4 deletions(-) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 2b159224e76..3f81abc7804 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -17974,10 +17974,10 @@ "operands[1] = adjust_address_nv (operands[1], V8QImode, 0);") (define_insn_and_split "*sse4_1_zero_extendv8qiv8hi2_3" - [(set (match_operand:V16QI 0 "register_operand" "=Yr,*x,v") + [(set (match_operand:V16QI 0 "register_operand" "=Yr,*x,Yw") (vec_select:V16QI (vec_concat:V32QI - (match_operand:V16QI 1 "vector_operand" "YrBm,*xBm,vm") + (match_operand:V16QI 1 "vector_operand" "YrBm,*xBm,Ywm") (match_operand:V16QI 2 "const0_operand" "C,C,C")) (match_parallel 3 "pmovzx_parallel" [(match_operand 4 "const_int_operand" "n,n,n")])))] @@ -18662,9 +18662,9 @@ }) (define_expand "v4siv4di2" - [(set (match_operand:V4DI 0 "register_operand" "=v") + [(set (match_operand:V4DI 0 "register_operand") (any_extend:V4DI - (match_operand:V4SI 1 "nonimmediate_operand" "vm")))] + (match_operand:V4SI 1 "nonimmediate_operand")))] "TARGET_AVX2") (define_insn "sse4_1_v2siv2di2" diff --git a/gcc/testsuite/g++.target/i386/pr100885.C b/gcc/testsuite/g++.target/i386/pr100885.C new file mode 100644 index 00000000000..08a5bdd02a2 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr100885.C @@ -0,0 +1,144 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-mavx512vl -mno-avx512bw -O2 -Wno-int-to-pointer-cast -std=c++14" } */ + +#include +typedef unsigned char byte; +enum ZoomLevel { ZOOM_LVL_COUNT }; +struct Colour { + unsigned data; + Colour(int data) : data(data) {} +}; +struct Palette { + Colour palette[6]; +}; +enum BlitterMode { BM_COLOUR_REMAP }; +class Blitter { +public: + struct BlitterParams { + int width; + int height; + int left; + int top; + void *dst; + }; + virtual void Draw(); +}; +class Blitter_32bppAnim : public Blitter { +protected: + unsigned short anim_buf; + Palette palette; + int LookupColourInPalette_index; + Colour LookupColourInPalette() { + return palette.palette[LookupColourInPalette_index]; + } +}; +__m128i _mm_set_epi64(__m64 __q0) { + __m128i __trans_tmp_5{(long)__q0}; + return __trans_tmp_5; +} +long _mm_storel_epi64___P, Draw_dsts; +__m128i _mm_packus_epi16___B, _mm_subs_epu16___B, _mm_hadd_epi16___Y, + Draw_srcABCD, Draw___trans_tmp_10, Draw___trans_tmp_29, Draw___trans_tmp_7, + AlphaBlendTwoPixels___trans_tmp_12, AlphaBlendTwoPixels___trans_tmp_11, + AdjustBrightnessOfTwoPixels_from; +int _mm_srli_epi16___B; +class Blitter_32bppSSE_Base { +public: + enum ReadMode { RM_WITH_MARGIN }; + enum BlockType { BT_NONE }; + struct SpriteData { + int infos[ZOOM_LVL_COUNT]; + byte data; + }; +}; +byte *Draw_remap; +short Draw_si_0; +class Blitter_32bppSSE4_Anim : Blitter_32bppAnim, Blitter_32bppSSE_Base { + template + void Draw(const BlitterParams *, ZoomLevel); + void Draw(); +}; +__m128i AdjustBrightnessOfTwoPixels() { + __m128i __trans_tmp_28, __trans_tmp_27, __trans_tmp_26, __trans_tmp_24, + __trans_tmp_23, __trans_tmp_22, __trans_tmp_21, __trans_tmp_20, + __trans_tmp_19, __trans_tmp_18, __trans_tmp_17, __trans_tmp_16, + __trans_tmp_14 = _mm_srli_epi16(AdjustBrightnessOfTwoPixels_from, + _mm_srli_epi16___B), + __trans_tmp_7; + char __trans_tmp_8; + __trans_tmp_7 = __m128i{__trans_tmp_8}; + { + __m128i __trans_tmp_7; + char __trans_tmp_8; + __trans_tmp_7 = __m128i{__trans_tmp_8}; + __trans_tmp_26 = __trans_tmp_7; + } + __trans_tmp_16 = (__v8hi)__trans_tmp_14 > (__v8hi)__trans_tmp_26; + __trans_tmp_17 = _mm_hadd_epi16(__trans_tmp_16, _mm_hadd_epi16___Y); + __trans_tmp_18 = _mm_hadd_epi16(__trans_tmp_17, _mm_hadd_epi16___Y); + __trans_tmp_19 = _mm_srli_epi16(__trans_tmp_18, _mm_srli_epi16___B); + { + __m128i __trans_tmp_7; + char __trans_tmp_8; + __trans_tmp_7 = __m128i{__trans_tmp_8}; + __trans_tmp_27 = __trans_tmp_7; + } + __trans_tmp_20 = _mm_shuffle_epi8(__trans_tmp_19, + __trans_tmp_27); + { + __m128i __trans_tmp_7; + char __trans_tmp_8; + __trans_tmp_7 = __m128i{__trans_tmp_8}; + __trans_tmp_28 = __trans_tmp_7; + } + __trans_tmp_21 = _mm_subs_epu16(__trans_tmp_28, _mm_subs_epu16___B); + __trans_tmp_22 = __m128i((__v8hu)__trans_tmp_21 * (__v8hu)__trans_tmp_20); + __trans_tmp_23 = __m128i((__v8hu)__trans_tmp_22 + (__v8hu)__trans_tmp_7); + __trans_tmp_24 = _mm_packus_epi16(__trans_tmp_23, _mm_packus_epi16___B); + return __trans_tmp_24; +} +template +void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom) { + __m128i __trans_tmp_30; + Colour *dst_line = (Colour *)bp->dst + bp->left; + unsigned short *anim_line = &anim_buf + bp->top; + int effective_width; + SpriteData *sd = (SpriteData *)bp; + Colour *src_rgba_line = (Colour *)sd->data; + Draw___trans_tmp_29 = Draw___trans_tmp_7; + for (int y = bp->height; y; y--) { + Colour *dst = dst_line; + unsigned short *anim = anim_line; + anim += src_rgba_line[0].data; + dst += src_rgba_line[0].data; + int width_diff = Draw_si_0 - bp->width; + effective_width = width_diff ?: effective_width; + for (int x = effective_width; x; x--) { + int mvX2 = *(unsigned *)sd->infos[zoom], m = byte(mvX2); + __trans_tmp_30 = _mm_set_epi64(*(__m64_u *)dst); + Colour c0 = Draw_dsts, srcm(0), cmap = LookupColourInPalette().data & 40; + c0 = Draw_remap[m] ?: cmap; + c0 = m ? c0 : srcm; + Draw___trans_tmp_10 = __v2di{c0.data}; + if (mvX2) + Draw_srcABCD = AdjustBrightnessOfTwoPixels(); + if (src_rgba_line) + anim[1] = 0; + __m128i tmp; + __m128i dstAB = _mm_unpacklo_epi8(__trans_tmp_30, tmp); + AlphaBlendTwoPixels___trans_tmp_12 = + __m128i((__v8hu)Draw_srcABCD + (__v8hu)dstAB); + AlphaBlendTwoPixels___trans_tmp_11 = _mm_shuffle_epi8 (AlphaBlendTwoPixels___trans_tmp_12, + Draw___trans_tmp_7); + *(__m64_u *)_mm_storel_epi64___P = + (__m64)AlphaBlendTwoPixels___trans_tmp_11[0]; + } + } +} +Blitter::BlitterParams Draw_bp; +ZoomLevel Draw_zoom; +void Blitter_32bppSSE4_Anim::Draw() { + Draw(&Draw_bp, + Draw_zoom); +}