From patchwork Fri May 3 15:36:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 794406 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp801056wrr; Fri, 3 May 2024 08:38:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVt0vPsAy/MNiBde4E7Lj0dTqX8TiGGcSvXqvsaqE8D6zr3/Nq78zzykhPdoVPrGLF5CL3adPHToQQnL1VcO8Oo X-Google-Smtp-Source: AGHT+IGR4FI1LA3C5m5D4eW+NjVnPNhENjpUwg5LK8DZLZnYMxY1v+NCptZFKOjqGGo8t1osGNoi X-Received: by 2002:a05:622a:1207:b0:43a:f23e:98ce with SMTP id y7-20020a05622a120700b0043af23e98cemr3226632qtx.67.1714750698398; Fri, 03 May 2024 08:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714750698; cv=none; d=google.com; s=arc-20160816; b=I+SeBu+xyY+HvgLEPXH+htts6NOH2WFMOwFYqmYzYIHhMmTxxHXakqUrqsIDuCTmwv 1Yw+t4opZ7N3VwjMbxEAYD0wkpPVGeIY9FEE0xns2AfhlZdiypk19S+H5IwmPjbVBCaR vMSUrxp+QT0WbSP6fnklHTjVIaGUT1d7hO4JP+8q2TttDN42OJ/xEHJJQW/UO9xMJYje m9eeGTCUTkSFZLaeTuorXStqUBR4NNZinUZmEeXN7IFKgNi80wg467QlTMIL7tkpswK3 wIuBoVqULQ58lmXSXh85pfyUhLcqq9WnpnsaJbCj9C681Hag+1P/y+NSUEz9OSAFjEd2 GixA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a7vgoVsqHzfmK76y1aCdJ7NQoyMwbf/Tg31Ldi1SHrk=; fh=qtn8prgQtzf5IzCNvLChUZDElvNECP6ej9YfjQeBz3I=; b=vFhRRYjEWsU6aBSJGP9PR+DuQLcA326Luh3a/lQMZ5dOtXLSdv8wvJSSGeEDERq13q C0ooYf1c7u8vFjVArQSF01BWL20rmALaW8OAbjj7ytivvSkKs7hy36wuoV5GysHxuDYN V3DuTdWXeyK1PwvQCGMgpeCOwqev6KpBTo77CztVWvWCNqNRtVs4zVFmKVDyLGj9/JNu ixu93XjUjg04MdLG24EiCAmHiIXqhHuFaVUxHgt019vCql63HNXbqm6stemxh5G6cc/V 22H/0HlZ9Xo4IH24EiG4urg5qSr5BNnfviR4DDmzsHc7d9Alu9ciheCcI7lDj9N04W9V aAPw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fjDJ1eaR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u14-20020a05622a14ce00b0043aea523a7asi3671183qtx.103.2024.05.03.08.38.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 May 2024 08:38:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fjDJ1eaR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2uyn-00057R-3q; Fri, 03 May 2024 11:37:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2uyY-0004Wg-MD for qemu-devel@nongnu.org; Fri, 03 May 2024 11:37:31 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2uyX-0002o7-0m for qemu-devel@nongnu.org; Fri, 03 May 2024 11:37:30 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a519e1b0e2dso1369678466b.2 for ; Fri, 03 May 2024 08:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714750647; x=1715355447; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a7vgoVsqHzfmK76y1aCdJ7NQoyMwbf/Tg31Ldi1SHrk=; b=fjDJ1eaREp8S61eKv6ySeGpdsOO6aZoAXuH6+TU+rkyZtdwFJQdwuiNnWAA4GyqyEi eztYD9FjHQfRUNK13XJlXcna4R9KhE51WlRfL7c+mlvj46bRncNvFbz/32LbdZAtwS0k l2jeGR5MPlYLcybJMnPeRAOEh0NofHIBOaXiTP2n0J7dbTSFfU5n7lW9oI5qyHOHhksL e/mAvS7dx9Vd0aGwW917K2f8pw9hH13QHM+n1h6jYcsRd1KdqkUNaP9xGZFOdMvw+Z4k bxMK7boyxAFsIzLWCyvztZoRnw+ELwFeITHWUXjjm8RYtel6iNhLxhOoyemca3FO4tWI jZeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714750647; x=1715355447; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a7vgoVsqHzfmK76y1aCdJ7NQoyMwbf/Tg31Ldi1SHrk=; b=uhyhNlDDmOaclHMuoGR9A1cQ75hlKTBTDFn1hcmgxuIgjwzWEhWB4ckb23OwfVGK0m N+6Ov5KIM4f1tqLSMYq76NwLPDbeJ+iHqo7815xvGdjVEZJyh8GnaUI17ujWQWVpmsh8 3sucW9XrBX8LvQdoY6qPBIHJ1owPIyUGPo6M+gAOYZ9hpXjPYgTASV5j8uLAghlDDUsv JZJDg0KbFZn8w7cPlmn7P7qKmg7mV8iHah8vIuBEGyt/kdHF1qDIqNQ/THlqxIRkivpi 07vfd544msx9u2StFfFwYWtW2ZPQv8CC2gPw+fOjFlAqIVSMowVUuSdYC22RadkA6R6t b8ag== X-Gm-Message-State: AOJu0YwLerWY5IC5/suT2EUGXkhz0dCAJdFqLL7HI+Jhf4WbXvFTZYRX uuNCJq/B5M9rSYWOlpl58ddDSa7xDtWHFE5BecD5kQSLi+9ayv+fJAVdVob4hJ3XwRPJ31WHiwk s X-Received: by 2002:a50:aa92:0:b0:56e:22bd:7e90 with SMTP id q18-20020a50aa92000000b0056e22bd7e90mr1502646edc.40.1714750647317; Fri, 03 May 2024 08:37:27 -0700 (PDT) Received: from m1x-phil.lan ([176.176.179.187]) by smtp.gmail.com with ESMTPSA id l11-20020a056402028b00b00572bba6745esm1771484edv.81.2024.05.03.08.37.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 May 2024 08:37:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 13/14] target/sh4: Rename TCGv variables as manual for SUBV opcode Date: Fri, 3 May 2024 17:36:12 +0200 Message-ID: <20240503153613.38709-14-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240503153613.38709-1-philmd@linaro.org> References: <20240503153613.38709-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org To easily compare with the SH4 manual, rename: REG(B11_8) -> Rn REG(B7_4) -> Rm t0 -> result Mention how underflow is calculated. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20240430163125.77430-5-philmd@linaro.org> --- target/sh4/translate.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 47c0f3404e..e599ab9d1a 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -933,16 +933,20 @@ static void _decode_opc(DisasContext * ctx) return; case 0x300b: /* subv Rm,Rn */ { - TCGv t0, t1, t2; - t0 = tcg_temp_new(); - tcg_gen_sub_i32(t0, REG(B11_8), REG(B7_4)); + TCGv Rn = REG(B11_8); + TCGv Rm = REG(B7_4); + TCGv result, t1, t2; + + result = tcg_temp_new(); t1 = tcg_temp_new(); - tcg_gen_xor_i32(t1, t0, REG(B11_8)); t2 = tcg_temp_new(); - tcg_gen_xor_i32(t2, REG(B11_8), REG(B7_4)); + tcg_gen_sub_i32(result, Rn, Rm); + /* T = ((Rn ^ Rm) & (Result ^ Rn)) >> 31 */ + tcg_gen_xor_i32(t1, result, Rn); + tcg_gen_xor_i32(t2, Rn, Rm); tcg_gen_and_i32(t1, t1, t2); tcg_gen_shri_i32(cpu_sr_t, t1, 31); - tcg_gen_mov_i32(REG(B11_8), t0); + tcg_gen_mov_i32(Rn, result); } return; case 0x2008: /* tst Rm,Rn */