From patchwork Tue Mar 16 19:20:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 1454180 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F0NRV0TFpz9sRR for ; Wed, 17 Mar 2021 06:20:36 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB925385481A; Tue, 16 Mar 2021 19:20:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from gcc1-power7.osuosl.org (gcc1-power7.osuosl.org [140.211.15.137]) by sourceware.org (Postfix) with ESMTP id A6FCB385480F for ; Tue, 16 Mar 2021 19:20:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A6FCB385480F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=segher@gcc1-power7.osuosl.org Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 7AEF9124028F; Tue, 16 Mar 2021 19:20:29 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Subject: [PATCH] rs6000: Workaround for PR98092 Date: Tue, 16 Mar 2021 19:20:27 +0000 Message-Id: X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Cc: Segher Boessenkool , dje.gcc@gmail.com Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The bcdinvalid_ RTL instruction uses the "unordered" comparison, which cannot be used if we have -ffinite-math-only. We really need CCMODEs that describe what bits in a CR field are set by other insns than just comparisons, but that is a lot more surgery, and it is stage 4 now. This patch does a simple workaround. 2021-03-16 Segher Boessenkool PR target/98092 * config/rs6000/predicates.md (branch_comparison_operator): Allow ordered and unordered for CCFPmode, if flag_finite_math_only. gcc/testsuite/ PR target/98092 * gcc.target/powerpc/pr98092.c: New. --- gcc/config/rs6000/predicates.md | 9 +++++---- gcc/testsuite/gcc.target/powerpc/pr98092.c | 7 +++++++ 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr98092.c diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index 69f3c709abbc..859af75dfbd1 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -1208,10 +1208,11 @@ (define_special_predicate "equality_operator" (define_predicate "branch_comparison_operator" (and (match_operand 0 "comparison_operator") (match_test "GET_MODE_CLASS (GET_MODE (XEXP (op, 0))) == MODE_CC") - (if_then_else (match_test "GET_MODE (XEXP (op, 0)) == CCFPmode - && !flag_finite_math_only") - (match_code "lt,gt,eq,unordered,unge,unle,ne,ordered") - (match_code "lt,ltu,le,leu,gt,gtu,ge,geu,eq,ne")) + (if_then_else (match_test "GET_MODE (XEXP (op, 0)) == CCFPmode") + (if_then_else (match_test "flag_finite_math_only") + (match_code "lt,le,gt,ge,eq,ne,unordered,ordered") + (match_code "lt,gt,eq,unordered,unge,unle,ne,ordered")) + (match_code "lt,ltu,le,leu,gt,gtu,ge,geu,eq,ne")) (match_test "validate_condition_mode (GET_CODE (op), GET_MODE (XEXP (op, 0))), 1"))) diff --git a/gcc/testsuite/gcc.target/powerpc/pr98092.c b/gcc/testsuite/gcc.target/powerpc/pr98092.c new file mode 100644 index 000000000000..03eab5a24ef7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr98092.c @@ -0,0 +1,7 @@ +/* { dg-options "-mdejagnu-cpu=power9 -ffinite-math-only" } */ + +int +h9 (__attribute__ ((altivec (vector__))) char un) +{ + return (__builtin_vec_bcdinvalid (un)); +}