From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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: Reply-To: Jakub Jelinek 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-Type: text/plain; charset=us-ascii 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 List-Id: 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. --- 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; +} Jakub