public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: hongtao Liu <liuhongt@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-8517] Fix ICE of insn does not satisfy its constraints. Date: Mon, 7 Jun 2021 04:38:04 +0000 (GMT) [thread overview] Message-ID: <20210607043804.EAC753857828@sourceware.org> (raw) https://gcc.gnu.org/g:c064e787b10069e3de56bd3d0d1a34a1a09086ea commit r11-8517-gc064e787b10069e3de56bd3d0d1a34a1a09086ea Author: liuhongt <hongtao.liu@intel.com> 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. (<insn>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 "<insn>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_<code>v2siv2di2<mask_name>" 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<x86intrin.h> +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 <BlitterMode, ReadMode, BlockType, bool, bool> + 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 <BlitterMode, Blitter_32bppSSE_Base::ReadMode, + Blitter_32bppSSE_Base::BlockType, bool, bool> +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<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true, false>(&Draw_bp, + Draw_zoom); +}
reply other threads:[~2021-06-07 4:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210607043804.EAC753857828@sourceware.org \ --to=liuhongt@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).