From patchwork Fri Feb 15 19:22:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 158536 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1061123jaa; Fri, 15 Feb 2019 11:23:30 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ0dBwHXrAu+kmi5oIrYuE2/nlZd79Oy/u/J44tur1fe1d0OPZBLpmf7ejMAmLOV7PL5Vcb X-Received: by 2002:a25:bbd1:: with SMTP id c17mr9402020ybk.519.1550258610531; Fri, 15 Feb 2019 11:23:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550258610; cv=none; d=google.com; s=arc-20160816; b=HVNtU52maCZPCoLfBTT2OWI3fyMCnQ0kkZqgOAPUDibgjM61MVRgt20rIV/9U2pc8k LHnmiy2NLKITEGRsK2RBFqw5DdUB+8rYvLiT12rFiBdimpR0pU0mXAx+LMWcnCMHpZWo pOdEBhUqVyEfgNMkNabiw8LSg9LvF2aTslBiaQztwz1970p4hfP1O4yLFS7KtkjIsztJ cIumod22+ahbsH4PUz/Jxrrgczu33u18nEBxq14j9ZJgclKb4vFaTu4r/Id4idD/BssT Xv/lZsiB4mE3joswbjufHE5EsDt8an6nyaZbA88vniDD7oPV8a/l54pTqP88oa7tO2C0 vj5g== 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; bh=3oH383gg4Bjb4JyarPs8/S+LBRYRoxcsv9/An4O0Kgc=; b=LCjAPS8SnLFKbK/zuoThGKqPbcOUux7QXQWbqDtwQOudoI6b3iafrX3XVwgqjkK7s2 MXsQrjWa34uFo23DT6j+atXJZw9mEzvpWlIBP9x6XZEH5GH4vPC+VgLncZMmjHhUP4jL gjaFPC08LNNzAsVgq7ZoAYDwr5m3zjIoFbgGxhXMOnfP2RoBXxpRpzYJzZCcAMCXgmQr 8KlxvFY1GwWaJmBMEUtQXDzMwEQXBfGjkfPBw2WNJO3IGmZWi86+wgg8oYYrerL2F6lh eI46Y/hhRvn1W9XLyltsJu4QjBQkRznF19Hk9VoROZde1ll1ydxvgtWJFNzowHccsJbk HECQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="XjA3/xwc"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id n184si1959112ybc.172.2019.02.15.11.23.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 15 Feb 2019 11:23:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="XjA3/xwc"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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 ([127.0.0.1]:45028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guj57-0005KR-W6 for patch@linaro.org; Fri, 15 Feb 2019 14:23:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guj4m-0005JD-Fw for qemu-devel@nongnu.org; Fri, 15 Feb 2019 14:23:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guj4l-00035g-Io for qemu-devel@nongnu.org; Fri, 15 Feb 2019 14:23:08 -0500 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:40245) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1guj4l-00034b-Cx for qemu-devel@nongnu.org; Fri, 15 Feb 2019 14:23:07 -0500 Received: by mail-pg1-x52d.google.com with SMTP id u9so1716117pgo.7 for ; Fri, 15 Feb 2019 11:23:07 -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=3oH383gg4Bjb4JyarPs8/S+LBRYRoxcsv9/An4O0Kgc=; b=XjA3/xwc7rx+m/fy0WuMRZlhYEq1IlYZamyU2MTD7iJvUTbVjMWOunXxfZEf+hL/Kn AOhb2sjXHbiTWY4ZzVDM4dW/VBC3gROK5B/1TPmHPiSUUQ5VhoQoiyYekDkb3yHmrcDE /YZgLfoME6OB8Oa6iJssVLNv2tbXcXEwhLyyOGjrep8tqcX0/dGm61IUXPeh4QoJXKdQ TarlY+b8YmvMxyZ2fldApv8HaGtWdiCwNgjnH/HS2K25wsByOeOAY7aDOLAw8XBE6e2q pMYd7gD+94BVR7afKeVnJiF2GGDOBQEHur13joALQscQ16oCIGpa/4ffQtLOXhdEM3qg 2JMw== 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=3oH383gg4Bjb4JyarPs8/S+LBRYRoxcsv9/An4O0Kgc=; b=HKwCEQ0mE/aHBmiKbz5TUkWNlucjUZXVtohhO05kn9MOCPGKGqFIK6QTD22+nPq4kJ QOu/XZacRoYGaIep9YTBAWS8XYbLGTOOZ+id1gOMroqthKi1LmA/9otFW5iKufE7kOxP 982SHhvS31+dMIyOCWOLqQEaeGbHD289EOJ224HxbNavCXW/tomvIB+A1ToE1mhnBfIa oZ9uP693mlvKQvCFy3bBUerUHUtwjS/yLUlMf2U23FpKzsCvx4P8Lw7H56ikEovpp+c9 vDRGzqShLQJ1Zy8GR5AeJn1YONlL1FRKNanJFTtZNFZfTcv7wmeVKGcRIhcfaFbx+I9n QCJg== X-Gm-Message-State: AHQUAuYDukb4CP21rulSQSLBOpUD3i5tRECaPGbPIityXfLESY81NEAz Rnj8y9AKjUMR1tOD4aK93DsN7QdiRuo= X-Received: by 2002:a62:5f07:: with SMTP id t7mr11282528pfb.108.1550258585945; Fri, 15 Feb 2019 11:23:05 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id o85sm15161596pfi.105.2019.02.15.11.23.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Feb 2019 11:23:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2019 11:22:55 -0800 Message-Id: <20190215192302.27855-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190215192302.27855-1-richard.henderson@linaro.org> References: <20190215192302.27855-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52d Subject: [Qemu-devel] [PATCH v4 1/8] target/arm: Restructure disas_fp_int_conv 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For opcodes 0-5, move some if conditions into the structure of a switch statement. For opcodes 6 & 7, decode everything at once with a second switch. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 94 ++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 45 deletions(-) -- 2.17.2 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index af8e4fd4be..dbce24fe32 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -6541,68 +6541,72 @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn) int type = extract32(insn, 22, 2); bool sbit = extract32(insn, 29, 1); bool sf = extract32(insn, 31, 1); + bool itof = false; if (sbit) { - unallocated_encoding(s); - return; + goto do_unallocated; } - if (opcode > 5) { - /* FMOV */ - bool itof = opcode & 1; - - if (rmode >= 2) { - unallocated_encoding(s); - return; - } - - switch (sf << 3 | type << 1 | rmode) { - case 0x0: /* 32 bit */ - case 0xa: /* 64 bit */ - case 0xd: /* 64 bit to top half of quad */ - break; - case 0x6: /* 16-bit float, 32-bit int */ - case 0xe: /* 16-bit float, 64-bit int */ - if (dc_isar_feature(aa64_fp16, s)) { - break; - } - /* fallthru */ - default: - /* all other sf/type/rmode combinations are invalid */ - unallocated_encoding(s); - return; - } - - if (!fp_access_check(s)) { - return; - } - handle_fmov(s, rd, rn, type, itof); - } else { - /* actual FP conversions */ - bool itof = extract32(opcode, 1, 1); - - if (rmode != 0 && opcode > 1) { - unallocated_encoding(s); - return; + switch (opcode) { + case 2: /* SCVTF */ + case 3: /* UCVTF */ + itof = true; + /* fallthru */ + case 4: /* FCVTAS */ + case 5: /* FCVTAU */ + if (rmode != 0) { + goto do_unallocated; } + /* fallthru */ + case 0: /* FCVT[NPMZ]S */ + case 1: /* FCVT[NPMZ]U */ switch (type) { case 0: /* float32 */ case 1: /* float64 */ break; case 3: /* float16 */ - if (dc_isar_feature(aa64_fp16, s)) { - break; + if (!dc_isar_feature(aa64_fp16, s)) { + goto do_unallocated; } - /* fallthru */ + break; default: - unallocated_encoding(s); - return; + goto do_unallocated; } - if (!fp_access_check(s)) { return; } handle_fpfpcvt(s, rd, rn, opcode, itof, rmode, 64, sf, type); + break; + + default: + switch (sf << 7 | type << 5 | rmode << 3 | opcode) { + case 0b01100110: /* FMOV half <-> 32-bit int */ + case 0b01100111: + case 0b11100110: /* FMOV half <-> 64-bit int */ + case 0b11100111: + if (!dc_isar_feature(aa64_fp16, s)) { + goto do_unallocated; + } + /* fallthru */ + case 0b00000110: /* FMOV 32-bit */ + case 0b00000111: + case 0b10100110: /* FMOV 64-bit */ + case 0b10100111: + case 0b11001110: /* FMOV top half of 128-bit */ + case 0b11001111: + if (!fp_access_check(s)) { + return; + } + itof = opcode & 1; + handle_fmov(s, rd, rn, type, itof); + break; + + default: + do_unallocated: + unallocated_encoding(s); + return; + } + break; } }