From patchwork Fri May 11 04:23:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135495 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp394086lji; Thu, 10 May 2018 21:29:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZovnP3HM3uw8gFakCVqcuMqCflyFUyq0HZ/U2cd8GuAXo+FR1823J/RxC9YfuUYIdhB1la5 X-Received: by 2002:ac8:73c4:: with SMTP id v4-v6mr4064368qtp.115.1526012969050; Thu, 10 May 2018 21:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526012969; cv=none; d=google.com; s=arc-20160816; b=XnU5JZ5en4NPQ4J/xlfoQdrFO35XfQctMYFjFSTXWWhrui8WPFzj9tAKKQ3nNeoocV M/EoCMpmpdqhH+sSdwplwoDVMGYMPsgth4PI6r26dceKGjC9J6l0b+20WB/m59Dfe7nP 5XPwwCm04gClRGDXS8Bt3TgI980ZLwvJwyVD4lvw6w5bHyba9ALZFau04dA9dJRSZAHj 0lhLBFwDsALU/4wK7mEy2oaeEEzwOz9CGq3JNpC1d/lhPNiGmp2KAdAYibD4EgS3VknZ RPYHlJCDpX+OKdZ7dPfEXMICroQaTOcfoiqmjewQ0Ev92S4UQANLXo0wLAtwBKx3dSh/ CIIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=z7p2K9NKWam7z055uDI/yGQyctt6xvQmsMmSqbtcR4Q=; b=yDnr00HfO8EmPHzt6Dd+uvAK/D+2RTsiKc8JxD8wGgswQHuGOwmoTUUsnDTiZ+li0J MPiXjSdh4fUnkxAee3akD6vQk/95S5bJk1JKMzD+7ThYWv6KJpF1VM43yHMzyBDRvJez i2uVRnzsXYlW2IRoIRDX2mwW6Qg0FwTfLOXM8ND4jvz9dNtIqcO6y4N8KQnnHug9NGIM v7SakrpOJusDSY4f4EBdVMwLJcBuAG+HqMnfRbNfY4RlmGElMp/bYC6GJu+REnmCsEEJ JZtJQ6YA2Y8dv0CEvK2wvN1lQAOIEyVJhMKvluwQx9smxfAP3A7nRBmwyPaVd8jFzAgI 8SUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GIwd1VQN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 2-v6si2382059qku.200.2018.05.10.21.29.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:29:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GIwd1VQN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzgO-0007rm-Cj for patch@linaro.org; Fri, 11 May 2018 00:29:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzae-0000Wz-Sg for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzac-00085H-61 for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:32 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:33239) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzab-00085D-SJ for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:30 -0400 Received: by mail-pf0-x244.google.com with SMTP id f20-v6so2101705pfn.0 for ; Thu, 10 May 2018 21:23:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=z7p2K9NKWam7z055uDI/yGQyctt6xvQmsMmSqbtcR4Q=; b=GIwd1VQN1EZBC1N8095JfG68tcdJnGtV0a0nN0nmWatl+VCeNr/WHfSl5mwOvA9TQ8 EokhhBY+9ImY6Ytbet8tUGeeYXjExBMwWezEcayHn5aiIXSMms5GVrJX+ggMCf6Zsjed lI9fXhhTDzPzq4PtKh7FHHGCAR6AK25Izkxfo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=z7p2K9NKWam7z055uDI/yGQyctt6xvQmsMmSqbtcR4Q=; b=Dv9QptGLSBUgR/8aXVR8A+7Bh9KVe+mx14plbOJmPgMSroUBc3nXmUcAV5Jw5KE8wt KEShORm2k8ScRtIqJxaWnS4qW0ISlw7gLgk7JdxYpDw58XxnOUyO9fMUiOtA2mp1ml+C TEjTXKmwbtBqzlWD/TUnY58pmg2WUXeso/Ur600g4gddqKac3dJ6P+WT8hjfvkhP22w+ kRaTSv8uELm1luDp9V6GX1AtJV2CXq8JVvzsxTBdbVFKKclMc2NtS0h17ycH591PU9/e inlDLPJQ/9BqYsoTtljgEMkGUPTYnZfKBaLPjZ6zuFAsd75Ame21mr0oibNgf9i60brs bm3g== X-Gm-Message-State: ALKqPwcLBop9qmKWE6+/tOjYEDuAGjy9vUl45SDwRM0fIyC+sVRPuRef giHlX/WP5WY2cMudFlDtLj2nR4hQ474= X-Received: by 2002:a65:4d44:: with SMTP id j4-v6mr3255593pgt.344.1526012608304; Thu, 10 May 2018 21:23:28 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:12 -0700 Message-Id: <20180511042324.5070-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::244 Subject: [Qemu-devel] [PULL 01/13] target-openrisc: Write back result before FPE exception 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: peter.maydell@linaro.org, Stafford Horne , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The architecture manual is unclear about this, but the or1ksim does writeback before the exception. This requires splitting the helpers in half, with the exception raised by the second. Acked-by: Stafford Horne Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- target/openrisc/helper.h | 25 ++-- target/openrisc/fpu_helper.c | 250 +++++++---------------------------- target/openrisc/translate.c | 101 +++++++++----- 3 files changed, 125 insertions(+), 251 deletions(-) -- 2.17.0 diff --git a/target/openrisc/helper.h b/target/openrisc/helper.h index 4fd1a6bb8e..e37dabc77a 100644 --- a/target/openrisc/helper.h +++ b/target/openrisc/helper.h @@ -24,17 +24,19 @@ DEF_HELPER_FLAGS_1(ove_ov, TCG_CALL_NO_WG, void, env) DEF_HELPER_FLAGS_1(ove_cyov, TCG_CALL_NO_WG, void, env) /* float */ -DEF_HELPER_FLAGS_2(itofd, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_2(itofs, TCG_CALL_NO_WG, i32, env, i32) -DEF_HELPER_FLAGS_2(ftoid, TCG_CALL_NO_WG, i64, env, i64) -DEF_HELPER_FLAGS_2(ftois, TCG_CALL_NO_WG, i32, env, i32) +DEF_HELPER_FLAGS_1(update_fpcsr, TCG_CALL_NO_WG, void, env) -DEF_HELPER_FLAGS_4(float_madd_s, TCG_CALL_NO_WG, i32, env, i32, i32, i32) -DEF_HELPER_FLAGS_4(float_madd_d, TCG_CALL_NO_WG, i64, env, i64, i64, i64) +DEF_HELPER_FLAGS_2(itofd, TCG_CALL_NO_RWG, i64, env, i64) +DEF_HELPER_FLAGS_2(itofs, TCG_CALL_NO_RWG, i32, env, i32) +DEF_HELPER_FLAGS_2(ftoid, TCG_CALL_NO_RWG, i64, env, i64) +DEF_HELPER_FLAGS_2(ftois, TCG_CALL_NO_RWG, i32, env, i32) + +DEF_HELPER_FLAGS_4(float_madd_s, TCG_CALL_NO_RWG, i32, env, i32, i32, i32) +DEF_HELPER_FLAGS_4(float_madd_d, TCG_CALL_NO_RWG, i64, env, i64, i64, i64) #define FOP_CALC(op) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, i32, i32) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_RWG, i32, env, i32, i32) \ +DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_RWG, i64, env, i64, i64) FOP_CALC(add) FOP_CALC(sub) FOP_CALC(mul) @@ -43,14 +45,11 @@ FOP_CALC(rem) #undef FOP_CALC #define FOP_CMP(op) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_WG, i32, env, i32, i32) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_WG, i64, env, i64, i64) +DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_RWG, tl, env, i32, i32) \ +DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_RWG, tl, env, i64, i64) FOP_CMP(eq) FOP_CMP(lt) FOP_CMP(le) -FOP_CMP(ne) -FOP_CMP(gt) -FOP_CMP(ge) #undef FOP_CMP /* interrupt */ diff --git a/target/openrisc/fpu_helper.c b/target/openrisc/fpu_helper.c index 977a1e8e55..265ce13337 100644 --- a/target/openrisc/fpu_helper.c +++ b/target/openrisc/fpu_helper.c @@ -24,121 +24,70 @@ #include "exception.h" #include "fpu/softfloat.h" -static inline uint32_t ieee_ex_to_openrisc(OpenRISCCPU *cpu, int fexcp) +static int ieee_ex_to_openrisc(int fexcp) { int ret = 0; - if (fexcp) { - if (fexcp & float_flag_invalid) { - cpu->env.fpcsr |= FPCSR_IVF; - ret = 1; - } - if (fexcp & float_flag_overflow) { - cpu->env.fpcsr |= FPCSR_OVF; - ret = 1; - } - if (fexcp & float_flag_underflow) { - cpu->env.fpcsr |= FPCSR_UNF; - ret = 1; - } - if (fexcp & float_flag_divbyzero) { - cpu->env.fpcsr |= FPCSR_DZF; - ret = 1; - } - if (fexcp & float_flag_inexact) { - cpu->env.fpcsr |= FPCSR_IXF; - ret = 1; - } + if (fexcp & float_flag_invalid) { + ret |= FPCSR_IVF; + } + if (fexcp & float_flag_overflow) { + ret |= FPCSR_OVF; + } + if (fexcp & float_flag_underflow) { + ret |= FPCSR_UNF; + } + if (fexcp & float_flag_divbyzero) { + ret |= FPCSR_DZF; + } + if (fexcp & float_flag_inexact) { + ret |= FPCSR_IXF; } - return ret; } -static inline void update_fpcsr(OpenRISCCPU *cpu) +void HELPER(update_fpcsr)(CPUOpenRISCState *env) { - int tmp = ieee_ex_to_openrisc(cpu, - get_float_exception_flags(&cpu->env.fp_status)); + int tmp = get_float_exception_flags(&env->fp_status); - SET_FP_CAUSE(cpu->env.fpcsr, tmp); - if ((GET_FP_ENABLE(cpu->env.fpcsr) & tmp) && - (cpu->env.fpcsr & FPCSR_FPEE)) { - helper_exception(&cpu->env, EXCP_FPE); - } else { - UPDATE_FP_FLAGS(cpu->env.fpcsr, tmp); + if (tmp) { + set_float_exception_flags(0, &env->fp_status); + tmp = ieee_ex_to_openrisc(tmp); + if (tmp) { + env->fpcsr |= tmp; + if (env->fpcsr & FPCSR_FPEE) { + helper_exception(env, EXCP_FPE); + } + } } } uint64_t HELPER(itofd)(CPUOpenRISCState *env, uint64_t val) { - uint64_t itofd; - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - - set_float_exception_flags(0, &cpu->env.fp_status); - itofd = int32_to_float64(val, &cpu->env.fp_status); - update_fpcsr(cpu); - - return itofd; + return int32_to_float64(val, &env->fp_status); } uint32_t HELPER(itofs)(CPUOpenRISCState *env, uint32_t val) { - uint32_t itofs; - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - - set_float_exception_flags(0, &cpu->env.fp_status); - itofs = int32_to_float32(val, &cpu->env.fp_status); - update_fpcsr(cpu); - - return itofs; + return int32_to_float32(val, &env->fp_status); } uint64_t HELPER(ftoid)(CPUOpenRISCState *env, uint64_t val) { - uint64_t ftoid; - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - - set_float_exception_flags(0, &cpu->env.fp_status); - ftoid = float32_to_int64(val, &cpu->env.fp_status); - update_fpcsr(cpu); - - return ftoid; + return float32_to_int64(val, &env->fp_status); } uint32_t HELPER(ftois)(CPUOpenRISCState *env, uint32_t val) { - uint32_t ftois; - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - - set_float_exception_flags(0, &cpu->env.fp_status); - ftois = float32_to_int32(val, &cpu->env.fp_status); - update_fpcsr(cpu); - - return ftois; + return float32_to_int32(val, &env->fp_status); } -#define FLOAT_OP(name, p) void helper_float_##_##p(void) - #define FLOAT_CALC(name) \ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ uint64_t fdt0, uint64_t fdt1) \ -{ \ - uint64_t result; \ - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ - set_float_exception_flags(0, &cpu->env.fp_status); \ - result = float64_ ## name(fdt0, fdt1, &cpu->env.fp_status); \ - update_fpcsr(cpu); \ - return result; \ -} \ - \ +{ return float64_ ## name(fdt0, fdt1, &env->fp_status); } \ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ uint32_t fdt0, uint32_t fdt1) \ -{ \ - uint32_t result; \ - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ - set_float_exception_flags(0, &cpu->env.fp_status); \ - result = float32_ ## name(fdt0, fdt1, &cpu->env.fp_status); \ - update_fpcsr(cpu); \ - return result; \ -} \ +{ return float32_ ## name(fdt0, fdt1, &env->fp_status); } FLOAT_CALC(add) FLOAT_CALC(sub) @@ -151,132 +100,29 @@ FLOAT_CALC(rem) uint64_t helper_float_madd_d(CPUOpenRISCState *env, uint64_t a, uint64_t b, uint64_t c) { - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - uint64_t result; - set_float_exception_flags(0, &cpu->env.fp_status); - /* Note that or1ksim doesn't use merged operation. */ - result = float64_mul(b, c, &cpu->env.fp_status); - result = float64_add(result, a, &cpu->env.fp_status); - update_fpcsr(cpu); - return result; + /* Note that or1ksim doesn't use fused operation. */ + b = float64_mul(b, c, &env->fp_status); + return float64_add(a, b, &env->fp_status); } uint32_t helper_float_madd_s(CPUOpenRISCState *env, uint32_t a, uint32_t b, uint32_t c) { - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - uint32_t result; - set_float_exception_flags(0, &cpu->env.fp_status); - /* Note that or1ksim doesn't use merged operation. */ - result = float32_mul(b, c, &cpu->env.fp_status); - result = float32_add(result, a, &cpu->env.fp_status); - update_fpcsr(cpu); - return result; + /* Note that or1ksim doesn't use fused operation. */ + b = float32_mul(b, c, &env->fp_status); + return float32_add(a, b, &env->fp_status); } -#define FLOAT_CMP(name) \ -uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ -{ \ - int res; \ - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ - set_float_exception_flags(0, &cpu->env.fp_status); \ - res = float64_ ## name(fdt0, fdt1, &cpu->env.fp_status); \ - update_fpcsr(cpu); \ - return res; \ -} \ - \ -uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ - uint32_t fdt0, uint32_t fdt1)\ -{ \ - int res; \ - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ - set_float_exception_flags(0, &cpu->env.fp_status); \ - res = float32_ ## name(fdt0, fdt1, &cpu->env.fp_status); \ - update_fpcsr(cpu); \ - return res; \ -} +#define FLOAT_CMP(name, impl) \ +target_ulong helper_float_ ## name ## _d(CPUOpenRISCState *env, \ + uint64_t fdt0, uint64_t fdt1) \ +{ return float64_ ## impl(fdt0, fdt1, &env->fp_status); } \ +target_ulong helper_float_ ## name ## _s(CPUOpenRISCState *env, \ + uint32_t fdt0, uint32_t fdt1) \ +{ return float32_ ## impl(fdt0, fdt1, &env->fp_status); } -FLOAT_CMP(le) -FLOAT_CMP(eq) -FLOAT_CMP(lt) +FLOAT_CMP(le, le) +FLOAT_CMP(lt, lt) +FLOAT_CMP(eq, eq_quiet) #undef FLOAT_CMP - - -#define FLOAT_CMPNE(name) \ -uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ -{ \ - int res; \ - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ - set_float_exception_flags(0, &cpu->env.fp_status); \ - res = !float64_eq_quiet(fdt0, fdt1, &cpu->env.fp_status); \ - update_fpcsr(cpu); \ - return res; \ -} \ - \ -uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ - uint32_t fdt0, uint32_t fdt1) \ -{ \ - int res; \ - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ - set_float_exception_flags(0, &cpu->env.fp_status); \ - res = !float32_eq_quiet(fdt0, fdt1, &cpu->env.fp_status); \ - update_fpcsr(cpu); \ - return res; \ -} - -FLOAT_CMPNE(ne) -#undef FLOAT_CMPNE - -#define FLOAT_CMPGT(name) \ -uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ -{ \ - int res; \ - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ - set_float_exception_flags(0, &cpu->env.fp_status); \ - res = !float64_le(fdt0, fdt1, &cpu->env.fp_status); \ - update_fpcsr(cpu); \ - return res; \ -} \ - \ -uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ - uint32_t fdt0, uint32_t fdt1) \ -{ \ - int res; \ - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ - set_float_exception_flags(0, &cpu->env.fp_status); \ - res = !float32_le(fdt0, fdt1, &cpu->env.fp_status); \ - update_fpcsr(cpu); \ - return res; \ -} -FLOAT_CMPGT(gt) -#undef FLOAT_CMPGT - -#define FLOAT_CMPGE(name) \ -uint64_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ - uint64_t fdt0, uint64_t fdt1) \ -{ \ - int res; \ - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ - set_float_exception_flags(0, &cpu->env.fp_status); \ - res = !float64_lt(fdt0, fdt1, &cpu->env.fp_status); \ - update_fpcsr(cpu); \ - return res; \ -} \ - \ -uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ - uint32_t fdt0, uint32_t fdt1) \ -{ \ - int res; \ - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); \ - set_float_exception_flags(0, &cpu->env.fp_status); \ - res = !float32_lt(fdt0, fdt1, &cpu->env.fp_status); \ - update_fpcsr(cpu); \ - return res; \ -} - -FLOAT_CMPGE(ge) -#undef FLOAT_CMPGE diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 2747b24cf0..6876317971 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1294,180 +1294,209 @@ static void dec_float(DisasContext *dc, uint32_t insn) rd = extract32(insn, 21, 5); switch (op0) { - case 0x00: /* lf.add.s */ + case 0x00: /* lf.add.s */ LOG_DIS("lf.add.s r%d, r%d, r%d\n", rd, ra, rb); check_r0_write(rd); gen_helper_float_add_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x01: /* lf.sub.s */ + case 0x01: /* lf.sub.s */ LOG_DIS("lf.sub.s r%d, r%d, r%d\n", rd, ra, rb); check_r0_write(rd); gen_helper_float_sub_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; case 0x02: /* lf.mul.s */ LOG_DIS("lf.mul.s r%d, r%d, r%d\n", rd, ra, rb); check_r0_write(rd); gen_helper_float_mul_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x03: /* lf.div.s */ + case 0x03: /* lf.div.s */ LOG_DIS("lf.div.s r%d, r%d, r%d\n", rd, ra, rb); check_r0_write(rd); gen_helper_float_div_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x04: /* lf.itof.s */ + case 0x04: /* lf.itof.s */ LOG_DIS("lf.itof r%d, r%d\n", rd, ra); check_r0_write(rd); gen_helper_itofs(cpu_R[rd], cpu_env, cpu_R[ra]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x05: /* lf.ftoi.s */ + case 0x05: /* lf.ftoi.s */ LOG_DIS("lf.ftoi r%d, r%d\n", rd, ra); check_r0_write(rd); gen_helper_ftois(cpu_R[rd], cpu_env, cpu_R[ra]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x06: /* lf.rem.s */ + case 0x06: /* lf.rem.s */ LOG_DIS("lf.rem.s r%d, r%d, r%d\n", rd, ra, rb); check_r0_write(rd); gen_helper_float_rem_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x07: /* lf.madd.s */ + case 0x07: /* lf.madd.s */ LOG_DIS("lf.madd.s r%d, r%d, r%d\n", rd, ra, rb); check_r0_write(rd); gen_helper_float_madd_s(cpu_R[rd], cpu_env, cpu_R[rd], cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x08: /* lf.sfeq.s */ + case 0x08: /* lf.sfeq.s */ LOG_DIS("lf.sfeq.s r%d, r%d\n", ra, rb); gen_helper_float_eq_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x09: /* lf.sfne.s */ + case 0x09: /* lf.sfne.s */ LOG_DIS("lf.sfne.s r%d, r%d\n", ra, rb); - gen_helper_float_ne_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_float_eq_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + tcg_gen_xori_tl(cpu_sr_f, cpu_sr_f, 1); + gen_helper_update_fpcsr(cpu_env); break; - case 0x0a: /* lf.sfgt.s */ + case 0x0a: /* lf.sfgt.s */ LOG_DIS("lf.sfgt.s r%d, r%d\n", ra, rb); - gen_helper_float_gt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_float_lt_s(cpu_sr_f, cpu_env, cpu_R[rb], cpu_R[ra]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x0b: /* lf.sfge.s */ + case 0x0b: /* lf.sfge.s */ LOG_DIS("lf.sfge.s r%d, r%d\n", ra, rb); - gen_helper_float_ge_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_float_le_s(cpu_sr_f, cpu_env, cpu_R[rb], cpu_R[ra]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x0c: /* lf.sflt.s */ + case 0x0c: /* lf.sflt.s */ LOG_DIS("lf.sflt.s r%d, r%d\n", ra, rb); gen_helper_float_lt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x0d: /* lf.sfle.s */ + case 0x0d: /* lf.sfle.s */ LOG_DIS("lf.sfle.s r%d, r%d\n", ra, rb); gen_helper_float_le_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; -/* not used yet, open it when we need or64. */ -/*#ifdef TARGET_OPENRISC64 - case 0x10: lf.add.d +#ifdef TARGET_OPENRISC64 + case 0x10: /* lf.add.d */ LOG_DIS("lf.add.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); check_r0_write(rd); gen_helper_float_add_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x11: lf.sub.d + case 0x11: /* lf.sub.d */ LOG_DIS("lf.sub.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); check_r0_write(rd); gen_helper_float_sub_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x12: lf.mul.d + case 0x12: /* lf.mul.d */ LOG_DIS("lf.mul.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); check_r0_write(rd); gen_helper_float_mul_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x13: lf.div.d + case 0x13: /* lf.div.d */ LOG_DIS("lf.div.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); check_r0_write(rd); gen_helper_float_div_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x14: lf.itof.d + case 0x14: /* lf.itof.d */ LOG_DIS("lf.itof r%d, r%d\n", rd, ra); check_of64s(dc); check_r0_write(rd); gen_helper_itofd(cpu_R[rd], cpu_env, cpu_R[ra]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x15: lf.ftoi.d + case 0x15: /* lf.ftoi.d */ LOG_DIS("lf.ftoi r%d, r%d\n", rd, ra); check_of64s(dc); check_r0_write(rd); gen_helper_ftoid(cpu_R[rd], cpu_env, cpu_R[ra]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x16: lf.rem.d + case 0x16: /* lf.rem.d */ LOG_DIS("lf.rem.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); check_r0_write(rd); gen_helper_float_rem_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x17: lf.madd.d + case 0x17: /* lf.madd.d */ LOG_DIS("lf.madd.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); check_r0_write(rd); gen_helper_float_madd_d(cpu_R[rd], cpu_env, cpu_R[rd], cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x18: lf.sfeq.d + case 0x18: /* lf.sfeq.d */ LOG_DIS("lf.sfeq.d r%d, r%d\n", ra, rb); check_of64s(dc); gen_helper_float_eq_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x1a: lf.sfgt.d + case 0x1a: /* lf.sfgt.d */ LOG_DIS("lf.sfgt.d r%d, r%d\n", ra, rb); check_of64s(dc); - gen_helper_float_gt_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_float_lt_d(cpu_sr_f, cpu_env, cpu_R[rb], cpu_R[ra]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x1b: lf.sfge.d + case 0x1b: /* lf.sfge.d */ LOG_DIS("lf.sfge.d r%d, r%d\n", ra, rb); check_of64s(dc); - gen_helper_float_ge_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_float_le_d(cpu_sr_f, cpu_env, cpu_R[rb], cpu_R[ra]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x19: lf.sfne.d + case 0x19: /* lf.sfne.d */ LOG_DIS("lf.sfne.d r%d, r%d\n", ra, rb); check_of64s(dc); - gen_helper_float_ne_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_float_eq_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + tcg_gen_xori_tl(cpu_sr_f, cpu_sr_f, 1); + gen_helper_update_fpcsr(cpu_env); break; - case 0x1c: lf.sflt.d + case 0x1c: /* lf.sflt.d */ LOG_DIS("lf.sflt.d r%d, r%d\n", ra, rb); check_of64s(dc); gen_helper_float_lt_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; - case 0x1d: lf.sfle.d + case 0x1d: /* lf.sfle.d */ LOG_DIS("lf.sfle.d r%d, r%d\n", ra, rb); check_of64s(dc); gen_helper_float_le_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); + gen_helper_update_fpcsr(cpu_env); break; -#endif*/ +#endif default: gen_illegal_exception(dc); From patchwork Fri May 11 04:23:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135491 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp392230lji; Thu, 10 May 2018 21:26:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpaTBBw8kIQ9DAWAzY/C0UfoSyfK9M+aG7Yi3T1u6GAfCqXsNAxGGMtXiX4q97BviU4VS1c X-Received: by 2002:a37:58c6:: with SMTP id m189-v6mr3647545qkb.144.1526012790547; Thu, 10 May 2018 21:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526012790; cv=none; d=google.com; s=arc-20160816; b=gZy5S7/UEZF0Tl8yXDbvuNzRtBYraLxzGrPvWa28nFm7IasGQEadQPsB/7WuVgmv0B vwhCBP6haA0msA9eXGWmt4q7aKPk4IoHwecfxWK/qcG3Da7N7UURUxJbNs9quTpcaGmt 03w4L4LhC5hGQ1kOJneJQhdGUmP8rZ+wvPDfr+SWrJ6kogcD9w30IVO9zYfthD3mH2N8 L2PSa/7+YSI47xpJENjaDlkCe4MzQvpW8l6xhj064rxZs1O0MGWfSJ+kcrlj1MeVqBvm 9xPtTbXkig0vENdiyleZ4X6yaGciGSz6Ar3aKp7irBGMd/Nvs/6xaH/HoGu/l8U/m/RZ uO0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=BiBMArvzBSclTtl+JJFYqnT65X4b0tbCIMNHU7EnCa8=; b=BbZZreBfS2RS9VU8gxmLGgbWd4n3snaEE9twQijzEWDogxc5U2jF2tSpFArtdSpZAX anVxEEQQYSeOWqPmE9YIICmrGS1ItRcEWrDuGCKICWR8Bw6N+Eq0Rg4SKAh/T0v8/ykI u8XdzdUwaI7GjcuMCEkPkoFilxRzNfHr6Cz1DHUA/EQyxFLbjIYavfhzLvynQd+5dnIY JKbb/9c73rLJ4TYaT+s+R3FtinJ78puBIwpcP7tmDrpnAVHq7kfVa+iL2iWTaXoyBo5M oSnX9Gc+eqsrPEDJA++kBlqpITjWjoyosdXOt3EOX4OiLY8FdWOoHNlAS5bXEW1/G+yi v8YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=M5DF0Em2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c52-v6si2416108qtc.267.2018.05.10.21.26.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=M5DF0Em2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36682 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzdV-0004rb-SQ for patch@linaro.org; Fri, 11 May 2018 00:26:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzae-0000X0-Uk for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzad-00085k-KQ for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:32 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:46426) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzad-00085U-DX for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:31 -0400 Received: by mail-pg0-x244.google.com with SMTP id z4-v6so1881375pgu.13 for ; Thu, 10 May 2018 21:23:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BiBMArvzBSclTtl+JJFYqnT65X4b0tbCIMNHU7EnCa8=; b=M5DF0Em2xu3YYMGb42MM8hiufWUF2WvtEYJ5rs7Y9U6Zu/XyeuA350+wqu/VIzGa6G jpfFil66dHxZFO4P5QhBPho8WiI/nlsIKMUxIPF+TV2KOIrX2VsdlFRsWf+G82cvJm8p zF/VKhUT6W60C95PAir2U4+7ZiTrRHuRh7XK8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BiBMArvzBSclTtl+JJFYqnT65X4b0tbCIMNHU7EnCa8=; b=tLNCC8t1mcgSX2vD+802CNP2nATPhgHXeHTJGr+q+a7ang0jq7dzWh1wkCp/oERfZn CNSOvgBgLIU+W8GkyGmTWLsh6gTrS1g33eRC0Xl2AFBlTrRAdkttB3f0Mm5iktPkjmIn 0LGYJBqNf7eOIxi+M2Jx9Zr3SWOrpxDY8ZkCNoK/hq5vxBIsCu8x/ReBB2gI+uZt/AA2 EhASZI/2fh/a9Lob/gBjEZ2D2tEIcw7YAfrMstfLInt/9e8EQLHXzEqxOAsdg5Li2P5n 4lkbKud4ngS0bvDOw3oqFopgvchvTjzoHLj6T1EPFSrJYnV1FgTILBReOsjvp37JYGVs IbCw== X-Gm-Message-State: ALKqPwe8nz55lO9RUqbSadqd6yVRwNmxbmDgthTNbbQr3kSzKjiMzZ+0 dwhhM4bjj2xS5K2Pq81ONMRwdWl4vsI= X-Received: by 2002:a65:4acd:: with SMTP id c13-v6mr3274487pgu.32.1526012610059; Thu, 10 May 2018 21:23:30 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:13 -0700 Message-Id: <20180511042324.5070-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PULL 02/13] target/openrisc: Start conversion to decodetree.py 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Begin with the 0x08 major opcode, the system instructions. Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 79 +++++++++++++++++------------------ target/openrisc/Makefile.objs | 9 ++++ target/openrisc/insns.decode | 28 +++++++++++++ 3 files changed, 76 insertions(+), 40 deletions(-) create mode 100644 target/openrisc/insns.decode -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 6876317971..40b21a5db1 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -31,6 +31,7 @@ #include "exec/helper-proto.h" #include "exec/helper-gen.h" +#include "exec/gen-icount.h" #include "trace-tcg.h" #include "exec/log.h" @@ -53,6 +54,9 @@ typedef struct DisasContext { bool singlestep_enabled; } DisasContext; +/* Include the auto-generated decoder. */ +#include "decode.inc.c" + static TCGv cpu_sr; static TCGv cpu_R[32]; static TCGv cpu_R0; @@ -67,7 +71,6 @@ static TCGv cpu_lock_value; static TCGv_i32 fpcsr; static TCGv_i64 cpu_mac; /* MACHI:MACLO */ static TCGv_i32 cpu_dflag; -#include "exec/gen-icount.h" void openrisc_translate_init(void) { @@ -1243,45 +1246,40 @@ static void dec_compi(DisasContext *dc, uint32_t insn) } } -static void dec_sys(DisasContext *dc, uint32_t insn) +static bool trans_l_sys(DisasContext *dc, arg_l_sys *a, uint32_t insn) { - uint32_t op0; - uint32_t K16; + LOG_DIS("l.sys %d\n", a->k); + tcg_gen_movi_tl(cpu_pc, dc->pc); + gen_exception(dc, EXCP_SYSCALL); + dc->is_jmp = DISAS_UPDATE; + return true; +} - op0 = extract32(insn, 16, 10); - K16 = extract32(insn, 0, 16); +static bool trans_l_trap(DisasContext *dc, arg_l_trap *a, uint32_t insn) +{ + LOG_DIS("l.trap %d\n", a->k); + tcg_gen_movi_tl(cpu_pc, dc->pc); + gen_exception(dc, EXCP_TRAP); + return true; +} - switch (op0) { - case 0x000: /* l.sys */ - LOG_DIS("l.sys %d\n", K16); - tcg_gen_movi_tl(cpu_pc, dc->pc); - gen_exception(dc, EXCP_SYSCALL); - dc->is_jmp = DISAS_UPDATE; - break; +static bool trans_l_msync(DisasContext *dc, arg_l_msync *a, uint32_t insn) +{ + LOG_DIS("l.msync\n"); + tcg_gen_mb(TCG_MO_ALL); + return true; +} - case 0x100: /* l.trap */ - LOG_DIS("l.trap %d\n", K16); - tcg_gen_movi_tl(cpu_pc, dc->pc); - gen_exception(dc, EXCP_TRAP); - break; +static bool trans_l_psync(DisasContext *dc, arg_l_psync *a, uint32_t insn) +{ + LOG_DIS("l.psync\n"); + return true; +} - case 0x300: /* l.csync */ - LOG_DIS("l.csync\n"); - break; - - case 0x200: /* l.msync */ - LOG_DIS("l.msync\n"); - tcg_gen_mb(TCG_MO_ALL); - break; - - case 0x270: /* l.psync */ - LOG_DIS("l.psync\n"); - break; - - default: - gen_illegal_exception(dc); - break; - } +static bool trans_l_csync(DisasContext *dc, arg_l_csync *a, uint32_t insn) +{ + LOG_DIS("l.csync\n"); + return true; } static void dec_float(DisasContext *dc, uint32_t insn) @@ -1509,17 +1507,18 @@ static void disas_openrisc_insn(DisasContext *dc, OpenRISCCPU *cpu) uint32_t op0; uint32_t insn; insn = cpu_ldl_code(&cpu->env, dc->pc); - op0 = extract32(insn, 26, 6); + /* Transition to the auto-generated decoder. */ + if (decode(dc, insn)) { + return; + } + + op0 = extract32(insn, 26, 6); switch (op0) { case 0x06: dec_M(dc, insn); break; - case 0x08: - dec_sys(dc, insn); - break; - case 0x2e: dec_logic(dc, insn); break; diff --git a/target/openrisc/Makefile.objs b/target/openrisc/Makefile.objs index 918b1c6e9c..1b98a911ea 100644 --- a/target/openrisc/Makefile.objs +++ b/target/openrisc/Makefile.objs @@ -3,3 +3,12 @@ obj-y += cpu.o exception.o interrupt.o mmu.o translate.o obj-y += exception_helper.o fpu_helper.o \ interrupt_helper.o mmu_helper.o sys_helper.o obj-y += gdbstub.o + +DECODETREE = $(SRC_PATH)/scripts/decodetree.py + +target/openrisc/decode.inc.c: \ + $(SRC_PATH)/target/openrisc/insns.decode $(DECODETREE) + $(call quiet-command,\ + $(PYTHON) $(DECODETREE) -o $@ $<, "GEN", $(TARGET_DIR)$@) + +target/openrisc/translate.o: target/openrisc/decode.inc.c diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode new file mode 100644 index 0000000000..47d31afc5b --- /dev/null +++ b/target/openrisc/insns.decode @@ -0,0 +1,28 @@ +# +# OpenRISC instruction decode definitions. +# +# Copyright (c) 2018 Richard Henderson +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . +# + +#### +# System Instructions +#### + +l_sys 001000 0000000000 k:16 +l_trap 001000 0100000000 k:16 +l_msync 001000 1000000000 00000000 00000000 +l_psync 001000 1010000000 00000000 00000000 +l_csync 001000 1100000000 00000000 00000000 From patchwork Fri May 11 04:23:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135489 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp390655lji; Thu, 10 May 2018 21:24:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoGh+++mH8q4UH7UN+nNT6R2M7uF4ApP6ZgqgiN/hMHLCLuV2CabbavYmUFQLE/x4bWnsMT X-Received: by 2002:a37:1f0f:: with SMTP id f15-v6mr3580302qkf.421.1526012645084; Thu, 10 May 2018 21:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526012645; cv=none; d=google.com; s=arc-20160816; b=TpG1mC+1iYnkj2CMhvRJ3IxnIAfDyXillDTY3OkOThQkCqKVze8HRoHMBmFqFrrK8a TySFTQwTVjehVyZhBiI3HvnIPmA8EPUmi8DwcM3+yFbRvxGEDGsU65wGDz9n1dUx+YGL INV7qIZqZ8s26Gx+FLe/QYTnMYwsNzOhCC11NhFQYsaT8QvaQ77/Y3swnwlorluUvBGh dq8+or5QrrufRilXV3RLc2yBh0W5iDzXAZqNlWxMICOuXTPwygqAkC9fF/UtCSa52XT+ uTPOkrCXYg0x/AOV8DFMq9P726IZR883De1n4a7xmTs3eJLZ4NN44L5FTwtix/2YItvK HDwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=tT+S22tWudduYX9UJYbKgHZL6JwAHlr4YVC3LpEsAQk=; b=ZyFPo4olh0S0gzXtzEwNuqg3c20XrXZavAzCJBAIwriHos/guCJjZRnDG00/zp8sYY McOzGuAtTpC4PS6ebxE1SzvQ7TFthmcGtvWNq3lHHDY0U+BISKt3W57Fuyj9zR21iKHL PExsJ0u1XV5QHkS97rU3m5dMrLkTvSo3YmsZUe4l1EErlYRyrWFs7+AZB9ec841SFeN0 Cq62lS0s/TO7QrZCBfvN8qfpP4XrFyXG8u0QduNCK8UhJHTCsAU/z4Kb3XA2mfJ37lew mrPPBa6IsW9bCrQzpI3VbnqyxDi/ED3ud+WuRxnFYcuLkWDei258Nc7O9MeQD97NYqVt a4sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EjQU50P1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 24-v6si2370725qtw.104.2018.05.10.21.24.04 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EjQU50P1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzbA-0000Z0-FC for patch@linaro.org; Fri, 11 May 2018 00:24:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzag-0000XD-2k for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzaf-00086D-0l for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:34 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:36572) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzae-00085u-Ov for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:32 -0400 Received: by mail-pf0-x242.google.com with SMTP id w129-v6so2100207pfd.3 for ; Thu, 10 May 2018 21:23:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tT+S22tWudduYX9UJYbKgHZL6JwAHlr4YVC3LpEsAQk=; b=EjQU50P14OHlrJO1LCfpUDaz+A6AuX9hDZV3RKo02o/WvsGo/I/5Oxm2Q/q7TluxEK dJX1xvs+2foGL77QKHhEvspYROODfr8/migkhWdTsBeMdi6g/JNC3BciBWD7qVzNiv1v t3WcCmgluzopknQiz5ovGiwn3ucklScDK/Umg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tT+S22tWudduYX9UJYbKgHZL6JwAHlr4YVC3LpEsAQk=; b=DzWpRxOQ8wfp9Jl2N/LyQvrxMJb3WvAXBbOJfpBo/E6NsQDua4bG48T8YCTS/bT1Cs PNWTfwHVE6t9NOyIep7zoE/Viwcz5GRINL7ckNyFMuPwsgy/2QsGSJn3fVVTIQZP6f2p 9b/fZVM3ftCq8HQahqqPayCcH01M81VgBrFF01GbRHkkrC/T9ctJI/wtaF2WdEc7XX/o GWa9mKevuRtpkazFgIa+BgKnO2mUK4ub5SKvETlP92bSUgwRWtMPR5BQKYYHlQvhwTOn ftYQP1kl4xtYWmt6noUUVsYi94IxAMPnNXnbGVbroNrJHhm00hgo9Cd2rpUjcE83QJYN NLag== X-Gm-Message-State: ALKqPwdu7cdnXrlOd0RSymZ3TtAFr1b0p7KXvOqDSRFwopcVsbG1590q 9x2H7I4DVv7qwLU75YNQ/JG6Cq9A4cU= X-Received: by 2002:a63:3286:: with SMTP id y128-v6mr3277995pgy.419.1526012611386; Thu, 10 May 2018 21:23:31 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:14 -0700 Message-Id: <20180511042324.5070-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::242 Subject: [Qemu-devel] [PULL 03/13] target/openrisc: Convert branch insns 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 149 +++++++++++++++++------------------ target/openrisc/insns.decode | 12 +++ 2 files changed, 83 insertions(+), 78 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 40b21a5db1..95e4f17b8a 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -195,52 +195,6 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) } } -static void gen_jump(DisasContext *dc, int32_t n26, uint32_t reg, uint32_t op0) -{ - target_ulong tmp_pc = dc->pc + n26 * 4; - - switch (op0) { - case 0x00: /* l.j */ - tcg_gen_movi_tl(jmp_pc, tmp_pc); - break; - case 0x01: /* l.jal */ - tcg_gen_movi_tl(cpu_R[9], dc->pc + 8); - /* Optimize jal being used to load the PC for PIC. */ - if (tmp_pc == dc->pc + 8) { - return; - } - tcg_gen_movi_tl(jmp_pc, tmp_pc); - break; - case 0x03: /* l.bnf */ - case 0x04: /* l.bf */ - { - TCGv t_next = tcg_const_tl(dc->pc + 8); - TCGv t_true = tcg_const_tl(tmp_pc); - TCGv t_zero = tcg_const_tl(0); - - tcg_gen_movcond_tl(op0 == 0x03 ? TCG_COND_EQ : TCG_COND_NE, - jmp_pc, cpu_sr_f, t_zero, t_true, t_next); - - tcg_temp_free(t_next); - tcg_temp_free(t_true); - tcg_temp_free(t_zero); - } - break; - case 0x11: /* l.jr */ - tcg_gen_mov_tl(jmp_pc, cpu_R[reg]); - break; - case 0x12: /* l.jalr */ - tcg_gen_movi_tl(cpu_R[9], (dc->pc + 8)); - tcg_gen_mov_tl(jmp_pc, cpu_R[reg]); - break; - default: - gen_illegal_exception(dc); - break; - } - - dc->delayed_branch = 2; -} - static void gen_ove_cy(DisasContext *dc) { if (dc->tb_flags & SR_OVE) { @@ -715,12 +669,82 @@ static void dec_calc(DisasContext *dc, uint32_t insn) gen_illegal_exception(dc); } +static bool trans_l_j(DisasContext *dc, arg_l_j *a, uint32_t insn) +{ + target_ulong tmp_pc = dc->pc + a->n * 4; + + LOG_DIS("l.j %d\n", a->n); + tcg_gen_movi_tl(jmp_pc, tmp_pc); + dc->delayed_branch = 2; + return true; +} + +static bool trans_l_jal(DisasContext *dc, arg_l_jal *a, uint32_t insn) +{ + target_ulong tmp_pc = dc->pc + a->n * 4; + + LOG_DIS("l.jal %d\n", a->n); + tcg_gen_movi_tl(cpu_R[9], dc->pc + 8); + /* Optimize jal being used to load the PC for PIC. */ + if (tmp_pc != dc->pc + 8) { + tcg_gen_movi_tl(jmp_pc, tmp_pc); + dc->delayed_branch = 2; + } + return true; +} + +static void do_bf(DisasContext *dc, arg_l_bf *a, TCGCond cond) +{ + target_ulong tmp_pc = dc->pc + a->n * 4; + TCGv t_next = tcg_const_tl(dc->pc + 8); + TCGv t_true = tcg_const_tl(tmp_pc); + TCGv t_zero = tcg_const_tl(0); + + tcg_gen_movcond_tl(cond, jmp_pc, cpu_sr_f, t_zero, t_true, t_next); + + tcg_temp_free(t_next); + tcg_temp_free(t_true); + tcg_temp_free(t_zero); + dc->delayed_branch = 2; +} + +static bool trans_l_bf(DisasContext *dc, arg_l_bf *a, uint32_t insn) +{ + LOG_DIS("l.bf %d\n", a->n); + do_bf(dc, a, TCG_COND_NE); + return true; +} + +static bool trans_l_bnf(DisasContext *dc, arg_l_bf *a, uint32_t insn) +{ + LOG_DIS("l.bnf %d\n", a->n); + do_bf(dc, a, TCG_COND_EQ); + return true; +} + +static bool trans_l_jr(DisasContext *dc, arg_l_jr *a, uint32_t insn) +{ + LOG_DIS("l.jr r%d\n", a->b); + tcg_gen_mov_tl(jmp_pc, cpu_R[a->b]); + dc->delayed_branch = 2; + return true; +} + +static bool trans_l_jalr(DisasContext *dc, arg_l_jalr *a, uint32_t insn) +{ + LOG_DIS("l.jalr r%d\n", a->b); + tcg_gen_mov_tl(jmp_pc, cpu_R[a->b]); + tcg_gen_movi_tl(cpu_R[9], dc->pc + 8); + dc->delayed_branch = 2; + return true; +} + static void dec_misc(DisasContext *dc, uint32_t insn) { uint32_t op0, op1; uint32_t ra, rb, rd; uint32_t L6, K5, K16, K5_11; - int32_t I16, I5_11, N26; + int32_t I16, I5_11; TCGMemOp mop; TCGv t0; @@ -733,31 +757,10 @@ static void dec_misc(DisasContext *dc, uint32_t insn) K5 = extract32(insn, 0, 5); K16 = extract32(insn, 0, 16); I16 = (int16_t)K16; - N26 = sextract32(insn, 0, 26); K5_11 = (extract32(insn, 21, 5) << 11) | extract32(insn, 0, 11); I5_11 = (int16_t)K5_11; switch (op0) { - case 0x00: /* l.j */ - LOG_DIS("l.j %d\n", N26); - gen_jump(dc, N26, 0, op0); - break; - - case 0x01: /* l.jal */ - LOG_DIS("l.jal %d\n", N26); - gen_jump(dc, N26, 0, op0); - break; - - case 0x03: /* l.bnf */ - LOG_DIS("l.bnf %d\n", N26); - gen_jump(dc, N26, 0, op0); - break; - - case 0x04: /* l.bf */ - LOG_DIS("l.bf %d\n", N26); - gen_jump(dc, N26, 0, op0); - break; - case 0x05: switch (op1) { case 0x01: /* l.nop */ @@ -770,16 +773,6 @@ static void dec_misc(DisasContext *dc, uint32_t insn) } break; - case 0x11: /* l.jr */ - LOG_DIS("l.jr r%d\n", rb); - gen_jump(dc, 0, rb, op0); - break; - - case 0x12: /* l.jalr */ - LOG_DIS("l.jalr r%d\n", rb); - gen_jump(dc, 0, rb, op0); - break; - case 0x13: /* l.maci */ LOG_DIS("l.maci r%d, %d\n", ra, I16); t0 = tcg_const_tl(I16); diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 47d31afc5b..8d35011eab 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -26,3 +26,15 @@ l_trap 001000 0100000000 k:16 l_msync 001000 1000000000 00000000 00000000 l_psync 001000 1010000000 00000000 00000000 l_csync 001000 1100000000 00000000 00000000 + +#### +# Branch Instructions +#### + +l_j 000000 n:s26 +l_jal 000001 n:s26 +l_bnf 000011 n:s26 +l_bf 000100 n:s26 + +l_jr 010001 ---------- b:5 ----------- +l_jalr 010010 ---------- b:5 ----------- From patchwork Fri May 11 04:23:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135492 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp392288lji; Thu, 10 May 2018 21:26:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrtMr4CKGs9Uj2s78flDeyrgHM9QjeA/yARhKgvpkw1OufmskQo0olhKyD08rBn7v3Jf2XR X-Received: by 2002:a0c:f604:: with SMTP id r4-v6mr3755901qvm.138.1526012797533; Thu, 10 May 2018 21:26:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526012797; cv=none; d=google.com; s=arc-20160816; b=ULBs+uojdpPHxft502KOWp8bCErhT9YQwomY33zHF55lr3HyDOVrEudtrVMh0nzl2R RkvuCBnLcgvcLs5IIdoqsXUk0qfdofNDM+sch2ss4VtZUaj7pUuDpgzNV0s8SlVdUuUB ZpDfPfeJL33viez7Yak8EZIflL3ISsnD6dBQhGHcwasAZvIQGtDwO/OlaO6iI3UXhjyX Yq7G+iGLP9DNFzyAVeHkPasYmPNTMWE3GmdXvwWAo3wIq71voiwQRFMalOcvwVwMKduT ZPMh7e7kNKGqp6lXHPzd4Wr+k1BSoyc5yHCk/KgFlF6jKzN3YinDvo0NWsNJlJM8JyyH 86AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=zsI0RVSM+qLeg8XVbhVfnXoz4we68zyXDzGOtdcEwv8=; b=dvhOv9kkIZRRrJgNndip5XAgAoRsmHbUp7uf3Z3x9hBy0MbF/StwqobLwjXukcoyZl a63AlDF2Qc2luWjXRa97LM1YqlDINsyqD30tnI93U3izMWWlORIN2SkaNdBwrVIBZuzk NcSb65bz9KCMFOITcG1VXCoTmB77Zj/G5iFyO9JAQIEln6Ucy2qN4svSzPMlySzuIaiS HRb7gXfKK7AIsud2kr7rO8h3FrfPc+1LCIn/yBmWasJyYSxiCxxgntIvOlJDe29+xRcD QK79LRWjLDk68eC50NnpbRUADauJ29WFE+zJK/zFdO/k4gu/BKfQu/ZcQc/OhGB02v+e nTkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KWQgywzb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n20-v6si901509qtb.20.2018.05.10.21.26.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:26:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KWQgywzb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36686 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzdc-0004xH-Uo for patch@linaro.org; Fri, 11 May 2018 00:26:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzai-0000Yj-4N for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzag-00086k-Bw for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:36 -0400 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:38368) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzag-00086K-4L for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:34 -0400 Received: by mail-pg0-x241.google.com with SMTP id n9-v6so1887806pgq.5 for ; Thu, 10 May 2018 21:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zsI0RVSM+qLeg8XVbhVfnXoz4we68zyXDzGOtdcEwv8=; b=KWQgywzbKkQ+yHOYYChQv+Tmjn7BXwfjxX0/FIm4jYCrLiuzogsnEwG6Z85r8uHd/8 JW4hGO0LWkXZ4KFP7U9LMTkXmmTsiP3oeGQ1BUizmALJEufcTZAisplqyDsbMDW/PhpE MCh5eVjDKdm7/cgf+9P/iYjkYgCZIF8wc1A0o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zsI0RVSM+qLeg8XVbhVfnXoz4we68zyXDzGOtdcEwv8=; b=hMCr/r3Sf1pu7Tl1svRg3AQSOdZSTgzwwe/IfrS7hVe3qbch/9V5HP55gRxIcEZxA6 exiqi+7R7fqnsK4cu+g0D8jm3ypM18X+1aA+ykp55+ij0cieC2ZAx42IPeDX5WvZlGTa OUKQQk9qmBqqFIVFekp/Rrxo98zuet2YzWa5F8VVp9Z1lzenhL5eJrk8xeMLCi95ATt3 rjceo7Eu6w3sNslV4NJvrwACZGLRBL7c/b25CLZI4lE2QhPqZOudGjUsLbt2rGIFYplo uPjG/Ej/XrpXL4n8UilLx/c2q9q63yp/JDiNfSXQds09ATMOKEHKnuBKQTeubNdisxHO jimw== X-Gm-Message-State: ALKqPwdvbqZGVUrIv1uECCYFkC2ftvPq48xApxDUE30xDBGtsgAkM9/M DN1jDIm8Lmc4QuwMmVRDuD7KV1STuko= X-Received: by 2002:a65:4b4d:: with SMTP id k13-v6mr3149863pgt.198.1526012612691; Thu, 10 May 2018 21:23:32 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:15 -0700 Message-Id: <20180511042324.5070-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::241 Subject: [Qemu-devel] [PULL 04/13] target/openrisc: Convert memory insns 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 275 +++++++++++++++++------------------ target/openrisc/insns.decode | 24 +++ 2 files changed, 160 insertions(+), 139 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 95e4f17b8a..794002aaaa 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -457,51 +457,6 @@ static void gen_msbu(DisasContext *dc, TCGv srca, TCGv srcb) gen_ove_cy(dc); } -static void gen_lwa(DisasContext *dc, TCGv rd, TCGv ra, int32_t ofs) -{ - TCGv ea = tcg_temp_new(); - - tcg_gen_addi_tl(ea, ra, ofs); - tcg_gen_qemu_ld_tl(rd, ea, dc->mem_idx, MO_TEUL); - tcg_gen_mov_tl(cpu_lock_addr, ea); - tcg_gen_mov_tl(cpu_lock_value, rd); - tcg_temp_free(ea); -} - -static void gen_swa(DisasContext *dc, int b, TCGv ra, int32_t ofs) -{ - TCGv ea, val; - TCGLabel *lab_fail, *lab_done; - - ea = tcg_temp_new(); - tcg_gen_addi_tl(ea, ra, ofs); - - /* For TB_FLAGS_R0_0, the branch below invalidates the temporary assigned - to cpu_R[0]. Since l.swa is quite often immediately followed by a - branch, don't bother reallocating; finish the TB using the "real" R0. - This also takes care of RB input across the branch. */ - cpu_R[0] = cpu_R0; - - lab_fail = gen_new_label(); - lab_done = gen_new_label(); - tcg_gen_brcond_tl(TCG_COND_NE, ea, cpu_lock_addr, lab_fail); - tcg_temp_free(ea); - - val = tcg_temp_new(); - tcg_gen_atomic_cmpxchg_tl(val, cpu_lock_addr, cpu_lock_value, - cpu_R[b], dc->mem_idx, MO_TEUL); - tcg_gen_setcond_tl(TCG_COND_EQ, cpu_sr_f, val, cpu_lock_value); - tcg_temp_free(val); - - tcg_gen_br(lab_done); - - gen_set_label(lab_fail); - tcg_gen_movi_tl(cpu_sr_f, 0); - - gen_set_label(lab_done); - tcg_gen_movi_tl(cpu_lock_addr, -1); -} - static void dec_calc(DisasContext *dc, uint32_t insn) { uint32_t op0, op1, op2; @@ -739,13 +694,147 @@ static bool trans_l_jalr(DisasContext *dc, arg_l_jalr *a, uint32_t insn) return true; } +static bool trans_l_lwa(DisasContext *dc, arg_load *a, uint32_t insn) +{ + TCGv ea; + + LOG_DIS("l.lwa r%d, r%d, %d\n", a->d, a->a, a->i); + + check_r0_write(a->d); + ea = tcg_temp_new(); + tcg_gen_addi_tl(ea, cpu_R[a->a], a->i); + tcg_gen_qemu_ld_tl(cpu_R[a->d], ea, dc->mem_idx, MO_TEUL); + tcg_gen_mov_tl(cpu_lock_addr, ea); + tcg_gen_mov_tl(cpu_lock_value, cpu_R[a->d]); + tcg_temp_free(ea); + return true; +} + +static void do_load(DisasContext *dc, arg_load *a, TCGMemOp mop) +{ + TCGv ea; + + check_r0_write(a->d); + ea = tcg_temp_new(); + tcg_gen_addi_tl(ea, cpu_R[a->a], a->i); + tcg_gen_qemu_ld_tl(cpu_R[a->d], ea, dc->mem_idx, mop); + tcg_temp_free(ea); +} + +static bool trans_l_lwz(DisasContext *dc, arg_load *a, uint32_t insn) +{ + LOG_DIS("l.lwz r%d, r%d, %d\n", a->d, a->a, a->i); + do_load(dc, a, MO_TEUL); + return true; +} + +static bool trans_l_lws(DisasContext *dc, arg_load *a, uint32_t insn) +{ + LOG_DIS("l.lws r%d, r%d, %d\n", a->d, a->a, a->i); + do_load(dc, a, MO_TESL); + return true; +} + +static bool trans_l_lbz(DisasContext *dc, arg_load *a, uint32_t insn) +{ + LOG_DIS("l.lbz r%d, r%d, %d\n", a->d, a->a, a->i); + do_load(dc, a, MO_UB); + return true; +} + +static bool trans_l_lbs(DisasContext *dc, arg_load *a, uint32_t insn) +{ + LOG_DIS("l.lbs r%d, r%d, %d\n", a->d, a->a, a->i); + do_load(dc, a, MO_SB); + return true; +} + +static bool trans_l_lhz(DisasContext *dc, arg_load *a, uint32_t insn) +{ + LOG_DIS("l.lhz r%d, r%d, %d\n", a->d, a->a, a->i); + do_load(dc, a, MO_TEUW); + return true; +} + +static bool trans_l_lhs(DisasContext *dc, arg_load *a, uint32_t insn) +{ + LOG_DIS("l.lhs r%d, r%d, %d\n", a->d, a->a, a->i); + do_load(dc, a, MO_TESW); + return true; +} + +static bool trans_l_swa(DisasContext *dc, arg_store *a, uint32_t insn) +{ + TCGv ea, val; + TCGLabel *lab_fail, *lab_done; + + LOG_DIS("l.swa r%d, r%d, %d\n", a->a, a->b, a->i); + + ea = tcg_temp_new(); + tcg_gen_addi_tl(ea, cpu_R[a->a], a->i); + + /* For TB_FLAGS_R0_0, the branch below invalidates the temporary assigned + to cpu_R[0]. Since l.swa is quite often immediately followed by a + branch, don't bother reallocating; finish the TB using the "real" R0. + This also takes care of RB input across the branch. */ + cpu_R[0] = cpu_R0; + + lab_fail = gen_new_label(); + lab_done = gen_new_label(); + tcg_gen_brcond_tl(TCG_COND_NE, ea, cpu_lock_addr, lab_fail); + tcg_temp_free(ea); + + val = tcg_temp_new(); + tcg_gen_atomic_cmpxchg_tl(val, cpu_lock_addr, cpu_lock_value, + cpu_R[a->b], dc->mem_idx, MO_TEUL); + tcg_gen_setcond_tl(TCG_COND_EQ, cpu_sr_f, val, cpu_lock_value); + tcg_temp_free(val); + + tcg_gen_br(lab_done); + + gen_set_label(lab_fail); + tcg_gen_movi_tl(cpu_sr_f, 0); + + gen_set_label(lab_done); + tcg_gen_movi_tl(cpu_lock_addr, -1); + return true; +} + +static void do_store(DisasContext *dc, arg_store *a, TCGMemOp mop) +{ + TCGv t0 = tcg_temp_new(); + tcg_gen_addi_tl(t0, cpu_R[a->a], a->i); + tcg_gen_qemu_st_tl(cpu_R[a->b], t0, dc->mem_idx, mop); + tcg_temp_free(t0); +} + +static bool trans_l_sw(DisasContext *dc, arg_store *a, uint32_t insn) +{ + LOG_DIS("l.sw r%d, r%d, %d\n", a->a, a->b, a->i); + do_store(dc, a, MO_TEUL); + return true; +} + +static bool trans_l_sb(DisasContext *dc, arg_store *a, uint32_t insn) +{ + LOG_DIS("l.sb r%d, r%d, %d\n", a->a, a->b, a->i); + do_store(dc, a, MO_UB); + return true; +} + +static bool trans_l_sh(DisasContext *dc, arg_store *a, uint32_t insn) +{ + LOG_DIS("l.sh r%d, r%d, %d\n", a->a, a->b, a->i); + do_store(dc, a, MO_TEUW); + return true; +} + static void dec_misc(DisasContext *dc, uint32_t insn) { uint32_t op0, op1; uint32_t ra, rb, rd; uint32_t L6, K5, K16, K5_11; - int32_t I16, I5_11; - TCGMemOp mop; + int32_t I16; TCGv t0; op0 = extract32(insn, 26, 6); @@ -758,7 +847,6 @@ static void dec_misc(DisasContext *dc, uint32_t insn) K16 = extract32(insn, 0, 16); I16 = (int16_t)K16; K5_11 = (extract32(insn, 21, 5) << 11) | extract32(insn, 0, 11); - I5_11 = (int16_t)K5_11; switch (op0) { case 0x05: @@ -796,12 +884,6 @@ static void dec_misc(DisasContext *dc, uint32_t insn) } break; - case 0x1b: /* l.lwa */ - LOG_DIS("l.lwa r%d, r%d, %d\n", rd, ra, I16); - check_r0_write(rd); - gen_lwa(dc, cpu_R[rd], cpu_R[ra], I16); - break; - case 0x1c: /* l.cust1 */ LOG_DIS("l.cust1\n"); break; @@ -834,53 +916,6 @@ static void dec_misc(DisasContext *dc, uint32_t insn) LOG_DIS("l.cust8\n"); break; -/* not used yet, open it when we need or64. */ -/*#ifdef TARGET_OPENRISC64 - case 0x20: l.ld - LOG_DIS("l.ld r%d, r%d, %d\n", rd, ra, I16); - check_ob64s(dc); - mop = MO_TEQ; - goto do_load; -#endif*/ - - case 0x21: /* l.lwz */ - LOG_DIS("l.lwz r%d, r%d, %d\n", rd, ra, I16); - mop = MO_TEUL; - goto do_load; - - case 0x22: /* l.lws */ - LOG_DIS("l.lws r%d, r%d, %d\n", rd, ra, I16); - mop = MO_TESL; - goto do_load; - - case 0x23: /* l.lbz */ - LOG_DIS("l.lbz r%d, r%d, %d\n", rd, ra, I16); - mop = MO_UB; - goto do_load; - - case 0x24: /* l.lbs */ - LOG_DIS("l.lbs r%d, r%d, %d\n", rd, ra, I16); - mop = MO_SB; - goto do_load; - - case 0x25: /* l.lhz */ - LOG_DIS("l.lhz r%d, r%d, %d\n", rd, ra, I16); - mop = MO_TEUW; - goto do_load; - - case 0x26: /* l.lhs */ - LOG_DIS("l.lhs r%d, r%d, %d\n", rd, ra, I16); - mop = MO_TESW; - goto do_load; - - do_load: - check_r0_write(rd); - t0 = tcg_temp_new(); - tcg_gen_addi_tl(t0, cpu_R[ra], I16); - tcg_gen_qemu_ld_tl(cpu_R[rd], t0, dc->mem_idx, mop); - tcg_temp_free(t0); - break; - case 0x27: /* l.addi */ LOG_DIS("l.addi r%d, r%d, %d\n", rd, ra, I16); check_r0_write(rd); @@ -958,44 +993,6 @@ static void dec_misc(DisasContext *dc, uint32_t insn) } break; - case 0x33: /* l.swa */ - LOG_DIS("l.swa r%d, r%d, %d\n", ra, rb, I5_11); - gen_swa(dc, rb, cpu_R[ra], I5_11); - break; - -/* not used yet, open it when we need or64. */ -/*#ifdef TARGET_OPENRISC64 - case 0x34: l.sd - LOG_DIS("l.sd r%d, r%d, %d\n", ra, rb, I5_11); - check_ob64s(dc); - mop = MO_TEQ; - goto do_store; -#endif*/ - - case 0x35: /* l.sw */ - LOG_DIS("l.sw r%d, r%d, %d\n", ra, rb, I5_11); - mop = MO_TEUL; - goto do_store; - - case 0x36: /* l.sb */ - LOG_DIS("l.sb r%d, r%d, %d\n", ra, rb, I5_11); - mop = MO_UB; - goto do_store; - - case 0x37: /* l.sh */ - LOG_DIS("l.sh r%d, r%d, %d\n", ra, rb, I5_11); - mop = MO_TEUW; - goto do_store; - - do_store: - { - TCGv t0 = tcg_temp_new(); - tcg_gen_addi_tl(t0, cpu_R[ra], I5_11); - tcg_gen_qemu_st_tl(cpu_R[rb], t0, dc->mem_idx, mop); - tcg_temp_free(t0); - } - break; - default: gen_illegal_exception(dc); break; diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 8d35011eab..ba5356abe1 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -38,3 +38,27 @@ l_bf 000100 n:s26 l_jr 010001 ---------- b:5 ----------- l_jalr 010010 ---------- b:5 ----------- + +#### +# Memory Instructions +#### + +&load d a i +@load ...... d:5 a:5 i:s16 &load + +%store_i 21:s5 0:11 +&store a b i +@store ...... ..... a:5 b:5 ........... &store i=%store_i + +l_lwa 011011 ..... ..... ........ ........ @load +l_lwz 100001 ..... ..... ........ ........ @load +l_lws 100010 ..... ..... ........ ........ @load +l_lbz 100011 ..... ..... ........ ........ @load +l_lbs 100100 ..... ..... ........ ........ @load +l_lhz 100101 ..... ..... ........ ........ @load +l_lhs 100110 ..... ..... ........ ........ @load + +l_swa 110011 ..... ..... ........ ........ @store +l_sw 110101 ..... ..... ........ ........ @store +l_sb 110110 ..... ..... ........ ........ @store +l_sh 110111 ..... ..... ........ ........ @store From patchwork Fri May 11 04:23:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135498 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp394627lji; Thu, 10 May 2018 21:30:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq2//3l25PtKlsS2609fsJZNbOMnA0ytd75MDMJBgy+QmyPe1yp48vrrQd/wiM7DkHO9TPi X-Received: by 2002:ac8:1b8b:: with SMTP id z11-v6mr3958486qtj.294.1526013015099; Thu, 10 May 2018 21:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526013015; cv=none; d=google.com; s=arc-20160816; b=I88uqWT6y5SYAzOjVgmzoNWkBPdcDWwAKozzQYh3R9Sivg0KwTnSH6Mpcikn6Wp1V0 y8HoY40HoqcyjWV2JQp30WicGg4GOaEH73mU3TZjAYw/OoIb2gH6GZTYrhh0Yo3RSac4 Ip5q0XggKI/Nl1WKbnnEMQqEG3KG/IP9Sv6Cb1nCkRgJOUDnRcG5/lFrF3+Ro3FAtjkb UJ8jtiP9joYg/8vwtEfJ/xvmxZ96nIaKiEXRYS5VnD8O+f3Z8gn70iQHkbmiX41F9GIL o0WY5sTKXCqgoB/wMmh1OzGMZc1ujYVZrAeswtq5KOktE6Wumvxh8NExABvVx08E7i8/ qAUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=PUMiv2YW2z6XO7+aJEmeA5pz71ztIDAWWfW+aUclYdM=; b=nfWHKAPl01bEOZWR2ubn9GmHg65RORmR+xYiA0h0S9MufUgV31duM64dMVitz0XG9t zqFg1Ml3/Tycn0gBDmlYQiRPsGu/LyavQWmg5VyLFZ9aeYFNgnIHkUNUqJ09UOIibu4A AytKgR2WF/EytWrSoo/eGGwr34OTQpcPnbXiIpeoCz3gOPCm/neCdF5Bo8oDAnZPbXKr 5eEcDGkv+djJ7T976qzxZnrQulgoHsFR6cv7FRXPdgwK2geyWd+yIjLtjgzqEmKjA5Xs LsZ3aJRRGqg38oBSUkvIWRzyOK9t9uBEuriGK4syoJzodhM/oz6yxzNMdtwRRYhyGiMi 399g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YupLm5Kr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a1-v6si2124575qvc.261.2018.05.10.21.30.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:30:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YupLm5Kr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzh8-0000yy-ID for patch@linaro.org; Fri, 11 May 2018 00:30:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzaj-0000Zm-AG for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzah-000876-RR for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:37 -0400 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:43685) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzah-00086t-It for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:35 -0400 Received: by mail-pl0-x244.google.com with SMTP id a39-v6so2536175pla.10 for ; Thu, 10 May 2018 21:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PUMiv2YW2z6XO7+aJEmeA5pz71ztIDAWWfW+aUclYdM=; b=YupLm5KrfD8F+jl5j96pylzlGrsDjTXnLOEjZAU4/CVcsO7VR19NCKGHMKoP8J6a+a dSLbXlSkgyYYj+nM74Usg32bTlGD1FKUri2xyZrsqOtahzWddmswz/grMeg6vZXYxOcO i5aCmlxUXuYcWJvN6haxBOtGV3fTh/Fjws/as= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PUMiv2YW2z6XO7+aJEmeA5pz71ztIDAWWfW+aUclYdM=; b=h6xeDbd3xw3TmODKqV33Y1bgdimKmKWxpZxDqqrL4s17llj95GegS/V+wMfMkdMXnb nXKgYFb+YFlH9U3+e7JA9VST/xsASd7DVERDkYKWap8MZcdBbn3kcRs7l+icm4QMlkwS lhiwrnpq9sEmOUw9cZC50UqQ3Xl6q4Azn3DDwwkCuEbBt+pisjsV90FeNeoNzAbmfTlB CfDeri/h3K8vn8R7GxS/gmT0fZ4riXX/ul4cMq7r6IUWE/1jGxvljQsd7eqebojSXnBF 5IzekMXDZq3a730FPNW+iiBivJUS9OPDu3AYxemUioRSYInzRAp3lfq9OekUkS43kLIC XUvQ== X-Gm-Message-State: ALKqPwemY5rjihl48wHroNe2pSqVnDRVkhPYUTUrQcvfh/dMmiDrgx8A 38+DCNWAYctFnLkrB0Ot1BQehqg1qXQ= X-Received: by 2002:a17:902:b942:: with SMTP id h2-v6mr4043091pls.312.1526012614093; Thu, 10 May 2018 21:23:34 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:16 -0700 Message-Id: <20180511042324.5070-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::244 Subject: [Qemu-devel] [PULL 05/13] target/openrisc: Convert remainder of dec_misc insns 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 279 +++++++++++++++-------------------- target/openrisc/insns.decode | 35 ++++- 2 files changed, 151 insertions(+), 163 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 794002aaaa..0100fbc460 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -829,174 +829,118 @@ static bool trans_l_sh(DisasContext *dc, arg_store *a, uint32_t insn) return true; } -static void dec_misc(DisasContext *dc, uint32_t insn) +static bool trans_l_nop(DisasContext *dc, arg_l_nop *a, uint32_t insn) +{ + LOG_DIS("l.nop %d\n", a->k); + return true; +} + +static bool trans_l_addi(DisasContext *dc, arg_rri *a, uint32_t insn) { - uint32_t op0, op1; - uint32_t ra, rb, rd; - uint32_t L6, K5, K16, K5_11; - int32_t I16; TCGv t0; - op0 = extract32(insn, 26, 6); - op1 = extract32(insn, 24, 2); - ra = extract32(insn, 16, 5); - rb = extract32(insn, 11, 5); - rd = extract32(insn, 21, 5); - L6 = extract32(insn, 5, 6); - K5 = extract32(insn, 0, 5); - K16 = extract32(insn, 0, 16); - I16 = (int16_t)K16; - K5_11 = (extract32(insn, 21, 5) << 11) | extract32(insn, 0, 11); + LOG_DIS("l.addi r%d, r%d, %d\n", a->d, a->a, a->i); + check_r0_write(a->d); + t0 = tcg_const_tl(a->i); + gen_add(dc, cpu_R[a->d], cpu_R[a->a], t0); + tcg_temp_free(t0); + return true; +} - switch (op0) { - case 0x05: - switch (op1) { - case 0x01: /* l.nop */ - LOG_DIS("l.nop %d\n", I16); - break; +static bool trans_l_addic(DisasContext *dc, arg_rri *a, uint32_t insn) +{ + TCGv t0; - default: - gen_illegal_exception(dc); - break; - } - break; + LOG_DIS("l.addic r%d, r%d, %d\n", a->d, a->a, a->i); + check_r0_write(a->d); + t0 = tcg_const_tl(a->i); + gen_addc(dc, cpu_R[a->d], cpu_R[a->a], t0); + tcg_temp_free(t0); + return true; +} - case 0x13: /* l.maci */ - LOG_DIS("l.maci r%d, %d\n", ra, I16); - t0 = tcg_const_tl(I16); - gen_mac(dc, cpu_R[ra], t0); - tcg_temp_free(t0); - break; +static bool trans_l_muli(DisasContext *dc, arg_rri *a, uint32_t insn) +{ + TCGv t0; - case 0x09: /* l.rfe */ - LOG_DIS("l.rfe\n"); - { -#if defined(CONFIG_USER_ONLY) - return; + LOG_DIS("l.muli r%d, r%d, %d\n", a->d, a->a, a->i); + check_r0_write(a->d); + t0 = tcg_const_tl(a->i); + gen_mul(dc, cpu_R[a->d], cpu_R[a->a], t0); + tcg_temp_free(t0); + return true; +} + +static bool trans_l_maci(DisasContext *dc, arg_l_maci *a, uint32_t insn) +{ + TCGv t0; + + LOG_DIS("l.maci r%d, %d\n", a->a, a->i); + t0 = tcg_const_tl(a->i); + gen_mac(dc, cpu_R[a->a], t0); + tcg_temp_free(t0); + return true; +} + +static bool trans_l_andi(DisasContext *dc, arg_rrk *a, uint32_t insn) +{ + LOG_DIS("l.andi r%d, r%d, %d\n", a->d, a->a, a->k); + check_r0_write(a->d); + tcg_gen_andi_tl(cpu_R[a->d], cpu_R[a->a], a->k); + return true; +} + +static bool trans_l_ori(DisasContext *dc, arg_rrk *a, uint32_t insn) +{ + LOG_DIS("l.ori r%d, r%d, %d\n", a->d, a->a, a->k); + check_r0_write(a->d); + tcg_gen_ori_tl(cpu_R[a->d], cpu_R[a->a], a->k); + return true; +} + +static bool trans_l_xori(DisasContext *dc, arg_rri *a, uint32_t insn) +{ + LOG_DIS("l.xori r%d, r%d, %d\n", a->d, a->a, a->i); + check_r0_write(a->d); + tcg_gen_xori_tl(cpu_R[a->d], cpu_R[a->a], a->i); + return true; +} + +static bool trans_l_mfspr(DisasContext *dc, arg_l_mfspr *a, uint32_t insn) +{ + LOG_DIS("l.mfspr r%d, r%d, %d\n", a->d, a->a, a->k); + check_r0_write(a->d); + +#ifdef CONFIG_USER_ONLY + gen_illegal_exception(dc); #else - if (dc->mem_idx == MMU_USER_IDX) { - gen_illegal_exception(dc); - return; - } - gen_helper_rfe(cpu_env); - dc->is_jmp = DISAS_UPDATE; -#endif - } - break; - - case 0x1c: /* l.cust1 */ - LOG_DIS("l.cust1\n"); - break; - - case 0x1d: /* l.cust2 */ - LOG_DIS("l.cust2\n"); - break; - - case 0x1e: /* l.cust3 */ - LOG_DIS("l.cust3\n"); - break; - - case 0x1f: /* l.cust4 */ - LOG_DIS("l.cust4\n"); - break; - - case 0x3c: /* l.cust5 */ - LOG_DIS("l.cust5 r%d, r%d, r%d, %d, %d\n", rd, ra, rb, L6, K5); - break; - - case 0x3d: /* l.cust6 */ - LOG_DIS("l.cust6\n"); - break; - - case 0x3e: /* l.cust7 */ - LOG_DIS("l.cust7\n"); - break; - - case 0x3f: /* l.cust8 */ - LOG_DIS("l.cust8\n"); - break; - - case 0x27: /* l.addi */ - LOG_DIS("l.addi r%d, r%d, %d\n", rd, ra, I16); - check_r0_write(rd); - t0 = tcg_const_tl(I16); - gen_add(dc, cpu_R[rd], cpu_R[ra], t0); - tcg_temp_free(t0); - break; - - case 0x28: /* l.addic */ - LOG_DIS("l.addic r%d, r%d, %d\n", rd, ra, I16); - check_r0_write(rd); - t0 = tcg_const_tl(I16); - gen_addc(dc, cpu_R[rd], cpu_R[ra], t0); - tcg_temp_free(t0); - break; - - case 0x29: /* l.andi */ - LOG_DIS("l.andi r%d, r%d, %d\n", rd, ra, K16); - check_r0_write(rd); - tcg_gen_andi_tl(cpu_R[rd], cpu_R[ra], K16); - break; - - case 0x2a: /* l.ori */ - LOG_DIS("l.ori r%d, r%d, %d\n", rd, ra, K16); - check_r0_write(rd); - tcg_gen_ori_tl(cpu_R[rd], cpu_R[ra], K16); - break; - - case 0x2b: /* l.xori */ - LOG_DIS("l.xori r%d, r%d, %d\n", rd, ra, I16); - check_r0_write(rd); - tcg_gen_xori_tl(cpu_R[rd], cpu_R[ra], I16); - break; - - case 0x2c: /* l.muli */ - LOG_DIS("l.muli r%d, r%d, %d\n", rd, ra, I16); - check_r0_write(rd); - t0 = tcg_const_tl(I16); - gen_mul(dc, cpu_R[rd], cpu_R[ra], t0); - tcg_temp_free(t0); - break; - - case 0x2d: /* l.mfspr */ - LOG_DIS("l.mfspr r%d, r%d, %d\n", rd, ra, K16); - check_r0_write(rd); - { -#if defined(CONFIG_USER_ONLY) - return; -#else - TCGv_i32 ti = tcg_const_i32(K16); - if (dc->mem_idx == MMU_USER_IDX) { - gen_illegal_exception(dc); - return; - } - gen_helper_mfspr(cpu_R[rd], cpu_env, cpu_R[rd], cpu_R[ra], ti); - tcg_temp_free_i32(ti); -#endif - } - break; - - case 0x30: /* l.mtspr */ - LOG_DIS("l.mtspr r%d, r%d, %d\n", ra, rb, K5_11); - { -#if defined(CONFIG_USER_ONLY) - return; -#else - TCGv_i32 im = tcg_const_i32(K5_11); - if (dc->mem_idx == MMU_USER_IDX) { - gen_illegal_exception(dc); - return; - } - gen_helper_mtspr(cpu_env, cpu_R[ra], cpu_R[rb], im); - tcg_temp_free_i32(im); -#endif - } - break; - - default: + if (dc->mem_idx == MMU_USER_IDX) { gen_illegal_exception(dc); - break; + } else { + TCGv_i32 ti = tcg_const_i32(a->k); + gen_helper_mfspr(cpu_R[a->d], cpu_env, cpu_R[a->d], cpu_R[a->a], ti); + tcg_temp_free_i32(ti); } +#endif + return true; +} + +static bool trans_l_mtspr(DisasContext *dc, arg_l_mtspr *a, uint32_t insn) +{ + LOG_DIS("l.mtspr r%d, r%d, %d\n", a->a, a->b, a->k); + +#ifdef CONFIG_USER_ONLY + gen_illegal_exception(dc); +#else + if (dc->mem_idx == MMU_USER_IDX) { + gen_illegal_exception(dc); + } else { + TCGv_i32 ti = tcg_const_i32(a->k); + gen_helper_mtspr(cpu_env, cpu_R[a->a], cpu_R[a->b], ti); + tcg_temp_free_i32(ti); + } +#endif + return true; } static void dec_mac(DisasContext *dc, uint32_t insn) @@ -1272,6 +1216,23 @@ static bool trans_l_csync(DisasContext *dc, arg_l_csync *a, uint32_t insn) return true; } +static bool trans_l_rfe(DisasContext *dc, arg_l_rfe *a, uint32_t insn) +{ + LOG_DIS("l.rfe\n"); + +#ifdef CONFIG_USER_ONLY + gen_illegal_exception(dc); +#else + if (dc->mem_idx == MMU_USER_IDX) { + gen_illegal_exception(dc); + } else { + gen_helper_rfe(cpu_env); + dc->is_jmp = DISAS_UPDATE; + } +#endif + return true; +} + static void dec_float(DisasContext *dc, uint32_t insn) { uint32_t op0; @@ -1534,7 +1495,7 @@ static void disas_openrisc_insn(DisasContext *dc, OpenRISCCPU *cpu) break; default: - dec_misc(dc, insn); + gen_illegal_exception(dc); break; } } diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index ba5356abe1..247a2e14f2 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -27,6 +27,8 @@ l_msync 001000 1000000000 00000000 00000000 l_psync 001000 1010000000 00000000 00000000 l_csync 001000 1100000000 00000000 00000000 +l_rfe 001001 ----- ----- -------- -------- + #### # Branch Instructions #### @@ -58,7 +60,32 @@ l_lbs 100100 ..... ..... ........ ........ @load l_lhz 100101 ..... ..... ........ ........ @load l_lhs 100110 ..... ..... ........ ........ @load -l_swa 110011 ..... ..... ........ ........ @store -l_sw 110101 ..... ..... ........ ........ @store -l_sb 110110 ..... ..... ........ ........ @store -l_sh 110111 ..... ..... ........ ........ @store +l_swa 110011 ..... ..... ..... ........... @store +l_sw 110101 ..... ..... ..... ........... @store +l_sb 110110 ..... ..... ..... ........... @store +l_sh 110111 ..... ..... ..... ........... @store + +#### +# Immediate Operand Instructions +#### + +%mtspr_k 21:5 0:11 + +&rri d a i +&rrk d a k +@rri ...... d:5 a:5 i:s16 &rri +@rrk ...... d:5 a:5 k:16 &rrk + +l_nop 000101 01--- ----- k:16 + +l_addi 100111 ..... ..... ........ ........ @rri +l_addic 101000 ..... ..... ........ ........ @rri +l_andi 101001 ..... ..... ........ ........ @rrk +l_ori 101010 ..... ..... ........ ........ @rrk +l_xori 101011 ..... ..... ........ ........ @rri +l_muli 101100 ..... ..... ........ ........ @rri + +l_mfspr 101101 ..... ..... ........ ........ @rrk +l_mtspr 110000 ..... a:5 b:5 ........... k=%mtspr_k + +l_maci 010011 ----- a:5 i:s16 From patchwork Fri May 11 04:23:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135497 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp394393lji; Thu, 10 May 2018 21:29:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrpQNTNnd6oTLsYnu9p8m7RT8hkwb/BYAZtG2conjH49QbltAzkwe7gBwM9xCRlJdCOs4dZ X-Received: by 2002:aed:3e67:: with SMTP id m36-v6mr4073017qtf.279.1526012996260; Thu, 10 May 2018 21:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526012996; cv=none; d=google.com; s=arc-20160816; b=UqCvhBi8hr2FcJMuylTeUew5LvOct1Zd5J+q4RJwRFWLokhq6S8rk9oJSqnGP68Bwe nkYzGYuVaxtGMrrEhNHDHdPF/i4/1p0szxhYg67UqwURVCEenJ3GQyLF1g+69c0CHh7/ HIlNbR6++D3pc/MEu29QhttoOrEdF3b4jLmaZ6JEZ39MJlBNCKUTjlkG7y9lr250WMcx BESrdz2yA6TLGllJnvioX7f8SjrT0Hi6Ubd0UIL1fYrACRJUmsZ72MNkGHCcZKVzJdMA 07XlQabqXsFFJZLeCCmz1OcXvOa8WgIXlxGTFNkCdIqlojkxMWuZAd/vUuGiXsUEjlMu iNRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=PoWd0t3lxQSPaCiwIy44m7RZEMWyx2Ft4BKXEZWcY0M=; b=WjiqDEw2o786wHJniGJDjeDdEl9vUjomrozCORhEGqCXxW7L8yTsas6J2Hh5EeS63v 7Yq3qBD2osInipNbB4zdZTwFOTD5yFYzB+M4X4OfyGzScGl0549W4N0mN7YxgQv7iIyw 52DPNWQquPeyGPMLyVd1d5GtS+ARHrUHu666fd17qCrU0oMJEsOr+M/k1/uFMIvmHWa1 KIHCuuOReT1KcE4usIgW5eCorZN5Lyh991m2wLfAsf/BATFYvBk0WBVVRDv+QA5PSygV 2bCpEiCQX8K29JbclK0mz+VFe2G1qjU28BLQDf6fKpcyQWZvsjFqjmBIq9a7AcDNHRju peSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kXgD6ZdM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o24-v6si2208477qtp.143.2018.05.10.21.29.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:29:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kXgD6ZdM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzgp-00086a-Db for patch@linaro.org; Fri, 11 May 2018 00:29:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzam-0000dD-Dx for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzaj-00087S-9E for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:40 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:42026) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzaj-00087L-0i for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:37 -0400 Received: by mail-pl0-x243.google.com with SMTP id u6-v6so2541623pls.9 for ; Thu, 10 May 2018 21:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PoWd0t3lxQSPaCiwIy44m7RZEMWyx2Ft4BKXEZWcY0M=; b=kXgD6ZdMomhQdZLnVVMI9WAO610Kla2cPVZn16HVCBeKUlqLIgKGUMimwzKAudABLv H1jiy28QhXXf1HKHsqwl8hiu5yxDrSouh+lP04EMg0qLU5bMIoZc6kCtiZZcC2c4lDC/ SOB7JRxX5Tps60vk1U34TQJs6eHzvU2Ou1PXU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PoWd0t3lxQSPaCiwIy44m7RZEMWyx2Ft4BKXEZWcY0M=; b=XlSbjN6mmZ35bji//5ts+5FLGKDHQtfv15ndx+YYc2n5QwODlC98idrEP4tKr1Qhtq bN4/bmwp8/MdHeSAMk1mSWaX8dIru/6lD94IdfDxO/AXP9hrZ8sYZcVEb09tgh5G3sjI C2mKgjMsGKzuI5KD8UEljj2QlLHEUtD9nKLtca0aXtMQeMUqcbale4WYtUK5gkU5+3ct RlDfCVUI4FICFPIz1rz+mjQp8ISyImh/dlfagNmgyPwhj+irI3CclAmWuWSC060+cTOI MM3ZcqUpxWq0MvVX0Lfl/QWIGfkhpww9uUcpEdaDfx7QfQxZK6YF8BoXWPAytwjEGGM+ H89g== X-Gm-Message-State: ALKqPweQPEdmt4sBcYnkcbzPFyUcPH4ZF/b6vQJFPgW3Qjh1eupI7CT+ R0b4FyZPeQAH2OzNsB8j8InYPW4kH5c= X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr3990051pla.125.1526012615523; Thu, 10 May 2018 21:23:35 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:17 -0700 Message-Id: <20180511042324.5070-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PULL 06/13] target/openrisc: Convert dec_calc 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 322 +++++++++++++++++++---------------- target/openrisc/insns.decode | 76 ++++++--- 2 files changed, 229 insertions(+), 169 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 0100fbc460..90520b0805 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -457,171 +457,199 @@ static void gen_msbu(DisasContext *dc, TCGv srca, TCGv srcb) gen_ove_cy(dc); } -static void dec_calc(DisasContext *dc, uint32_t insn) +static bool trans_l_add(DisasContext *dc, arg_dab *a, uint32_t insn) { - uint32_t op0, op1, op2; - uint32_t ra, rb, rd; - op0 = extract32(insn, 0, 4); - op1 = extract32(insn, 8, 2); - op2 = extract32(insn, 6, 2); - ra = extract32(insn, 16, 5); - rb = extract32(insn, 11, 5); - rd = extract32(insn, 21, 5); + LOG_DIS("l.add r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + gen_add(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} - switch (op1) { - case 0: - switch (op0) { - case 0x0: /* l.add */ - LOG_DIS("l.add r%d, r%d, r%d\n", rd, ra, rb); - gen_add(dc, cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; +static bool trans_l_addc(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.addc r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + gen_addc(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x1: /* l.addc */ - LOG_DIS("l.addc r%d, r%d, r%d\n", rd, ra, rb); - gen_addc(dc, cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; +static bool trans_l_sub(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.sub r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + gen_sub(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x2: /* l.sub */ - LOG_DIS("l.sub r%d, r%d, r%d\n", rd, ra, rb); - gen_sub(dc, cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; +static bool trans_l_and(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.and r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + tcg_gen_and_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x3: /* l.and */ - LOG_DIS("l.and r%d, r%d, r%d\n", rd, ra, rb); - tcg_gen_and_tl(cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; +static bool trans_l_or(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.or r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + tcg_gen_or_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x4: /* l.or */ - LOG_DIS("l.or r%d, r%d, r%d\n", rd, ra, rb); - tcg_gen_or_tl(cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; +static bool trans_l_xor(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.xor r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + tcg_gen_xor_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x5: /* l.xor */ - LOG_DIS("l.xor r%d, r%d, r%d\n", rd, ra, rb); - tcg_gen_xor_tl(cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; +static bool trans_l_sll(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.sll r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + tcg_gen_shl_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x8: - switch (op2) { - case 0: /* l.sll */ - LOG_DIS("l.sll r%d, r%d, r%d\n", rd, ra, rb); - tcg_gen_shl_tl(cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; - case 1: /* l.srl */ - LOG_DIS("l.srl r%d, r%d, r%d\n", rd, ra, rb); - tcg_gen_shr_tl(cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; - case 2: /* l.sra */ - LOG_DIS("l.sra r%d, r%d, r%d\n", rd, ra, rb); - tcg_gen_sar_tl(cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; - case 3: /* l.ror */ - LOG_DIS("l.ror r%d, r%d, r%d\n", rd, ra, rb); - tcg_gen_rotr_tl(cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; - } - break; +static bool trans_l_srl(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.srl r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + tcg_gen_shr_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0xc: - switch (op2) { - case 0: /* l.exths */ - LOG_DIS("l.exths r%d, r%d\n", rd, ra); - tcg_gen_ext16s_tl(cpu_R[rd], cpu_R[ra]); - return; - case 1: /* l.extbs */ - LOG_DIS("l.extbs r%d, r%d\n", rd, ra); - tcg_gen_ext8s_tl(cpu_R[rd], cpu_R[ra]); - return; - case 2: /* l.exthz */ - LOG_DIS("l.exthz r%d, r%d\n", rd, ra); - tcg_gen_ext16u_tl(cpu_R[rd], cpu_R[ra]); - return; - case 3: /* l.extbz */ - LOG_DIS("l.extbz r%d, r%d\n", rd, ra); - tcg_gen_ext8u_tl(cpu_R[rd], cpu_R[ra]); - return; - } - break; +static bool trans_l_sra(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.sra r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + tcg_gen_sar_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0xd: - switch (op2) { - case 0: /* l.extws */ - LOG_DIS("l.extws r%d, r%d\n", rd, ra); - tcg_gen_ext32s_tl(cpu_R[rd], cpu_R[ra]); - return; - case 1: /* l.extwz */ - LOG_DIS("l.extwz r%d, r%d\n", rd, ra); - tcg_gen_ext32u_tl(cpu_R[rd], cpu_R[ra]); - return; - } - break; +static bool trans_l_ror(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.ror r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + tcg_gen_rotr_tl(cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0xe: /* l.cmov */ - LOG_DIS("l.cmov r%d, r%d, r%d\n", rd, ra, rb); - { - TCGv zero = tcg_const_tl(0); - tcg_gen_movcond_tl(TCG_COND_NE, cpu_R[rd], cpu_sr_f, zero, - cpu_R[ra], cpu_R[rb]); - tcg_temp_free(zero); - } - return; +static bool trans_l_exths(DisasContext *dc, arg_da *a, uint32_t insn) +{ + LOG_DIS("l.exths r%d, r%d\n", a->d, a->a); + check_r0_write(a->d); + tcg_gen_ext16s_tl(cpu_R[a->d], cpu_R[a->a]); + return true; +} - case 0xf: /* l.ff1 */ - LOG_DIS("l.ff1 r%d, r%d, r%d\n", rd, ra, rb); - tcg_gen_ctzi_tl(cpu_R[rd], cpu_R[ra], -1); - tcg_gen_addi_tl(cpu_R[rd], cpu_R[rd], 1); - return; - } - break; +static bool trans_l_extbs(DisasContext *dc, arg_da *a, uint32_t insn) +{ + LOG_DIS("l.extbs r%d, r%d\n", a->d, a->a); + check_r0_write(a->d); + tcg_gen_ext8s_tl(cpu_R[a->d], cpu_R[a->a]); + return true; +} - case 1: - switch (op0) { - case 0xf: /* l.fl1 */ - LOG_DIS("l.fl1 r%d, r%d, r%d\n", rd, ra, rb); - tcg_gen_clzi_tl(cpu_R[rd], cpu_R[ra], TARGET_LONG_BITS); - tcg_gen_subfi_tl(cpu_R[rd], TARGET_LONG_BITS, cpu_R[rd]); - return; - } - break; +static bool trans_l_exthz(DisasContext *dc, arg_da *a, uint32_t insn) +{ + LOG_DIS("l.exthz r%d, r%d\n", a->d, a->a); + check_r0_write(a->d); + tcg_gen_ext16u_tl(cpu_R[a->d], cpu_R[a->a]); + return true; +} - case 2: - break; +static bool trans_l_extbz(DisasContext *dc, arg_da *a, uint32_t insn) +{ + LOG_DIS("l.extbz r%d, r%d\n", a->d, a->a); + check_r0_write(a->d); + tcg_gen_ext8u_tl(cpu_R[a->d], cpu_R[a->a]); + return true; +} - case 3: - switch (op0) { - case 0x6: /* l.mul */ - LOG_DIS("l.mul r%d, r%d, r%d\n", rd, ra, rb); - gen_mul(dc, cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; +static bool trans_l_cmov(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + TCGv zero; + LOG_DIS("l.cmov r%d, r%d, r%d\n", a->d, a->a, a->b); - case 0x7: /* l.muld */ - LOG_DIS("l.muld r%d, r%d\n", ra, rb); - gen_muld(dc, cpu_R[ra], cpu_R[rb]); - break; + check_r0_write(a->d); + zero = tcg_const_tl(0); + tcg_gen_movcond_tl(TCG_COND_NE, cpu_R[a->d], cpu_sr_f, zero, + cpu_R[a->a], cpu_R[a->b]); + tcg_temp_free(zero); + return true; +} - case 0x9: /* l.div */ - LOG_DIS("l.div r%d, r%d, r%d\n", rd, ra, rb); - gen_div(dc, cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; +static bool trans_l_ff1(DisasContext *dc, arg_da *a, uint32_t insn) +{ + LOG_DIS("l.ff1 r%d, r%d\n", a->d, a->a); - case 0xa: /* l.divu */ - LOG_DIS("l.divu r%d, r%d, r%d\n", rd, ra, rb); - gen_divu(dc, cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; + check_r0_write(a->d); + tcg_gen_ctzi_tl(cpu_R[a->d], cpu_R[a->a], -1); + tcg_gen_addi_tl(cpu_R[a->d], cpu_R[a->d], 1); + return true; +} - case 0xb: /* l.mulu */ - LOG_DIS("l.mulu r%d, r%d, r%d\n", rd, ra, rb); - gen_mulu(dc, cpu_R[rd], cpu_R[ra], cpu_R[rb]); - return; +static bool trans_l_fl1(DisasContext *dc, arg_da *a, uint32_t insn) +{ + LOG_DIS("l.fl1 r%d, r%d\n", a->d, a->a); - case 0xc: /* l.muldu */ - LOG_DIS("l.muldu r%d, r%d\n", ra, rb); - gen_muldu(dc, cpu_R[ra], cpu_R[rb]); - return; - } - break; - } - gen_illegal_exception(dc); + check_r0_write(a->d); + tcg_gen_clzi_tl(cpu_R[a->d], cpu_R[a->a], TARGET_LONG_BITS); + tcg_gen_subfi_tl(cpu_R[a->d], TARGET_LONG_BITS, cpu_R[a->d]); + return true; +} + +static bool trans_l_mul(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.mul r%d, r%d, r%d\n", a->d, a->a, a->b); + + check_r0_write(a->d); + gen_mul(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} + +static bool trans_l_mulu(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.mulu r%d, r%d, r%d\n", a->d, a->a, a->b); + + check_r0_write(a->d); + gen_mulu(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} + +static bool trans_l_div(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.div r%d, r%d, r%d\n", a->d, a->a, a->b); + + check_r0_write(a->d); + gen_div(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} + +static bool trans_l_divu(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("l.divu r%d, r%d, r%d\n", a->d, a->a, a->b); + + check_r0_write(a->d); + gen_divu(dc, cpu_R[a->d], cpu_R[a->a], cpu_R[a->b]); + return true; +} + +static bool trans_l_muld(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("l.muld r%d, r%d\n", a->a, a->b); + gen_muld(dc, cpu_R[a->a], cpu_R[a->b]); + return true; +} + +static bool trans_l_muldu(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("l.muldu r%d, r%d\n", a->a, a->b); + gen_muldu(dc, cpu_R[a->a], cpu_R[a->b]); + return true; } static bool trans_l_j(DisasContext *dc, arg_l_j *a, uint32_t insn) @@ -1486,10 +1514,6 @@ static void disas_openrisc_insn(DisasContext *dc, OpenRISCCPU *cpu) dec_float(dc, insn); break; - case 0x38: - dec_calc(dc, insn); - break; - case 0x39: dec_comp(dc, insn); break; diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 247a2e14f2..20f035f488 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -17,6 +17,10 @@ # License along with this library; if not, see . # +&dab d a b +&da d a +&ab a b + #### # System Instructions #### @@ -27,7 +31,7 @@ l_msync 001000 1000000000 00000000 00000000 l_psync 001000 1010000000 00000000 00000000 l_csync 001000 1100000000 00000000 00000000 -l_rfe 001001 ----- ----- -------- -------- +l_rfe 001001 ----- ----- -------- -------- #### # Branch Instructions @@ -60,32 +64,64 @@ l_lbs 100100 ..... ..... ........ ........ @load l_lhz 100101 ..... ..... ........ ........ @load l_lhs 100110 ..... ..... ........ ........ @load -l_swa 110011 ..... ..... ..... ........... @store -l_sw 110101 ..... ..... ..... ........... @store -l_sb 110110 ..... ..... ..... ........... @store -l_sh 110111 ..... ..... ..... ........... @store +l_swa 110011 ..... ..... ..... ........... @store +l_sw 110101 ..... ..... ..... ........... @store +l_sb 110110 ..... ..... ..... ........... @store +l_sh 110111 ..... ..... ..... ........... @store #### # Immediate Operand Instructions #### -%mtspr_k 21:5 0:11 +%mtspr_k 21:5 0:11 -&rri d a i -&rrk d a k -@rri ...... d:5 a:5 i:s16 &rri -@rrk ...... d:5 a:5 k:16 &rrk +&rri d a i +&rrk d a k +@rri ...... d:5 a:5 i:s16 &rri +@rrk ...... d:5 a:5 k:16 &rrk -l_nop 000101 01--- ----- k:16 +l_nop 000101 01--- ----- k:16 -l_addi 100111 ..... ..... ........ ........ @rri -l_addic 101000 ..... ..... ........ ........ @rri -l_andi 101001 ..... ..... ........ ........ @rrk -l_ori 101010 ..... ..... ........ ........ @rrk -l_xori 101011 ..... ..... ........ ........ @rri -l_muli 101100 ..... ..... ........ ........ @rri +l_addi 100111 ..... ..... ........ ........ @rri +l_addic 101000 ..... ..... ........ ........ @rri +l_andi 101001 ..... ..... ........ ........ @rrk +l_ori 101010 ..... ..... ........ ........ @rrk +l_xori 101011 ..... ..... ........ ........ @rri +l_muli 101100 ..... ..... ........ ........ @rri -l_mfspr 101101 ..... ..... ........ ........ @rrk -l_mtspr 110000 ..... a:5 b:5 ........... k=%mtspr_k +l_mfspr 101101 ..... ..... ........ ........ @rrk +l_mtspr 110000 ..... a:5 b:5 ........... k=%mtspr_k -l_maci 010011 ----- a:5 i:s16 +l_maci 010011 ----- a:5 i:s16 + +#### +# Arithmetic Instructions +#### + +l_exths 111000 d:5 a:5 ----- - 0000 -- 1100 +l_extbs 111000 d:5 a:5 ----- - 0001 -- 1100 +l_exthz 111000 d:5 a:5 ----- - 0010 -- 1100 +l_extbz 111000 d:5 a:5 ----- - 0011 -- 1100 + +l_add 111000 d:5 a:5 b:5 - 00 ---- 0000 +l_addc 111000 d:5 a:5 b:5 - 00 ---- 0001 +l_sub 111000 d:5 a:5 b:5 - 00 ---- 0010 +l_and 111000 d:5 a:5 b:5 - 00 ---- 0011 +l_or 111000 d:5 a:5 b:5 - 00 ---- 0100 +l_xor 111000 d:5 a:5 b:5 - 00 ---- 0101 +l_cmov 111000 d:5 a:5 b:5 - 00 ---- 1110 +l_ff1 111000 d:5 a:5 ----- - 00 ---- 1111 +l_fl1 111000 d:5 a:5 ----- - 01 ---- 1111 + +l_sll 111000 d:5 a:5 b:5 - 0000 -- 1000 +l_srl 111000 d:5 a:5 b:5 - 0001 -- 1000 +l_sra 111000 d:5 a:5 b:5 - 0010 -- 1000 +l_ror 111000 d:5 a:5 b:5 - 0011 -- 1000 + +l_mul 111000 d:5 a:5 b:5 - 11 ---- 0110 +l_mulu 111000 d:5 a:5 b:5 - 11 ---- 1011 +l_div 111000 d:5 a:5 b:5 - 11 ---- 1001 +l_divu 111000 d:5 a:5 b:5 - 11 ---- 1010 + +l_muld 111000 ----- a:5 b:5 - 11 ---- 0111 +l_muldu 111000 ----- a:5 b:5 - 11 ---- 1100 From patchwork Fri May 11 04:23:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135494 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp394058lji; Thu, 10 May 2018 21:29:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoZzOMTn64RAiO+1Je8gCFizp4rIih6zbm3q4k9ee1SnEVqYKgsO7qkZDbX6nvRfnKYZ+oi X-Received: by 2002:a0c:e78a:: with SMTP id x10-v6mr3786097qvn.13.1526012965816; Thu, 10 May 2018 21:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526012965; cv=none; d=google.com; s=arc-20160816; b=xvJ54Oimo8Re5N2WTMBWB1JjPcupBIlkr3YkqaXczwzLP6JPqcgbKrVlbPzCZeruBo XyvJ6pfX4208eGUhnk/z+WsOozzQ8MIKAoQbHV7FFZFojErFeUehAn+lN0g58ZCEhUNM utp/Glz2XGKt2MXhcK2om6E71nI4PCKBLKF2icOy82WqWnbXRVuPed50m/YGxz4jQDX3 TWdZXwueofTQpSOMXemo16J3H2hVsBDzRTye/QZ/atpjL71rbgdbjHJeM1+nAYlrbxjE f31dCw1mJVT4Oty8lDQ8vlDT/AqozTmWB3Ay7Ek58PeRYCYF6TOOlxIdXSRL/Vj5J/r9 Fk8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=Z+5TIFy3I+D/WDAlD3QSum7pBMO7Xmvbj4B3x10drQ0=; b=ohFrCH19IA+6pCD3XU2Bppr0Jb7jgsQzVq8zhcfoZRUlu1WGE4Ux71MBO2c91NKj34 NgLVio3W0GApLeCQoLLwVLmx2OFeRYjvJIYawnA+oa44eMs/R9RbSzOoAkWFS5KmPgjH usD7SSs3lyGT7WY0AVYecAqTRw8yCTHNqei/vPvPju2QwaepooIA/wZ4siEoM9pOV12h 2Ls7oRGGVBUphc6wzTunaF4VxCVrz9PE+XLV80YSLEXgbwglWR4Atmrosz+Yb/nxR2ZY 3CArglaPRjYSPXktzL5f007k6pl+WBzsBzohcW00kqT4g+Xi4uOmKGzUVOp3jcfHVdUE gjww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=c08dDJHW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r41-v6si2381570qtc.165.2018.05.10.21.29.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:29:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=c08dDJHW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzgL-0007fV-4T for patch@linaro.org; Fri, 11 May 2018 00:29:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzam-0000dC-Dv for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzak-00087q-Ii for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:40 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:42026) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzak-00087g-DH for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:38 -0400 Received: by mail-pl0-x242.google.com with SMTP id u6-v6so2541660pls.9 for ; Thu, 10 May 2018 21:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z+5TIFy3I+D/WDAlD3QSum7pBMO7Xmvbj4B3x10drQ0=; b=c08dDJHWFF4/EGEiuYX5DHhH9KND3DaG9RX0gjvA3d1bBKIrquhzrI1GJSNE2EWEJu 6Wk9ogGmppHSOGGEMrXDTDbSYi5U1sSCqWGT0Nf5gPwhN5F0GvEQcuFPxA1gMA/DU0ul RRBKSs6PRL/INmtw5iBfEOC0Jpc2NO1500skU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z+5TIFy3I+D/WDAlD3QSum7pBMO7Xmvbj4B3x10drQ0=; b=iFmzNEfgg2h/vbTtmOS2hJlbtEE0AKFHwHZcZps7g6X7cD+bxyXMDHS4qkE3SvtKj+ keICzyu3xVxvnD1ZtY8dolIZ5ktMcfoIC+yYj262rxsOCDUzBqzAugyuADa6Rcbx12x/ Pe0GSQvTShlX6I2E2riNARC0TXC5BG7bERDJAIIuN3bHscr1WdG1hntWhbCq3SzuYUMS OoDvt6DI+SjkSGKlfIu1TaQuHDfzAzsMzMmM9y8ANyU1Fqcp6ypTtCxgI6ugMQTcYKMP wgjefRU/IzwEJtY7UVoCII/9TjI+IhI5xrFWRgm+09nIcLA+jEMtXb4beb5GMFf8Od9O Jvkg== X-Gm-Message-State: ALKqPwcS7uUb/wqVQLFeNBFUa9c8jkt9PtlMcfKW1NFgg++QMvHYY5YU oB3PkV5qVBwuitYTfrT4EF0H0XK6MPY= X-Received: by 2002:a17:902:b582:: with SMTP id a2-v6mr3905649pls.371.1526012617125; Thu, 10 May 2018 21:23:37 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:18 -0700 Message-Id: <20180511042324.5070-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PULL 07/13] target/openrisc: Convert dec_mac 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 55 +++++++++++++++--------------------- target/openrisc/insns.decode | 5 ++++ 2 files changed, 27 insertions(+), 33 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 90520b0805..8ca01e1a33 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -971,39 +971,32 @@ static bool trans_l_mtspr(DisasContext *dc, arg_l_mtspr *a, uint32_t insn) return true; } -static void dec_mac(DisasContext *dc, uint32_t insn) +static bool trans_l_mac(DisasContext *dc, arg_ab *a, uint32_t insn) { - uint32_t op0; - uint32_t ra, rb; - op0 = extract32(insn, 0, 4); - ra = extract32(insn, 16, 5); - rb = extract32(insn, 11, 5); + LOG_DIS("l.mac r%d, r%d\n", a->a, a->b); + gen_mac(dc, cpu_R[a->a], cpu_R[a->b]); + return true; +} - switch (op0) { - case 0x0001: /* l.mac */ - LOG_DIS("l.mac r%d, r%d\n", ra, rb); - gen_mac(dc, cpu_R[ra], cpu_R[rb]); - break; +static bool trans_l_msb(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("l.msb r%d, r%d\n", a->a, a->b); + gen_msb(dc, cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x0002: /* l.msb */ - LOG_DIS("l.msb r%d, r%d\n", ra, rb); - gen_msb(dc, cpu_R[ra], cpu_R[rb]); - break; +static bool trans_l_macu(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("l.mac r%d, r%d\n", a->a, a->b); + gen_macu(dc, cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x0003: /* l.macu */ - LOG_DIS("l.macu r%d, r%d\n", ra, rb); - gen_macu(dc, cpu_R[ra], cpu_R[rb]); - break; - - case 0x0004: /* l.msbu */ - LOG_DIS("l.msbu r%d, r%d\n", ra, rb); - gen_msbu(dc, cpu_R[ra], cpu_R[rb]); - break; - - default: - gen_illegal_exception(dc); - break; - } +static bool trans_l_msbu(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("l.msb r%d, r%d\n", a->a, a->b); + gen_msbu(dc, cpu_R[a->a], cpu_R[a->b]); + return true; } static void dec_logic(DisasContext *dc, uint32_t insn) @@ -1506,10 +1499,6 @@ static void disas_openrisc_insn(DisasContext *dc, OpenRISCCPU *cpu) dec_compi(dc, insn); break; - case 0x31: - dec_mac(dc, insn); - break; - case 0x32: dec_float(dc, insn); break; diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 20f035f488..7240c6fb77 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -125,3 +125,8 @@ l_divu 111000 d:5 a:5 b:5 - 11 ---- 1010 l_muld 111000 ----- a:5 b:5 - 11 ---- 0111 l_muldu 111000 ----- a:5 b:5 - 11 ---- 1100 + +l_mac 110001 ----- a:5 b:5 ------- 0001 +l_macu 110001 ----- a:5 b:5 ------- 0011 +l_msb 110001 ----- a:5 b:5 ------- 0010 +l_msbu 110001 ----- a:5 b:5 ------- 0100 From patchwork Fri May 11 04:23:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135493 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp393875lji; Thu, 10 May 2018 21:29:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrvdvuorq2vyY71Y8upnZrM9VgyUclo0uE5WpirmOJiqB4P/SvL20dN5O6lHreUIUBM4tR7 X-Received: by 2002:ac8:1752:: with SMTP id u18-v6mr4114697qtk.177.1526012951966; Thu, 10 May 2018 21:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526012951; cv=none; d=google.com; s=arc-20160816; b=AoNg+Sy3slM/2U0NknmgvFHzW9p0lU5POG5LwfT56bXqekEP5zx31pcPGViqUZUdG+ 98+ddBn8fpQ7J6kpriXsVdbgbSUfqdXp1wUP6pgvTaQrgahiTyyoe+sxsv4UNzrcPtyQ NhTymzERsO4fObm58J39LxYp9QPjp2VIKDSAnv/gHwbRj11WKOQx7Td1I8YW8RgzUxPv 6H7JztvXvdqlG3rPaCkB5P87DegAqRZMzoPjfAmrf7ZrKqsegJEiGnoEKXYFlAGYoMqk 09CEF0WFLmeeXQGmSVZ5a7VJb5IDZcGTyjnRec2zLbANcNnyXozUlfdTTAVpjj7B9c3E kTHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=fdKMSpPgSCU+i/C9BazEFLV/D4k9opP07/GXYcH8Yns=; b=tDpsm95MPFP5oB77reamrhOpmOhk9T1bwbe1QhPNrnf/T049NjUGnfiNeR9MnURYJC cc7U5N2bw93+VkNaaGCchge4hmWhMxtBpNLuWiBU/1Z+iboMYozoYoqWPBo4ZlMaerkN KwWjT/WEu83YfG8UQbiR6iaxQ0qwlgiJ7GkM/jKau/rcthE0e4RS7FzdeIbBHKkdUie6 KemJJMQwgUuYoZcUudA5rK0ZccZ6+E9qfr8Bdjl1ZIr8ha0xoWVG1ii90chaGKJThmmu 2EnhiEkQJRw0Lb7nOtpyzgQcU74LyoeI7V3YGOu9BflepyKwrUOp88qO6DH7BcHEOidX 6YfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ie/c6Rey; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s16-v6si2257356qvj.183.2018.05.10.21.29.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:29:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ie/c6Rey; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzg7-000725-9L for patch@linaro.org; Fri, 11 May 2018 00:29:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzan-0000dp-2J for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzam-00088E-4g for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:41 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:44735) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzal-000884-VB for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:40 -0400 Received: by mail-pl0-x241.google.com with SMTP id e6-v6so2536710plt.11 for ; Thu, 10 May 2018 21:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fdKMSpPgSCU+i/C9BazEFLV/D4k9opP07/GXYcH8Yns=; b=ie/c6ReyIfVvTq/ZJQZIhWnuj8VpTQFbeHBiDADiIV159XNOhtmQ+vkB+3xjKehO63 nG10u3d0oVFxhGyXEgfkak3EKyG2m5O1ySQRhy9YMDEpsu3MBFEaoP6kT0QgYZCHwmV5 25CBoTIRJu7ZROGjeYER3gqwztAKsZOS/PrS0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fdKMSpPgSCU+i/C9BazEFLV/D4k9opP07/GXYcH8Yns=; b=Sv5U+/ceWXzWb0cEeWNXYqZXCy9qdB+pE7tuR2sv0qoVp2bFGs3YZvE4m54FZxQobO MWZNDpnkR5kdUoLJSTOcwU1Cy/Y32AZ7OxpIq3OgQo13rWJRoGdGnTOYz0l35LGtIoV2 Uytm3dWEAvldPXx9ARn4rYHe2WcuEV0pcH9toYSiHBa5TxXXiX0yytqQyDsCG8OYBU/6 OpkUt4idXpcvg78HdKh/ZSIqXKPg5ydtSbNAKQvcBZB1p/WfTm6B4OwLClvrWpkCvbUC UTJ2rw9z+tbiUbbYhBb86Z+M/1kwYUmBwHETPlx+H8iqgeM6eHKMFAxXLfuOekvV+8e6 ZMzg== X-Gm-Message-State: ALKqPwcItbE8JdAqTWa49tgJSfqwoGoj4nMd+3VQp2G3OtyU0Si/+0VZ RfFKU3dYFDqcaPuNltYu622w+Qcs7qA= X-Received: by 2002:a17:902:28e8:: with SMTP id f95-v6mr4029909plb.250.1526012618423; Thu, 10 May 2018 21:23:38 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:19 -0700 Message-Id: <20180511042324.5070-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::241 Subject: [Qemu-devel] [PULL 08/13] target/openrisc: Convert dec_logic 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 62 +++++++++++++++--------------------- target/openrisc/insns.decode | 6 ++++ 2 files changed, 32 insertions(+), 36 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 8ca01e1a33..f2f9a0c0d2 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -999,42 +999,36 @@ static bool trans_l_msbu(DisasContext *dc, arg_ab *a, uint32_t insn) return true; } -static void dec_logic(DisasContext *dc, uint32_t insn) +static bool trans_l_slli(DisasContext *dc, arg_dal *a, uint32_t insn) { - uint32_t op0; - uint32_t rd, ra, L6, S6; - op0 = extract32(insn, 6, 2); - rd = extract32(insn, 21, 5); - ra = extract32(insn, 16, 5); - L6 = extract32(insn, 0, 6); - S6 = L6 & (TARGET_LONG_BITS - 1); + LOG_DIS("l.slli r%d, r%d, %d\n", a->d, a->a, a->l); + check_r0_write(a->d); + tcg_gen_shli_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); + return true; +} - check_r0_write(rd); - switch (op0) { - case 0x00: /* l.slli */ - LOG_DIS("l.slli r%d, r%d, %d\n", rd, ra, L6); - tcg_gen_shli_tl(cpu_R[rd], cpu_R[ra], S6); - break; +static bool trans_l_srli(DisasContext *dc, arg_dal *a, uint32_t insn) +{ + LOG_DIS("l.srli r%d, r%d, %d\n", a->d, a->a, a->l); + check_r0_write(a->d); + tcg_gen_shri_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); + return true; +} - case 0x01: /* l.srli */ - LOG_DIS("l.srli r%d, r%d, %d\n", rd, ra, L6); - tcg_gen_shri_tl(cpu_R[rd], cpu_R[ra], S6); - break; +static bool trans_l_srai(DisasContext *dc, arg_dal *a, uint32_t insn) +{ + LOG_DIS("l.srai r%d, r%d, %d\n", a->d, a->a, a->l); + check_r0_write(a->d); + tcg_gen_sari_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); + return true; +} - case 0x02: /* l.srai */ - LOG_DIS("l.srai r%d, r%d, %d\n", rd, ra, L6); - tcg_gen_sari_tl(cpu_R[rd], cpu_R[ra], S6); - break; - - case 0x03: /* l.rori */ - LOG_DIS("l.rori r%d, r%d, %d\n", rd, ra, L6); - tcg_gen_rotri_tl(cpu_R[rd], cpu_R[ra], S6); - break; - - default: - gen_illegal_exception(dc); - break; - } +static bool trans_l_rori(DisasContext *dc, arg_dal *a, uint32_t insn) +{ + LOG_DIS("l.rori r%d, r%d, %d\n", a->d, a->a, a->l); + check_r0_write(a->d); + tcg_gen_rotri_tl(cpu_R[a->d], cpu_R[a->a], a->l & (TARGET_LONG_BITS - 1)); + return true; } static void dec_M(DisasContext *dc, uint32_t insn) @@ -1491,10 +1485,6 @@ static void disas_openrisc_insn(DisasContext *dc, OpenRISCCPU *cpu) dec_M(dc, insn); break; - case 0x2e: - dec_logic(dc, insn); - break; - case 0x2f: dec_compi(dc, insn); break; diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 7240c6fb77..fb8ba5812a 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -20,6 +20,7 @@ &dab d a b &da d a &ab a b +&dal d a l #### # System Instructions @@ -130,3 +131,8 @@ l_mac 110001 ----- a:5 b:5 ------- 0001 l_macu 110001 ----- a:5 b:5 ------- 0011 l_msb 110001 ----- a:5 b:5 ------- 0010 l_msbu 110001 ----- a:5 b:5 ------- 0100 + +l_slli 101110 d:5 a:5 -------- 00 l:6 +l_srli 101110 d:5 a:5 -------- 01 l:6 +l_srai 101110 d:5 a:5 -------- 10 l:6 +l_rori 101110 d:5 a:5 -------- 11 l:6 From patchwork Fri May 11 04:23:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135496 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp394345lji; Thu, 10 May 2018 21:29:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq1JY/IWTqMcIUVi0WSuxQSBLB19CB9AM5WRBTjeBiWneQWSnC9FWLSNCFdPfhMxLaozKQb X-Received: by 2002:ac8:859:: with SMTP id x25-v6mr4159299qth.48.1526012992197; Thu, 10 May 2018 21:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526012992; cv=none; d=google.com; s=arc-20160816; b=YPOCj1HcAaFT85Sw1Skf+aecZXrYJ4WmChNoQVA/Eg2T/6sq1Z0Aqok5pfN9LCgNsC lDycp1RidEqMbAKUJaXD2YPg8fu4Fw6vn2s11b7XkQzaONv4DaGuzJaIYdp77r7+35FA ZtbKJtWqEqC9erEPmX+UsIRkstI7Rjsa9Yn5WAH5TLdNShK0jDaIF4M6b4+fyuLKG7aa rOCnwJfaX6mvKkqVjygMQ5yZRl6ecyCs4O6kP1v6oYDzohb2cJV0Q2wxJReAVRVZyaew uUWkmZHl/u96c2Q0870GeBXhCH3mwY0kdATlOkgHdRRaWuSjolIn92210rWFEKqeydza dNEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=1lY73R3Cbw8tBI+8Ovo7cwbtTAlyxzG/opbV7x2Z9IQ=; b=WLjOjayQinb855hOyk91uY7eazTsHFvEzPfqWE4HcLjR4rH5qqD3L6qgVITsmHkeyH y6hMgATMag61rUMo3HtJS3IfAgm+8RoCi+GlBk3Ofztb2liXI0zcJ0JoMeZm0wadoMOs N3LEQY1nD5Cq9R4VIxZPuu7C1r2E8LmkjnuA3+pBFUTIwJ/tdrfahhq6Bou3C01Z9MPL fV1gybl1RGBwZoyV5FhBQiUs0iutIVsa1jFIseucEbQQragMG2dCTEN/xGWzC4VExW6f DPJ37SruW1rinPoreh/nrJID0tBYOq66WpP7+nirMMEIwAeLd4jnPzV32X5e6bC0SFlx z16A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DNuT+Sg8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t192-v6si2129420qke.194.2018.05.10.21.29.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:29:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DNuT+Sg8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzgl-0007uR-Kv for patch@linaro.org; Fri, 11 May 2018 00:29:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzao-0000f8-6z for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzan-00088o-CA for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:42 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:39792) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzan-00088U-7k for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:41 -0400 Received: by mail-pl0-x242.google.com with SMTP id c19-v6so2547390pls.6 for ; Thu, 10 May 2018 21:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1lY73R3Cbw8tBI+8Ovo7cwbtTAlyxzG/opbV7x2Z9IQ=; b=DNuT+Sg8e08A0mMTr7sAoDW4XbazuzLsnGpZonTAV7LdzrK/6YbrcP4ZeUaqkhxTNd FDerul/vt8oEb/O/B35iLs2F1FnKMqqxLLRx+IYIqecpa3kqCEZHcyqM5+9NEpTGDAgZ /GJRJzIGnK84uTKKRlyOXiygmwNXK2nUc/TKg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1lY73R3Cbw8tBI+8Ovo7cwbtTAlyxzG/opbV7x2Z9IQ=; b=DppqnXsiuTiO2M5Jh8Am6dXNKSzXjIPqh7eOMUBX7gVIICyqaERNqS0kGXcIzerYkl iIjoVbBNx8+932C0XoAT6S0HyBI+505U0hy77yrShBeGzJpazC3eTGQq6vrnx//I1yFT mvPzbYKwojqkT+EbyM3vUL3WfnMkIVpznCJBhZTYbhtzWw/aILJn6zPd2wax9nnGVcL2 W/09ABWqmTxT3cXSobApSRrBY7VFRj/wMDlKiA3x5vEZ05JlBlHiJpFekc9GmO5IjZh/ 3Bl0KhQv4G+7SoP9VQq9We3n4MoJKnP8qgw+f9qq6ufLn7/k19HhRpFWmoIDx/wxKi68 ljMA== X-Gm-Message-State: ALKqPwfP8NjZ2YHHv7D2ipWaDVqkUJ29nTOUnI0X7iBQskCoPfMj2zkS Eg7hJVmUTEWfiLxYKIF6RWC5J9ywkMo= X-Received: by 2002:a17:902:4081:: with SMTP id c1-v6mr41963pld.60.1526012619987; Thu, 10 May 2018 21:23:39 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:20 -0700 Message-Id: <20180511042324.5070-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PULL 09/13] target/openrisc: Convert dec_M 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 41 ++++++++++++------------------------ target/openrisc/insns.decode | 3 +++ 2 files changed, 16 insertions(+), 28 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index f2f9a0c0d2..548e0230b3 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1031,32 +1031,21 @@ static bool trans_l_rori(DisasContext *dc, arg_dal *a, uint32_t insn) return true; } -static void dec_M(DisasContext *dc, uint32_t insn) +static bool trans_l_movhi(DisasContext *dc, arg_l_movhi *a, uint32_t insn) { - uint32_t op0; - uint32_t rd; - uint32_t K16; - op0 = extract32(insn, 16, 1); - rd = extract32(insn, 21, 5); - K16 = extract32(insn, 0, 16); + LOG_DIS("l.movhi r%d, %d\n", a->d, a->k); + check_r0_write(a->d); + tcg_gen_movi_tl(cpu_R[a->d], a->k << 16); + return true; +} - check_r0_write(rd); - switch (op0) { - case 0x0: /* l.movhi */ - LOG_DIS("l.movhi r%d, %d\n", rd, K16); - tcg_gen_movi_tl(cpu_R[rd], (K16 << 16)); - break; - - case 0x1: /* l.macrc */ - LOG_DIS("l.macrc r%d\n", rd); - tcg_gen_trunc_i64_tl(cpu_R[rd], cpu_mac); - tcg_gen_movi_i64(cpu_mac, 0); - break; - - default: - gen_illegal_exception(dc); - break; - } +static bool trans_l_macrc(DisasContext *dc, arg_l_macrc *a, uint32_t insn) +{ + LOG_DIS("l.macrc r%d\n", a->d); + check_r0_write(a->d); + tcg_gen_trunc_i64_tl(cpu_R[a->d], cpu_mac); + tcg_gen_movi_i64(cpu_mac, 0); + return true; } static void dec_comp(DisasContext *dc, uint32_t insn) @@ -1481,10 +1470,6 @@ static void disas_openrisc_insn(DisasContext *dc, OpenRISCCPU *cpu) op0 = extract32(insn, 26, 6); switch (op0) { - case 0x06: - dec_M(dc, insn); - break; - case 0x2f: dec_compi(dc, insn); break; diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index fb8ba5812a..84f71c13b3 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -95,6 +95,9 @@ l_mtspr 110000 ..... a:5 b:5 ........... k=%mtspr_k l_maci 010011 ----- a:5 i:s16 +l_movhi 000110 d:5 ----0 k:16 +l_macrc 000110 d:5 ----1 00000000 00000000 + #### # Arithmetic Instructions #### From patchwork Fri May 11 04:23:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135499 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp396218lji; Thu, 10 May 2018 21:32:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqbOenS//qDHjTQAHu2fSQcJjxr6h2GkQMgQOF2PZXsJPkAoXT5t7XzqpDxQGVxpE8umIJ8 X-Received: by 2002:a37:ae83:: with SMTP id x125-v6mr3734718qke.130.1526013147628; Thu, 10 May 2018 21:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526013147; cv=none; d=google.com; s=arc-20160816; b=WU87jXTEdno+vOS0g3xpsohCdl2TD4vTNL9m6YuQnGZCSyU80Xow3MggHU58OIb2v/ Yh10yppuw+90sLuE69ozgxKJ3W6LLAOihrObFRnDXaoEHFNXJRL0RJiXCwbSyA1RMkLw Y8e81MKgULWFfkgmHGUboN8bmKzB8L/GYAyvdBLoU2Jo2gAPt0arlBzXSSqL8UTZt1KQ AOq78ikKC0lb1UfBC4j61Zj0V0cQIVF9IdprobXBxm87kZ6l09x5ObBCjDi2VgSKXkmn vYkDW3dV5pq5kxU7xZszRNMdfVNMkUgnZQdHZEWqwnE1f8mBjgudi1t4DbKso7H14tG0 rP6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=FlkcSexzv4clfZ/4+GmlMcHpJQ9S7bQqU4zoMTiVRTA=; b=SExMmoyfLz1pT4m0MhZfsKMceha+m40OGv9t7423tGJGy088ag1yk4nufk2R5sIk9n 3At3Bgxs2MXKUwWzQ/WpZau/EsKAMnRLmLFwly8OBtGbhzNiybukDjCq+H5xBYsNyaxg qRVw0RHTafU1Dg2zmJLe6GaXjHU6Srz7Z40OXrE7vwSa/aEJjlED5e+uG2SV1PAjUtyc J/ZmpN+qg4PUVbRF3f3u+eYOe0/HkjzONpcrJ16VEl246uztILRE5D6BgLP19Dg7AHI+ NVUK3bzQzLI+TLnUYWW2XoKlahZdzIhuz8Tk1Y5PZA9ciGm5HsKK8nmWDPUsaM6iuC5T iyIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KtXmRnrG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w28-v6si2342632qtw.128.2018.05.10.21.32.27 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:32:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KtXmRnrG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzjG-0002B6-Ug for patch@linaro.org; Fri, 11 May 2018 00:32:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzaq-0000hD-4T for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzao-00089D-OL for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:44 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:42027) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzao-000890-GE for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:42 -0400 Received: by mail-pl0-x243.google.com with SMTP id u6-v6so2541759pls.9 for ; Thu, 10 May 2018 21:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FlkcSexzv4clfZ/4+GmlMcHpJQ9S7bQqU4zoMTiVRTA=; b=KtXmRnrGiAl01kV3RDXolu+aWTDuYz60KU17DXbk4Mwy6WIo9DuDxIbl77IlKlIOhc VodTGaG0s897tzH+3KT4mzg9OsciVep2/cjKk8fu+8D3Ormwwo9WL0FQ705lSDNp12ia XQyROqyqRsE2QV+y/mUGhYgxNmDjHZV0N+XgA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FlkcSexzv4clfZ/4+GmlMcHpJQ9S7bQqU4zoMTiVRTA=; b=r7Rb01o02UJkKc88gwyVHIRsNOkF136AHyPeVlwZAIk0c9sS4aB9yMG2swYSSMoygC dbWKlopitfU4w58SKn5qmp9RbkuVfCYx4HHodNMkNvHbuszlsy8poO5OO6UWC9ieFxBM kimriloxKDqkMMi7CMrzBxhBXr7AZGzBwuHyspECRgjki83lGY9qwd/SWbf1lCqpOOVk lHB6WARVaYaLS9lKq7yc8RkoXwWFoS3rrLNpblRo085FrOD82C6hPiC7TvVQczla1+7u NB2iNI1jP63UF04Wr37dzJcMgIBPdsrSh8ej0Dg+SfcQ7b/7lMLMOxcOmQG/RcZ6k7KG LX1g== X-Gm-Message-State: ALKqPweL5zlra3jOoOE9zP+/Fn4AVNS9XWXuJWPiGC6KMs5wJyj7m3Hh 9NB439Cz8sy2j++C3tK5oGAmJQPPhmI= X-Received: by 2002:a17:902:b497:: with SMTP id y23-v6mr3854196plr.309.1526012621289; Thu, 10 May 2018 21:23:41 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:21 -0700 Message-Id: <20180511042324.5070-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PULL 10/13] target/openrisc: Convert dec_comp 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 120 +++++++++++++++++------------------ target/openrisc/insns.decode | 15 +++++ 2 files changed, 73 insertions(+), 62 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 548e0230b3..2c15b2713f 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1048,74 +1048,74 @@ static bool trans_l_macrc(DisasContext *dc, arg_l_macrc *a, uint32_t insn) return true; } -static void dec_comp(DisasContext *dc, uint32_t insn) +static bool trans_l_sfeq(DisasContext *dc, arg_ab *a, TCGCond cond) { - uint32_t op0; - uint32_t ra, rb; + LOG_DIS("l.sfeq r%d, r%d\n", a->a, a->b); + tcg_gen_setcond_tl(TCG_COND_EQ, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + return true; +} - op0 = extract32(insn, 21, 5); - ra = extract32(insn, 16, 5); - rb = extract32(insn, 11, 5); +static bool trans_l_sfne(DisasContext *dc, arg_ab *a, TCGCond cond) +{ + LOG_DIS("l.sfne r%d, r%d\n", a->a, a->b); + tcg_gen_setcond_tl(TCG_COND_NE, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + return true; +} - /* unsigned integers */ - tcg_gen_ext32u_tl(cpu_R[ra], cpu_R[ra]); - tcg_gen_ext32u_tl(cpu_R[rb], cpu_R[rb]); +static bool trans_l_sfgtu(DisasContext *dc, arg_ab *a, TCGCond cond) +{ + LOG_DIS("l.sfgtu r%d, r%d\n", a->a, a->b); + tcg_gen_setcond_tl(TCG_COND_GTU, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + return true; +} - switch (op0) { - case 0x0: /* l.sfeq */ - LOG_DIS("l.sfeq r%d, r%d\n", ra, rb); - tcg_gen_setcond_tl(TCG_COND_EQ, cpu_sr_f, cpu_R[ra], cpu_R[rb]); - break; +static bool trans_l_sfgeu(DisasContext *dc, arg_ab *a, TCGCond cond) +{ + LOG_DIS("l.sfgeu r%d, r%d\n", a->a, a->b); + tcg_gen_setcond_tl(TCG_COND_GEU, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x1: /* l.sfne */ - LOG_DIS("l.sfne r%d, r%d\n", ra, rb); - tcg_gen_setcond_tl(TCG_COND_NE, cpu_sr_f, cpu_R[ra], cpu_R[rb]); - break; +static bool trans_l_sfltu(DisasContext *dc, arg_ab *a, TCGCond cond) +{ + LOG_DIS("l.sfltu r%d, r%d\n", a->a, a->b); + tcg_gen_setcond_tl(TCG_COND_LTU, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x2: /* l.sfgtu */ - LOG_DIS("l.sfgtu r%d, r%d\n", ra, rb); - tcg_gen_setcond_tl(TCG_COND_GTU, cpu_sr_f, cpu_R[ra], cpu_R[rb]); - break; +static bool trans_l_sfleu(DisasContext *dc, arg_ab *a, TCGCond cond) +{ + LOG_DIS("l.sfleu r%d, r%d\n", a->a, a->b); + tcg_gen_setcond_tl(TCG_COND_LEU, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x3: /* l.sfgeu */ - LOG_DIS("l.sfgeu r%d, r%d\n", ra, rb); - tcg_gen_setcond_tl(TCG_COND_GEU, cpu_sr_f, cpu_R[ra], cpu_R[rb]); - break; +static bool trans_l_sfgts(DisasContext *dc, arg_ab *a, TCGCond cond) +{ + LOG_DIS("l.sfgts r%d, r%d\n", a->a, a->b); + tcg_gen_setcond_tl(TCG_COND_GT, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x4: /* l.sfltu */ - LOG_DIS("l.sfltu r%d, r%d\n", ra, rb); - tcg_gen_setcond_tl(TCG_COND_LTU, cpu_sr_f, cpu_R[ra], cpu_R[rb]); - break; +static bool trans_l_sfges(DisasContext *dc, arg_ab *a, TCGCond cond) +{ + LOG_DIS("l.sfges r%d, r%d\n", a->a, a->b); + tcg_gen_setcond_tl(TCG_COND_GE, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0x5: /* l.sfleu */ - LOG_DIS("l.sfleu r%d, r%d\n", ra, rb); - tcg_gen_setcond_tl(TCG_COND_LEU, cpu_sr_f, cpu_R[ra], cpu_R[rb]); - break; +static bool trans_l_sflts(DisasContext *dc, arg_ab *a, TCGCond cond) +{ + LOG_DIS("l.sflts r%d, r%d\n", a->a, a->b); + tcg_gen_setcond_tl(TCG_COND_LT, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + return true; +} - case 0xa: /* l.sfgts */ - LOG_DIS("l.sfgts r%d, r%d\n", ra, rb); - tcg_gen_setcond_tl(TCG_COND_GT, cpu_sr_f, cpu_R[ra], cpu_R[rb]); - break; - - case 0xb: /* l.sfges */ - LOG_DIS("l.sfges r%d, r%d\n", ra, rb); - tcg_gen_setcond_tl(TCG_COND_GE, cpu_sr_f, cpu_R[ra], cpu_R[rb]); - break; - - case 0xc: /* l.sflts */ - LOG_DIS("l.sflts r%d, r%d\n", ra, rb); - tcg_gen_setcond_tl(TCG_COND_LT, cpu_sr_f, cpu_R[ra], cpu_R[rb]); - break; - - case 0xd: /* l.sfles */ - LOG_DIS("l.sfles r%d, r%d\n", ra, rb); - tcg_gen_setcond_tl(TCG_COND_LE, cpu_sr_f, cpu_R[ra], cpu_R[rb]); - break; - - default: - gen_illegal_exception(dc); - break; - } +static bool trans_l_sfles(DisasContext *dc, arg_ab *a, TCGCond cond) +{ + LOG_DIS("l.sfles r%d, r%d\n", a->a, a->b); + tcg_gen_setcond_tl(TCG_COND_LE, cpu_sr_f, cpu_R[a->a], cpu_R[a->b]); + return true; } static void dec_compi(DisasContext *dc, uint32_t insn) @@ -1478,10 +1478,6 @@ static void disas_openrisc_insn(DisasContext *dc, OpenRISCCPU *cpu) dec_float(dc, insn); break; - case 0x39: - dec_comp(dc, insn); - break; - default: gen_illegal_exception(dc); break; diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 84f71c13b3..29d28ff5be 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -139,3 +139,18 @@ l_slli 101110 d:5 a:5 -------- 00 l:6 l_srli 101110 d:5 a:5 -------- 01 l:6 l_srai 101110 d:5 a:5 -------- 10 l:6 l_rori 101110 d:5 a:5 -------- 11 l:6 + +#### +# Compare Instructions +#### + +l_sfeq 111001 00000 a:5 b:5 ----------- +l_sfne 111001 00001 a:5 b:5 ----------- +l_sfgtu 111001 00010 a:5 b:5 ----------- +l_sfgeu 111001 00011 a:5 b:5 ----------- +l_sfltu 111001 00100 a:5 b:5 ----------- +l_sfleu 111001 00101 a:5 b:5 ----------- +l_sfgts 111001 01010 a:5 b:5 ----------- +l_sfges 111001 01011 a:5 b:5 ----------- +l_sflts 111001 01100 a:5 b:5 ----------- +l_sfles 111001 01101 a:5 b:5 ----------- From patchwork Fri May 11 04:23:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135501 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp398631lji; Thu, 10 May 2018 21:36:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoV+r6dMZn9uyQhatQLJocCG/izv1H/hAkv6FJhms/Te8A1sPeD/SbuYATfK4jpvKHWqYL5 X-Received: by 2002:ac8:2753:: with SMTP id h19-v6mr3935257qth.185.1526013368996; Thu, 10 May 2018 21:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526013368; cv=none; d=google.com; s=arc-20160816; b=NfP2l4DBQRpcvPuGpsL5FI60JiKUjODqKW72KcjYsFFMaa0A9oSDYN79r7zL0UxYET QVP++eJZb8lmjqJ3QyGUQNOOUyIjfy5Ir7RPFU2I8MAZPhgrHjOSFn9BxXVXBse+ZFYl 20u8TlgUfgsFtA9JnuV03+92qmwsUmeQN1shEeQ7v0u8GL8aoMJNUVAocjshSLv2DKY9 H5Jq++vr5XwJrc+3VgfME+8269cLMa1ckTW4kaOBhoNhqt3gkojDzTcBtx4pWg4RUn14 YQbXNC5mq6va4YHaq9PjKsF/Bhxzj+MiWiyKzP0H0OU7YF5cvoptFwUbUxri40dLyj7O nhIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=8jjFKfRZdR1Z+4AOKQs6ZIN8e17nL9E6Rxt/cMTfMjs=; b=Hwyl5923Q8FtjzRJYU/5GEf8pGJIaC1EvajkcRu4r2AASGksUhzSWp3i55MWg+3EKM a8arnBnDiI7aJSQRO94KdAZaq9bVjfKqpDI+9zqnT4ayWDmLG0eKqvzoRq3QpkODPD6Y J5y4ko3n2pS3g0if/TMvefJGDX+s6VvWqer8SkjPn8E3/ID+uHLOVIvQjj5jz9y0Uezb RmjlOAug5Z/Ln1PpsuUiKfZ0SYHl1zpZRhcvVk8fVfg7E6iBGT+Slugje6rG3SQ0hCDZ 4TLdK2XbPSoEs0L3TyZ1fgUIqai7tGMxfpTW7Pj4EH0KY4deCxb5o5UeMJ3RjuFW6Glz opIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bk8d4eUU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h7-v6si7868qvk.34.2018.05.10.21.36.08 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:36:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bk8d4eUU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzmq-0005Hb-Du for patch@linaro.org; Fri, 11 May 2018 00:36:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzar-0000iS-EF for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzaq-00089d-61 for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:45 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:41948) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzap-00089Q-UV for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:44 -0400 Received: by mail-pl0-x243.google.com with SMTP id az12-v6so2541253plb.8 for ; Thu, 10 May 2018 21:23:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8jjFKfRZdR1Z+4AOKQs6ZIN8e17nL9E6Rxt/cMTfMjs=; b=bk8d4eUUrT6CPFMLah90A60qWWeLySTWiZBw1Zme9F1g2L+aMomivIWLnkq+FA2U2o wvwwNgr4D4wq5in6f4T5Jf4mYljwZBRw22bqBrN5WuuSfGHcG7rRjzRhpTo1sZTCwSH4 YBP6EUiI9hMct20a4gDE2G4v7nkd+0BXjaBdA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8jjFKfRZdR1Z+4AOKQs6ZIN8e17nL9E6Rxt/cMTfMjs=; b=i9/mvOdMFR8n2H2JBjQaiULd79P5xzQr+jIujxAWPyRtT6DcuIPBgtVed/xbFV2/Qe fvtQnjWMw6DrTaK0o93jrx3HBhWZy27WTiXibsAw/SWrQ15/IRmw73L7EipdsfkJhTKe lxk3sGvQyimNkVFRrOBW1occyju9+3fHOSph6q2bqpMkiOJ8LcfgN3Dbb1Hk+QOwOViW zvlYkZ/Q5coDTFc+dc842qcLkLWktQ+InloFlWRuMBJ0UaYsCXfclL88H1ypmAPdLEpK xw6Z2NNjKyr8hoFy1QDrWssbyxt/rf8jXJ4vhLrNqozGRIuPIK/el3wso9KL9es3MgRK ySZA== X-Gm-Message-State: ALKqPwdanbeAJrg6s9U7oWFFbPxj+B00+oQdHIqHSXH7lZSZySSYMlrh /zNAz4+6Es32EaC1qyP4xTboJgnhiV0= X-Received: by 2002:a17:902:9a8a:: with SMTP id w10-v6mr3977742plp.333.1526012622715; Thu, 10 May 2018 21:23:42 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:22 -0700 Message-Id: <20180511042324.5070-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PULL 11/13] target/openrisc: Convert dec_compi 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 116 +++++++++++++++++------------------ target/openrisc/insns.decode | 12 ++++ 2 files changed, 70 insertions(+), 58 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 2c15b2713f..f02d04cbce 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1118,70 +1118,74 @@ static bool trans_l_sfles(DisasContext *dc, arg_ab *a, TCGCond cond) return true; } -static void dec_compi(DisasContext *dc, uint32_t insn) +static bool trans_l_sfeqi(DisasContext *dc, arg_ai *a, TCGCond cond) { - uint32_t op0, ra; - int32_t I16; + LOG_DIS("l.sfeqi r%d, %d\n", a->a, a->i); + tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_sr_f, cpu_R[a->a], a->i); + return true; +} - op0 = extract32(insn, 21, 5); - ra = extract32(insn, 16, 5); - I16 = sextract32(insn, 0, 16); +static bool trans_l_sfnei(DisasContext *dc, arg_ai *a, TCGCond cond) +{ + LOG_DIS("l.sfnei r%d, %d\n", a->a, a->i); + tcg_gen_setcondi_tl(TCG_COND_NE, cpu_sr_f, cpu_R[a->a], a->i); + return true; +} - switch (op0) { - case 0x0: /* l.sfeqi */ - LOG_DIS("l.sfeqi r%d, %d\n", ra, I16); - tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_sr_f, cpu_R[ra], I16); - break; +static bool trans_l_sfgtui(DisasContext *dc, arg_ai *a, TCGCond cond) +{ + LOG_DIS("l.sfgtui r%d, %d\n", a->a, a->i); + tcg_gen_setcondi_tl(TCG_COND_GTU, cpu_sr_f, cpu_R[a->a], a->i); + return true; +} - case 0x1: /* l.sfnei */ - LOG_DIS("l.sfnei r%d, %d\n", ra, I16); - tcg_gen_setcondi_tl(TCG_COND_NE, cpu_sr_f, cpu_R[ra], I16); - break; +static bool trans_l_sfgeui(DisasContext *dc, arg_ai *a, TCGCond cond) +{ + LOG_DIS("l.sfgeui r%d, %d\n", a->a, a->i); + tcg_gen_setcondi_tl(TCG_COND_GEU, cpu_sr_f, cpu_R[a->a], a->i); + return true; +} - case 0x2: /* l.sfgtui */ - LOG_DIS("l.sfgtui r%d, %d\n", ra, I16); - tcg_gen_setcondi_tl(TCG_COND_GTU, cpu_sr_f, cpu_R[ra], I16); - break; +static bool trans_l_sfltui(DisasContext *dc, arg_ai *a, TCGCond cond) +{ + LOG_DIS("l.sfltui r%d, %d\n", a->a, a->i); + tcg_gen_setcondi_tl(TCG_COND_LTU, cpu_sr_f, cpu_R[a->a], a->i); + return true; +} - case 0x3: /* l.sfgeui */ - LOG_DIS("l.sfgeui r%d, %d\n", ra, I16); - tcg_gen_setcondi_tl(TCG_COND_GEU, cpu_sr_f, cpu_R[ra], I16); - break; +static bool trans_l_sfleui(DisasContext *dc, arg_ai *a, TCGCond cond) +{ + LOG_DIS("l.sfleui r%d, %d\n", a->a, a->i); + tcg_gen_setcondi_tl(TCG_COND_LEU, cpu_sr_f, cpu_R[a->a], a->i); + return true; +} - case 0x4: /* l.sfltui */ - LOG_DIS("l.sfltui r%d, %d\n", ra, I16); - tcg_gen_setcondi_tl(TCG_COND_LTU, cpu_sr_f, cpu_R[ra], I16); - break; +static bool trans_l_sfgtsi(DisasContext *dc, arg_ai *a, TCGCond cond) +{ + LOG_DIS("l.sfgtsi r%d, %d\n", a->a, a->i); + tcg_gen_setcondi_tl(TCG_COND_GT, cpu_sr_f, cpu_R[a->a], a->i); + return true; +} - case 0x5: /* l.sfleui */ - LOG_DIS("l.sfleui r%d, %d\n", ra, I16); - tcg_gen_setcondi_tl(TCG_COND_LEU, cpu_sr_f, cpu_R[ra], I16); - break; +static bool trans_l_sfgesi(DisasContext *dc, arg_ai *a, TCGCond cond) +{ + LOG_DIS("l.sfgesi r%d, %d\n", a->a, a->i); + tcg_gen_setcondi_tl(TCG_COND_GE, cpu_sr_f, cpu_R[a->a], a->i); + return true; +} - case 0xa: /* l.sfgtsi */ - LOG_DIS("l.sfgtsi r%d, %d\n", ra, I16); - tcg_gen_setcondi_tl(TCG_COND_GT, cpu_sr_f, cpu_R[ra], I16); - break; +static bool trans_l_sfltsi(DisasContext *dc, arg_ai *a, TCGCond cond) +{ + LOG_DIS("l.sfltsi r%d, %d\n", a->a, a->i); + tcg_gen_setcondi_tl(TCG_COND_LT, cpu_sr_f, cpu_R[a->a], a->i); + return true; +} - case 0xb: /* l.sfgesi */ - LOG_DIS("l.sfgesi r%d, %d\n", ra, I16); - tcg_gen_setcondi_tl(TCG_COND_GE, cpu_sr_f, cpu_R[ra], I16); - break; - - case 0xc: /* l.sfltsi */ - LOG_DIS("l.sfltsi r%d, %d\n", ra, I16); - tcg_gen_setcondi_tl(TCG_COND_LT, cpu_sr_f, cpu_R[ra], I16); - break; - - case 0xd: /* l.sflesi */ - LOG_DIS("l.sflesi r%d, %d\n", ra, I16); - tcg_gen_setcondi_tl(TCG_COND_LE, cpu_sr_f, cpu_R[ra], I16); - break; - - default: - gen_illegal_exception(dc); - break; - } +static bool trans_l_sflesi(DisasContext *dc, arg_ai *a, TCGCond cond) +{ + LOG_DIS("l.sflesi r%d, %d\n", a->a, a->i); + tcg_gen_setcondi_tl(TCG_COND_LE, cpu_sr_f, cpu_R[a->a], a->i); + return true; } static bool trans_l_sys(DisasContext *dc, arg_l_sys *a, uint32_t insn) @@ -1470,10 +1474,6 @@ static void disas_openrisc_insn(DisasContext *dc, OpenRISCCPU *cpu) op0 = extract32(insn, 26, 6); switch (op0) { - case 0x2f: - dec_compi(dc, insn); - break; - case 0x32: dec_float(dc, insn); break; diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 29d28ff5be..4ec0e2de3a 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -21,6 +21,7 @@ &da d a &ab a b &dal d a l +&ai a i #### # System Instructions @@ -154,3 +155,14 @@ l_sfgts 111001 01010 a:5 b:5 ----------- l_sfges 111001 01011 a:5 b:5 ----------- l_sflts 111001 01100 a:5 b:5 ----------- l_sfles 111001 01101 a:5 b:5 ----------- + +l_sfeqi 101111 00000 a:5 i:s16 +l_sfnei 101111 00001 a:5 i:s16 +l_sfgtui 101111 00010 a:5 i:s16 +l_sfgeui 101111 00011 a:5 i:s16 +l_sfltui 101111 00100 a:5 i:s16 +l_sfleui 101111 00101 a:5 i:s16 +l_sfgtsi 101111 01010 a:5 i:s16 +l_sfgesi 101111 01011 a:5 i:s16 +l_sfltsi 101111 01100 a:5 i:s16 +l_sflesi 101111 01101 a:5 i:s16 From patchwork Fri May 11 04:23:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135500 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp397426lji; Thu, 10 May 2018 21:34:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqG/r2cp193bRM8KVfCGL+hUtZMRxXY7rL3a1TXeUi20oGx0oIjIjrw/oi7SZrk6BySUlVJ X-Received: by 2002:a0c:bc95:: with SMTP id l21-v6mr3878998qvg.238.1526013260259; Thu, 10 May 2018 21:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526013260; cv=none; d=google.com; s=arc-20160816; b=hI9aiI/Hc8aIADIOnY6/kFouwnFoXtQGiAkzXTGGJmSKoO+rWhLknO4rALRILLreJO g1PAdS7quXaaZe6smzWJconMp1M9KekBIcD33/zYafDEwxxxf4xCTrrTUWs9Jqaum+5Y oAsLb3pYCLcomiDeoud3jD/xuWK9XhSeeNGnog5Rx5vpb+X4CPHhak4Irv+79Svv8GBs jI7wrrW2xHp3JjPLdSUjCzZO6KIxCtkhqnRnHpX+pB8NC5xwPd6BuzIHdIofYAn0nWRy verwondQ4K8llYihPTilGJvne3VlXYnMcP7XToV5QdLn9DR1ljx89cDS/jlCzGWCYoAt oJpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=UjukMuKdZlCOccmp49pHBQ6hfJ2aGFiC9Zh/q162D3U=; b=Cfq9Wtlf3OBBp0VJy1jb7cPlep1o5aJsOsCsQIVa1cte/+cNncbFNJvYzMmOA9C1mL tsnJ8BPOfeUebuuB950rWMMzEpfjuPSzVGhgNJlYwj15Oo1dNGdfM2lFnxXCldr8DB4C AfKMPWkROnkgTU4Lt4VWLaLRPiyl3SVs/hqlMzVCuJBy6Px6ALQslAlVnrCeAglLx0KD kHzceJL+Bdqs8fsYcAb+7wmbogVI5NQeAkc5UjimoRGH1xc5vkG8XXFEtZkX0VvhRaMM u2Df2zb+Jx+UXBgwytDNDz/zN1qdE+L44WcpCEmCSg/p005/HWCfBT5OZMm/dT8V+qQJ ed0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WxzP/CIZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f16-v6si2267690qvm.80.2018.05.10.21.34.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:34:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WxzP/CIZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzl5-0003pQ-OA for patch@linaro.org; Fri, 11 May 2018 00:34:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzau-0000jW-KT for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzar-0008A5-H4 for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:47 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:34555) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzar-00089r-8v for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:45 -0400 Received: by mail-pf0-x243.google.com with SMTP id a14-v6so2104767pfi.1 for ; Thu, 10 May 2018 21:23:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UjukMuKdZlCOccmp49pHBQ6hfJ2aGFiC9Zh/q162D3U=; b=WxzP/CIZFG89gGyKgNy1FigTzqh5jADlbh2Jc1D4iL7NtWUzGo47u8ngN1acAqRevx GEYFN8phgXiTtX1JPurMFMZf2+QvAua5uaYpjOHL/Jnuo9hVgl+nUAaA9YFzwHk2Egah v+UKsEMR4CoAdBgEihoZ3YS5xcVzSA2HbsSjo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UjukMuKdZlCOccmp49pHBQ6hfJ2aGFiC9Zh/q162D3U=; b=V1NAGR1rzXy5VXPwsLoegZhjV41M6vnC3K86DOq6frU44JxmyQ2pNpPCaPByIvHyyF T3gt33q1WdsWEcbtcWAH96qUvzcCrpzMqFglN1WZEfvcunfJWswBFD5rj+2+i6slgCbC kCw5FYvcPDw4p2E+YRif6/KgV4bOj85W+OaSpHYUKwevItGN6U1EO3JQl2Jq4Nyy+SFP PyJ6P31hNAcZ71v8vDKQ51Uh1uYBpjNJuojI68hvghZ9A+oja7Q/wKq8h0L/Ud8nSiDW EcokJFGHUCfIliaZbKxlU4CVdcwLzCRSDaoI8YwAuo3BGyrU1Qk67HiV+3/e427kZLtW toEg== X-Gm-Message-State: ALKqPweD2p3PbGblWQfZiIsz2yq6GPLF5YnWGLHzvNF3zO5YQab7rvJM 5gvSSZf6LIdp5ebu5fLF0KnTlu5Lgd0= X-Received: by 2002:a65:4443:: with SMTP id e3-v6mr1649520pgq.348.1526012623948; Thu, 10 May 2018 21:23:43 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:23 -0700 Message-Id: <20180511042324.5070-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PULL 12/13] target/openrisc: Convert dec_float 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 359 +++++++++++++---------------------- target/openrisc/insns.decode | 21 ++ 2 files changed, 149 insertions(+), 231 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index f02d04cbce..66e493220e 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1241,246 +1241,143 @@ static bool trans_l_rfe(DisasContext *dc, arg_l_rfe *a, uint32_t insn) return true; } -static void dec_float(DisasContext *dc, uint32_t insn) +static void do_fp2(DisasContext *dc, arg_da *a, + void (*fn)(TCGv, TCGv_env, TCGv)) { - uint32_t op0; - uint32_t ra, rb, rd; - op0 = extract32(insn, 0, 8); - ra = extract32(insn, 16, 5); - rb = extract32(insn, 11, 5); - rd = extract32(insn, 21, 5); + check_r0_write(a->d); + fn(cpu_R[a->d], cpu_env, cpu_R[a->a]); + gen_helper_update_fpcsr(cpu_env); +} - switch (op0) { - case 0x00: /* lf.add.s */ - LOG_DIS("lf.add.s r%d, r%d, r%d\n", rd, ra, rb); - check_r0_write(rd); - gen_helper_float_add_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; +static void do_fp3(DisasContext *dc, arg_dab *a, + void (*fn)(TCGv, TCGv_env, TCGv, TCGv)) +{ + check_r0_write(a->d); + fn(cpu_R[a->d], cpu_env, cpu_R[a->a], cpu_R[a->b]); + gen_helper_update_fpcsr(cpu_env); +} - case 0x01: /* lf.sub.s */ - LOG_DIS("lf.sub.s r%d, r%d, r%d\n", rd, ra, rb); - check_r0_write(rd); - gen_helper_float_sub_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x02: /* lf.mul.s */ - LOG_DIS("lf.mul.s r%d, r%d, r%d\n", rd, ra, rb); - check_r0_write(rd); - gen_helper_float_mul_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x03: /* lf.div.s */ - LOG_DIS("lf.div.s r%d, r%d, r%d\n", rd, ra, rb); - check_r0_write(rd); - gen_helper_float_div_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x04: /* lf.itof.s */ - LOG_DIS("lf.itof r%d, r%d\n", rd, ra); - check_r0_write(rd); - gen_helper_itofs(cpu_R[rd], cpu_env, cpu_R[ra]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x05: /* lf.ftoi.s */ - LOG_DIS("lf.ftoi r%d, r%d\n", rd, ra); - check_r0_write(rd); - gen_helper_ftois(cpu_R[rd], cpu_env, cpu_R[ra]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x06: /* lf.rem.s */ - LOG_DIS("lf.rem.s r%d, r%d, r%d\n", rd, ra, rb); - check_r0_write(rd); - gen_helper_float_rem_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x07: /* lf.madd.s */ - LOG_DIS("lf.madd.s r%d, r%d, r%d\n", rd, ra, rb); - check_r0_write(rd); - gen_helper_float_madd_s(cpu_R[rd], cpu_env, cpu_R[rd], - cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x08: /* lf.sfeq.s */ - LOG_DIS("lf.sfeq.s r%d, r%d\n", ra, rb); - gen_helper_float_eq_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x09: /* lf.sfne.s */ - LOG_DIS("lf.sfne.s r%d, r%d\n", ra, rb); - gen_helper_float_eq_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); - tcg_gen_xori_tl(cpu_sr_f, cpu_sr_f, 1); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x0a: /* lf.sfgt.s */ - LOG_DIS("lf.sfgt.s r%d, r%d\n", ra, rb); - gen_helper_float_lt_s(cpu_sr_f, cpu_env, cpu_R[rb], cpu_R[ra]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x0b: /* lf.sfge.s */ - LOG_DIS("lf.sfge.s r%d, r%d\n", ra, rb); - gen_helper_float_le_s(cpu_sr_f, cpu_env, cpu_R[rb], cpu_R[ra]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x0c: /* lf.sflt.s */ - LOG_DIS("lf.sflt.s r%d, r%d\n", ra, rb); - gen_helper_float_lt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x0d: /* lf.sfle.s */ - LOG_DIS("lf.sfle.s r%d, r%d\n", ra, rb); - gen_helper_float_le_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - -#ifdef TARGET_OPENRISC64 - case 0x10: /* lf.add.d */ - LOG_DIS("lf.add.d r%d, r%d, r%d\n", rd, ra, rb); - check_of64s(dc); - check_r0_write(rd); - gen_helper_float_add_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x11: /* lf.sub.d */ - LOG_DIS("lf.sub.d r%d, r%d, r%d\n", rd, ra, rb); - check_of64s(dc); - check_r0_write(rd); - gen_helper_float_sub_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x12: /* lf.mul.d */ - LOG_DIS("lf.mul.d r%d, r%d, r%d\n", rd, ra, rb); - check_of64s(dc); - check_r0_write(rd); - gen_helper_float_mul_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x13: /* lf.div.d */ - LOG_DIS("lf.div.d r%d, r%d, r%d\n", rd, ra, rb); - check_of64s(dc); - check_r0_write(rd); - gen_helper_float_div_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x14: /* lf.itof.d */ - LOG_DIS("lf.itof r%d, r%d\n", rd, ra); - check_of64s(dc); - check_r0_write(rd); - gen_helper_itofd(cpu_R[rd], cpu_env, cpu_R[ra]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x15: /* lf.ftoi.d */ - LOG_DIS("lf.ftoi r%d, r%d\n", rd, ra); - check_of64s(dc); - check_r0_write(rd); - gen_helper_ftoid(cpu_R[rd], cpu_env, cpu_R[ra]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x16: /* lf.rem.d */ - LOG_DIS("lf.rem.d r%d, r%d, r%d\n", rd, ra, rb); - check_of64s(dc); - check_r0_write(rd); - gen_helper_float_rem_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x17: /* lf.madd.d */ - LOG_DIS("lf.madd.d r%d, r%d, r%d\n", rd, ra, rb); - check_of64s(dc); - check_r0_write(rd); - gen_helper_float_madd_d(cpu_R[rd], cpu_env, cpu_R[rd], - cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x18: /* lf.sfeq.d */ - LOG_DIS("lf.sfeq.d r%d, r%d\n", ra, rb); - check_of64s(dc); - gen_helper_float_eq_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x1a: /* lf.sfgt.d */ - LOG_DIS("lf.sfgt.d r%d, r%d\n", ra, rb); - check_of64s(dc); - gen_helper_float_lt_d(cpu_sr_f, cpu_env, cpu_R[rb], cpu_R[ra]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x1b: /* lf.sfge.d */ - LOG_DIS("lf.sfge.d r%d, r%d\n", ra, rb); - check_of64s(dc); - gen_helper_float_le_d(cpu_sr_f, cpu_env, cpu_R[rb], cpu_R[ra]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x19: /* lf.sfne.d */ - LOG_DIS("lf.sfne.d r%d, r%d\n", ra, rb); - check_of64s(dc); - gen_helper_float_eq_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); - tcg_gen_xori_tl(cpu_sr_f, cpu_sr_f, 1); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x1c: /* lf.sflt.d */ - LOG_DIS("lf.sflt.d r%d, r%d\n", ra, rb); - check_of64s(dc); - gen_helper_float_lt_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; - - case 0x1d: /* lf.sfle.d */ - LOG_DIS("lf.sfle.d r%d, r%d\n", ra, rb); - check_of64s(dc); - gen_helper_float_le_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); - gen_helper_update_fpcsr(cpu_env); - break; -#endif - - default: - gen_illegal_exception(dc); - break; +static void do_fpcmp(DisasContext *dc, arg_ab *a, + void (*fn)(TCGv, TCGv_env, TCGv, TCGv), + bool inv, bool swap) +{ + if (swap) { + fn(cpu_sr_f, cpu_env, cpu_R[a->b], cpu_R[a->a]); + } else { + fn(cpu_sr_f, cpu_env, cpu_R[a->a], cpu_R[a->b]); } + if (inv) { + tcg_gen_xori_tl(cpu_sr_f, cpu_sr_f, 1); + } + gen_helper_update_fpcsr(cpu_env); +} + +static bool trans_lf_add_s(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("lf.add.s r%d, r%d, r%d\n", a->d, a->a, a->b); + do_fp3(dc, a, gen_helper_float_add_s); + return true; +} + +static bool trans_lf_sub_s(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("lf.sub.s r%d, r%d, r%d\n", a->d, a->a, a->b); + do_fp3(dc, a, gen_helper_float_sub_s); + return true; +} + +static bool trans_lf_mul_s(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("lf.mul.s r%d, r%d, r%d\n", a->d, a->a, a->b); + do_fp3(dc, a, gen_helper_float_mul_s); + return true; +} + +static bool trans_lf_div_s(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("lf.div.s r%d, r%d, r%d\n", a->d, a->a, a->b); + do_fp3(dc, a, gen_helper_float_div_s); + return true; +} + +static bool trans_lf_rem_s(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("lf.rem.s r%d, r%d, r%d\n", a->d, a->a, a->b); + do_fp3(dc, a, gen_helper_float_rem_s); + return true; +} + +static bool trans_lf_itof_s(DisasContext *dc, arg_da *a, uint32_t insn) +{ + LOG_DIS("lf.itof.s r%d, r%d\n", a->d, a->a); + do_fp2(dc, a, gen_helper_itofs); + return true; +} + +static bool trans_lf_ftoi_s(DisasContext *dc, arg_da *a, uint32_t insn) +{ + LOG_DIS("lf.ftoi.s r%d, r%d\n", a->d, a->a); + do_fp2(dc, a, gen_helper_ftois); + return true; +} + +static bool trans_lf_madd_s(DisasContext *dc, arg_dab *a, uint32_t insn) +{ + LOG_DIS("lf.madd.s r%d, r%d, r%d\n", a->d, a->a, a->b); + check_r0_write(a->d); + gen_helper_float_madd_s(cpu_R[a->d], cpu_env, cpu_R[a->d], + cpu_R[a->a], cpu_R[a->b]); + gen_helper_update_fpcsr(cpu_env); + return true; +} + +static bool trans_lf_sfeq_s(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("lf.sfeq.s r%d, r%d\n", a->a, a->b); + do_fpcmp(dc, a, gen_helper_float_eq_s, false, false); + return true; +} + +static bool trans_lf_sfne_s(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("lf.sfne.s r%d, r%d\n", a->a, a->b); + do_fpcmp(dc, a, gen_helper_float_eq_s, true, false); + return true; +} + +static bool trans_lf_sfgt_s(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("lf.sfgt.s r%d, r%d\n", a->a, a->b); + do_fpcmp(dc, a, gen_helper_float_lt_s, false, true); + return true; +} + +static bool trans_lf_sfge_s(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("lf.sfge.s r%d, r%d\n", a->a, a->b); + do_fpcmp(dc, a, gen_helper_float_le_s, false, true); + return true; +} + +static bool trans_lf_sflt_s(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("lf.sflt.s r%d, r%d\n", a->a, a->b); + do_fpcmp(dc, a, gen_helper_float_lt_s, false, false); + return true; +} + +static bool trans_lf_sfle_s(DisasContext *dc, arg_ab *a, uint32_t insn) +{ + LOG_DIS("lf.sfle.s r%d, r%d\n", a->a, a->b); + do_fpcmp(dc, a, gen_helper_float_le_s, false, false); + return true; } static void disas_openrisc_insn(DisasContext *dc, OpenRISCCPU *cpu) { - uint32_t op0; - uint32_t insn; - insn = cpu_ldl_code(&cpu->env, dc->pc); - - /* Transition to the auto-generated decoder. */ - if (decode(dc, insn)) { - return; - } - - op0 = extract32(insn, 26, 6); - switch (op0) { - case 0x32: - dec_float(dc, insn); - break; - - default: + uint32_t insn = cpu_ldl_code(&cpu->env, dc->pc); + if (!decode(dc, insn)) { gen_illegal_exception(dc); - break; } } diff --git a/target/openrisc/insns.decode b/target/openrisc/insns.decode index 4ec0e2de3a..dad68c8422 100644 --- a/target/openrisc/insns.decode +++ b/target/openrisc/insns.decode @@ -166,3 +166,24 @@ l_sfgtsi 101111 01010 a:5 i:s16 l_sfgesi 101111 01011 a:5 i:s16 l_sfltsi 101111 01100 a:5 i:s16 l_sflesi 101111 01101 a:5 i:s16 + +#### +# FP Instructions +#### + +lf_add_s 110010 d:5 a:5 b:5 --- 00000000 +lf_sub_s 110010 d:5 a:5 b:5 --- 00000001 +lf_mul_s 110010 d:5 a:5 b:5 --- 00000010 +lf_div_s 110010 d:5 a:5 b:5 --- 00000011 +lf_rem_s 110010 d:5 a:5 b:5 --- 00000110 +lf_madd_s 110010 d:5 a:5 b:5 --- 00000111 + +lf_itof_s 110010 d:5 a:5 00000 --- 00000100 +lf_ftoi_s 110010 d:5 a:5 00000 --- 00000101 + +lf_sfeq_s 110010 ----- a:5 b:5 --- 00001000 +lf_sfne_s 110010 ----- a:5 b:5 --- 00001001 +lf_sfgt_s 110010 ----- a:5 b:5 --- 00001010 +lf_sfge_s 110010 ----- a:5 b:5 --- 00001011 +lf_sflt_s 110010 ----- a:5 b:5 --- 00001100 +lf_sfle_s 110010 ----- a:5 b:5 --- 00001101 From patchwork Fri May 11 04:23:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135502 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp398709lji; Thu, 10 May 2018 21:36:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqD/GP1yCxnVyh3TjD/lprBtDTXyVhkKrMJ6TUESHIRp+TKJhuoQWt5qEDSexkgpOxiSgHb X-Received: by 2002:aed:2864:: with SMTP id r91-v6mr4019332qtd.233.1526013375774; Thu, 10 May 2018 21:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526013375; cv=none; d=google.com; s=arc-20160816; b=Oc2Az8Vuvd9AITrVj3VtCzLc6DFuNTwQGtROX2/YpOju/eg7CTwHZ5u8gT9QT9xSi3 UPKJn8NwrpnNW8gZWTYFeHTZEVLwboqh6HX8i3tqnY+rIL2xz51VnzEjZ3LZGcYHTIUx BQ+MRWdpV3svKTq94f6SFFAPv04W6R+a4KW3nmxpgZOYjL/6C6ZfqmeqVIic67FjbJzb Vdy7vhfX5Z9DphThNqDG8Ro8HSAf5X8x8alr14clfK0HNBI8ToJ5yKyYGJrXEom83WNy LHkQapCl7/0ERr8p7WJm54p0Rs7vE6sAEjhwkkCAwT4AqvsCGSP/6hPJCyJVlV0VjrXj ZpSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=Yg0xUOuQh/q5/fKTd9F65rB9ebwPsYTBtK543/i/CMc=; b=e+EZBagjaTwMtp1wynMACBYTSIIUqCstEMlDcHwhNQei4IYNI2gSdyqLQ7ZxfTkOf6 jkygdQH2uzbnirTqkQecoda+ChX/gWWYMbIZ+g2srx1bISpOwX6aS8Dyl8Z2yHHfYd0P P2/El+as/5JEIlyQMwMlfV1XKldXt6lN2NQItrSwD9D9vR7zWnztL8GjuihsNb73IpQO CYH/8NoHdIcd4a0ElkTR875llpqPCKCEEOrYHc7rfWO/Hm+kuuJf7g4rg9YOIB6/L0ak apoiDBka5sLwyMmwY0eTA5vLXKLuRgEgcl2SecBTg/HmeHbpY2fksSg2latkrxOvYXQ9 wjtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WqNfSa8v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c20-v6si2286096qvi.235.2018.05.10.21.36.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 10 May 2018 21:36:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WqNfSa8v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzmx-0005KG-6k for patch@linaro.org; Fri, 11 May 2018 00:36:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGzav-0000kx-Sq for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGzas-0008Ah-Qa for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:49 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:43685) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGzas-0008AP-LS for qemu-devel@nongnu.org; Fri, 11 May 2018 00:23:46 -0400 Received: by mail-pl0-x243.google.com with SMTP id a39-v6so2536424pla.10 for ; Thu, 10 May 2018 21:23:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Yg0xUOuQh/q5/fKTd9F65rB9ebwPsYTBtK543/i/CMc=; b=WqNfSa8vWar+iMXxPWezzJciHhEhIhuCnIveujGULHHipbKXQ8WZX/+5W3XyZtoR6v p1bQuxyPy/hOyUrKOTcX4UsEq7HiFuuBkbz7o8lTMfgm4B7yYkqKuGUpDIFUAAGb8ZFx ejEM/YGxV6ECin/QInuJi6ggxXSLkznWWDM98= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Yg0xUOuQh/q5/fKTd9F65rB9ebwPsYTBtK543/i/CMc=; b=p2aTqTG55/j/ySt2AVzSYIbrU5+oHMdnDgsep+CP8++Mwl2WFLwr0ICHM+Jkr861MZ LgkJcgxAGkj9yO6tSqmPsr+iA+AnQMPFre7SOxCdwcuAX3NdXW66oLo0BBBO37YtZehI Du4YhakyG85YJ+mYmI+XdEcqEHAjpUi++ZggfUCAR7IaJ7m7nUR84pHQK5UUuglSL1ti FDdwcGpnvL7dnSuayjySg7af2YglOy78e7TO8MTANqtkLs2K7mnNlbCyWt1aXFV+7iNB yx56v4Hw+BuGmpFXR9g0zNF5or6Pi9HtaPxbhPRg/z1L5g9oSW5ng+6ENzKvno8AoDgA z/2g== X-Gm-Message-State: ALKqPwczsdlLLtBPeweVmJX3I1CBB1WQ8aKbO+HmtEISmdSx86+xSV9h 3D7vCULA4rqqeGLzNv22wEQmM5laZVg= X-Received: by 2002:a17:902:b942:: with SMTP id h2-v6mr4043572pls.312.1526012625525; Thu, 10 May 2018 21:23:45 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id r76-v6sm4509462pfl.1.2018.05.10.21.23.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 21:23:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 10 May 2018 21:23:24 -0700 Message-Id: <20180511042324.5070-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511042324.5070-1-richard.henderson@linaro.org> References: <20180511042324.5070-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PULL 13/13] target/openrisc: Merge disas_openrisc_insn 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: peter.maydell@linaro.org, Stafford Horne Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/translate.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 66e493220e..3866106bf6 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1373,14 +1373,6 @@ static bool trans_lf_sfle_s(DisasContext *dc, arg_ab *a, uint32_t insn) return true; } -static void disas_openrisc_insn(DisasContext *dc, OpenRISCCPU *cpu) -{ - uint32_t insn = cpu_ldl_code(&cpu->env, dc->pc); - if (!decode(dc, insn)) { - gen_illegal_exception(dc); - } -} - void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) { CPUOpenRISCState *env = cs->env_ptr; @@ -1388,6 +1380,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) struct DisasContext ctx, *dc = &ctx; uint32_t pc_start; uint32_t next_page_start; + uint32_t insn; int num_insns; int max_insns; @@ -1449,7 +1442,11 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) if (num_insns == max_insns && (tb_cflags(tb) & CF_LAST_IO)) { gen_io_start(); } - disas_openrisc_insn(dc, cpu); + + insn = cpu_ldl_code(&cpu->env, dc->pc); + if (!decode(dc, insn)) { + gen_illegal_exception(dc); + } dc->pc = dc->pc + 4; /* delay slot */