From patchwork Fri Dec 11 20:48:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 1415266 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=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux-mips.org 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 4Ct2tW6vyjz9sSf for ; Sat, 12 Dec 2020 07:48:19 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9CACC3972474; Fri, 11 Dec 2020 20:48:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by sourceware.org (Postfix) with ESMTP id 9F8CA3857C4F for ; Fri, 11 Dec 2020 20:48:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9F8CA3857C4F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-mips.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=macro@linux-mips.org Received: from localhost.localdomain ([127.0.0.1]:47734 "EHLO localhost" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23994220AbgLKUsMQ70pB (ORCPT ); Fri, 11 Dec 2020 21:48:12 +0100 Date: Fri, 11 Dec 2020 20:48:12 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/3] VAX: Handle subtracting from self with QMATH DImode add/sub In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Remove an assertion the failure of which has not been actually observed, but which appears clearly dangerous, for when the QMATH DImode add/sub handler is invoked with the subtrahend and the minuend both the same. Instead handle the operation by emitting a move of constant 0 to the output operand. Adjust the relevant inline comment accordingly. gcc/ * config/vax/vax.c (vax_expand_addsub_di_operands): Handle equal input operands with subtraction. --- gcc/config/vax/vax.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) Index: gcc/gcc/config/vax/vax.c =================================================================== --- gcc.orig/gcc/config/vax/vax.c +++ gcc/gcc/config/vax/vax.c @@ -2042,12 +2042,14 @@ vax_expand_addsub_di_operands (rtx * ope } else { - /* If are adding the same value together, that's really a multiply by 2, - and that's just a left shift of 1. */ + /* If we are adding a value to itself, that's really a multiply by 2, + and that's just a left shift by 1. If subtracting, it's just 0. */ if (rtx_equal_p (operands[1], operands[2])) { - gcc_assert (code != MINUS); - emit_insn (gen_ashldi3 (operands[0], operands[1], const1_rtx)); + if (code == PLUS) + emit_insn (gen_ashldi3 (operands[0], operands[1], const1_rtx)); + else + emit_move_insn (operands[0], const0_rtx); return; }