From patchwork Mon May 14 22:27:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 135786 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp205984lji; Mon, 14 May 2018 15:38:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqjtBKCpV73dQBxh+06bPadihzTuYT+9yWltA1AfmPRjJQDFzLyF8GDSVy5DlBQBlXUJIN2 X-Received: by 2002:a37:be86:: with SMTP id o128-v6mr9852092qkf.141.1526337504870; Mon, 14 May 2018 15:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526337504; cv=none; d=google.com; s=arc-20160816; b=YuOxK8XnyV4DWO3VdXt+YGCia+UVximbIJfgyCfb/rpp+7DQBbE64OY1dZP5jirfob BJHI4NJAIvd8n82E3BDjjyq2xS1VCVLS2jshr3C1xf79cMdTNPvvAoaKxbIpQTSf9/Em SZwvgqhfdRUZZ317M33V690Li/IIlpqBRK6yzOik2zF4H7NiIFHdTdKfRnoHxOOBl/GX gscwsu5Thjvgap9lnbnoWsdWr+wN0jdFdjudFVfb9wwJ4qkAvAnt5VQAGh5NH/nnWKtK o85hJMzV+Q6fVJP0YfANLLJ36aN+MnRAfdjliUEgtfhso9L2xwu4MWzOVYFH4x6ynjNg y++Q== 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=csRCOH8Ejg1TLUFygvipKlVl8CFUa4n4P2cwqJniRb4=; b=u01dkXdyrHYaOjBxbnzOPJ8rYLHPzWe1MRNSe4SCwAuFIoNVBg3WqVBb7ovcd7RFTn tUzQ6eO3Ol075SQROjQaLQUnYQqMFM5kIiEqbpfF44+UKraBB3KlTidSU+CB3e2ldWqy k2Ur/49r3w/8KXz7/bw8njAwb7uTMVNApbUTs/ARHTKp4Y67FHsL9zA649O1cNLCHJDq qiFv7sEtHxGazNLPYXJ4mRDUcOndfZGt7A6dUUXNL6CuNtOT2bUMHthFO0smCe5kT2QZ WNNlyg5JQBigYHbNQsuy3aLwtKosa0Oo52dl2XDuDsT9F/mfyS2C7wZ0QVRm/m0yJOc4 3MPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kg56zaNI; 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 b6-v6si4322955qkg.359.2018.05.14.15.38.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 14 May 2018 15:38:24 -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=kg56zaNI; 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]:50616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIM6q-0004IW-9T for patch@linaro.org; Mon, 14 May 2018 18:38:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fILwJ-0004CU-0r for qemu-devel@nongnu.org; Mon, 14 May 2018 18:27:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fILwI-0008RU-0c for qemu-devel@nongnu.org; Mon, 14 May 2018 18:27:31 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:39467) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fILwH-0008QR-Q3 for qemu-devel@nongnu.org; Mon, 14 May 2018 18:27:29 -0400 Received: by mail-pg0-x242.google.com with SMTP id e1-v6so6079441pga.6 for ; Mon, 14 May 2018 15:27: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=csRCOH8Ejg1TLUFygvipKlVl8CFUa4n4P2cwqJniRb4=; b=kg56zaNIBsewbjhZ+Fi2KW0wl3CLU5hoPAxSkj5ARIKp93v3dnDewijEAv3+hIIe8o 02oX2fbeJ23mrxZri00Red1+i47uS0dE1qynyXhZncF3v9iM1A9MFBMTfd3YPRsMOtOy PlkhxlmKmzT8CuXXxN6K0Rl4wk2WlQuR3nJ9k= 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=csRCOH8Ejg1TLUFygvipKlVl8CFUa4n4P2cwqJniRb4=; b=abwVg0wHiBALIpWJp+UyghvX9ATfQKDomPCJE2YzABERUOMsfXk5oycS69qL42shIp HaXYRnW8cJMP43CQ1RTSNcR9RrKelVUNY2ptMaG6SF/xkM+SFEHh4R2QUz3RjM9zHQ8F +sVaOYSyCGjWee0sgv08CzQlkG3/Q4h/AkiVIlpV/55I52x8Roe60DzptarZef/O02vm a/IeycRyhOhu1/felJyd35XigseivNEVaIILapKHyjezyN9nvZdEI8BBcpi8gZpA9dqP WIJwviJ7W0iw/rmHva81DOnqlFgyv+lTyGnOfA/3mv//L6OkzGorx3wR+wgyU02eVkst 8DqQ== X-Gm-Message-State: ALKqPwf6yqT7r5/s2XVL+bf9Die/wl5N13kzIHuTSSbZq2XmtsNOQDM1 zvxvkorMnu8zOOZtmMe3zeU6f/LQA7Y= X-Received: by 2002:a63:7d51:: with SMTP id m17-v6mr10108434pgn.52.1526336848521; Mon, 14 May 2018 15:27: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 g13-v6sm19517976pfm.67.2018.05.14.15.27.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 15:27:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 14 May 2018 15:27:09 -0700 Message-Id: <20180514222714.7982-9-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:c05::242 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 48e26c4349..b5ff7577bd 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -998,42 +998,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) @@ -1490,10 +1484,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