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: 30234 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2748566wrr; Tue, 6 Dec 2022 02:50:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf7pGD9zffV5A252HvwPvzYCq+Jd17Aq0hiUTPDUY3+sIH4N+cKunqXEx0772r7qhAUnb0k9 X-Received: by 2002:aa7:d808:0:b0:46b:9715:1630 with SMTP id v8-20020aa7d808000000b0046b97151630mr27068483edq.213.1670323837720; Tue, 06 Dec 2022 02:50:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670323837; cv=none; d=google.com; s=arc-20160816; b=bJ4cYCyOYcD/sA47Kw283iI6zZM2yx+monOGPPLFKBUzeNLCAs3fSkxeDC4rr1K/1A cLarBjiudoo/BymvI3j1JzgntPnzlvtJaQYMeb+OKYTXd4Xl227BDdyBWOJlN3n889Fm dC4BQfmjNtx9MkUJVhahdjJNDGXqRnVfQW6ul1GLjGK0cxMec3diCxBAaB2DcwHyFlM8 NztsHDSBheb1Ty+Ea4kA5/nGhJhbN7luywn2kXAO39XaBHzwlD/n9Uq4t8OFPgbWMrCe WRsHJgjJmcAxqMF6XmH5XK59HxAc2FRbbxm0yDZ7dDeVoDrGHlJepQdeYmGrohlmokYS yIzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=PfzMRJuy4fVNSvj8s8ULIk0ZYSiqTW6GAHAbC2qoFlM=; b=KAAijbEdoUhKcDvbKF6B4d4CBif35adHGS9cGN5vlSnAnaEGch1Iedg1OXKVcdWGX/ UnSMbKuvBPcrkIqdbUlHncaAbc8y3nJklEu4uc+zxdmPqpDpZ1vqFEx/qHLWhgjNSf8u 4UIVgZlnYmI/aQ4WIwmX4mvQyFz8op1+uvaz4LqTyV+k1vm+1K4uR8SBoTWkHL2v+s1Z ANVanh5JoA7gSxSvoarjwM5bqKCUF5Px18xznaTpLMH/XobjXbgIubm/vB5ta0HThf6b McnmrAWThqFWATxce66pYnn45T1hW/QmDz/vr0xXn0AFCsSneDpRW9hfhNhOMyfRuBkq ExLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=RhFJXJDE; 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=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i27-20020a0564020f1b00b00469b3fcafe8si1732846eda.432.2022.12.06.02.50.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 02:50:37 -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=@gcc.gnu.org header.s=default header.b=RhFJXJDE; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 333E13864A3B for ; Tue, 6 Dec 2022 10:48:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 333E13864A3B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670323708; bh=PfzMRJuy4fVNSvj8s8ULIk0ZYSiqTW6GAHAbC2qoFlM=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=RhFJXJDET6zGoCZMby/s5cP7qM6t7dfDD1MY/fTIxeUTFTlujqjQQR5TX5qNH3V94 TS/5ETkspUm2f4ZWqDKjl9NpDdu3erQL3WpS1QxQoC5Aku3/iKZLc6nUcsHBujY4m7 pGWkIYjtcQJWhM2kMXGmtvraqwP4QiwsWaV6JDqU= 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751461488241779576?= X-GMAIL-MSGID: =?utf-8?q?1751461488241779576?= 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; +}