Message ID | ZW2BNARKl5/NbRVg@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp2603450vqy; Sun, 3 Dec 2023 23:36:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEt80lmC/z/GBrEGpHqZTMLwTk3v1JWWPKRbaLGS1r121/4+FqvmU7CcpwtX/k7MQ4Jxo+ X-Received: by 2002:ac8:5806:0:b0:425:4043:8d5a with SMTP id g6-20020ac85806000000b0042540438d5amr1457283qtg.117.1701675376556; Sun, 03 Dec 2023 23:36:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701675376; cv=pass; d=google.com; s=arc-20160816; b=ht+VuG2EBmR4w/fsuBNd6bL+XKMwWBAq745DvTs7vl4DaVPfIHqIXhg8eEhIeQ3vwX hyCWa8HecDw9xRELjpzRuQk09ipJK8gvnDsX8vG+foHCZldNCjQ7VwXKamzPKWNVLhTg FvlKFGlerLGyZgfr8df5XFrt/2rfRQboIzdb7OhRRVkqo5eJEhn1veMMQ7KsMAyOAEFg oTQDrstJ9ykDXaGWx7FiM/2mF9CTRQhM+R2MqlV9uw+2OmpSNvPXYM0Q9NnMBw9R0/4Z Gyv9bsDoZhOu7ixITiOeHLft78+yQH0coy2yAON/Tg3UESMivM6cfaLL5DVa8fHfr7U1 oM1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=JUnMXekU+oolKp9UvKS8im1oHlNw7kC7CHYukp4QFBI=; fh=h2iPLTLlSKmpj4PWOaJAO8af6hiH/htLInOT1vU8M+E=; b=lPwAkQxI/Ms+j9DB2H7cuFLZZzo9hHWYs3X3xqHsAE1QFPU2H0lquyHs3nGCXs06P4 wXa8QSdQSH9L99hR3HiREa+0jVEB0300Q//2UrVbzk5bJm/ICWNrOp05Kt3vpqvjG+LG 6XSsI5ResA2tJCKO5ishZPCIsp/+PBTPON07/h4d5+UrnoOCIUKYhdyIwSyc9NO03gxl bVFpZWllq1tzXn47Mvxt4gCj76XtAUKDuJWVYw3WypibVOSVWsDzBuCSUdu4/YH9xdnF dJDi7Fxt/XP+QCSqxRyk8VMuBWVzHmb08twA/m5nJuPo/yAPUVNGmRwaB/zJU/WQ6M8v uUEw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hFv2z90U; arc=pass (i=1); 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id j26-20020ac8405a000000b004239db465b1si8391053qtl.433.2023.12.03.23.36.16 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 23:36:16 -0800 (PST) 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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hFv2z90U; arc=pass (i=1); 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5258338582A3 for <ouuuleilei@gmail.com>; Mon, 4 Dec 2023 07:36:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 5FE6B3858427 for <gcc-patches@gcc.gnu.org>; Mon, 4 Dec 2023 07:35:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5FE6B3858427 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5FE6B3858427 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701675353; cv=none; b=cFbQKDWy4l5W2xCwNwsBsJcwUFzqiFYj3WBHazaoLneEwDEyaOeQ960VWv+3+hDZ41Dx9ssghwBoPxqOzb+d7XEX770LWMhR99j9+5taL+TnArG3GhvCn/wElDa+IARsusWrTxdjesVgcOdlCmoJel3PV65n9zreqQJtccJlE/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701675353; c=relaxed/simple; bh=+MMyBsOMmfD4UcoLilwHh6cvlTqSFMZ5soqExvnnmas=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=SJoIpy8Ifw8xoaLHtpetalAimtT8iAAxc54iDAI2mBXMSENItDTvoiUtpC3sNZYK94IDOppppZKCZ0i8cyF1yk7zZQdtkHW0T13XthdnvN4DG0L82Sg84oVyrcg3zW1JSC/CHAdYazYmGuoH5q44I4MEzuEqoRA3OuuGGFUpLvw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701675351; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=JUnMXekU+oolKp9UvKS8im1oHlNw7kC7CHYukp4QFBI=; b=hFv2z90UEXOm5NRLKOCO3fGCVa3g1RT3Ek1Ddlx1QlQZt56GSsmGJjLX3EWMiFDRovGH5N pR8WuSH4Kp/VRm+Rpdun/UD6/yBn+LzFHD4oJK7HbykqDlrE2UX4MliBvfB9UxHcTGg6id hNzaPip94K1hcXxpkqGKzBWUUu+n3v8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-407-EeIqZatFPy2OXEjw06rPkg-1; Mon, 04 Dec 2023 02:35:20 -0500 X-MC-Unique: EeIqZatFPy2OXEjw06rPkg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5B5EC2825E8E; Mon, 4 Dec 2023 07:35:20 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.157]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E99840C6EB9; Mon, 4 Dec 2023 07:35:20 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 3B47ZHg12150103 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 4 Dec 2023 08:35:17 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3B47ZGb62150102; Mon, 4 Dec 2023 08:35:16 +0100 Date: Mon, 4 Dec 2023 08:35:16 +0100 From: Jakub Jelinek <jakub@redhat.com> To: Uros Bizjak <ubizjak@gmail.com> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Fix up signbit<mode>2 expander [PR112816] Message-ID: <ZW2BNARKl5/NbRVg@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784335959384541440 X-GMAIL-MSGID: 1784335959384541440 |
Series |
i386: Fix up signbit<mode>2 expander [PR112816]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Dec. 4, 2023, 7:35 a.m. UTC
Hi! The following testcase ICEs, because the signbit<mode>2 expander uses an explicit SUBREG in the pattern around match_operand with register_operand predicate. If we are unlucky enough that expansion tries to expand it with some SUBREG as operands[1], we have two nested SUBREGs in the IL, which is not valid and causes ICE later. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-12-04 Jakub Jelinek <jakub@redhat.com> PR target/112816 * config/i386/sse.md (signbit<mode>2): Force operands[1] into a REG. * gcc.target/i386/sse2-pr112816.c: New test. Jakub
Comments
On Mon, Dec 4, 2023 at 8:35 AM Jakub Jelinek <jakub@redhat.com> wrote: > > Hi! > > The following testcase ICEs, because the signbit<mode>2 expander uses an > explicit SUBREG in the pattern around match_operand with register_operand > predicate. If we are unlucky enough that expansion tries to expand it > with some SUBREG as operands[1], we have two nested SUBREGs in the IL, > which is not valid and causes ICE later. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok > for trunk? > > 2023-12-04 Jakub Jelinek <jakub@redhat.com> > > PR target/112816 > * config/i386/sse.md (signbit<mode>2): Force operands[1] into a REG. > > * gcc.target/i386/sse2-pr112816.c: New test. OK. Thanks, Uros. > > --- gcc/config/i386/sse.md.jj 2023-12-01 08:10:42.311330174 +0100 > +++ gcc/config/i386/sse.md 2023-12-02 09:53:45.489970487 +0100 > @@ -5116,7 +5116,10 @@ (define_expand "signbit<mode>2" > (match_operand:VF1_AVX2 1 "register_operand") 0) > (match_dup 2)))] > "TARGET_SSE2" > - "operands[2] = GEN_INT (GET_MODE_UNIT_BITSIZE (<MODE>mode)-1);") > +{ > + operands[1] = force_reg (<MODE>mode, operands[1]); > + operands[2] = GEN_INT (GET_MODE_UNIT_BITSIZE (<MODE>mode)-1); > +}) > > ;; Also define scalar versions. These are used for abs, neg, and > ;; conditional move. Using subregs into vector modes causes register > --- gcc/testsuite/gcc.target/i386/sse2-pr112816.c.jj 2023-12-02 10:00:23.623394880 +0100 > +++ gcc/testsuite/gcc.target/i386/sse2-pr112816.c 2023-12-02 09:59:47.024909235 +0100 > @@ -0,0 +1,16 @@ > +/* PR target/112816 */ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -msse2" } */ > + > +#define N 4 > +struct S { float x[N]; }; > +struct T { int x[N]; }; > + > +struct T > +foo (struct S x) > +{ > + struct T res; > + for (int i = 0; i < N; ++i) > + res.x[i] = __builtin_signbit (x.x[i]) ? -1 : 0; > + return res; > +} > > Jakub >
--- gcc/config/i386/sse.md.jj 2023-12-01 08:10:42.311330174 +0100 +++ gcc/config/i386/sse.md 2023-12-02 09:53:45.489970487 +0100 @@ -5116,7 +5116,10 @@ (define_expand "signbit<mode>2" (match_operand:VF1_AVX2 1 "register_operand") 0) (match_dup 2)))] "TARGET_SSE2" - "operands[2] = GEN_INT (GET_MODE_UNIT_BITSIZE (<MODE>mode)-1);") +{ + operands[1] = force_reg (<MODE>mode, operands[1]); + operands[2] = GEN_INT (GET_MODE_UNIT_BITSIZE (<MODE>mode)-1); +}) ;; Also define scalar versions. These are used for abs, neg, and ;; conditional move. Using subregs into vector modes causes register --- gcc/testsuite/gcc.target/i386/sse2-pr112816.c.jj 2023-12-02 10:00:23.623394880 +0100 +++ gcc/testsuite/gcc.target/i386/sse2-pr112816.c 2023-12-02 09:59:47.024909235 +0100 @@ -0,0 +1,16 @@ +/* PR target/112816 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +#define N 4 +struct S { float x[N]; }; +struct T { int x[N]; }; + +struct T +foo (struct S x) +{ + struct T res; + for (int i = 0; i < N; ++i) + res.x[i] = __builtin_signbit (x.x[i]) ? -1 : 0; + return res; +}