From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id A36213858D28 for ; Tue, 15 Mar 2022 14:52:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A36213858D28 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=NixdZGR0bbomfA3fqAAoGz3ajXXY3MizCVPTAInKEEY=; b=DEp3AxTZvzUAtjpGlpJ4GZ0zBD XGRBFo9tBaEoYZ0YT9nv+8daxDXjod7XsIcNlp3QCLWf5qGViLQst5oi+EF3K0pBwbqE9p9vf6rsO N6w8tYebyz0snSe4uum1hYym7X2cjbDE/d3HaU4OiAFKmTe3i3GAjrnTTWUWknIAaIuMlJVWemqBd WM722x4LHqMZnhKwY9n2WKEwKtb+ZOZDYsXd7HUfb6M8gtsliI9TtLpZFcZk6WaPC2SgYEV7uBl7T azt5uBnHbuwCDtqIvFrWvan+4RH/UXKXkrB7L6ivVKD20Bj4M0Xqv0allAcNc64RAXI7/ZCIH4vcb bG8wJgNQ==; Received: from [185.62.158.67] (port=53727 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nU8X6-0004gA-2t; Tue, 15 Mar 2022 10:52:20 -0400 From: "Roger Sayle" To: "'GCC Patches'" Subject: [x86 PATCH] PR target/94680: Clear upper bits of V2DF using movq (like V2DI). Date: Tue, 15 Mar 2022 14:52:19 -0000 Message-ID: <022601d8387c$45a41130$d0ec3390$@nextmovesoftware.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0227_01D8387C.45A68230" X-Mailer: Microsoft Outlook 16.0 Thread-Index: Adg4euttTFG0zc3RQhe+MRI02X5jgA== 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=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 15 Mar 2022 14:52:22 -0000 This is a multipart message in MIME format. ------=_NextPart_000_0227_01D8387C.45A68230 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This simple i386 patch unblocks a more significant change. The testcase gcc.target/i386/sse2-pr94680.c isn't quite testing what's intended, and alas the fix for PR target/94680 doesn't (yet) handle V2DF mode. For the first test from sse2-pr94680.c, below v2df foo_v2df (v2df x) { return __builtin_shuffle (x, (v2df) { 0, 0 }, (v2di) { 0, 2 }); } GCC on x86_64-pc-linux-gnu with -O2 currently generates: movhpd .LC0(%rip), %xmm0 ret .LC0: .long 0 .long 0 which passes the test as it contains a mov insn and no xor. Alas reading a zero from the constant pool isn't quite the desired implementation. With this patch we now generate: movq %xmm0, %xmm0 ret The same code as we generate for V2DI, and add a stricter test case. My first attempt tried using VI8F_128 to generalize the existing sse2_movq128 define_insn to both V2DI and V2DF. Alas, CODE_FOR_sse2_movq128 is exposed as a builtin in i386-builtin.def, requiring some internal name changes, that ultimately the testsuite was unhappy with. The simpler solution (that works) is to clone/specialize a new V2DF *sse2_movq128_2. This patch has been tested on x86_64-pc-linux-gnu with make bootstrap and make -k check with no new failures. Ok for mainline? 2022-03-15 Roger Sayle gcc/ChangeLog PR target/94680 * config/i386/sse.md (*sse2_movq128_2): A version of sse2_movq128 for V2DF mode. gcc/testsuite/ChangeLog PR target/94680 * gcc.target/i386/sse2-pr94680-2.c: New stricter V2DF test case. Thanks in advance, Roger -- ------=_NextPart_000_0227_01D8387C.45A68230 Content-Type: text/plain; name="patchmq2.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patchmq2.txt" diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md=0A= index e9292e6..d017fb8 100644=0A= --- a/gcc/config/i386/sse.md=0A= +++ b/gcc/config/i386/sse.md=0A= @@ -1599,6 +1599,19 @@=0A= (set_attr "prefix" "maybe_vex")=0A= (set_attr "mode" "TI")])=0A= =0A= +(define_insn "*sse2_movq128_2"=0A= + [(set (match_operand:V2DF 0 "register_operand" "=3Dv")=0A= + (vec_concat:V2DF=0A= + (vec_select:DF=0A= + (match_operand:V2DF 1 "nonimmediate_operand" "vm")=0A= + (parallel [(const_int 0)]))=0A= + (match_operand:DF 2 "const0_operand")))]=0A= + "TARGET_SSE2"=0A= + "%vmovq\t{%1, %0|%0, %q1}"=0A= + [(set_attr "type" "ssemov")=0A= + (set_attr "prefix" "maybe_vex")=0A= + (set_attr "mode" "TI")])=0A= +=0A= ;; Move a DI from a 32-bit register pair (e.g. %edx:%eax) to an xmm.=0A= ;; We'd rather avoid this entirely; if the 32-bit reg pair was loaded=0A= ;; from memory, we'd prefer to load the memory directly into the %xmm=0A= diff --git a/gcc/testsuite/gcc.target/i386/sse2-pr94680-2.c = b/gcc/testsuite/gcc.target/i386/sse2-pr94680-2.c=0A= new file mode 100644=0A= index 0000000..abd260a=0A= --- /dev/null=0A= +++ b/gcc/testsuite/gcc.target/i386/sse2-pr94680-2.c=0A= @@ -0,0 +1,13 @@=0A= +/* { dg-do compile } */=0A= +/* { dg-options "-O2 -msse2" } */=0A= +typedef double v2df __attribute__ ((vector_size (16)));=0A= +typedef long long v2di __attribute__((vector_size(16)));=0A= +=0A= +v2df foo_v2df (v2df x)=0A= +{=0A= + return __builtin_shuffle (x, (v2df) { 0, 0 }, (v2di) { 0, 2 });=0A= +}=0A= +=0A= +/* { dg-final { scan-assembler "movq" } } */=0A= +/* { dg-final { scan-assembler-not "pxor" } } */=0A= +=0A= ------=_NextPart_000_0227_01D8387C.45A68230--