From patchwork Mon Nov 23 20:10:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1405058 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=IqIg9c8L; dkim-atps=neutral Received: from sourceware.org (unknown [8.43.85.97]) (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 4Cfyvk5Rt7z9sVh for ; Tue, 24 Nov 2020 07:10:58 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9B0F3836C08; Mon, 23 Nov 2020 20:10:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9B0F3836C08 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1606162253; bh=bb7QejLUvLC5BZNfnLRPiVcgq6GY5ZG1sNDiEGbLmSo=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=IqIg9c8LZHYj2ElNrOLucF4oTESQqZpesLnG2QXTZiwGJk2a5ItBMPuQ4btEFhAKo AAbx4+ZygpmcrSEq7YW8rtczzVaiyPFwjzMjde8aqaDGMuJcJ+AOT9gCUXKMfM9NOk 1tpb/v9SWltQtmCNXx27exDTBD0I03WRgpB85840= 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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id AFD9A386F407 for ; Mon, 23 Nov 2020 20:10:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AFD9A386F407 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-497-IoZA3GKFM225h1zbMUAkFw-1; Mon, 23 Nov 2020 15:10:44 -0500 X-MC-Unique: IoZA3GKFM225h1zbMUAkFw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E9EB18C89CD for ; Mon, 23 Nov 2020 20:10:43 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-152.phx2.redhat.com [10.3.113.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id E62A55D9D2 for ; Mon, 23 Nov 2020 20:10:42 +0000 (UTC) Subject: [committed] Adjust rtx_costs for h8300 To: GCC Patches Message-ID: Date: Mon, 23 Nov 2020 13:10:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, 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: , X-Patchwork-Original-From: Jeff Law via Gcc-patches From: Jeff Law Reply-To: Jeff Law Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" So the primary purpose of this patch is to make it easier to write tests for removal of useless test/compare insns on the H8. In simplest terms the costing model in the H8 port tends to encourage changing something like   x = y + 4;   if (x == 0) into   x = y + 4;   if (y == -4) This is a marginal de-optimization on the H8.  So fixing it makes the code ever-so-slightly better in isolation.   Fixing this also improves redundant test/compare elimination and makes writing tests for redundant test/compare elimination far easier.    gcc/             * config/h8300/h8300.c (h8300_rtx_costs): Handle the various             comparison rtx codes too. Committed to the trunk. Jeff diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 89cd793277a..31f7805f057 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -1205,6 +1205,16 @@ h8300_rtx_costs (rtx x, machine_mode mode ATTRIBUTE_UNUSED, int outer_code, return true; case COMPARE: + case NE: + case EQ: + case GE: + case GT: + case LE: + case LT: + case GEU: + case GTU: + case LEU: + case LTU: if (XEXP (x, 1) == const0_rtx) *total = 0; return false;