From patchwork Mon Jul 31 07:13:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 128372 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp1845275vqg; Mon, 31 Jul 2023 00:13:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlEI6aN0gqbg2hMy6Dry3dwsKas1dz3Hid9x0TbE6ymTKOeEPU3pIMKLSzii0FZcEjHjXF0c X-Received: by 2002:a05:6512:401e:b0:4fd:d7c7:170c with SMTP id br30-20020a056512401e00b004fdd7c7170cmr5510405lfb.23.1690787619016; Mon, 31 Jul 2023 00:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690787618; cv=none; d=google.com; s=arc-20160816; b=ukuACq23sxbBo9HAXk4fjvJOt12LeUIORQPjrDjO2LViZv80axvEJ91TEULG1c6XHn B1S7b5eZ2SqhQEiXP/UAoXpDwaQ8WfBykdKMtZXCtBA54Y+bAMJb2C4MhciTOlbSop/b nefXEQVK9rvWlwM+aQAC0VcXkW9jCjy3fLqvsbcF6Wh1gLmGZ+uKYNA8dvErYxOsti7W /JvctjYX0Qh3v/U8BDIXL0m9q0itttHG5IDAos3zzjk30AZxyFMBdPcMueqgath7Wul3 0B+LepIR1nwbUGBZDkvbMzsdSPvl022ZNQK/bZCEBrRVZNrXcI7/djcbN50/NoNzDWiH SVcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-language:thread-index :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=EKSh1JfPtZyw51i7IouwS62a0u0QUFivwBSo/PPE83Y=; fh=UAbSimdGpojL/e9wL4Po0hjwO3sT24dauJYSxjnq65Y=; b=NrFmWRQcnLNrIKb9jiXpu2IsnfvBMM6fy6DK9lYkTueO2/FpA5SKPHT7/i5csgtmT/ JNiE20IsKVCAERjNkPO7y4bk900+7nq2IgxIVQWcYwxwSSBjPsaay8zxawvjNxnH+wmI wk6F1A6VJGfG9iU6VPl4tHTeZ3bDMi8D2qxSm+WYoU4sC3bDgcebj0keejFSfe7udR+D uey3zwsbqxCv3L+OQI1dulGW6nK9NGG5liG1HbMQmfeAQs1Y4C0rVc/TVWXlKGR6+MnF 52dFB+NKPR+D68c+jhDLQkRcbU/5FSyRZKWUAIjz6m1NSlXSdEqisZAtW7obJ0FNgA4U iv2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nextmovesoftware.com header.s=default header.b=JOgzwFX0; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id m15-20020a17090607cf00b00992feaebee8si2386375ejc.943.2023.07.31.00.13.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 00:13:38 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=fail header.i=@nextmovesoftware.com header.s=default header.b=JOgzwFX0; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 82A2938582AC for ; Mon, 31 Jul 2023 07:13:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id F0DC53858C54 for ; Mon, 31 Jul 2023 07:13:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F0DC53858C54 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=EKSh1JfPtZyw51i7IouwS62a0u0QUFivwBSo/PPE83Y=; b=JOgzwFX0Idc2anGJlfPKN2mTV8 x9yDfC9jOWHui0KUjuzlolvHDqcXmVJmnkaOzH3gH21I74vYNwTPcUj/ZRZnA/SOBlWPq4+mMuk8p tFZYURBhn93yfcZnGqtFGcpMQvJR+wJHjKCMMjsvDHqVKtw6KcgjSs+VfgAzMgKV/uGyebPGyHMGN Da+AqEDhCQMHsUuIEvfR0yUM/5F5Oyvnm3Ug+iL7g2win3KBcAcgLRY9mb2iMIEn05XcCDzr5YdcU B+k1jg/EyVhMg4QGNjI08kBUoj24dEcHeWHmxGsZS+dBMtI3AkiiLX6rVLnV409f11XU36eTkWKBA ZMABN0uA==; Received: from host86-161-68-50.range86-161.btcentralplus.com ([86.161.68.50]:56834 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qQN5Z-0000jr-0q; Mon, 31 Jul 2023 03:13:09 -0400 From: "Roger Sayle" To: Cc: "'Uros Bizjak'" Subject: [Committed] PR target/110843: Check TARGET_AVX512VL for V2DI rotates in STV. Date: Mon, 31 Jul 2023 08:13:07 +0100 Message-ID: <001a01d9c37e$75abcfb0$61036f10$@nextmovesoftware.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 thread-index: AdnDfhVQHByZhvEJRAyAoF0jJUGvYg== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772919318227519725 X-GMAIL-MSGID: 1772919318227519725 This patch resolves PR target/110843, an ICE caused by my enhancement to support AVX512 DImode and SImode rotates in the scalar-to-vector (STV) pass. Although the vprotate instructions are available on all TARGET_AVX512F microarchitectures, the V2DI and V4SI variants are only available on the TARGET_AVX512VL subset, leading to problems when command line options enable AVX512 (i.e. AVX512F) but not the required AVX512VL functionality. The simple fix is to update/correct the target checks. This patch has been tested on x86_64-pc-linux-gnu with make bootstrap and make -k check, both with and without --target_board=unix{-m32} with no new failures. Committed to mainline as obvious. 2023-07-31 Roger Sayle gcc/ChangeLog PR target/110843 * config/i386/i386-features.cc (compute_convert_gain): Check TARGET_AVX512VL (not TARGET_AVX512F) when considering V2DImode and V4SImode rotates in STV. (general_scalar_chain::convert_rotate): Likewise. gcc/testsuite/ChangeLog PR target/110843 * gcc.target/i386/pr110843.c: New test case. Sorry again for the inconvenience. Roger diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc index 6da8395..cead397 100644 --- a/gcc/config/i386/i386-features.cc +++ b/gcc/config/i386/i386-features.cc @@ -587,7 +587,7 @@ general_scalar_chain::compute_convert_gain () case ROTATE: case ROTATERT: igain += m * ix86_cost->shift_const; - if (TARGET_AVX512F) + if (TARGET_AVX512VL) igain -= ix86_cost->sse_op; else if (smode == DImode) { @@ -1230,7 +1230,7 @@ general_scalar_chain::convert_rotate (enum rtx_code code, rtx op0, rtx op1, emit_insn_before (pat, insn); result = gen_lowpart (V2DImode, tmp1); } - else if (TARGET_AVX512F) + else if (TARGET_AVX512VL) result = simplify_gen_binary (code, V2DImode, op0, op1); else if (bits == 16 || bits == 48) { @@ -1276,7 +1276,7 @@ general_scalar_chain::convert_rotate (enum rtx_code code, rtx op0, rtx op1, emit_insn_before (pat, insn); result = gen_lowpart (V4SImode, tmp1); } - else if (TARGET_AVX512F) + else if (TARGET_AVX512VL) result = simplify_gen_binary (code, V4SImode, op0, op1); else { diff --git a/gcc/testsuite/gcc.target/i386/pr110843.c b/gcc/testsuite/gcc.target/i386/pr110843.c new file mode 100644 index 0000000..b9bcddb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr110843.c @@ -0,0 +1,20 @@ +/* PR target/110843 */ +/* derived from gcc.target/i386/pr70007.c */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-Os -mavx512ifma -Wno-psabi" } */ + +typedef unsigned short v32u16 __attribute__ ((vector_size (32))); +typedef unsigned long long v32u64 __attribute__ ((vector_size (32))); +typedef unsigned __int128 u128; +typedef unsigned __int128 v32u128 __attribute__ ((vector_size (32))); + +u128 foo (v32u16 v32u16_0, v32u64 v32u64_0, v32u64 v32u64_1) +{ + do { + v32u16_0[13] |= v32u64_1[3] = (v32u64_1[3] >> 19) | (v32u64_1[3] << 45); + v32u64_1 %= ~v32u64_1; + v32u64_0 *= (v32u64) v32u16_0; + } while (v32u64_0[0]); + return v32u64_1[3]; +} +