From patchwork Wed Feb 28 19:31: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: 130052 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp128093lja; Wed, 28 Feb 2018 11:32:24 -0800 (PST) X-Google-Smtp-Source: AG47ELvD3QtDB13Gn8S5gBw+pub+O03/sl4szHmnyFGNgpwOxjlIjVU5QYi+E3Xp66Mi7OMJCHrp X-Received: by 2002:a25:ef48:: with SMTP id w8-v6mr12777599ybm.323.1519846344813; Wed, 28 Feb 2018 11:32:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519846344; cv=none; d=google.com; s=arc-20160816; b=rqKXYwbLWl+X0wG614f09CTbwWz2wHjTTGFdiyxDEI3ssNk/SBXYq48auWmwm85v1Z kvT6Xp3Cc/LwAHYmjLge0h069wuNWw5AMzgsOgcZ01vN57QMvWNfimyFm+6dP+ACRawE frJI8CSJhEkSfy+bXb3XWFivYWakxI44WxYRTvk9tk6G9LWWmWbn9rJt+7TUrYulGmyn f37KYxjaA/De4hbOZ4sEeWx1UUh6dDeiV9XvTo8OvFjUpLCSfcYuWLM9uJ46Ol/WntJw RoXnMGJWS+bnn1KRaLbyRdhLQXaoeA5cR0URMLeJSeJ3tEf2dner92DuvvLwMRpdxdSW HnDw== 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=aDbouliVWWr3hNOE8ldscKdsfFLWXw8zhcxRCOLGT0M=; b=gPzR2+ZWltNjnHZ+7nhseYNxux5vgJa9HSqhraihKXylG23ySzbOwBNDo0KVRlJp2f wf3yCBsZdtI3Y47irdtdtx0fekiEfoDbJaTbdJUdkamFlgk2+zLzNg9HAyL0vG3r+K12 1D8GO55UqhRWvl67G2/4BFmA+VXvtCZg1Hv++6oBAEuRg1rDy3Y3MNouyamkZgX2UmkS HF8M6+lvL0vRhbgArabSTtdwMb6kn0wmAcHud2DxODv/SheEWREctsH9hgn0tiwqkaFo omP/ix3D2LF/dT5k98rWOwec3U/UP6H40mG5RCWfGysJLRjkM7XPNowjveMVvf9BFS73 KW0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Wnn94taC; 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 d3-v6si366858ybk.767.2018.02.28.11.32.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 28 Feb 2018 11:32:24 -0800 (PST) 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=Wnn94taC; 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]:46407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er7Si-0003Wa-5I for patch@linaro.org; Wed, 28 Feb 2018 14:32:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er7Ru-0003Fi-9z for qemu-devel@nongnu.org; Wed, 28 Feb 2018 14:31:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er7Rt-0006Gf-DT for qemu-devel@nongnu.org; Wed, 28 Feb 2018 14:31:34 -0500 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:44306) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1er7Rt-0006Fq-8d for qemu-devel@nongnu.org; Wed, 28 Feb 2018 14:31:33 -0500 Received: by mail-pl0-x242.google.com with SMTP id w21-v6so2114153plp.11 for ; Wed, 28 Feb 2018 11:31:33 -0800 (PST) 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=aDbouliVWWr3hNOE8ldscKdsfFLWXw8zhcxRCOLGT0M=; b=Wnn94taCRxw6ks/jAqoIdl6M+x4xDpV17Vm6YW4uxvh/zw5o/6w1f6UzHTJWQVt/zc m6EajvuaDdelwG/igt5rgAbaCiCx6L7jiaNqJzIRLP/SyMAY6slZWBjzIi4WKiVC+5Vm 1dah568q1zrm3yHaiXUbGYiBEEEv4PKJidXGg= 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=aDbouliVWWr3hNOE8ldscKdsfFLWXw8zhcxRCOLGT0M=; b=BIsL5qFwRkrpheYayxf8bvaxuXeltRVGpC/nxwxRKwj75cBEl6lQjk/ViEKeIh2n/j pqTJpozwimK4lOnPKvqTkbSui/z/xzRxAKBcSAbMq1T5aDYlSD0Pjujb5fNV1KyWGVnn 4t/xeQeLwT4mQykIEiWD2yWiI1oTdt/Hz3ipNRhUL+QMHXhmG0g8GzC6rgMm4xkl7COu 0z2QMscPEX/qMrcAFfcV2mDz4fl0cf5gnhb4Lj2j2otYQdkTI7Xh411Mqqf7NZ5GCD+/ b/TxUm4YG3UemDeagxWz36RU5mUiwTzcVF99yaD44oi2qb31CnwuYlVnXF2AnF31azXQ Tmow== X-Gm-Message-State: APf1xPAhfxAv+myTxBJVYs9neBAEqloQI5iTHYsOwZdhGrNy5vhDQucI RoJvfBkWZDyavpGMdX4acDHPwm9wkec= X-Received: by 2002:a17:902:20c9:: with SMTP id v9-v6mr19197533plg.41.1519846291895; Wed, 28 Feb 2018 11:31:31 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-169-147.tukw.qwest.net. [97.113.169.147]) by smtp.gmail.com with ESMTPSA id k185sm4200212pgk.94.2018.02.28.11.31.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 11:31:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 11:31:12 -0800 Message-Id: <20180228193125.20577-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180228193125.20577-1-richard.henderson@linaro.org> References: <20180228193125.20577-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] [PATCH v3 03/16] target/arm: Refactor disas_simd_indexed size checks 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: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The integer size check was already outside of the opcode switch; move the floating-point size check outside as well. Unify the size vs index adjustment between fp and integer paths. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 65 +++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 33 deletions(-) -- 2.14.3 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index fc928b61f6..cbb4510e3a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -11820,10 +11820,6 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) case 0x05: /* FMLS */ case 0x09: /* FMUL */ case 0x19: /* FMULX */ - if (size == 1) { - unallocated_encoding(s); - return; - } is_fp = true; break; default: @@ -11834,45 +11830,48 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) if (is_fp) { /* convert insn encoded size to TCGMemOp size */ switch (size) { - case 2: /* single precision */ - size = MO_32; - index = h << 1 | l; - rm |= (m << 4); - break; - case 3: /* double precision */ - size = MO_64; - if (l || !is_q) { + case 0: /* half-precision */ + if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { unallocated_encoding(s); return; } - index = h; - rm |= (m << 4); - break; - case 0: /* half precision */ size = MO_16; - index = h << 2 | l << 1 | m; - is_fp16 = true; - if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) { - break; - } - /* fallthru */ - default: /* unallocated */ - unallocated_encoding(s); - return; - } - } else { - switch (size) { - case 1: - index = h << 2 | l << 1 | m; break; - case 2: - index = h << 1 | l; - rm |= (m << 4); + case MO_32: /* single precision */ + case MO_64: /* double precision */ break; default: unallocated_encoding(s); return; } + } else { + switch (size) { + case MO_8: + case MO_64: + unallocated_encoding(s); + return; + } + } + + /* Given TCGMemOp size, adjust register and indexing. */ + switch (size) { + case MO_16: + index = h << 2 | l << 1 | m; + break; + case MO_32: + index = h << 1 | l; + rm |= m << 4; + break; + case MO_64: + if (l || !is_q) { + unallocated_encoding(s); + return; + } + index = h; + rm |= m << 4; + break; + default: + g_assert_not_reached(); } if (!fp_access_check(s)) {