From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 231FD3858022 for ; Mon, 24 Oct 2022 10:55:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 231FD3858022 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 82160300089; Mon, 24 Oct 2022 10:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1666608943; bh=PrfywqKV8zwetURnCK33E4OKI2IqER4X0ce3MFEg9r0=; h=Message-ID:Date:Mime-Version:Subject:To:References:From: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=b/Y2EL0e0tc1KLWq7FRrSJEOggL0pzZDpfQfc4ipPM9ycqo2yD/KLngIaFJwapVDB QUSlpgsVaSPMZWRDrq0DkFu5MGmIMfuFmj64dzCkjQxuGAPJpMWP1BLm1WrVo3J3OX /ZYgbLwpxhsEmtkrDwlnTu64IoNrfqM1JPiismWc= Message-ID: <9a25e076-17d8-13b5-6ca5-abcda37d15b7@irq.a4lg.com> Date: Mon, 24 Oct 2022 19:55:41 +0900 Mime-Version: 1.0 Subject: Re: [PATCH 15/40] sim/h8300: Add "+ 0x0" to avoid self-assignments Content-Language: en-US To: Mike Frysinger , gdb-patches@sourceware.org References: <5ab303a5bdfc1da7832f8fa22f57678c9ef1a5fa.1666258361.git.research_trasio@irq.a4lg.com> From: Tsukasa OI In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 List-Id: On 2022/10/23 23:05, Mike Frysinger wrote: > On 20 Oct 2022 09:32, Tsukasa OI wrote: >> Clang generates a warning if there is a redundant self-assignment >> ("-Wself-assign"). On the default configuration, it causes a build failure >> (unless "--disable-werror" is specified). >> >> However, removing self-assignments in step_once function makes the code less >> readable. Instead, this commit inserts dummy addition to match the comments >> "Value added == 0". This is redundant but will suppress warnings and >> matches with other branches better. It will be also optimized away so we >> can ignore performance impact on this. >> --- >> sim/h8300/compile.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> --- a/sim/h8300/compile.c >> +++ b/sim/h8300/compile.c >> @@ -4141,7 +4141,7 @@ step_once (SIM_DESC sd, SIM_CPU *cpu) >> res = GET_B_REG (code->src.reg); /* FIXME fetch? */ >> if (!c && (0 <= (res >> 4) && (res >> 4) <= 9) && >> !h && (0 <= (res & 0xf) && (res & 0xf) <= 9)) >> - res = res; /* Value added == 0. */ >> + res = res + 0x0; /* Value added == 0. */ > > Andrew posted a patch to just delete the assignment. either is fine with me. > -mike I'll leave it for Andrew and I will withdraw following patches from my patchset: - PATCH 03/40 - PATCH 15/40 - PATCH 16/40 (wrote by Andrew) - PATCH 28/40 - PATCH 30/40 - PATCH 36/40 Because this patchset (intended to be a RFC PATCH) is a mere copy of my working branch, I need to sync with Andrew's work. Thanks, Tsukasa