From patchwork Tue Dec 6 10:47:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 61543 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1C6DD384C93B for ; Tue, 6 Dec 2022 10:48:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C6DD384C93B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670323693; bh=PfzMRJuy4fVNSvj8s8ULIk0ZYSiqTW6GAHAbC2qoFlM=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=It0ZfowrQK4rALqwJAlj8Pc/Vc53jpcUySqG0tqYTTnbTe8Hbr0OQ9XrK6LXWHf71 4AwNO7XUXzJCA+hibOH5ZpDSGWQgmMF/hNjnfuwj2oQXlrwu8vPREmQ4VHTCP0Ytwy 9WA2LKiTjDr6UugS++0ktQy6/aUX2cK99lUFGJ8A= 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 9780E3856B4F for ; Tue, 6 Dec 2022 10:47:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9780E3856B4F 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 To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Fix up expander conditions on cbranchbf4 and cstorebf4 [PR107969] Message-ID: 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-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 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-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. Jakub --- 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; +}