From patchwork Tue Dec 19 09:00:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 180839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1802741dyi; Tue, 19 Dec 2023 01:00:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0pcVa4t2F3EKIZUQ2JBv04SdlPm06i+9+fFqr3QkOY6eflIRgG36mg9GknP7566bp+Ov0 X-Received: by 2002:a05:620a:ec6:b0:77e:fba3:9394 with SMTP id x6-20020a05620a0ec600b0077efba39394mr16296879qkm.118.1702976450233; Tue, 19 Dec 2023 01:00:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702976450; cv=pass; d=google.com; s=arc-20160816; b=qN+R4Nc1gCNziUiF+8/hoa7l3FDUy0LhZIPMY95wcEGHKlHLja/O+7u0RHP7QgxleR eBm3hfrhilhucpVjQQlH1m0ib8Jar7E25K3fRKWxnUg9tiN34aVtPhDrWgvoIKjaKwX/ +KGsw3tY0nOoy4maXaaGl0Sg7jGVy0uZHMD2BfkHnP1D0K92xtbKcHR8ude/8tKsv5UT q5DVOubIO8Ad+7uJTmCPl2cKBKtP1oAAfucJlPDrS7HuhXnDUyZ1w1d7Cr4Dn5N33GcW wyH3oVrfkB/XQY8YLEK9s43raBEi8tTczfnO51IU1HPdjtc8jztz1551yxsU5QagRTLu JmzQ== 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=uooxDgKHEiTnEsuKWk06WsHvjpI4aimWp4MiZy/x41w=; fh=h2iPLTLlSKmpj4PWOaJAO8af6hiH/htLInOT1vU8M+E=; b=OiJkzrCiaaSimdZO+iiyvVOxuPHyC6HX/mpJzWLMxT+95mJ/3oPdogYFWa2UiW3jtA 4Xu4VlbyWB19UjFykkDQPHPoX22KMAC9hCJim/rH51dUzAX7SrL8Wg22Rp0vU7NYL8hn QWsrLPSbtPaX5Z1Mu18A6AAsKuNJRg/Uw8IqrAzCtMHAHeYmP/W6FFm1NBEWIQ4OPt5T w9Fe2M/0DItnXyUqFVz4eZLOlx910gn2tI8Oj0/2KQ6HCDUNC4zEdFPPoCIKF5DiXiz4 NmcLn3v2WWo7tbb4vIomMmpC65jDIKYzCAlpN3y8EwsmSzLVSU1zC+8P+kyvZy2y0t7P Y9lg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WS69eR0A; 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 x10-20020a05620a258a00b0077f319cff23si26570754qko.21.2023.12.19.01.00.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 01:00:50 -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=WS69eR0A; 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 F0E4F385E82E for ; Tue, 19 Dec 2023 09:00:49 +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 A5D793858D38 for ; Tue, 19 Dec 2023 09:00:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A5D793858D38 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 A5D793858D38 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=1702976414; cv=none; b=rOfYI4oFkvkcHy0M2g8Cs5Ch4WBfLq03yrCtC9yaJjs9u5SUirbFehw5hkDcpYPWGs0ookf0RHFlyUXY7lieLfW9yC6gFIdyyHdawkIq8DFLg2htnjL+48fZe2mOLsH/IFuWRjuSx0ejBj58oGnXD4da1jAKlEPCv12kSdFVlBc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702976414; c=relaxed/simple; bh=hOeSNwK5IK9XOgIZf2+ZPbF07RnGEbraxGGSOiOrjyg=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=U0HXCrzuTeE30hE+8Zzn8o6mGYht+ipd0Ia/ja25RxrhOIUX4xaHc603K3rrsi8JIxpGhIF7/DcnMPG2DYq6pL3xA3hZ+Qlgo5mFyxjXZs4LL2g3gUW9+svtLetLtgayPmMLsnZi0lO/kCo43qLHSHOFruinEAWm7EsZbwXOPvQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702976413; 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=uooxDgKHEiTnEsuKWk06WsHvjpI4aimWp4MiZy/x41w=; b=WS69eR0AuwlgY2nQyKsOflTBQz3DYeTszzOB7w7hTbcDcp0dSTzOieeHm5BJKf10/2ZhGg xiaVKym2pNE3oI1jpgGIQY4fJqFyYC1x7jKSXR1G1eGyS0tK+SoYFCw2QIINXVKT/DwleZ eW9eNW3N0EsRV17uD0zW3C1WeCccOFk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-279-DD5jr2UzMeqNVK0aqgCGWA-1; Tue, 19 Dec 2023 04:00:11 -0500 X-MC-Unique: DD5jr2UzMeqNVK0aqgCGWA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 332DE887E43; Tue, 19 Dec 2023 09:00:11 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA9C83C25; Tue, 19 Dec 2023 09:00:10 +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 3BJ903dr4083932 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 19 Dec 2023 10:00:04 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3BJ902Fn4083931; Tue, 19 Dec 2023 10:00:02 +0100 Date: Tue, 19 Dec 2023 10:00:02 +0100 From: Jakub Jelinek To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Fix mmx.md signbit expanders [PR112816] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, MEDICAL_SUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785700234166891965 X-GMAIL-MSGID: 1785700234166891965 Hi! Apparently when looking for "signbit2" vector expanders, I've only looked at sse.md and forgot mmx.md, which has two further ones and the following patch still ICEd. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-12-19 Jakub Jelinek PR target/112816 * config/i386/mmx.md (signbitv2sf2, signbit2): Force operands[1] into a REG. * gcc.target/i386/sse2-pr112816-2.c: New test. Jakub --- gcc/config/i386/mmx.md.jj 2023-12-11 08:31:58.825941145 +0100 +++ gcc/config/i386/mmx.md 2023-12-18 20:55:53.899326034 +0100 @@ -1339,7 +1339,10 @@ (define_expand "signbitv2sf2" (match_operand:V2SF 1 "register_operand") 0) (match_dup 2)))] "TARGET_MMX_WITH_SSE" - "operands[2] = GEN_INT (GET_MODE_UNIT_BITSIZE (V2SFmode)-1);") +{ + operands[1] = force_reg (V2SFmode, operands[1]); + operands[2] = GEN_INT (GET_MODE_UNIT_BITSIZE (V2SFmode)-1); +}) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; @@ -2482,7 +2485,10 @@ (define_expand "signbit2" (match_operand:VHF_32_64 1 "register_operand") 0) (match_dup 2)))] "TARGET_SSE2" - "operands[2] = GEN_INT (GET_MODE_UNIT_BITSIZE (mode)-1);") +{ + operands[1] = force_reg (mode, operands[1]); + operands[2] = GEN_INT (GET_MODE_UNIT_BITSIZE (mode)-1); +}) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; --- gcc/testsuite/gcc.target/i386/sse2-pr112816-2.c.jj 2023-12-18 20:57:16.313175688 +0100 +++ gcc/testsuite/gcc.target/i386/sse2-pr112816-2.c 2023-12-18 20:52:22.006283681 +0100 @@ -0,0 +1,16 @@ +/* PR target/112816 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +#define N 2 +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; +}