From patchwork Mon May 14 22:27:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135799 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp218683lji; Mon, 14 May 2018 15:56:19 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo0vz7OK9lYWV/w/FEt40AdDiGecnAh9k+A2ueO4rnFnHMjsyQO6K0Zj5UYCeKLFVJtmsVC X-Received: by 2002:a0c:9de6:: with SMTP id p38-v6mr10974333qvf.101.1526338579167; Mon, 14 May 2018 15:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526338579; cv=none; d=google.com; s=arc-20160816; b=Ihfqkl6r3jzu5Dj3vcAuBxvfEaVXemsFWQ8P4E2jiRNaNqo5vEK0GV/XSsoy9i5naR +2mXfPbCOtgyGzLyX9/b0SyGyUT0E69R13y9hUvcY4wLlMB55Zjn3UgDxVTVxNDiDizR XS2WvOdFvAdzzfdIOUuo4Lp+jMsJKZANLIb1tZA9r1oHfPUUDd3LoPHce7etgkKxKTXR 7Y4M0piJWhcF6KHLD6HJwpoIaMxun6eM/Fhc3RnEC8+g91oCBUKTtP+6evSlxlfsIInI XwmeHFXNf0M+ql3yL86SQAaWh7DJNufk1CbX4EGvh0d52ATdnnGuBOvpDwuASZKbhZQc 8o2g== 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=wHaEhgIyci0cypY/5E+yLSSD0u8vq/HRjuh9U/Mew7E=; b=axQbF2Z/Qn73k/eIx5d+KvjL4sXcJNyKu8JxsU2Wq7TZdSg8iEESZQ1fpE6p99qhG1 2CeIifhSHLl9JCPP0qnR7G18/1XfnQDrEcc4kCvQLA1L/Y88w7Ni7c6wfTptrK8Rul4m 8EIrHbvQ0qgxEyAFRoy+PVU96OjA/MWuUOsv6q2qHJD4InTuxnHzyr5H5YfrQlzS0ulU At2i10yqrAicGKWTpjIl/eXAKf0DxvAUwLv0bnhkOoYUFhtyUthk2Ly16wbahJm2TnQy PhT8xjE4S5JXUsW/ptTEwHGmT8ppqsVGx3gM7hsNQDRTQHCj0x2EvaYf6euq6i5cfKDv t0+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WBnZXiuf; 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 h6-v6si2656418qvo.152.2018.05.14.15.56.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 14 May 2018 15:56:19 -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=WBnZXiuf; 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]:51866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIMOA-0001H0-My for patch@linaro.org; Mon, 14 May 2018 18:56:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fILwM-0004Fo-1s for qemu-devel@nongnu.org; Mon, 14 May 2018 18:27:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fILwK-0008V4-Nh for qemu-devel@nongnu.org; Mon, 14 May 2018 18:27:34 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:33478) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fILwK-0008Tx-Ez for qemu-devel@nongnu.org; Mon, 14 May 2018 18:27:32 -0400 Received: by mail-pf0-x244.google.com with SMTP id a20-v6so2737543pfo.0 for ; Mon, 14 May 2018 15:27: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=wHaEhgIyci0cypY/5E+yLSSD0u8vq/HRjuh9U/Mew7E=; b=WBnZXiufeBF3u4wL6V/Q1dC9ce+U2IQlGCskGTPisp+kJryYRQGOIAWAg+gO3+nAAn iy4Ns2VXHBO3dsVOF8j+RjcsbmNLoLU1+lFJTttZWw8q/KaI9ztMXtrABSuua4pcd0l+ 5WlrKj2QYQMovKy8FBI8Zn6S6V81yP/Wbqusc= 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=wHaEhgIyci0cypY/5E+yLSSD0u8vq/HRjuh9U/Mew7E=; b=H+6WLHlY+Z5vkFKIUkrTCN2XqgwAWi2T2nMUtjj6n3o2wwNA3T7pptUheBEKW9Ou5Z pGgvgc8L/lfZOYQa5YLuTMIAe1sG+34NgtI4RFFqfHmgxCPhu506B4ZsSDWkzVSytP16 QUst324hXh1qjMNMWbjIlgi77H4sYr3BJenU3t/buel73NcH+eEm+TZNXZrWjeQgJE6x dK8pF+BIhYHFRONaoBkE+g/vxGTZphdnMZbZMPDJ66C4FpiyI/4n+9qBLHF1munUEyI+ IFx+Tav6jfu5HtkZ0hVhMu9V4vHHB9Q8XmPtcO5Lgeq6DeXTxi7vp8OvVM4gY/oVtOo5 Y3BA== X-Gm-Message-State: ALKqPwfQoPPpIp2LWt0Gmd3GFDmXoCTuTxGaQqd4JX/hECtcShP/wftl kC58wKOW0KpZqf/REt8OMsMCynXgxjw= X-Received: by 2002:a62:23d7:: with SMTP id q84-v6mr12159940pfj.31.1526336851163; Mon, 14 May 2018 15:27: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 g13-v6sm19517976pfm.67.2018.05.14.15.27.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 15:27:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 14 May 2018 15:27:11 -0700 Message-Id: <20180514222714.7982-11-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::244 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 bdd4626c02..8743b5e96e 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1047,74 +1047,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) @@ -1477,10 +1477,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 -----------