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 9780E3856B4F for ; Tue, 6 Dec 2022 10:47:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9780E3856B4F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670323661; 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=PfzMRJuy4fVNSvj8s8ULIk0ZYSiqTW6GAHAbC2qoFlM=; b=AgjEGWp+0PiAlCB5sSXG8gcoKewWHayN8Ge4yaLPECTy3wI6LjUhroF8V8FC5HlU0luTlC dqaB6ZHeIn/KU1+HgV8gixQiuJQ2myXxwniOHbY5OavZYW6OVf5y8moqzCSLKr/oMh7NxH pPRNcOERA22AOyUh8pf8JSaMonyJnJs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-255-DKHFI1lyM4-c077N-FX4SA-1; Tue, 06 Dec 2022 05:47:38 -0500 X-MC-Unique: DKHFI1lyM4-c077N-FX4SA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B1FA5185A79C; Tue, 6 Dec 2022 10:47:37 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6BC8D4A9279; Tue, 6 Dec 2022 10:47:37 +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 2B6AlWxq1100357 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 6 Dec 2022 11:47:33 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2B6AlWiu1100356; Tue, 6 Dec 2022 11:47:32 +0100 Date: Tue, 6 Dec 2022 11:47:32 +0100 From: Jakub Jelinek To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Fix up expander conditions on cbranchbf4 and cstorebf4 [PR107969] Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.5 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_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham 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! With -msoft-float we ICE on __bf16 comparisons, because the insns we want to use under the hood (cbranchsf4 and cstoresf4) after performing the fast extensions aren't available. The following patch copies the conditions from the c*sf4 expanders to the corresponding c*bf4 expanders. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-12-06 Jakub Jelinek PR target/107969 * config/i386/i386.md (cbranchbf4, cstorebf4): Guard expanders with the same condition as cbranchsf4 or cstoresf4 expanders. * gcc.target/i386/pr107969.c: New test. --- gcc/config/i386/i386.md.jj 2022-12-02 10:28:30.000000000 +0100 +++ gcc/config/i386/i386.md 2022-12-05 17:21:53.062085995 +0100 @@ -1667,7 +1667,7 @@ (define_expand "cbranchbf4" (const_int 0)]) (label_ref (match_operand 3)) (pc)))] - "" + "TARGET_80387 || (SSE_FLOAT_MODE_P (SFmode) && TARGET_SSE_MATH)" { rtx op1 = ix86_expand_fast_convert_bf_to_sf (operands[1]); rtx op2 = ix86_expand_fast_convert_bf_to_sf (operands[2]); @@ -1702,7 +1702,7 @@ (define_expand "cstorebf4" (match_operator 1 "comparison_operator" [(reg:CC FLAGS_REG) (const_int 0)]))] - "" + "TARGET_80387 || (SSE_FLOAT_MODE_P (SFmode) && TARGET_SSE_MATH)" { rtx op1 = ix86_expand_fast_convert_bf_to_sf (operands[2]); rtx op2 = ix86_expand_fast_convert_bf_to_sf (operands[3]); --- gcc/testsuite/gcc.target/i386/pr107969.c.jj 2022-12-05 17:27:36.229060068 +0100 +++ gcc/testsuite/gcc.target/i386/pr107969.c 2022-12-05 17:27:14.839373669 +0100 @@ -0,0 +1,12 @@ +/* PR target/107969 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fexcess-precision=16 -msoft-float -msse2" } */ + +int i; +__bf16 f; + +void +bar (void) +{ + i *= 0 <= f; +} Jakub