From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by sourceware.org (Postfix) with ESMTPS id E9B293857821 for ; Wed, 23 Jun 2021 07:21:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E9B293857821 Received: by mail-vs1-xe35.google.com with SMTP id l26so910481vsm.9 for ; Wed, 23 Jun 2021 00:21:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=+Ym9ctcytFyD9zyr/PDRpvZ5AaAVzPDZk0DHOANASxk=; b=qrQknz/RpPWIIPZb5skbn3QwzB+VMe8yLAtERtcj94///9i4p7PYoGCsh/FfDbI6ks Yhzdenw5wAwSJThu/goQfXy8c6tqpeRyry7jC6mjYtWNp2ZYVZMe3K7jIDdIAo/k0NTE Pwq9JNQc+l45FmbQW03PY/ANzutYlrWH+7rccypqEZdKnmB92R3MMpzLX+WNq2bktZqn Cn6nFSEXdw5cTtI9T7mnnepshNSXy9iGBU1p62mVPU1Br6wyFPTRteDNhX4s7KIBeQ3C YGUamcrcNHkl3tGJKrKviPadalrXiLOYosBuqSBBkvcx5pUtpR4ET7xZ1hmaUhZGUSGM Aceg== X-Gm-Message-State: AOAM530A7dktXdQ0ppTRYJmKrt3ejEorVnQhqL5vFuUxy/xkWCJ/hbh8 SVAGu8jLXPShYez5pe8WucQCPukjsw1bgIRcPogFhpvrVNE= X-Google-Smtp-Source: ABdhPJyEF3MXY5tEjpIAt9NSLWui60A1GLLOaYLak34g70oHZFo8DY5bc4feRLI/2LmbTKZIr6suYR+4eYJlE3qvg2s= X-Received: by 2002:a67:fc46:: with SMTP id p6mr27327519vsq.48.1624432864438; Wed, 23 Jun 2021 00:21:04 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Hongtao Liu Date: Wed, 23 Jun 2021 15:25:52 +0800 Message-ID: Subject: Re: [PATCH] [i386] Support avx512 vector shift with vector [PR98434] To: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jun 2021 07:21:06 -0000 On Wed, Jun 23, 2021 at 3:23 PM Hongtao Liu wrote: > > Here's the patch I'm going to check in. > > The patch will regress pr91838.C with extra options: -march=cascadelake > > using T = unsigned char; // or ushort, or uint > using V [[gnu::vector_size(8)]] = T; > V f(V x) { return x >> 8 * sizeof(T); } > > Basically, the testcase is UB with logic right shift more than 8 bits > for unsigned char, but however w/o lashr_optab, vector operation will typo, vlshr_optab, it's vector shift with vector, so as below. > be lowered to scalar and be optimized by pass_ccp4 in gimple. > But w/ lashr_optab, it's not optimized and left to the backend, in the > backend we don't optimize such UB(just like what we did in > ix86_expand_vec_shift_qihi_constant). > So I guess maybe gimple should handle such situations to avoid > "nonoptimal codegen". > > On Mon, May 24, 2021 at 5:49 PM Hongtao Liu wrote: > > > > Hi: > > This patch is about to add expanders for vashl, > > vlshr, > > vashr and vashr. > > > > Besides there's some assumption in expand_mult_const that mul and > > add must be available at the same time, but for i386, addv8qi is > > restricted under TARGET_64BIT, but mulv8qi not, that could cause ICE. > > So restrict mulv8qi and shiftv8qi under TARGET_64BIT. > > Bootstrap and regtested on x86_64-linux-gnu{-m32,} and > > x86_64-linux-gnu{-m32\ -march=cascadelake,-march=cascadelake} > > > > gcc/ChangeLog: > > > > PR target/98434 > > * config/i386/i386-expand.c (ix86_expand_vec_interleave): > > Adjust comments for ix86_expand_vecop_qihi2. > > (ix86_expand_vecmul_qihi): Renamed to .. > > (ix86_expand_vecop_qihi2): Adjust function prototype to > > support shift operation, add static to definition. > > (ix86_expand_vec_shift_qihi_constant): Add static to definition. > > (ix86_expand_vecop_qihi): Call ix86_expand_vecop_qihi2 and > > ix86_expand_vec_shift_qihi_constant. > > * config/i386/i386-protos.h (ix86_expand_vecmul_qihi): Deleted. > > (ix86_expand_vec_shift_qihi_constant): Deleted. > > * config/i386/sse.md (mulv8qi3): Call ix86_expand_vecop_qihi > > directly, add condition TARGET_64BIT. > > (mul3): Ditto. > > (3): Ditto. > > (vlshr3): Extend to support avx512 vlshr. > > (v3): New expander for > > vashr/vlshr/vashl. > > (vv8qi3): Ditto. > > (vashrv8hi3): Renamed to .. > > (vashr3): And extend to support V16QImode for avx512. > > (vashrv16qi3): Deleted. > > (vashrv2di3): Extend expander to support avx512 > > instruction. > > > > gcc/testsuite/ChangeLog: > > > > PR target/98434 > > * gcc.target/i386/pr98434-1.c: New test. > > * gcc.target/i386/pr98434-2.c: New test. > > * gcc.target/i386/avx512vl-pr95488-1.c: Adjust testcase. > > > > -- > BR, > Hongtao -- BR, Hongtao