From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT5Jx-0002l7-Fz for qemu-devel@nongnu.org; Wed, 13 Jun 2018 08:56:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fT5Ju-0005GY-3u for qemu-devel@nongnu.org; Wed, 13 Jun 2018 08:56:17 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:42679) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fT5Jt-0005Ev-Ua for qemu-devel@nongnu.org; Wed, 13 Jun 2018 08:56:14 -0400 Received: by mail-wr0-x242.google.com with SMTP id w10-v6so2645484wrk.9 for ; Wed, 13 Jun 2018 05:56:13 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 13 Jun 2018 13:55:50 +0100 Message-Id: <20180613125601.14371-12-alex.bennee@linaro.org> In-Reply-To: <20180613125601.14371-1-alex.bennee@linaro.org> References: <20180613125601.14371-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [RISU PATCH v3 11/22] risugen: add dtype_msz address helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, richard.henderson@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= From: Richard Henderson Signed-off-by: Richard Henderson Signed-off-by: Alex Bennée --- risugen_arm.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/risugen_arm.pm b/risugen_arm.pm index 696bf5f..8d423b1 100644 --- a/risugen_arm.pm +++ b/risugen_arm.pm @@ -765,6 +765,15 @@ sub write_get_offset() write_risuop($OP_GETMEMBLOCK); } +# Return the log2 of the memory size of an operation described by dtype. +sub dtype_msz($) +{ + my ($dtype) = @_; + my $dth = $dtype >> 2; + my $dtl = $dtype & 3; + return $dtl >= $dth ? $dth : 3 - $dth; +} + sub reg($@) { my ($base, @trashed) = @_; -- 2.17.1