From nobody Wed Nov 5 10:05:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499394721738408.86053439430873; Thu, 6 Jul 2017 19:32:01 -0700 (PDT) Received: from localhost ([::1]:54146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTJ3o-00017i-7a for importer@patchew.org; Thu, 06 Jul 2017 22:32:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTIwX-00038W-72 for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:24:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTIwW-0000wq-4A for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:24:29 -0400 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:36582) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTIwV-0000wV-VP for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:24:28 -0400 Received: by mail-qt0-x242.google.com with SMTP id v31so2716815qtb.3 for ; Thu, 06 Jul 2017 19:24:27 -0700 (PDT) Received: from bigtime.twiddle.net.com (rrcs-66-91-136-156.west.biz.rr.com. [66.91.136.156]) by smtp.gmail.com with ESMTPSA id i85sm1407176qke.66.2017.07.06.19.24.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jul 2017 19:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=G4BQ3QrdP0w0sg22ycSTniDlHtjGPLKDzVbB8fTM2D8=; b=WssgfRueXELsdRG3XdlTYBzgkaKpJZ4oPKUxTWlKYQBK13m+eDnYtPvhTg6HMwnHwl 7LMI1ddVnph7jVk2e/nQjPAsTG+CAz4U4xAuiMVjr+LWUH4OVWQAUeWMH9qjCTxnbytu +2PsbpCY6MKp0+eCd/q41o2XbDJsdXX3zK3+PCs01kRWrq6JhH5qc3DCtuzVD016je9j 1hWjrQ6gPcsVITDabj/WlviNl4uZdTi1tiMLWURzP6yAYhLUcbGyzbw/igQPTl9pbVyi 4HrSfyg/6eHRwf2whFY4ZOhyPuyK1YLI9ifZPVfC99vj//5Fm0rVMga+lZ9bUhJLSUBr 8lmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=G4BQ3QrdP0w0sg22ycSTniDlHtjGPLKDzVbB8fTM2D8=; b=izhoeaIgj/2/4niT1ZIKfdHjpRZ3XAMtYhINEgauj8ILYbMoXKt/HPvmVfqM2nF9ly Bu3qm4LZJ9V3k+WR/R3nvtTB4zpF9lOxFRx6KtknE9DI19DKwNNPysGMI7mbF4sVHEpw 9xukksI3UQ3VVyegMZYWwE1LeZojg2PLj2yFJKYIeo60khwW/lz6/ZBnoUOeweDQKXxZ +emfw9ywMNRJpVFvPGuIPepj5eiqPt4fPfq9uIThDxjOkUTJXo14aLnpDkNxC8oQtlM4 0PolBmVll+/mEorsgbJNNuZHRLSP/eaW+G1viYo24oQU+22DEaUYo0zvFfpDeCsCPwPF SYQw== X-Gm-Message-State: AIVw113yHAQmrMyMmr7lA9MeNxc1sckq36hCJ0elC1B7+kBxG/uCF1KX UenmINMlmotCzmk4nZY= X-Received: by 10.200.35.21 with SMTP id a21mr34591714qta.56.1499394267304; Thu, 06 Jul 2017 19:24:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 6 Jul 2017 16:20:59 -1000 Message-Id: <20170707022111.21836-16-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170707022111.21836-1-rth@twiddle.net> References: <20170707022111.21836-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::242 Subject: [Qemu-devel] [PATCH v2 15/27] target/sh4: Merge DREG into fpr64 routines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bruno@clisp.org, laurent@vivier.eu, aurelien@aurel32.net, glaubitz@debian.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Also add a debugging assert that we did signal illegal opc for odd double-precision registers. Signed-off-by: Richard Henderson Reviewed-by: Aurelien Jarno --- target/sh4/translate.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/target/sh4/translate.c b/target/sh4/translate.c index b6c3ff9..616e615 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -346,11 +346,17 @@ static void gen_delayed_conditional_jump(DisasContext= * ctx) =20 static inline void gen_load_fpr64(DisasContext *ctx, TCGv_i64 t, int reg) { + /* We have already signaled illegal instruction for odd Dr. */ + tcg_debug_assert((reg & 1) =3D=3D 0); + reg ^=3D ctx->fbank; tcg_gen_concat_i32_i64(t, cpu_fregs[reg + 1], cpu_fregs[reg]); } =20 static inline void gen_store_fpr64(DisasContext *ctx, TCGv_i64 t, int reg) { + /* We have already signaled illegal instruction for odd Dr. */ + tcg_debug_assert((reg & 1) =3D=3D 0); + reg ^=3D ctx->fbank; tcg_gen_extr_i64_i32(cpu_fregs[reg + 1], cpu_fregs[reg], t); } =20 @@ -369,8 +375,6 @@ static inline void gen_store_fpr64(DisasContext *ctx, T= CGv_i64 t, int reg) #define FREG(x) cpu_fregs[(x) ^ ctx->fbank] =20 #define XHACK(x) ((((x) & 1 ) << 4) | ((x) & 0xe)) -/* Assumes lsb of (x) is always 0 */ -#define DREG(x) ((x) ^ ctx->fbank) =20 #define CHECK_NOT_DELAY_SLOT \ if (ctx->envflags & DELAY_SLOT_MASK) { \ @@ -1100,8 +1104,8 @@ static void _decode_opc(DisasContext * ctx) break; /* illegal instruction */ fp0 =3D tcg_temp_new_i64(); fp1 =3D tcg_temp_new_i64(); - gen_load_fpr64(ctx, fp0, DREG(B11_8)); - gen_load_fpr64(ctx, fp1, DREG(B7_4)); + gen_load_fpr64(ctx, fp0, B11_8); + gen_load_fpr64(ctx, fp1, B7_4); switch (ctx->opcode & 0xf00f) { case 0xf000: /* fadd Rm,Rn */ gen_helper_fadd_DT(fp0, cpu_env, fp0, fp1); @@ -1122,7 +1126,7 @@ static void _decode_opc(DisasContext * ctx) gen_helper_fcmp_gt_DT(cpu_sr_t, cpu_env, fp0, fp1); return; } - gen_store_fpr64(ctx, fp0, DREG(B11_8)); + gen_store_fpr64(ctx, fp0, B11_8); tcg_temp_free_i64(fp0); tcg_temp_free_i64(fp1); } else { @@ -1714,7 +1718,7 @@ static void _decode_opc(DisasContext * ctx) break; /* illegal instruction */ fp =3D tcg_temp_new_i64(); gen_helper_float_DT(fp, cpu_env, cpu_fpul); - gen_store_fpr64(ctx, fp, DREG(B11_8)); + gen_store_fpr64(ctx, fp, B11_8); tcg_temp_free_i64(fp); } else { @@ -1728,7 +1732,7 @@ static void _decode_opc(DisasContext * ctx) if (ctx->opcode & 0x0100) break; /* illegal instruction */ fp =3D tcg_temp_new_i64(); - gen_load_fpr64(ctx, fp, DREG(B11_8)); + gen_load_fpr64(ctx, fp, B11_8); gen_helper_ftrc_DT(cpu_fpul, cpu_env, fp); tcg_temp_free_i64(fp); } @@ -1750,9 +1754,9 @@ static void _decode_opc(DisasContext * ctx) if (ctx->opcode & 0x0100) break; /* illegal instruction */ TCGv_i64 fp =3D tcg_temp_new_i64(); - gen_load_fpr64(ctx, fp, DREG(B11_8)); + gen_load_fpr64(ctx, fp, B11_8); gen_helper_fsqrt_DT(fp, cpu_env, fp); - gen_store_fpr64(ctx, fp, DREG(B11_8)); + gen_store_fpr64(ctx, fp, B11_8); tcg_temp_free_i64(fp); } else { gen_helper_fsqrt_FT(FREG(B11_8), cpu_env, FREG(B11_8)); @@ -1778,7 +1782,7 @@ static void _decode_opc(DisasContext * ctx) { TCGv_i64 fp =3D tcg_temp_new_i64(); gen_helper_fcnvsd_FT_DT(fp, cpu_env, cpu_fpul); - gen_store_fpr64(ctx, fp, DREG(B11_8)); + gen_store_fpr64(ctx, fp, B11_8); tcg_temp_free_i64(fp); } return; @@ -1786,7 +1790,7 @@ static void _decode_opc(DisasContext * ctx) CHECK_FPU_ENABLED { TCGv_i64 fp =3D tcg_temp_new_i64(); - gen_load_fpr64(ctx, fp, DREG(B11_8)); + gen_load_fpr64(ctx, fp, B11_8); gen_helper_fcnvds_DT_FT(cpu_fpul, cpu_env, fp); tcg_temp_free_i64(fp); } --=20 2.9.4