From patchwork Wed Feb 12 07:05:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 1236660 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=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519398-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axis.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=B3ncXOJa; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48HVyn2vh0z9s3x for ; Wed, 12 Feb 2020 18:05:20 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:subject:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=T+e9Oc10xr09DqHG m7T6uhOCWQL7XgnFgs7DvniQb68CVmkX9E/RlqBNPlSZ/Rk2/B5hxuL67UGaHkWW WXSWd6gXXfd2M/NDiLTP0tCXwZDEkGioW7vmCB7w2nTzoeNfQV+Xxts/rhjdJPDE dYPj4igRwHY/4EwgAoPFrGm2O/Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:subject:mime-version:content-type :content-transfer-encoding; s=default; bh=2Af7bD4fcomi6OzjT60cco u9gZ0=; b=B3ncXOJaW5rdZX84OaTk3pwqPoRtnjEkKOSItw452biYqvaRBxg6Zw GoonT8V0t67V7INSHppTt860wEilrugUj8HTpsgACWwRiuguxa/xc/gguYI0+YB3 EXhHcs3Sxil3YIpcDrW+yCBU/7/cWSVUBsPB6cy+fcdCZVgk/+RP8= Received: (qmail 61592 invoked by alias); 12 Feb 2020 07:05:12 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 61580 invoked by uid 89); 12 Feb 2020 07:05:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: smtp2.axis.com Received: from smtp2.axis.com (HELO smtp2.axis.com) (195.60.68.18) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Feb 2020 07:05:10 +0000 IronPort-SDR: M3iw1ElD7g4Tjq31TLd/amJRVZOD38ZXaABPjeJpOtBLte+CnL8EPtxgCxhozRHcrkLVeWmr+B xIjs2QFJ7D4vLgO8ja5HtUOgVbr7eYrhv4BkzLOPgTEDMYDSLkpgVnDLb7RvnledHByrx6ZhV7 BnqEsnbB5svjZwMbsvfst1mz3uHebutihRaB0Rndb5Z04RCUVuBTqcKkAtyf9LTZgxtg1z3Tgh YMljLCdI7HK35G8IDVmXRSLqrfngST0vIDIGH1hkYJFrXKseXkSIGLAGMzv0fBBpQx4APXm+YG t6k= Date: Wed, 12 Feb 2020 08:05:07 +0100 Message-ID: <202002120705.01C757jv027193@ignucius.se.axis.com> From: Hans-Peter Nilsson To: Subject: [cris-decc0 14/14] cris: Enable "neg" to set condition codes. MIME-Version: 1.0 X-IsSubscribed: yes * config/cris/cris.c (cris_select_cc_mode): Return CC_NZmode for NEG too. Correct comment. * config/cris/cris.md ("neg2"): Rename from "neg2". While gcc seems to prefer transforming tests on the result of reversible operations, into tests on the original, it also can work with the destination, if allocated to the same register as it commonly-enough is. The re-use is easily covered in a test-case. (N.B.: the value 0x80000000 appears to be considered invalid and unimportant.) Spotted as a "microregression" in libgcc when comparing to the cc0 version. --- gcc/config/cris/cris.c | 8 ++++---- gcc/config/cris/cris.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index d0807adc8..2bad9393c 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -1531,9 +1531,9 @@ cris_select_cc_mode (enum rtx_code op, rtx x, rtx y) return CCmode; /* If we have a comparison that doesn't have to look at V or C, check - operand x; if it looks like a binary operator, return CC_NZmode, - else CCmode, so we only use CC_NZmode for the cases where we don't - actually have both V and C valid. */ + operand x; if it's a valid operator, return CC_NZmode, else CCmode, + so we only use CC_NZmode for the cases where we don't actually have + both V and C valid. */ if (op == EQ || op == NE || op == GTU || op == LEU || op == LT || op == GE) { @@ -1542,7 +1542,7 @@ cris_select_cc_mode (enum rtx_code op, rtx x, rtx y) /* Mentioning the rtx_code here is required but not sufficient: the insn also needs to be decorated with (and the anonymization prefix for a named pattern). */ - return e == PLUS || e == MINUS || e == MULT || e == NOT + return e == PLUS || e == MINUS || e == MULT || e == NOT || e == NEG ? CC_NZmode : CCmode; } diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md index 1e895a375..081041fa2 100644 --- a/gcc/config/cris/cris.md +++ b/gcc/config/cris/cris.md @@ -1734,7 +1734,7 @@ (define_insn "*expanded_negsf2" ;; No "negdi2" although we could make one up that may be faster than ;; the one in libgcc. -(define_insn "neg2" +(define_insn "neg2" [(set (match_operand:BWD 0 "register_operand" "=r") (neg:BWD (match_operand:BWD 1 "register_operand" "r"))) (clobber (reg:CC CRIS_CC0_REGNUM))]