From patchwork Mon May 14 22:27: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: 135791 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp209340lji; Mon, 14 May 2018 15:43:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZouhdqYGkU6+iQ/i5CVkgJ+xyJ/TP/3QoOg/DQzWKDV1rfs3rcpxbskToMpMKhcl9a0+CS/ X-Received: by 2002:a37:95c6:: with SMTP id x189-v6mr10001176qkd.110.1526337789920; Mon, 14 May 2018 15:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526337789; cv=none; d=google.com; s=arc-20160816; b=ExObupxlnutn3q/tep4ZNSaSBHwyHKyQrLWYYKfIkAkObPv8SSs1wwouofUjdJhnxS pExjSv9j+jvDvYfRXxmXq+tiV2PBbQCwU/ExCVNDaJXEWICq2EuV+q4JQ1eLTmfsgm4B EgE5FUqgADGafGV8om77z6MLsQGnsRehJxT9vjj9sXNsaUPRE734nNyyt0ehTR811Z/i 8YatOllu2qky4U4o/EZh0dglcj35P//DmSSpnA97CjrPijALa4/cuFPC5ysnUB31B2go VOoqsrIZ/fWJ32NWOw24Myve7xgHlFJkyvfCJBp22JRO+ee2/sbaedvsAi2r198kz0RV cC3Q== 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=+vrEZ6hzrL+QPGl23oslBHnz/bUAZDwXyjTIPajth6c=; b=gVUKb7L0WKW5XHxxwuZLXNh1M4qduHLppe8jvkOZc649Yz8gUnoHlwqhfISd6Cd0m7 /g5fwec3yIQacfLYlqr5VvDwoX6+M+QH/YqPgpm/nEbwLGrw6vs6q6p7fQBap/x8EIhJ 2ZkBdUdvMNY2a98lCJ6KP/ftCUXG0FMmXacd1uEqYH7rdr90Xt5JdF7QRaaFyZ6toY3Z DW4rS7aJW85iWPJPxu5Xw1eDnrtIB1gAq2Ih9ozBVIlEMF9Kz0d//m6B48JIeo9OUkaj oDE8rWOlqP1GQP9KBxkQKZZZlceWfxZmEfRpwLqj5JcY8FSJbmv734KLaRdPWJpTU/xU Ypow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IvVmCf1e; 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 d10-v6si4122155qkc.79.2018.05.14.15.43.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 14 May 2018 15:43:09 -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=IvVmCf1e; 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]:50934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIMBR-0000TH-EA for patch@linaro.org; Mon, 14 May 2018 18:43:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fILwQ-0004Kd-Cm for qemu-devel@nongnu.org; Mon, 14 May 2018 18:27:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fILwN-00007X-Kt for qemu-devel@nongnu.org; Mon, 14 May 2018 18:27:38 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:45704) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fILwN-00006s-Dj for qemu-devel@nongnu.org; Mon, 14 May 2018 18:27:35 -0400 Received: by mail-pf0-x241.google.com with SMTP id c10-v6so6672823pfi.12 for ; Mon, 14 May 2018 15:27: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=+vrEZ6hzrL+QPGl23oslBHnz/bUAZDwXyjTIPajth6c=; b=IvVmCf1evEMmf95/qkKmnzbibhKYLLPq2EM6s00I4M3biHGDoru8kRf9WJgw2eswtV 0zlYmIKieozB8gCLM1JdT8UgsDnpTmEYTwlbEvFwccFNEUh7W2z7OPLtbnrhKg31YFg/ o7I1BjBWaMPX0cti17VNAbRNOrExUFXHFnAME= 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=+vrEZ6hzrL+QPGl23oslBHnz/bUAZDwXyjTIPajth6c=; b=nlQAJWIJAB6e5bMkUWWoh3ka1Q6kZn+OGaTPxdiCqadkIozXHVsZ8wVMbSkS3v2zaz Gws6OTTvwKZe25njti4iGohafKFeSEX6TtiWq9kUN0p2AsVx2K2u4f7U3JjfPYUt0V4c 8i2n5/tAHnPdOV2tiENtbePNJd9Oa8TepOd8lSFpfxuNxzzjXFIcLOPk/jmep3gkuwim ZpraK9gBLZggXx/1HJPWZkzAHMeO//bmQY1QMrodWK8qE68hk4+fEsZU/nH86y9bvHPr 0b51eTH0TANV44kDX8x0Ej3nHXnbZr0gM9eLSrjBiFGUqaQ0YTDlT8jxGoiJkjCe2dJy DDCw== X-Gm-Message-State: ALKqPwcxo2DsRvxgmGJJVjpTUEEsfPU1LeSs+tLuA4TJJ76ES3xeMINR tfXgWvHZXO9FgyM+f5AMKz/WT29ZXqs= X-Received: by 2002:a62:8105:: with SMTP id t5-v6mr12131189pfd.215.1526336854018; Mon, 14 May 2018 15:27: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 g13-v6sm19517976pfm.67.2018.05.14.15.27.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 15:27:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 14 May 2018 15:27:13 -0700 Message-Id: <20180514222714.7982-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180514222714.7982-1-richard.henderson@linaro.org> References: <20180514222714.7982-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::241 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 | 356 +++++++++++++---------------------- target/openrisc/insns.decode | 21 +++ 2 files changed, 148 insertions(+), 229 deletions(-) -- 2.17.0 diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index c4256518cb..1f87ad6b2e 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1241,245 +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 = cpu_ldl_code(&cpu->env, dc->base.pc_next); - - /* 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: + 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