From patchwork Mon Feb 27 21:12:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1749150 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=hP++jGVE; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PQYBF2ywQz1yWy for ; Tue, 28 Feb 2023 08:13:07 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9208E3858D32 for ; Mon, 27 Feb 2023 21:13:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9208E3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677532382; bh=fhgtoZVKSv4pDAHtgAz1M4jLkaD4w8LLbDfR0lOsKcg=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=hP++jGVEp5Uf6lfD9zZ6hmyqpA4N5+CcQSeIDjB14R9VxFc114RvyAsg966V3nLcA jHbz48lqEQG4ugJSndDsEesr0J/O7RYla80D6rQFnTh+W+DMDGP7PrWTS5wK1JzeEg 3lE102YAWl17JZjGoR59v0JD1j+HcIr3beHE5qJU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by sourceware.org (Postfix) with ESMTPS id 50CD73858D32 for ; Mon, 27 Feb 2023 21:12:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 50CD73858D32 Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-536b7ffdd34so213373757b3.6 for ; Mon, 27 Feb 2023 13:12:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=fhgtoZVKSv4pDAHtgAz1M4jLkaD4w8LLbDfR0lOsKcg=; b=NZb0o2RN8t3oUYGYOO9mLZIUKd6YXwst75kJIIw5GsC8ORxwB+YCQ1vvbRaegzqbRT CskL44RIxliwbI1TNqCkzLmycVptLT4u9qq8JYHo9gER7V+Nxjrv2ZaLWH9FT5QyqATN xCqmg8Nv5XagAcXwHhD0aTHY8EjaHkFOdbplbwplAuQh5rdpzyiZOaa5XPwDomKnIY0k pMJSKVyAePyD1kyJOJRPJg8y2TP0lvGU43VCjV7OFLjiu4jzZAhx5O2/Geq4iW97hdrh fq/+hxr61yrYZ6Z4pL+74P1hhS8RMTn+TQvzhiJ9+t4YOZYrpu0s82DlR3QTAqjf4qU8 qu4A== X-Gm-Message-State: AO0yUKXdHRS2KedaMANa5BHgAvhm6NdpmoyqTTRD5P4iWGzysg34Di6i 3wh5I52vOFOWOKWsdtT0GmszHG34UgjQYatHFrWQUj7UipWvhQ== X-Google-Smtp-Source: AK7set+LhN1HSXsmBHpCrHrl3pmE6GeK5+HjPWqWxF0LRmqloDG1WBLF3Yq4DNboD3zxjI19t6ZGOCP5tpPpRioMkM8= X-Received: by 2002:a25:e210:0:b0:a36:3875:56be with SMTP id h16-20020a25e210000000b00a36387556bemr66119ybe.10.1677532361387; Mon, 27 Feb 2023 13:12:41 -0800 (PST) MIME-Version: 1.0 Date: Mon, 27 Feb 2023 22:12:30 +0100 Message-ID: Subject: [PATCH] i386: Do not constrain fmod and remainder patterns with flag_finite_math_only [PR108922] To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Uros Bizjak via Gcc-patches From: Uros Bizjak Reply-To: Uros Bizjak Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" According to Intel ISA manual, fprem and fprem1 return NaN when invalid arithmetic exception is generated. This is documented in Table 8-10 of the ISA manual and makes these two instructions fully IEEE compatible. The reverted patch was based on the data from table 3-30 and 3-31 of the Intel ISA manual, where results in case of st(0) being infinity or st(1) being 0 are not specified. 2023-02-27 Uroš Bizjak gcc/ChangeLog: PR target/108922 Revert: * config/i386/i386.md (fmodxf3): Enable for flag_finite_math_only only. (fmod3): Ditto. (fpremxf4_i387): Ditto. (reminderxf3): Ditto. (reminder3): Ditto. (fprem1xf4_i387): Ditto. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Pushed to master. Uros. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 8ebb12be2c9..ed689b044c3 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -19527,8 +19527,7 @@ (set (reg:CCFP FPSR_REG) (unspec:CCFP [(match_dup 2) (match_dup 3)] UNSPEC_C2_FLAG))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" "fprem" [(set_attr "type" "fpspc") (set_attr "znver1_decode" "vector") @@ -19538,8 +19537,7 @@ [(use (match_operand:XF 0 "register_operand")) (use (match_operand:XF 1 "general_operand")) (use (match_operand:XF 2 "general_operand"))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" { rtx_code_label *label = gen_label_rtx (); @@ -19562,8 +19560,7 @@ [(use (match_operand:MODEF 0 "register_operand")) (use (match_operand:MODEF 1 "general_operand")) (use (match_operand:MODEF 2 "general_operand"))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" { rtx (*gen_truncxf) (rtx, rtx); @@ -19602,8 +19599,7 @@ (set (reg:CCFP FPSR_REG) (unspec:CCFP [(match_dup 2) (match_dup 3)] UNSPEC_C2_FLAG))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" "fprem1" [(set_attr "type" "fpspc") (set_attr "znver1_decode" "vector") @@ -19613,8 +19609,7 @@ [(use (match_operand:XF 0 "register_operand")) (use (match_operand:XF 1 "general_operand")) (use (match_operand:XF 2 "general_operand"))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" { rtx_code_label *label = gen_label_rtx (); @@ -19637,8 +19632,7 @@ [(use (match_operand:MODEF 0 "register_operand")) (use (match_operand:MODEF 1 "general_operand")) (use (match_operand:MODEF 2 "general_operand"))] - "TARGET_USE_FANCY_MATH_387 - && flag_finite_math_only" + "TARGET_USE_FANCY_MATH_387" { rtx (*gen_truncxf) (rtx, rtx);