From patchwork Tue Jun 11 10:53:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166387 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2197640ilk; Tue, 11 Jun 2019 03:57:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6KRk6VjSCIK25GfZtfok4Kl8J9hKO0vz029F343D5tL45COrWR2TjprhRFXMvjOrO51Qj X-Received: by 2002:a05:620a:144a:: with SMTP id i10mr58815007qkl.130.1560250675295; Tue, 11 Jun 2019 03:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560250675; cv=none; d=google.com; s=arc-20160816; b=CLbwL7IqyAEDrpBSYl7TNnYyugfv0vVE2Z89DfeSL+WQxfcE/cg3PtNT85ki34ifcm zE8AY4aAShwkWmambK897OfBWR5MDyCgxB1Uze2P+wZ7jAPvQCEHymK53d+CeyBXWhUj wm/FUgjQTlWY8W5FIIQMbdt68nO7Lm4WxJRV2DfDgkmPiMxoUZJc89LT4hF1/oJzalrK FbUL7A4UTdfVRWLLfnoJtxUVTEbe77YtySLYu5gf79KyPVKPIb1xB37LZUdr5eLG/Xjj LFpPXESXruRfhFOJQDBa68yoEFKXONWdHt0V5UaQl/r8NGl7NBJSQ1EwVJl6H4iXvVzx LVhg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=xvppecsZ94muJindcBii3Utpb+nLFsPXwtatLVkaeiQ=; b=a4hVqtIhXFAC65YFTNVa8SNy0FT3Mube2xBRKn87aKFZHXvCU/G8EeCsYENUfV7kR/ Gx4G6kfAbvQdnM/NdUsIhLsBsgIp/9Z2X3ZUGvfwpYLGNwdqpNWonWYp0ni9Vq0zTySg QG/4VD15VLDICUQbxkCLHP6zNJIE83xluAcWCdlbLslPKth9+ggkMHUJIB4i/4RKaaU1 /WZnEmE3jk6GeJgBLU5MSNm9tSn6CKL2CbAvdWUCIfZoZiZKO7yEqHXbrTWl50RSCrTa E9fCdEHJVFm6EZhiaEYuzyVJdhMFk23xlSX/e2i0LF/8Mg84dzJf4JkbrRaOJqytPzhN MHBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QxcvXdNh; 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 r188si2222486qkb.263.2019.06.11.03.57.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 03:57:55 -0700 (PDT) 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=QxcvXdNh; 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 ([::1]:56188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeTS-0002lh-RZ for patch@linaro.org; Tue, 11 Jun 2019 06:57:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38779) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePc-0006xd-KQ for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:53:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePb-00079d-Hw for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:53:56 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:41366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePb-00078q-Be for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:53:55 -0400 Received: by mail-wr1-x442.google.com with SMTP id c2so12475471wrm.8 for ; Tue, 11 Jun 2019 03:53:55 -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 :mime-version:content-transfer-encoding; bh=xvppecsZ94muJindcBii3Utpb+nLFsPXwtatLVkaeiQ=; b=QxcvXdNhqcQcxT2TQQpjGemQ5SaPFiwbECfLsnqIhVID2VtK3xrLA/NMK9fOX2mu+J hAT1Askxu4DQ6cIDvhpiellL7gVw+ior83riMXg9LX1RyBelpIEkcSjdWFFnxxeYKGPA u8d55+tYHzuBV6sloVrX43mIl2W6S55Xu/CpG9lECvAzuYjh6L/KlzmkIap1hrnRLt4S hlDv76hktS6RVNgHSnU2rdV3T4dToOC6VUCwTsPRiaaD8/C77obJ2dq0O6ZCtWrb/ZSA C14LNJqV2nrCZM429FFP01/EgiqMUW433Nbzisk6miRxSqXjTasJHodWZLrHTTQzp3Eu b31g== 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:mime-version:content-transfer-encoding; bh=xvppecsZ94muJindcBii3Utpb+nLFsPXwtatLVkaeiQ=; b=FZzFMk2emxvHc9383ZxsP4NrOWy/k44GoQgmbewoJSd8YgqcLoP16CdtyeJtYK6VEe b2CvBHT5y3cpBN6szWp839qgPSr/T+BSSDqpl2WwG9UAvBy0ycW/Wjb2wFL/jTSO14xE yYhRMwdfiw4mL5PhwsH2YLCDkDPCC1tnpsWHDVNCLw+ElwzqkDNmIv80zgqbqxvCt3wd oeXQcyPvv2gW/fQFwpDBDJJhGeft3xMEBfRUMYakJY4Irf9OjwvzNsjeteqrHIeAJHhv BNcqjl/2ZVE2OLa/loLqS8YAc5cc2+yNHNWzItz9e1nBk4Jg2rm6GT4T/sLs54r13WnT jWmw== X-Gm-Message-State: APjAAAUO14Sfth88FzddlGSm66W/Ss13niaVkGCwPlsmSXoVITxW+yt7 s6dkqRqe44a6iCxV1hmyzaY4BQ== X-Received: by 2002:adf:9dcc:: with SMTP id q12mr24217933wre.93.1560250434374; Tue, 11 Jun 2019 03:53:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.53.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:53:53 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:10 +0100 Message-Id: <20190611105351.9871-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH v2 01/42] decodetree: Fix comparison of Field X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Typo comparing the sign of the field, twice, instead of also comparing the mask of the field (which itself encodes both position and length). Reported-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20190604154225.26992-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- scripts/decodetree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 81874e22cc7..d7a59d63ac3 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -184,7 +184,7 @@ class Field: return '{0}(insn, {1}, {2})'.format(extr, self.pos, self.len) def __eq__(self, other): - return self.sign == other.sign and self.sign == other.sign + return self.sign == other.sign and self.mask == other.mask def __ne__(self, other): return not self.__eq__(other) From patchwork Tue Jun 11 10:53:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166390 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2203931ilk; Tue, 11 Jun 2019 04:03:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxucO2vpV1k8JZzyiPE9kJUN1Crxj3RaphcDkKUUlIiDybZ7z6kyF+CZAYnvZZrmfwfKDRf X-Received: by 2002:ac8:428f:: with SMTP id o15mr60994834qtl.210.1560251020364; Tue, 11 Jun 2019 04:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251020; cv=none; d=google.com; s=arc-20160816; b=XabZwDX6z6iryQd9xEqrw7ADt24FyMsQ6PQP6UeICVNf1KuRSsV8qLY/Wz9FKM82Q8 07wyzKmZNvRijP6Q0qweCeYd0TaeI+UKpwpHQlWOd2VaDHQoKJ3LIYG2Du533dgY09ZP IHbKTRQxblsh7twWiCSfDtiRaxCHOHTb7A1qlQMF5Dsr9RvGYTiiEXbVwfeDzY0Iinij mxfqoT82hvnWIb61Sc+slLs3EpDQJ5F3E+ETjdCVxAixWHp1AdMwjVhnxoo8Qj7Etkqp C1AyflYigHIWWV6Iz3KhN0IGRGkg6bWizO2WXNUZiXKcrePvKEgghi4wfsi4PuTjmTK4 pmPw== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=qg/q28/1l7FZ4RskG5OVkaABmpJcNNAgYVp1eUduElc=; b=UF3e4TondhfGPCo1ZFKz0lYM1dQX8/+9Swe29Kc5galcV0rCYxsKvMJdAY9WUMgcTt wYaLYOJeLr06Sjoq7Pnd+jLgJWYdGW8xdjKHqz2LQDmAIdOq+rMmVzE8ILE7RiUdBQUW UR5GI5ctcn2J2+I4ycRMzHXws9ajSn3vxKH4G5sxUFelqMtHBNJ6C71DGQwyy5NXwxXA P8/+gTtnywoF62xJtDtigPd7kz5/O1m0z2J2F4DtNRZUuCXejHI/dOEy+M23nD4IcrZH RJo+GNuasdBbxNuqtcdoODUVOdxfsudVxQdBECmk+mN8xyvaSEyGbqCtnGq9D4llgoPj Tulw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HYf46yLm; 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 o46si1868746qto.362.2019.06.11.04.03.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:03:40 -0700 (PDT) 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=HYf46yLm; 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 ([::1]:56238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeZ1-0007jp-Sl for patch@linaro.org; Tue, 11 Jun 2019 07:03:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38827) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePf-00071E-AY for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePc-0007Al-UK for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:53:59 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:53189) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePc-00079o-KC for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:53:56 -0400 Received: by mail-wm1-x341.google.com with SMTP id s3so2438049wms.2 for ; Tue, 11 Jun 2019 03:53:56 -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 :mime-version:content-transfer-encoding; bh=qg/q28/1l7FZ4RskG5OVkaABmpJcNNAgYVp1eUduElc=; b=HYf46yLmF/0wqPkGW/XTezzAiofwoLDjWODLPoucVetrmg6dRYuDaQsheWjscnwo/z HJ9Ic5j41UENofIL9d1iWwMeiCgcAzyFD6Wck1CNt8QMmyYASejvYB2S4UhPKltRCFMb LtbJSCWS5Cpt1Q1UgR2523bR6lc+dUIL2WTstF+XsYB1kC7G9EF9YvzjjBlCgqy41dk8 9xCQQSmHAzwfEkFMzQjAceFt3FUqkZIfYS05/F7ofN0Eh5Wqy3uxiQnhBMw6XGER0iv9 l6uP/7frY5sZczRmlh5UcbU3n3PhZnP+nY0eK1AW334yRRIR+4V7FA/zmT0JzkXg2O6P v8xA== 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:mime-version:content-transfer-encoding; bh=qg/q28/1l7FZ4RskG5OVkaABmpJcNNAgYVp1eUduElc=; b=forrvDHqSjMF6elefjhjde3mOUnDGshPRMV5SxgTo1/PgnfF9KikkEploNFHCt3rYo tLz7Xc1ftZ8obeMCZAxkIQ5V7oSpESj1dIlhN+KLEd3vag/IdKVoMo1HniJZ8ruYHYwg vXp1hrUhm6U0OnAro94038eQfMenCuQzKfuGbnDUnuLvaauB4zQ17kHhlEy7gkKuDTCG BYOlDWebgLM6EszhfXDWI6QlB938KgmW2QKaHbJ3yfNtXogiHDlivuAoYcWWADKX/SBH z9DWZxbRFAKpiuf0wz2lqZyHobcuaLIVhUwTVWzva3VkGWhcbVzCMuxIPBK5pR9r1oZ0 S1YQ== X-Gm-Message-State: APjAAAW6ERhS1VeTh2zRsX5bTtSZ+/iVKDZynw4H/7c4w+H5I7nI3Dyi QkUUY5kRYFUHl2nTvf9IQr+0Pw== X-Received: by 2002:a05:600c:21d4:: with SMTP id x20mr10738729wmj.149.1560250435460; Tue, 11 Jun 2019 03:53:55 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.53.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:53:54 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:11 +0100 Message-Id: <20190611105351.9871-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v2 02/42] target/arm: Add stubs for AArch32 VFP decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add the infrastructure for building and invoking a decodetree decoder for the AArch32 VFP encodings. At the moment the new decoder covers nothing, so we always fall back to the existing hand-written decode. We need to have one decoder for the unconditional insns and one for the conditional insns, as otherwise the patterns for conditional insns would incorrectly match against the unconditional ones too. Since translate.c is over 14,000 lines long and we're going to be touching pretty much every line of the VFP code as part of the decodetree conversion, we create a new translate-vfp.inc.c to hold the code which deals with VFP in the new scheme. It should be possible to convert this into a standalone translation unit eventually, but the conversion process will be much simpler if we simply #include it midway through translate.c to start with. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/Makefile.objs | 13 +++++++++++++ target/arm/translate-vfp.inc.c | 31 +++++++++++++++++++++++++++++++ target/arm/translate.c | 19 +++++++++++++++++++ target/arm/vfp-uncond.decode | 28 ++++++++++++++++++++++++++++ target/arm/vfp.decode | 28 ++++++++++++++++++++++++++++ 5 files changed, 119 insertions(+) create mode 100644 target/arm/translate-vfp.inc.c create mode 100644 target/arm/vfp-uncond.decode create mode 100644 target/arm/vfp.decode -- 2.20.1 diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs index 6bdcc65c2c8..dfa736a3752 100644 --- a/target/arm/Makefile.objs +++ b/target/arm/Makefile.objs @@ -19,5 +19,18 @@ target/arm/decode-sve.inc.c: $(SRC_PATH)/target/arm/sve.decode $(DECODETREE) $(PYTHON) $(DECODETREE) --decode disas_sve -o $@ $<,\ "GEN", $(TARGET_DIR)$@) +target/arm/decode-vfp.inc.c: $(SRC_PATH)/target/arm/vfp.decode $(DECODETREE) + $(call quiet-command,\ + $(PYTHON) $(DECODETREE) --static-decode disas_vfp -o $@ $<,\ + "GEN", $(TARGET_DIR)$@) + +target/arm/decode-vfp-uncond.inc.c: $(SRC_PATH)/target/arm/vfp-uncond.decode $(DECODETREE) + $(call quiet-command,\ + $(PYTHON) $(DECODETREE) --static-decode disas_vfp_uncond -o $@ $<,\ + "GEN", $(TARGET_DIR)$@) + target/arm/translate-sve.o: target/arm/decode-sve.inc.c +target/arm/translate.o: target/arm/decode-vfp.inc.c +target/arm/translate.o: target/arm/decode-vfp-uncond.inc.c + obj-$(TARGET_AARCH64) += translate-sve.o sve_helper.o diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c new file mode 100644 index 00000000000..3447b3e6466 --- /dev/null +++ b/target/arm/translate-vfp.inc.c @@ -0,0 +1,31 @@ +/* + * ARM translation: AArch32 VFP instructions + * + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2005-2007 CodeSourcery + * Copyright (c) 2007 OpenedHand, Ltd. + * Copyright (c) 2019 Linaro, Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * This file is intended to be included from translate.c; it uses + * some macros and definitions provided by that file. + * It might be possible to convert it to a standalone .c file eventually. + */ + +/* Include the generated VFP decoder */ +#include "decode-vfp.inc.c" +#include "decode-vfp-uncond.inc.c" diff --git a/target/arm/translate.c b/target/arm/translate.c index d25e19ef113..c75d94952de 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1727,6 +1727,9 @@ static inline void gen_mov_vreg_F0(int dp, int reg) #define ARM_CP_RW_BIT (1 << 20) +/* Include the VFP decoder */ +#include "translate-vfp.inc.c" + static inline void iwmmxt_load_reg(TCGv_i64 var, int reg) { tcg_gen_ld_i64(var, cpu_env, offsetof(CPUARMState, iwmmxt.regs[reg])); @@ -3384,6 +3387,22 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; } + /* + * If the decodetree decoder handles this insn it will always + * emit code to either execute the insn or generate an appropriate + * exception; so we don't need to ever return non-zero to tell + * the calling code to emit an UNDEF exception. + */ + if (extract32(insn, 28, 4) == 0xf) { + if (disas_vfp_uncond(s, insn)) { + return 0; + } + } else { + if (disas_vfp(s, insn)) { + return 0; + } + } + /* FIXME: this access check should not take precedence over UNDEF * for invalid encodings; we will generate incorrect syndrome information * for attempts to execute invalid vfp/neon encodings with FP disabled. diff --git a/target/arm/vfp-uncond.decode b/target/arm/vfp-uncond.decode new file mode 100644 index 00000000000..b1d9dc507c2 --- /dev/null +++ b/target/arm/vfp-uncond.decode @@ -0,0 +1,28 @@ +# AArch32 VFP instruction descriptions (unconditional insns) +# +# Copyright (c) 2019 Linaro, Ltd +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +# +# This file is processed by scripts/decodetree.py +# +# Encodings for the unconditional VFP instructions are here: +# generally anything matching A32 +# 1111 1110 .... .... .... 101. ...0 .... +# and T32 +# 1111 110. .... .... .... 101. .... .... +# 1111 1110 .... .... .... 101. .... .... +# (but those patterns might also cover some Neon instructions, +# which do not live in this file.) diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode new file mode 100644 index 00000000000..28ee664d8c3 --- /dev/null +++ b/target/arm/vfp.decode @@ -0,0 +1,28 @@ +# AArch32 VFP instruction descriptions (conditional insns) +# +# Copyright (c) 2019 Linaro, Ltd +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +# +# This file is processed by scripts/decodetree.py +# +# Encodings for the conditional VFP instructions are here: +# generally anything matching A32 +# cccc 11.. .... .... .... 101. .... .... +# and T32 +# 1110 110. .... .... .... 101. .... .... +# 1110 1110 .... .... .... 101. .... .... +# (but those patterns might also cover some Neon instructions, +# which do not live in this file.) From patchwork Tue Jun 11 10:53:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166386 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2197422ilk; Tue, 11 Jun 2019 03:57:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtQnt9BpaiaTNJktkQ9SBbbmme7KeRx6EnaOxOxOm10Fh4tFxHBz5YtirMhaCjNtarOFON X-Received: by 2002:ac8:30d2:: with SMTP id w18mr32413423qta.296.1560250658150; Tue, 11 Jun 2019 03:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560250658; cv=none; d=google.com; s=arc-20160816; b=OFpEgPvPOlnwwE1yKvgGjMLB8McFdTxfArGquMXyucH6PH37fDRDlfQEagiBN8zd3a H2P2T6yk/WjXJzvCQwHroX9arlzi3Mnd0PBDO5g9WxwOMVH9ySRmrvW6jf/SeQz7e9Ij bEvXMjv6vc5CBhox8fWptBo11DqRQZPQzy7b04xWQ6/Ed02roCv7nDzig6yJqTOBel7I 6XnnV3FHUmmClMgcfuKIuUhtCEhn44biMGugfRZ0UFE6xEAwkMA3xYW9At/Xe6V5rVcL 19pKCTVRUVyFKjhldN1BKD30gsDTlMG2GGMoraJx9/2Xb3VrvFN1txuUIrN2xUJMt0oj kEaQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=7jqHN827NhY1D5N0LjiHG3QJ6+mHqX+62R3ls5gE3QI=; b=sLL2+E+jVTB1ppE1GVIZ34M27G9ESS7yCRnrYs4PQ20ZmhIkwMOvNAgapZp8ivBmRq EOz1SOhH+aMnEhOSh6e3tGF30qKAfem39gJbtZeJfAwSnUT11ZUDcWP1mxhhVEcbblMx CbgmCbdtPPZRNB0auiMBmhTpGwwHHHvfZdoAxamNbfIOodCQYnnv7LsWHhdAzhGz/3Tg Ef8zkz1rSYt9Swzjikz8zBncA3I9yNEWd0gSF6j3lA06RmkRbJkTLJahB70cT9KVgiGG qEMiiMPeLxxb+gq6dPkC+lECBSXrHIm+M52Tdqn598vbQah/JZKn2GsgUfqieq2xCFyB cw8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mZlyf08o; 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 r21si2366233qtp.149.2019.06.11.03.57.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 03:57:38 -0700 (PDT) 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=mZlyf08o; 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 ([::1]:56186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeTB-0001hU-Lk for patch@linaro.org; Tue, 11 Jun 2019 06:57:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38862) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePg-00073d-U7 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePd-0007Bj-SM for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:00 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:45344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePd-0007Ai-Hv for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:53:57 -0400 Received: by mail-wr1-x442.google.com with SMTP id f9so12455986wre.12 for ; Tue, 11 Jun 2019 03:53:57 -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 :mime-version:content-transfer-encoding; bh=7jqHN827NhY1D5N0LjiHG3QJ6+mHqX+62R3ls5gE3QI=; b=mZlyf08oNQFnE4X7k9kHqzZbDAXgJBcq1qjVUQJa0hLeFg38PRNpGwr1SNQjpZ6WtP c3w6oT7K1gsp7wdTo3oMRIpGgjgDpEFZqnD1BBpSnNNWWF+Byq5q7L0iDqHoqSNcbbIZ p6vLDF8BIt1yQVEv7kuOiY3PJojl2Ud1OoswJuK87ZBF/0s5S7gL6rMI3nJA6HT21/py DjXRQm7idrfExBiOx9nb7UmW0YS0QTuMXtDB8unxftTAiY1PqJr4l3ht4j97mqQV07xI de4paIZflBa9Mv/quvlUaPf4psv+sVsdxJxjmZDt3OiGVbIqyjMvg8TVNp8esCZLjkkA oI6g== 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:mime-version:content-transfer-encoding; bh=7jqHN827NhY1D5N0LjiHG3QJ6+mHqX+62R3ls5gE3QI=; b=rV/w4IJI/bQXpwt5r1aNMYdTzmXB8wO1JfnoRTsQvsJSLIu11rT0OsKO1pMwreYPU7 FLTCtSpoLPmEgmzy/nLp6pyiiyrvurcp86RYlNrVTVyioRwHSZefBncV0BtIPmHcf84J 7E4XoCLnfNX5VJ++8cLoikeAWxw4eviQBxRIUYIZZykz8nu9y1qZnS0i2GEbcpU6+n/d PNBBzaGUxIbOPtX0TZbZghl6P5n3R19wwbublM1cpZJnct6D3NaqPLZuMGblrEzN4CU9 tfoyMJ2eIEWA/YmJKRjRQUBEXHoZIlYh+9eqqpulJzCLT7whxO8Do2V2V5+jX6CFdsrF wXlg== X-Gm-Message-State: APjAAAVJ7g+mf1MvG2OkJfTtMfaZcBuNkUhvkH2vLy7VFSElRCVlCPwT aieoXgq0btgg1dTw0ONxtuhuYyOAoEkYmA== X-Received: by 2002:adf:d847:: with SMTP id k7mr19449277wrl.144.1560250436525; Tue, 11 Jun 2019 03:53:56 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.53.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:53:56 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:12 +0100 Message-Id: <20190611105351.9871-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH v2 03/42] target/arm: Factor out VFP access checking code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Factor out the VFP access checking code so that we can use it in the leaf functions of the decodetree decoder. We call the function full_vfp_access_check() so we can keep the more natural vfp_access_check() for a version which doesn't have the 'ignore_vfp_enabled' flag -- that way almost all VFP insns will be able to use vfp_access_check(s) and only the special-register access function will have to use full_vfp_access_check(s, ignore_vfp_enabled). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 100 ++++++++++++++++++++++++++++++++ target/arm/translate.c | 101 +++++---------------------------- 2 files changed, 113 insertions(+), 88 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 3447b3e6466..cf3d7febaa7 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -29,3 +29,103 @@ /* Include the generated VFP decoder */ #include "decode-vfp.inc.c" #include "decode-vfp-uncond.inc.c" + +/* + * Check that VFP access is enabled. If it is, do the necessary + * M-profile lazy-FP handling and then return true. + * If not, emit code to generate an appropriate exception and + * return false. + * The ignore_vfp_enabled argument specifies that we should ignore + * whether VFP is enabled via FPEXC[EN]: this should be true for FMXR/FMRX + * accesses to FPSID, FPEXC, MVFR0, MVFR1, MVFR2, and false for all other insns. + */ +static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) +{ + if (s->fp_excp_el) { + if (arm_dc_feature(s, ARM_FEATURE_M)) { + gen_exception_insn(s, 4, EXCP_NOCP, syn_uncategorized(), + s->fp_excp_el); + } else { + gen_exception_insn(s, 4, EXCP_UDEF, + syn_fp_access_trap(1, 0xe, false), + s->fp_excp_el); + } + return false; + } + + if (!s->vfp_enabled && !ignore_vfp_enabled) { + assert(!arm_dc_feature(s, ARM_FEATURE_M)); + gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(), + default_exception_el(s)); + return false; + } + + if (arm_dc_feature(s, ARM_FEATURE_M)) { + /* Handle M-profile lazy FP state mechanics */ + + /* Trigger lazy-state preservation if necessary */ + if (s->v7m_lspact) { + /* + * Lazy state saving affects external memory and also the NVIC, + * so we must mark it as an IO operation for icount. + */ + if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { + gen_io_start(); + } + gen_helper_v7m_preserve_fp_state(cpu_env); + if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { + gen_io_end(); + } + /* + * If the preserve_fp_state helper doesn't throw an exception + * then it will clear LSPACT; we don't need to repeat this for + * any further FP insns in this TB. + */ + s->v7m_lspact = false; + } + + /* Update ownership of FP context: set FPCCR.S to match current state */ + if (s->v8m_fpccr_s_wrong) { + TCGv_i32 tmp; + + tmp = load_cpu_field(v7m.fpccr[M_REG_S]); + if (s->v8m_secure) { + tcg_gen_ori_i32(tmp, tmp, R_V7M_FPCCR_S_MASK); + } else { + tcg_gen_andi_i32(tmp, tmp, ~R_V7M_FPCCR_S_MASK); + } + store_cpu_field(tmp, v7m.fpccr[M_REG_S]); + /* Don't need to do this for any further FP insns in this TB */ + s->v8m_fpccr_s_wrong = false; + } + + if (s->v7m_new_fp_ctxt_needed) { + /* + * Create new FP context by updating CONTROL.FPCA, CONTROL.SFPA + * and the FPSCR. + */ + TCGv_i32 control, fpscr; + uint32_t bits = R_V7M_CONTROL_FPCA_MASK; + + fpscr = load_cpu_field(v7m.fpdscr[s->v8m_secure]); + gen_helper_vfp_set_fpscr(cpu_env, fpscr); + tcg_temp_free_i32(fpscr); + /* + * We don't need to arrange to end the TB, because the only + * parts of FPSCR which we cache in the TB flags are the VECLEN + * and VECSTRIDE, and those don't exist for M-profile. + */ + + if (s->v8m_secure) { + bits |= R_V7M_CONTROL_SFPA_MASK; + } + control = load_cpu_field(v7m.control[M_REG_S]); + tcg_gen_ori_i32(control, control, bits); + store_cpu_field(control, v7m.control[M_REG_S]); + /* Don't need to do this for any further FP insns in this TB */ + s->v7m_new_fp_ctxt_needed = false; + } + } + + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index c75d94952de..4ba3f1287ee 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3373,8 +3373,10 @@ static int disas_vfp_misc_insn(DisasContext *s, uint32_t insn) return 1; } -/* Disassemble a VFP instruction. Returns nonzero if an error occurred - (ie. an undefined instruction). */ +/* + * Disassemble a VFP instruction. Returns nonzero if an error occurred + * (ie. an undefined instruction). + */ static int disas_vfp_insn(DisasContext *s, uint32_t insn) { uint32_t rd, rn, rm, op, i, n, offset, delta_d, delta_m, bank_mask; @@ -3382,6 +3384,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) TCGv_i32 addr; TCGv_i32 tmp; TCGv_i32 tmp2; + bool ignore_vfp_enabled = false; if (!arm_dc_feature(s, ARM_FEATURE_VFP)) { return 1; @@ -3403,98 +3406,20 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) } } - /* FIXME: this access check should not take precedence over UNDEF + /* + * FIXME: this access check should not take precedence over UNDEF * for invalid encodings; we will generate incorrect syndrome information * for attempts to execute invalid vfp/neon encodings with FP disabled. */ - if (s->fp_excp_el) { - if (arm_dc_feature(s, ARM_FEATURE_M)) { - gen_exception_insn(s, 4, EXCP_NOCP, syn_uncategorized(), - s->fp_excp_el); - } else { - gen_exception_insn(s, 4, EXCP_UDEF, - syn_fp_access_trap(1, 0xe, false), - s->fp_excp_el); - } - return 0; - } - - if (!s->vfp_enabled) { - /* VFP disabled. Only allow fmxr/fmrx to/from some control regs. */ - if ((insn & 0x0fe00fff) != 0x0ee00a10) - return 1; + if ((insn & 0x0fe00fff) == 0x0ee00a10) { rn = (insn >> 16) & 0xf; - if (rn != ARM_VFP_FPSID && rn != ARM_VFP_FPEXC && rn != ARM_VFP_MVFR2 - && rn != ARM_VFP_MVFR1 && rn != ARM_VFP_MVFR0) { - return 1; + if (rn == ARM_VFP_FPSID || rn == ARM_VFP_FPEXC || rn == ARM_VFP_MVFR2 + || rn == ARM_VFP_MVFR1 || rn == ARM_VFP_MVFR0) { + ignore_vfp_enabled = true; } } - - if (arm_dc_feature(s, ARM_FEATURE_M)) { - /* Handle M-profile lazy FP state mechanics */ - - /* Trigger lazy-state preservation if necessary */ - if (s->v7m_lspact) { - /* - * Lazy state saving affects external memory and also the NVIC, - * so we must mark it as an IO operation for icount. - */ - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_io_start(); - } - gen_helper_v7m_preserve_fp_state(cpu_env); - if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { - gen_io_end(); - } - /* - * If the preserve_fp_state helper doesn't throw an exception - * then it will clear LSPACT; we don't need to repeat this for - * any further FP insns in this TB. - */ - s->v7m_lspact = false; - } - - /* Update ownership of FP context: set FPCCR.S to match current state */ - if (s->v8m_fpccr_s_wrong) { - TCGv_i32 tmp; - - tmp = load_cpu_field(v7m.fpccr[M_REG_S]); - if (s->v8m_secure) { - tcg_gen_ori_i32(tmp, tmp, R_V7M_FPCCR_S_MASK); - } else { - tcg_gen_andi_i32(tmp, tmp, ~R_V7M_FPCCR_S_MASK); - } - store_cpu_field(tmp, v7m.fpccr[M_REG_S]); - /* Don't need to do this for any further FP insns in this TB */ - s->v8m_fpccr_s_wrong = false; - } - - if (s->v7m_new_fp_ctxt_needed) { - /* - * Create new FP context by updating CONTROL.FPCA, CONTROL.SFPA - * and the FPSCR. - */ - TCGv_i32 control, fpscr; - uint32_t bits = R_V7M_CONTROL_FPCA_MASK; - - fpscr = load_cpu_field(v7m.fpdscr[s->v8m_secure]); - gen_helper_vfp_set_fpscr(cpu_env, fpscr); - tcg_temp_free_i32(fpscr); - /* - * We don't need to arrange to end the TB, because the only - * parts of FPSCR which we cache in the TB flags are the VECLEN - * and VECSTRIDE, and those don't exist for M-profile. - */ - - if (s->v8m_secure) { - bits |= R_V7M_CONTROL_SFPA_MASK; - } - control = load_cpu_field(v7m.control[M_REG_S]); - tcg_gen_ori_i32(control, control, bits); - store_cpu_field(control, v7m.control[M_REG_S]); - /* Don't need to do this for any further FP insns in this TB */ - s->v7m_new_fp_ctxt_needed = false; - } + if (!full_vfp_access_check(s, ignore_vfp_enabled)) { + return 0; } if (extract32(insn, 28, 4) == 0xf) { From patchwork Tue Jun 11 10:53:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166385 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2195341ilk; Tue, 11 Jun 2019 03:55:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMnn77jwn6aipXA9KKjDXe90fWOSH5nMOJeyfzw4D0qEz5OyLVpdO7r/8S/7SsIDcLoXv6 X-Received: by 2002:a0c:d196:: with SMTP id e22mr61100539qvh.75.1560250510361; Tue, 11 Jun 2019 03:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560250510; cv=none; d=google.com; s=arc-20160816; b=Y7RBpz5f3cCS2daFtH0ky1bEz8R5AAVS92P+/XjqbNrDlsLEf9svVlatU3lSVMy599 Upc/tbpaC42SmvRb2293pZlq+PLwfjvJIAD0I1ZVbxKAXG6I0yDmKWjQN2hApf/e+sr+ vMGWAqc6XrDTrryN+2bxOpHTAqxUBZMy/2YzjksoBitQP5TY9opoGvIrMb0S8B55nolt tN5nUOkfP8LZ97GGpWD4r37F/+ZNJBpDvunbCzR6xvRydmEU8aXH7v+0bMWsKd2OjIJp R0LkwWEBeewLD6J0pRGRQPFeTbkRpHckNwUMRRMwcaCpqYZ71AmEhkUSlHCJxXUra3wu IO2Q== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=2nnkt7R1TuC9dEF2XrgS8dyozUj2d0kArsZ33YiCDeY=; b=GMvcU9pQvI9dysmv2uE2Rn+8hdpx7CDjY0k+VeQllJ0HFxTzzC3e/bXGqU5ESDEfdF xi9fr1AccGgIfkiuwbEyZebp+lx9KmyN+zMErTTHZVhrimBlnfUqctSXqcWEMcloHcN6 d/IWA78XxPKbCVKW9REWq5KXZ3QYu+8bS5moVqcxnMylAx3m9GhGXiOI/a/aECvz9h+7 +5r20l0l7clUx9jPQ7PjuwMWqexHVyD2etcxx59R5MJnua6ee+AdzGuD9kA1+ISyy+5V gUd1frOCS5XeiI1X27/FIUr5oPcjBCqhzwpatJ6pGSq/QWWS7q/NQu0Vp9TrUVo51DdP JN8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vhEsKcSb; 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 h127si1379136qkf.186.2019.06.11.03.55.10 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 03:55:10 -0700 (PDT) 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=vhEsKcSb; 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 ([::1]:56172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQm-00079J-94 for patch@linaro.org; Tue, 11 Jun 2019 06:55:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38844) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePg-00072g-51 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePe-0007CJ-Ge for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:53:59 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:35555) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePe-0007Be-Ai for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:53:58 -0400 Received: by mail-wm1-x343.google.com with SMTP id c6so2403500wml.0 for ; Tue, 11 Jun 2019 03:53:58 -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 :mime-version:content-transfer-encoding; bh=2nnkt7R1TuC9dEF2XrgS8dyozUj2d0kArsZ33YiCDeY=; b=vhEsKcSbtesMlNLHub1R3EqBDLAFaYjNUYnHR48csoo2Z1jqFCW9Yp5hDcgsOFCGU/ 9eVRrw+406d/xy9bT5hWECbLBpdu2TBl32jv9kDqtUU5N/TLQdYPmz3zkk4xH07aS+HP cXs3x8aUAj2d4v5Lf4L2ASKXMyLqNPsSZtcqzXrChNgAD6DSzBEuqzjfb/crDlGc4yyj eBELjYPnLs0KacmGPSVnx3j2ym/jiw5q2ZAKIe+ZDtDC/fZBZSbARAmk1M5Y9MLU+DSu DNRmFqyQ5YJNC6Y1eMT+f81sgp2BJpoPW0kZL0RI6i8PH5kwzs+XYcNhYNdvU6R/3ORw H/kg== 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:mime-version:content-transfer-encoding; bh=2nnkt7R1TuC9dEF2XrgS8dyozUj2d0kArsZ33YiCDeY=; b=BdXSqH3nBdFo4OhQ8xq44GgJdvB/knhmIwwqjKlnuvD7VtENzmkBLzrBbU2rBnhfG5 dIrYsaqC34X7adrPCr0lDHq4MKdRvM57QhShjdKNPwLmdOhIG8+Zy2xtYAZ/DJWCYTIR n7CtBWFzcBqAVG67/Uk62i9fqMnnejXSMHQhNEhVNm64W0MNlkC1VAlHPxQROH0slYqb I4UEo21gAXfQmSI1XJz2GlR1d4s+oZxLeiHWlwBk3BJXcGPfoUMyrP9+YVMgCkA1J31s JSzIU7Qo/0DOkoPhai4uYTG1DylGOstndY+VQ6JId3HKsPYXVtuy286TE2QiNXBlDYHE BqRQ== X-Gm-Message-State: APjAAAUX4VrsAF817Yt6UOoK66PKgunTIq10UsXTJIkvPYvNmwtveUZx +qfrYO4weYEzL+TXpYthklbU2vaAm87UZw== X-Received: by 2002:a1c:f001:: with SMTP id a1mr18327491wmb.130.1560250437454; Tue, 11 Jun 2019 03:53:57 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.53.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:53:56 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:13 +0100 Message-Id: <20190611105351.9871-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH v2 04/42] target/arm: Fix Cortex-R5F MVFR values X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The Cortex-R5F initfn was not correctly setting up the MVFR ID register values. Fill these in, since some subsequent patches will use ID register checks rather than CPU feature bit checks. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.20.1 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index f70e07fd118..ac5adb81bf1 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1607,6 +1607,8 @@ static void cortex_r5f_initfn(Object *obj) cortex_r5_initfn(obj); set_feature(&cpu->env, ARM_FEATURE_VFP3); + cpu->isar.mvfr0 = 0x10110221; + cpu->isar.mvfr1 = 0x00000011; } static const ARMCPRegInfo cortexa8_cp_reginfo[] = { From patchwork Tue Jun 11 10:53:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166389 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2203862ilk; Tue, 11 Jun 2019 04:03:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwn0ex5lVcJ/zxuG18qHv4V2guKAL55HqhKxxIZRf+iTioiUXCDwuxr6B0OQQ1jiM2Lityf X-Received: by 2002:a0c:d947:: with SMTP id t7mr6047155qvj.127.1560251017482; Tue, 11 Jun 2019 04:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251017; cv=none; d=google.com; s=arc-20160816; b=OSM0lol3aWHwgI58kDZJTgags+sqYKfCbG3kH54jhSENn8cYZuhXiOMdp0tusykMvH UhGsk5R01yunvDW4kClA0w9ROxwlXMNVsq2wPGg59aIwGEpItwm1ON/2tyZ3Sw+V486/ Al798gBiQa67YdQ8z1NWEXCgtK1wauxGJTHrG6xIlx9ZUJOZ82tmkfrzrfi5NqIijLVY c/jlj+9/7hl4d3Dkle9xJR1bIxrtlxbvoURM2IfpAeZuGm4eJXOdeD5BG44twxzEqMof YPGATiT+HYmWzM06qZkxEHMl2FYTwzzRNi0j/INUa11xuK0Ovy3DrOyU+pCo0TC+ziuY CbQQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=o6pWiOTZGrPQzzzhaP28sXPHF/a5tiDkyRfucp6JqcA=; b=Epx2r6f0nUNrhcqTMOGgU3lIzCnSg6XeJ/YHjPdCZSiFJxSHYfb0prOSy7RZmKuoSM 3oaBo4mgJ49e/NyEVH2Zu3c5aHC4U6MTGoJoSqmpgF1ykKqsKwN51xEKhPerLuVpTwQu TK18x797uQ6CtUOGYDeSINXHvnqtdZwz3L+dwOeBR8/14CNqzzQP1y8M2Ju7rGrQ3H0g J8edrs32z7r2DaghXt3EgWQAo18vbwwFxz40QJ0+pX8UlfkzP0aVdf0knzIAB0dHEBuL Kfapm1ZMZfGxeRDVFcFlXTQSxnISrCSTzpNaKuXeNCD/ogB4ktIKXnwAhYXN5IiIvAAf nGgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MgYwJOTG; 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 h38si3577378qvc.155.2019.06.11.04.03.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:03:37 -0700 (PDT) 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=MgYwJOTG; 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 ([::1]:56236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeYz-0007dm-26 for patch@linaro.org; Tue, 11 Jun 2019 07:03:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38908) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePj-000783-3k for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePg-0007E4-C2 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:02 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:54211) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePf-0007Cb-M7 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:53:59 -0400 Received: by mail-wm1-x344.google.com with SMTP id x15so2419385wmj.3 for ; Tue, 11 Jun 2019 03:53:59 -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 :mime-version:content-transfer-encoding; bh=o6pWiOTZGrPQzzzhaP28sXPHF/a5tiDkyRfucp6JqcA=; b=MgYwJOTG1JwRYllOT3EqKrsxmY9ZJngNgNWexrOwaYyFor0oniGU+2T9PGCw0wB+UW uy1aoozIM1HLJHa9k+uzlgHTOsLPtQol41jizMm46eI/pKgioOfCWjXoaqH1d9Jmfg9l 63J8SzGv7hb/UQxK0Th05sOqZI6a0ll0aEeMBl27CPd9TL/UeT3L9N3td7hLXw4B284y v95QRrSz2wAA8D1KwI5LZ3OGNJTWAwrW956FQf5iGneOH2eDueXFKbpuRoFcb5xQ6yhV 3hSNUGU/r179w1ARMg96qpADIuQJ2RIby22NgK/LPoAYxQryyhjhyTOX7NFipIjsz+vk GCnA== 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:mime-version:content-transfer-encoding; bh=o6pWiOTZGrPQzzzhaP28sXPHF/a5tiDkyRfucp6JqcA=; b=mpOMGBUeEADvmZXYxm4bhZtY/PNr8hzmecFeD2SK7aeWyPmMKFiEaz4scHa/dedgHU /mX2ZeZBXMEdiv6rYKCe+ohtNJCtpPxfyXa8sbaGlwfnyJps78/k8KjXTrvQiVjEuRy8 qtZNx7eRnSpcfouL6zg88U2FgF5tHg/sY3U8dL8rN7A43nKjxpamJmkklcIqlG0u+H6V bStJk6BqO3armXs9YToRgcZUGyUbwje4bzsMGKeIGcPnXWP/hcmd2tgevqjSBlZ6GtYn BJJe/hDkq635kmrgT90Q4JQplxpd7x4rEQ8MXHTOet6bLznr9Gv3O1mbyH0SaX3IJXFW rP+A== X-Gm-Message-State: APjAAAXdTzpKBHP4QCmobecDko7VNqPX0I4XyLzYI3UN+X+h7ezBRLQ5 npnev8Xigg9L30l8Tp5jxnTivg== X-Received: by 2002:a1c:4b1a:: with SMTP id y26mr13400026wma.105.1560250438428; Tue, 11 Jun 2019 03:53:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.53.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:53:57 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:14 +0100 Message-Id: <20190611105351.9871-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH v2 05/42] target/arm: Explicitly enable VFP short-vectors for aarch32 -cpu max X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" At the moment our -cpu max for AArch32 supports VFP short-vectors because we always implement them, even for CPUs which should not have them. The following commits are going to switch to using the correct ID-register-check to enable or disable short vector support, so we need to turn it on explicitly for -cpu max, because Cortex-A15 doesn't implement it. We don't enable this for the AArch64 -cpu max, because the v8A architecture never supports short-vectors. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.20.1 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index ac5adb81bf1..cdd76c54444 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2021,6 +2021,10 @@ static void arm_max_initfn(Object *obj) kvm_arm_set_cpu_features_from_host(cpu); } else { cortex_a15_initfn(obj); + + /* old-style VFP short-vector support */ + cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1); + #ifdef CONFIG_USER_ONLY /* We don't set these in system emulation mode for the moment, * since we don't correctly set (all of) the ID registers to From patchwork Tue Jun 11 10:53:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166392 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2206966ilk; Tue, 11 Jun 2019 04:06:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIXu63a16WI1N4TCYl1GDuTpKGE1O+w80WRwWT0IIM/usImXfZS481PqcnDDJLWiVRHwkO X-Received: by 2002:ac8:38cf:: with SMTP id g15mr56825283qtc.268.1560251164712; Tue, 11 Jun 2019 04:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251164; cv=none; d=google.com; s=arc-20160816; b=VTvi2NItYfZrU1WfSav8XGsePWcnG1dlPXD87pdmIpSvDpiTTUJgIrQpvC54TAW6Of 7Rx44FE9h4PDiCZc/VHhtEe/zfnYnd2SHtfHPD9u/d2jQEJ/qIFqxe/ayrCtxrxRd24P fxyzLTKN2ED6mHaGt8/lxQz3++ogf3rqEr3ee43dkgbpXPEPx97DpmGJ5dUh20VruLiO b9ckxEB9M1Y/5sGVkIk+78CUFY8y1pQpbqFluZrZ8CTGQdF82qrWE9DdV/s6YeybSfi1 A7rAmPnPQ5w6alyV+Y2jnvCVWIbdW17u5ho/T+7VZdfQUnLMbfEdANRGVJCxjBRnhgQ4 JCcg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ntqFWnYKEOd6do5Dv+t7ajMLbUOjNo0hPh/YM8tuMAg=; b=GAI3IJSRQGdzmbDHfOT12UYLDfKhEwNbsboRARa6mGUNXQcDIbzHYOJJsDjR4+MP/N WVIXSgdlkNvDCSmOUXjBSO1PTWI4SIhRx4LcwLcYbFphwbjfFCrNkz4hOb/IFdPUmoFU AVvBMJvNUmg3fvn6CbcaYj48uQyXgGWbtd+XDavlbVebAbCTAi9hH3RJLyAHDiJDuM6V 71Dx612ksalwLeFedMmPUVK5Pt2d6GfmUTrxTu4vwZObQeoIJq4lZwuCQxSuhjO2Plkm DAtwlRNZXoEGJh8GhlOmJF3V4zoSwDzhzehdCwN9kuQwIfniQtRGx3FVA2SqkbopbSoE Ro5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HATPupoE; 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 v21si148246qvf.209.2019.06.11.04.06.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:06:04 -0700 (PDT) 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=HATPupoE; 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 ([::1]:56258 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haebM-0001LG-Ai for patch@linaro.org; Tue, 11 Jun 2019 07:06:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38909) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePj-00078A-4l for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePh-0007F9-29 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:02 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:38708) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePg-0007Da-Oj for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:00 -0400 Received: by mail-wm1-x341.google.com with SMTP id s15so2384702wmj.3 for ; Tue, 11 Jun 2019 03:54:00 -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 :mime-version:content-transfer-encoding; bh=ntqFWnYKEOd6do5Dv+t7ajMLbUOjNo0hPh/YM8tuMAg=; b=HATPupoEgeWJUI4YHLuth9hpywYEqGYa+KoN3boD9+UOulIaWcEzRSZKIVMB/tIlM2 7dXNdW9NMSDFjyY7f3GmB8lwNS5eMAirW54le4A9i8OSSUILv77VkBaQm2H7vg/wcljS QWNbOTVSh/iMrtUhpP/c0C75ve5hhAg44Fklg1tZS4ggCqe/9kJsTGF6uqLsx9FJLu1s 2zndeRs3wk0pnFOR7UeYujzhKRXfQAxbiCib0EjYTji+ryAjjMYS3zWjinMGomsgg4n2 iO3lZpG4+IrMcZrGFwvp26hefL0inkSIz0sS6yhxN8DizwhdqYMz/CRf0HDjbdUftAkC Mrig== 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:mime-version:content-transfer-encoding; bh=ntqFWnYKEOd6do5Dv+t7ajMLbUOjNo0hPh/YM8tuMAg=; b=SiSmC8b9ZOD7vbYnrgXkHvg1SJ/91vQ6T1qrddXRal81uvk0inbj2cOTTpoNPXKATM cJuuIN7CjhIHPbmwQkcs2eHLk7vbWcJi1+F9KnlQTdDam1y+Bxpz6XVFIGO15wd6avwe 4wonUT59dWUD04826V+DVbA8orBavzVE3ADgyXEjIuW3a8nVF7Cs8jP6oDlXuZgYkYIt Ljgp+/ZPbfWEP6Q9shFp38M9M8Mlb08/fG98o6VGOP4GCzk9WmnMylIJbF/6Wjn8DpgC oWwBhMAar0odgDXhDTFywpvhLtacIY/9LK362AuFhL1DPx6S9MVinOw5i/QWBJeVtMJP U54g== X-Gm-Message-State: APjAAAVaNX+wvosJJ9lkCbv6dOhaSXuiHI65A8Ejk8AQgJHxABDMmNyW B/N6H4VUmvhCUeTaL0CkIgX0axavJ51zeQ== X-Received: by 2002:a1c:e715:: with SMTP id e21mr18044295wmh.16.1560250439475; Tue, 11 Jun 2019 03:53:59 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.53.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:53:59 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:15 +0100 Message-Id: <20190611105351.9871-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v2 06/42] target/arm: Convert the VSEL instructions to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VSEL instructions to decodetree. We leave trans_VSEL() in translate.c for now as this allows the patch to show just the changes from the old handle_vsel(). In the old code the check for "do D16-D31 exist" was hidden in the VFP_DREG macro, and assumed that VFPv3 always implied that D16-D31 exist. In the new code we do the correct ID register test. This gives identical behaviour for most of our CPUs, and fixes previously incorrect handling for Cortex-R5F, Cortex-M4 and Cortex-M33, which all implement VFPv3 or better with only 16 double-precision registers. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 6 ++++++ target/arm/translate-vfp.inc.c | 9 +++++++++ target/arm/translate.c | 35 ++++++++++++++++++++++++---------- target/arm/vfp-uncond.decode | 19 ++++++++++++++++++ 4 files changed, 59 insertions(+), 10 deletions(-) -- 2.20.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 8fa9772c9da..c612901daeb 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3372,6 +3372,12 @@ static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) == 1; } +static inline bool isar_feature_aa32_fp_d32(const ARMISARegisters *id) +{ + /* Return true if D16-D31 are implemented */ + return FIELD_EX64(id->mvfr0, MVFR0, SIMDREG) >= 2; +} + /* * We always set the FP and SIMD FP16 fields to indicate identical * levels of support (assuming SIMD is implemented at all), so diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index cf3d7febaa7..f7535138d0f 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -129,3 +129,12 @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) return true; } + +/* + * The most usual kind of VFP access check, for everything except + * FMXR/FMRX to the always-available special registers. + */ +static bool vfp_access_check(DisasContext *s) +{ + return full_vfp_access_check(s, false); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 4ba3f1287ee..6ee60303eeb 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3076,10 +3076,27 @@ static void gen_neon_dup_high16(TCGv_i32 var) tcg_temp_free_i32(tmp); } -static int handle_vsel(uint32_t insn, uint32_t rd, uint32_t rn, uint32_t rm, - uint32_t dp) +static bool trans_VSEL(DisasContext *s, arg_VSEL *a) { - uint32_t cc = extract32(insn, 20, 2); + uint32_t rd, rn, rm; + bool dp = a->dp; + + if (!dc_isar_feature(aa32_vsel, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (dp && !dc_isar_feature(aa32_fp_d32, s) && + ((a->vm | a->vn | a->vd) & 0x10)) { + return false; + } + rd = a->vd; + rn = a->vn; + rm = a->vm; + + if (!vfp_access_check(s)) { + return true; + } if (dp) { TCGv_i64 frn, frm, dest; @@ -3101,7 +3118,7 @@ static int handle_vsel(uint32_t insn, uint32_t rd, uint32_t rn, uint32_t rm, tcg_gen_ld_f64(frn, cpu_env, vfp_reg_offset(dp, rn)); tcg_gen_ld_f64(frm, cpu_env, vfp_reg_offset(dp, rm)); - switch (cc) { + switch (a->cc) { case 0: /* eq: Z */ tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero, frn, frm); @@ -3148,7 +3165,7 @@ static int handle_vsel(uint32_t insn, uint32_t rd, uint32_t rn, uint32_t rm, dest = tcg_temp_new_i32(); tcg_gen_ld_f32(frn, cpu_env, vfp_reg_offset(dp, rn)); tcg_gen_ld_f32(frm, cpu_env, vfp_reg_offset(dp, rm)); - switch (cc) { + switch (a->cc) { case 0: /* eq: Z */ tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero, frn, frm); @@ -3182,7 +3199,7 @@ static int handle_vsel(uint32_t insn, uint32_t rd, uint32_t rn, uint32_t rm, tcg_temp_free_i32(zero); } - return 0; + return true; } static int handle_vminmaxnm(uint32_t insn, uint32_t rd, uint32_t rn, @@ -3354,10 +3371,8 @@ static int disas_vfp_misc_insn(DisasContext *s, uint32_t insn) rm = VFP_SREG_M(insn); } - if ((insn & 0x0f800e50) == 0x0e000a00 && dc_isar_feature(aa32_vsel, s)) { - return handle_vsel(insn, rd, rn, rm, dp); - } else if ((insn & 0x0fb00e10) == 0x0e800a00 && - dc_isar_feature(aa32_vminmaxnm, s)) { + if ((insn & 0x0fb00e10) == 0x0e800a00 && + dc_isar_feature(aa32_vminmaxnm, s)) { return handle_vminmaxnm(insn, rd, rn, rm, dp); } else if ((insn & 0x0fbc0ed0) == 0x0eb80a40 && dc_isar_feature(aa32_vrint, s)) { diff --git a/target/arm/vfp-uncond.decode b/target/arm/vfp-uncond.decode index b1d9dc507c2..b7f7c27fe86 100644 --- a/target/arm/vfp-uncond.decode +++ b/target/arm/vfp-uncond.decode @@ -26,3 +26,22 @@ # 1111 1110 .... .... .... 101. .... .... # (but those patterns might also cover some Neon instructions, # which do not live in this file.) + +# VFP registers have an odd encoding with a four-bit field +# and a one-bit field which are assembled in different orders +# depending on whether the register is double or single precision. +# Each individual instruction function must do the checks for +# "double register selected but CPU does not have double support" +# and "double register number has bit 4 set but CPU does not +# support D16-D31" (which should UNDEF). +%vm_dp 5:1 0:4 +%vm_sp 0:4 5:1 +%vn_dp 7:1 16:4 +%vn_sp 16:4 7:1 +%vd_dp 22:1 12:4 +%vd_sp 12:4 22:1 + +VSEL 1111 1110 0. cc:2 .... .... 1010 .0.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0 +VSEL 1111 1110 0. cc:2 .... .... 1011 .0.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1 From patchwork Tue Jun 11 10:53:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166391 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2204388ilk; Tue, 11 Jun 2019 04:04:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdTWjnHjcaOJ5N49+P1z4Cps0XxCtDFeDfSHYSXxxC2j8uGGAh6Eo6JJQG71KcHhZIh2PX X-Received: by 2002:ac8:2edc:: with SMTP id i28mr43438599qta.77.1560251041366; Tue, 11 Jun 2019 04:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251041; cv=none; d=google.com; s=arc-20160816; b=F+5HlUDSKcdSCSpXz/WXpsUYycouKPO4k91MJfsLRKDcFZkdZaX4j6Mq+5+pCJN11/ 5IW1PyVCbbWht/Eco4XK3NOQHYPeTtK0C7/p5IftfVlrT2gX+dSxWb1YaVdBRkU6XxCq +OtejlOmOxG3S2lrO9llW8tye7yBgqFO/ft+rxQjV4tGe2Z3ncysXX3n+JP+kBfg8U9A l9vrPpk/D/yWaPkISW0CY/AWBgm7xIrTwQSXnzh3jWWMUBAWD+mzFQXF8DdN0YW9C4RC W6XaDcOfj+qnxOfgYXO96t+M/MiPYvl5UseI9jU+br13gj7sV6Y/MQmI/ALkYnYGxXNO c3AQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=SZbakxW0g38DCAAdbQ5o6o6UWVsvUIKVBk4A8V5fIVY=; b=atqOzAV4cqxevSfC/xmL0tmi/Oo0UixbFSGCJO+Dso2GwYbS8bD6HVVxz51c+ki5wF Htra/aSfKMqBoXF7nuAoZVdZE9ilgcxdEnx58O4gNNDy1hMxsMXuo2EkqiYT7G01tpDf awlXFS9QfdAJFnDFEh8GGDWjtf5/9O/ns+8njyr9JRFJ90v4P1kY5Ani97IGr6++dihn WNzdQFUTIn1VTelCWP2kctV5k4ZPlSrV4IXmV3r0LId2ykzOFZ4zydOnLsANyAhaUUyM LnSmxbHQCpiPpw/HtOS1Uv9Fe2AIewl6lg+hsPfU2RkbyDJ7PcmE5q7t91sFzHYcKpQ3 ElEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=D4+2M2+F; 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 m1si454443qtq.92.2019.06.11.04.04.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:04:01 -0700 (PDT) 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=D4+2M2+F; 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 ([::1]:56244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeZM-0007sa-71 for patch@linaro.org; Tue, 11 Jun 2019 07:04:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38987) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePp-0007A4-BU for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePl-0007IK-2x for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:07 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:36473) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePi-0007EU-Ul for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:03 -0400 Received: by mail-wm1-x342.google.com with SMTP id u8so2398905wmm.1 for ; Tue, 11 Jun 2019 03:54:01 -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 :mime-version:content-transfer-encoding; bh=SZbakxW0g38DCAAdbQ5o6o6UWVsvUIKVBk4A8V5fIVY=; b=D4+2M2+FrohjPjlO6FclDGgkQtD129vVisIuNtgtJIMypwavc6CYeDXe6xmoYb87t0 pdRsYQ524L7kGJBeiGcQ1Qx84IekbIcJlWANHrxWt9fH/piSyl9dWZBMmz/HtZsH63pd OHsVwG2u8Pd2c7FMa1j/+YrDPm/3T/XotFpNNC5ZDlkGWh8CYizNC2t+7d8DWFSla8a5 6712Kx4bOAVYLJ2eRaoMobV3u88eo08phU2uHOLx6GNK74pUbSaxFT0K9JUKYbVp+Y2c vU/cyn7LBQ7f/XWIxxGHV6DEkSd30RBDqbTS6B3XExxcMW6ZWQxkS/9RmssgJv7e5SUV C58A== 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:mime-version:content-transfer-encoding; bh=SZbakxW0g38DCAAdbQ5o6o6UWVsvUIKVBk4A8V5fIVY=; b=Zej9Q3sv7votiKSlSO7pI4kbW5yyN6uhcl6LK+cn0L4Wyt++V8F5lOa2gCwNBqvPch Xwjdfjeyp1laNptblZFYduQUh2cZSlAQT99dUawynD8d1hUzW+sbwe+BZDf8+zuAvw7J zyv/ZbAwnEe8iTsgKj2pOQVlQimLHCqKmEKK8A6yd/vwsaeQoZ2mAH9NSDluWEqQ+ZuP 72dVCGjDrhMoAWcnqdyUhOw+G/bGd068pZV67Iw6Zbl0k/11KcCLg9x16RI0Lhxymmmg qY1BpDRoo+oVWvuBLUA1yGKer8gyeW8vv0bBvHkYgtlOjWGinfsGhkTiDZ0mSREN0QyK jOTg== X-Gm-Message-State: APjAAAX/bUXYZ15sMYyk7GVS62UYyDsUdSj2Zp8HaO2RNwKX2t3/2lSo tqUdwiQ91N7e1Chy7I1KRp/tY9my5jd7UQ== X-Received: by 2002:a1c:80c1:: with SMTP id b184mr15846499wmd.24.1560250440383; Tue, 11 Jun 2019 03:54:00 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.53.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:53:59 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:16 +0100 Message-Id: <20190611105351.9871-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 07/42] target/arm: Convert VMINNM, VMAXNM to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VMINNM and VMAXNM instructions to decodetree. As with VSEL, we leave the trans_VMINMAXNM() function in translate.c for the moment. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate.c | 41 ++++++++++++++++++++++++------------ target/arm/vfp-uncond.decode | 5 +++++ 2 files changed, 33 insertions(+), 13 deletions(-) -- 2.20.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 6ee60303eeb..53badde1f52 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3202,11 +3202,31 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) return true; } -static int handle_vminmaxnm(uint32_t insn, uint32_t rd, uint32_t rn, - uint32_t rm, uint32_t dp) +static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) { - uint32_t vmin = extract32(insn, 6, 1); - TCGv_ptr fpst = get_fpstatus_ptr(0); + uint32_t rd, rn, rm; + bool dp = a->dp; + bool vmin = a->op; + TCGv_ptr fpst; + + if (!dc_isar_feature(aa32_vminmaxnm, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (dp && !dc_isar_feature(aa32_fp_d32, s) && + ((a->vm | a->vn | a->vd) & 0x10)) { + return false; + } + rd = a->vd; + rn = a->vn; + rm = a->vm; + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(0); if (dp) { TCGv_i64 frn, frm, dest; @@ -3247,7 +3267,7 @@ static int handle_vminmaxnm(uint32_t insn, uint32_t rd, uint32_t rn, } tcg_temp_free_ptr(fpst); - return 0; + return true; } static int handle_vrint(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, @@ -3359,23 +3379,18 @@ static const uint8_t fp_decode_rm[] = { static int disas_vfp_misc_insn(DisasContext *s, uint32_t insn) { - uint32_t rd, rn, rm, dp = extract32(insn, 8, 1); + uint32_t rd, rm, dp = extract32(insn, 8, 1); if (dp) { VFP_DREG_D(rd, insn); - VFP_DREG_N(rn, insn); VFP_DREG_M(rm, insn); } else { rd = VFP_SREG_D(insn); - rn = VFP_SREG_N(insn); rm = VFP_SREG_M(insn); } - if ((insn & 0x0fb00e10) == 0x0e800a00 && - dc_isar_feature(aa32_vminmaxnm, s)) { - return handle_vminmaxnm(insn, rd, rn, rm, dp); - } else if ((insn & 0x0fbc0ed0) == 0x0eb80a40 && - dc_isar_feature(aa32_vrint, s)) { + if ((insn & 0x0fbc0ed0) == 0x0eb80a40 && + dc_isar_feature(aa32_vrint, s)) { /* VRINTA, VRINTN, VRINTP, VRINTM */ int rounding = fp_decode_rm[extract32(insn, 16, 2)]; return handle_vrint(insn, rd, rm, dp, rounding); diff --git a/target/arm/vfp-uncond.decode b/target/arm/vfp-uncond.decode index b7f7c27fe86..8ab201fa058 100644 --- a/target/arm/vfp-uncond.decode +++ b/target/arm/vfp-uncond.decode @@ -45,3 +45,8 @@ VSEL 1111 1110 0. cc:2 .... .... 1010 .0.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0 VSEL 1111 1110 0. cc:2 .... .... 1011 .0.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1 + +VMINMAXNM 1111 1110 1.00 .... .... 1010 . op:1 .0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0 +VMINMAXNM 1111 1110 1.00 .... .... 1011 . op:1 .0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1 From patchwork Tue Jun 11 10:53:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166396 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2210110ilk; Tue, 11 Jun 2019 04:08:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzY5LUudKRx8umdfX0Wt+N8tb1gSj9BON92aFQqM/fhcQv7aSpF+YmIYY7dAmc1/JeV2dfX X-Received: by 2002:a0c:816c:: with SMTP id 99mr39348067qvc.165.1560251324765; Tue, 11 Jun 2019 04:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251324; cv=none; d=google.com; s=arc-20160816; b=r1k69aJLMJHJGMeEApll35WWM3mgR82bUdrwrK53UHdOpuretoN08qn8XRFCg+prSP W+XOTU+wQLI98ridKoeZtT+xES7CrI3dNlYm/RTFLlvN0dbgrP3gi+lg/i1+WgaI2utx 859RRmDW7Gm92NZFhOTsSPOB2xV4CNEI+g7q53zoF16LTnTT4MsuEclpWoJ1PgyMRKXY 1RDiHW1w6OJ3qfJSyUWfDhMQeqsdzzv7b1/g3pdxTCfOD0b7Gut5BZYE5Udkw4II7Hia 6yKrgWRO6kvsznfIXdI0PnyeZltryBr378caKjweRywWe0YsArsbWoglIE4o5KnZJNjD Hy2Q== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Hf8MpfHUo3UF7W88LcdNMkV2Y4vd60PhY1ZXXjpwkAc=; b=da7veLoxuFoM2nKzA3WhbJT66LDxyNd6Ni5Ll/t1kSa/5SyTowk5rj6yFi4Waodwxe YrMndg6hDqzSdH5xu48/qHqhEY21chxdGeY/99SXOJGqubMaqidX95IIRW35xY8Rf+RE zsBp0SgYjVzMNcToV80d96TwSfqgymfHuiw0PRcB2wwCVQYTBZ2dhuBOCAGM0UBn3HG8 0pmJq+qXDUK6ENBI1HSTT/jm5twqTH2jbFybiBEOPkOGYUV5sYw29oCyzBIg9xkIb26W sV+Z4QYQP0TLwToarlGM9g9y+goYhZspXOSBBEq/neKBmBjQXedHddwFYmsDRrdarYGS 9BFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Fx5hVUm1; 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 u9si4590697qvg.28.2019.06.11.04.08.44 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:08:44 -0700 (PDT) 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=Fx5hVUm1; 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 ([::1]:56282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haedu-0004Dl-0u for patch@linaro.org; Tue, 11 Jun 2019 07:08:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38988) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePp-0007A5-BA for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePl-0007J0-BC for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:07 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:56295) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePj-0007Fq-1I for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:05 -0400 Received: by mail-wm1-x343.google.com with SMTP id a15so2409709wmj.5 for ; Tue, 11 Jun 2019 03:54:02 -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 :mime-version:content-transfer-encoding; bh=Hf8MpfHUo3UF7W88LcdNMkV2Y4vd60PhY1ZXXjpwkAc=; b=Fx5hVUm1eRw65ai0VMakp4UYD1xiLn6mW8m0KC3dub5tD75DRNetioFNRSPCAN1LRK eSUtrgWL/hOJhkzmXXQMh2+JHYeLp8oZYWhi1za8aawIC3N+6OQ+ih+1pJxeRH506Lu0 6SLusmNvIfg3jcjnr51PcBocxZlwKlB8TrUxISyo4Q48O1cSLSEcSjR0EOrmv/jl/rS0 j6d1g9ISeybLsK2FMkR+AEzqCjEYIvgXKAbtO7cJmXCJ61wAQQ7uZMuroxEWTzWM/VgH KUYLrvTxDNgNBbTNNaIPWc1GDLiy9ISetQqJ2eE+kSf6tkst7DaJitJtBFzKlVPEvK0f lkOw== 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:mime-version:content-transfer-encoding; bh=Hf8MpfHUo3UF7W88LcdNMkV2Y4vd60PhY1ZXXjpwkAc=; b=UtrJnBPJKOyWrEZLYyjHOPtmKWUkeD9AxlmPwUqiwf2P8eO6GQEPaMddyFVuc9wWgy QUev6hwzrAF2EwQqTrfaQWQCBeIoVA6Aa0GUGA/nGcvFr7DKYSXnDgqiDjZjuIwg03jt YpdY2SZXY5FjsgiA5Ib0/e/pZ+bCm1FZCvKRhleqIoQYM8X1EFMl3zQ/C0fG3R9ZQeCr tlH3aTKxpOEJTAK5496UbU8PSQOA/tKZ9Wh4AbKKklTklaSGqytO+cKHb7ejbXnP6RXo 54g23afyTfoRFf8VYekPunUj5Zje5lbO8H4sgsvylBiaybINcsoRjkIvqqRyt61PXSZZ 4ZNw== X-Gm-Message-State: APjAAAWGw5fIkfBgd2wl+kITi/D41u7EFW0NvZzEfY8id+AuZqcjMw1r pH1bb9nnVCU7XNdvNvw6MWnTGQ== X-Received: by 2002:a7b:c018:: with SMTP id c24mr14398730wmb.37.1560250441571; Tue, 11 Jun 2019 03:54:01 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:01 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:17 +0100 Message-Id: <20190611105351.9871-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH v2 08/42] target/arm: Convert VRINTA/VRINTN/VRINTP/VRINTM to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VRINTA/VRINTN/VRINTP/VRINTM instructions to decodetree. Again, trans_VRINT() is temporarily left in translate.c. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate.c | 60 +++++++++++++++++++++++------------- target/arm/vfp-uncond.decode | 5 +++ 2 files changed, 43 insertions(+), 22 deletions(-) -- 2.20.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 53badde1f52..1f106645bca 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3270,11 +3270,43 @@ static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) return true; } -static int handle_vrint(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, - int rounding) +/* + * Table for converting the most common AArch32 encoding of + * rounding mode to arm_fprounding order (which matches the + * common AArch64 order); see ARM ARM pseudocode FPDecodeRM(). + */ +static const uint8_t fp_decode_rm[] = { + FPROUNDING_TIEAWAY, + FPROUNDING_TIEEVEN, + FPROUNDING_POSINF, + FPROUNDING_NEGINF, +}; + +static bool trans_VRINT(DisasContext *s, arg_VRINT *a) { - TCGv_ptr fpst = get_fpstatus_ptr(0); + uint32_t rd, rm; + bool dp = a->dp; + TCGv_ptr fpst; TCGv_i32 tcg_rmode; + int rounding = fp_decode_rm[a->rm]; + + if (!dc_isar_feature(aa32_vrint, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (dp && !dc_isar_feature(aa32_fp_d32, s) && + ((a->vm | a->vd) & 0x10)) { + return false; + } + rd = a->vd; + rm = a->vm; + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(0); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding)); gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); @@ -3305,7 +3337,7 @@ static int handle_vrint(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, tcg_temp_free_i32(tcg_rmode); tcg_temp_free_ptr(fpst); - return 0; + return true; } static int handle_vcvt(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, @@ -3366,17 +3398,6 @@ static int handle_vcvt(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, return 0; } -/* Table for converting the most common AArch32 encoding of - * rounding mode to arm_fprounding order (which matches the - * common AArch64 order); see ARM ARM pseudocode FPDecodeRM(). - */ -static const uint8_t fp_decode_rm[] = { - FPROUNDING_TIEAWAY, - FPROUNDING_TIEEVEN, - FPROUNDING_POSINF, - FPROUNDING_NEGINF, -}; - static int disas_vfp_misc_insn(DisasContext *s, uint32_t insn) { uint32_t rd, rm, dp = extract32(insn, 8, 1); @@ -3389,13 +3410,8 @@ static int disas_vfp_misc_insn(DisasContext *s, uint32_t insn) rm = VFP_SREG_M(insn); } - if ((insn & 0x0fbc0ed0) == 0x0eb80a40 && - dc_isar_feature(aa32_vrint, s)) { - /* VRINTA, VRINTN, VRINTP, VRINTM */ - int rounding = fp_decode_rm[extract32(insn, 16, 2)]; - return handle_vrint(insn, rd, rm, dp, rounding); - } else if ((insn & 0x0fbc0e50) == 0x0ebc0a40 && - dc_isar_feature(aa32_vcvt_dr, s)) { + if ((insn & 0x0fbc0e50) == 0x0ebc0a40 && + dc_isar_feature(aa32_vcvt_dr, s)) { /* VCVTA, VCVTN, VCVTP, VCVTM */ int rounding = fp_decode_rm[extract32(insn, 16, 2)]; return handle_vcvt(insn, rd, rm, dp, rounding); diff --git a/target/arm/vfp-uncond.decode b/target/arm/vfp-uncond.decode index 8ab201fa058..0aa83285de2 100644 --- a/target/arm/vfp-uncond.decode +++ b/target/arm/vfp-uncond.decode @@ -50,3 +50,8 @@ VMINMAXNM 1111 1110 1.00 .... .... 1010 . op:1 .0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0 VMINMAXNM 1111 1110 1.00 .... .... 1011 . op:1 .0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1 + +VRINT 1111 1110 1.11 10 rm:2 .... 1010 01.0 .... \ + vm=%vm_sp vd=%vd_sp dp=0 +VRINT 1111 1110 1.11 10 rm:2 .... 1011 01.0 .... \ + vm=%vm_dp vd=%vd_dp dp=1 From patchwork Tue Jun 11 10:53:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166394 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2207592ilk; Tue, 11 Jun 2019 04:06:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRJsGIZtXvt0lMX4TaPEKy0TyHBLOFGvSg6+M053S5DGd5oWeEfZDsxtCSWX+7F7SiXpjk X-Received: by 2002:aed:21f0:: with SMTP id m45mr49922713qtc.391.1560251193865; Tue, 11 Jun 2019 04:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251193; cv=none; d=google.com; s=arc-20160816; b=Z8zkHpFs4tDfz/hmP4doj7MLPRyuAs98HF7n1909rfCjj9SRjHKE848XxfviT2r/rt 3K2QMx9qUo5EL2ot/z1MPwv95B4gXxMkRtMqiwZZZzK+rP5efwrmCxsPkkbstE94iQPm RTCj65AVARTh69jgu8AcqVp6NTi2oUMNx+Cl5RpE5zSA+c8EI6aJgy+k59yg+1uZe3bu /zFnboGRZh4ymiB1pdLmlOhpVijgWgfEv/GZQI63i26Y0K60IYr9nojQ4InPPo/exyE2 Zil1boCIJIOmXxbR+qwMqwGYNA576uRSAow2kZ91x67a22eCU/Xmx913x8872MOAQ9sR +F7A== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=6srWzGhLdDZvahbNwt98sqmf01N2eShCM8nmAyJtJt8=; b=OdiGdTqh2qqHrpHXWiZ1TtYNcmtW0tgY1JwUf1n+sNFATrC9Xg/d3xmZSMZ7kYGEtv 2XtHtGErCCB0gfR+xqu2bOaFVnVKpyVyXiAAWGakkImGVRtArrwl9a9nWGhp2POFZpeZ WbXkrvQ3UiZqEucgQd/yO27lDSvqHtJzODTVVaOuVZGCniZJcgGjPmm6LkuFx2Yvaprt N+wQjI3aIH1kil9XnyjW6HJqLgVa2JokjNdixFpXzo9PStLuO8/LUAp7fHlel2BHWH/f uJ5RYyxZNS09p+G2DkHsqrwVgBW/PDDrBly2i4rHIOXGGabdi60iNLUhYN9LPIjNrRu5 +wdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=enSUahLz; 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 o38si5216770qte.117.2019.06.11.04.06.33 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:06:33 -0700 (PDT) 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=enSUahLz; 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 ([::1]:56260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haebp-0001Wx-2o for patch@linaro.org; Tue, 11 Jun 2019 07:06:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38999) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePp-0007AT-I0 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePl-0007JL-Cf for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:09 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:37452) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePl-0007HG-1h for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:05 -0400 Received: by mail-wm1-x342.google.com with SMTP id 22so2394161wmg.2 for ; Tue, 11 Jun 2019 03:54:03 -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 :mime-version:content-transfer-encoding; bh=6srWzGhLdDZvahbNwt98sqmf01N2eShCM8nmAyJtJt8=; b=enSUahLzS7sdbjgFcAUG949lrnHrwXq02sbbbsMWLWem/dTWkSvOteuEYdhUgfttck EHU4Q58lbqK2GDwqdz8abvwqM10vDNyGZ/xeEgoX2zkyli0IZMJ+1dRymGyH587MPYQj iHs3XfGkkI4J86xyaXJHGIgdGv8UnL6yuXPr5JBsrs3z51N4uRfWI/0L+wo5nk5R1qYM E27kBOP0SZLfTwkT9EP3Sv8vmeWL0PQPZbdcvDSBTGp7WXwYjETKYxk5lR5Pkim5K9ck eR45ljRMh7B7tqNhXLQCwv9+IOtlUHV0Q1w5fTWmdFcwdDHjVrYzDMz/RRYure4o0HpM rK1A== 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:mime-version:content-transfer-encoding; bh=6srWzGhLdDZvahbNwt98sqmf01N2eShCM8nmAyJtJt8=; b=D7IiCHkn9t0C05qJSrlFpSYjZIuWURH/ui0Gt2fkDZv+P1Te2HO3T8DK9dfpi1R7YZ v4C3tvOCxh+GtCRJRvUWdF0T2bK5HQsrlxrctJqvIgJOFyiLT6B9VtAUKU4Gj1bCjTRJ 4cEARNZJQAOJiWIT+V7nxmjTkJM6rLwzcaFNpUgtNqMC1vBNI4Iuw0GsiOa4ZlxU9I0H siO8cZG8pjQQUhdOTHybOQiea9fZ3wb1JXYs/Rf941L3fCsPqLauM96j6y+/eik+qECf z9PEsnBC5t2X9cxwlfDL4VMrDrHitUQr1tYGNx6gpKYLrBK5HURBse10GSDhDcE9jGRL m//w== X-Gm-Message-State: APjAAAXvriosMRDwyjkIPMynFjuigNJvpYXZ03S1HnTvpT20iCCmWV5U Z087QLW3WucacSYLOzwhJjdtoA== X-Received: by 2002:a1c:5f09:: with SMTP id t9mr18294175wmb.112.1560250443007; Tue, 11 Jun 2019 03:54:03 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:02 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:18 +0100 Message-Id: <20190611105351.9871-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 09/42] target/arm: Convert VCVTA/VCVTN/VCVTP/VCVTM to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VCVTA/VCVTN/VCVTP/VCVTM instructions to decodetree. trans_VCVT() is temporarily left in translate.c. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate.c | 72 +++++++++++++++++------------------- target/arm/vfp-uncond.decode | 6 +++ 2 files changed, 39 insertions(+), 39 deletions(-) -- 2.20.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 1f106645bca..6da472dbca8 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3340,12 +3340,31 @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a) return true; } -static int handle_vcvt(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, - int rounding) +static bool trans_VCVT(DisasContext *s, arg_VCVT *a) { - bool is_signed = extract32(insn, 7, 1); - TCGv_ptr fpst = get_fpstatus_ptr(0); + uint32_t rd, rm; + bool dp = a->dp; + TCGv_ptr fpst; TCGv_i32 tcg_rmode, tcg_shift; + int rounding = fp_decode_rm[a->rm]; + bool is_signed = a->op; + + if (!dc_isar_feature(aa32_vcvt_dr, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (dp && !dc_isar_feature(aa32_fp_d32, s) && (a->vm & 0x10)) { + return false; + } + rd = a->vd; + rm = a->vm; + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(0); tcg_shift = tcg_const_i32(0); @@ -3355,10 +3374,6 @@ static int handle_vcvt(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, if (dp) { TCGv_i64 tcg_double, tcg_res; TCGv_i32 tcg_tmp; - /* Rd is encoded as a single precision register even when the source - * is double precision. - */ - rd = ((rd << 1) & 0x1e) | ((rd >> 4) & 0x1); tcg_double = tcg_temp_new_i64(); tcg_res = tcg_temp_new_i64(); tcg_tmp = tcg_temp_new_i32(); @@ -3395,28 +3410,7 @@ static int handle_vcvt(uint32_t insn, uint32_t rd, uint32_t rm, uint32_t dp, tcg_temp_free_ptr(fpst); - return 0; -} - -static int disas_vfp_misc_insn(DisasContext *s, uint32_t insn) -{ - uint32_t rd, rm, dp = extract32(insn, 8, 1); - - if (dp) { - VFP_DREG_D(rd, insn); - VFP_DREG_M(rm, insn); - } else { - rd = VFP_SREG_D(insn); - rm = VFP_SREG_M(insn); - } - - if ((insn & 0x0fbc0e50) == 0x0ebc0a40 && - dc_isar_feature(aa32_vcvt_dr, s)) { - /* VCVTA, VCVTN, VCVTP, VCVTM */ - int rounding = fp_decode_rm[extract32(insn, 16, 2)]; - return handle_vcvt(insn, rd, rm, dp, rounding); - } - return 1; + return true; } /* @@ -3452,6 +3446,15 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) } } + if (extract32(insn, 28, 4) == 0xf) { + /* + * Encodings with T=1 (Thumb) or unconditional (ARM): these + * were all handled by the decodetree decoder, so any insn + * patterns which get here must be UNDEF. + */ + return 1; + } + /* * FIXME: this access check should not take precedence over UNDEF * for invalid encodings; we will generate incorrect syndrome information @@ -3468,15 +3471,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 0; } - if (extract32(insn, 28, 4) == 0xf) { - /* - * Encodings with T=1 (Thumb) or unconditional (ARM): - * only used for the "miscellaneous VFP features" added in v8A - * and v7M (and gated on the MVFR2.FPMisc field). - */ - return disas_vfp_misc_insn(s, insn); - } - dp = ((insn & 0xf00) == 0xb00); switch ((insn >> 24) & 0xf) { case 0xe: diff --git a/target/arm/vfp-uncond.decode b/target/arm/vfp-uncond.decode index 0aa83285de2..5af1f2ee664 100644 --- a/target/arm/vfp-uncond.decode +++ b/target/arm/vfp-uncond.decode @@ -55,3 +55,9 @@ VRINT 1111 1110 1.11 10 rm:2 .... 1010 01.0 .... \ vm=%vm_sp vd=%vd_sp dp=0 VRINT 1111 1110 1.11 10 rm:2 .... 1011 01.0 .... \ vm=%vm_dp vd=%vd_dp dp=1 + +# VCVT float to int with specified rounding mode; Vd is always single-precision +VCVT 1111 1110 1.11 11 rm:2 .... 1010 op:1 1.0 .... \ + vm=%vm_sp vd=%vd_sp dp=0 +VCVT 1111 1110 1.11 11 rm:2 .... 1011 op:1 1.0 .... \ + vm=%vm_dp vd=%vd_sp dp=1 From patchwork Tue Jun 11 10:53:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166400 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2215524ilk; Tue, 11 Jun 2019 04:13:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrjKwvme1z5jjmy77x3wqJmxLHjLirsSx8cCD/atLTZHXyskom/77/PcKRDcMQUHxhVcTw X-Received: by 2002:a37:b381:: with SMTP id c123mr147672qkf.349.1560251604997; Tue, 11 Jun 2019 04:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251604; cv=none; d=google.com; s=arc-20160816; b=vxs18yr1gNfcYEOaaFdFaYmnyRvRPt2mihWlOtCqJYhiA24MvzBgJpB/hXJOnH7z/z Bd9wa2VHqOwVcB7hzVhCLfK4ftcWC5gP26JxcfS+MM6lVrthQYWlpM7OvCpGHewJLsji du6fhDAtEiHau54r2LtYjm1Jg10S3/FEmx0SMRdUrG7Rptw0v03IRmhnr6WNy/DkaUvQ 8n9nTOC6dE0hGv9b+5C13y+D4BW3Ld6Wr1HwnNeXwrMzkPDIr96pBBKTbPRtUUFhwVaG wyDLFwdjpp/SflKDsgSz2Eo9EJ//AnKiZAaRGZEQUPoZaAt6CSfyFo6YYMKmGDdQcjjV 12og== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=G1mXK/eH5N64QkDhmnkelnMmCB2hbh3lAb5CdjVow+A=; b=tnWlBasbvq9CSNZDSwyvwWub8RUjikoUbroP89m7k6PsR7qQtZvFpdrro4DTiMqhJZ Dlq9Tek/K9wN05X0A6Iub4m0KZhEa7QV5zEiY98YOZ8MBAfppIWYOkafmHHnJL5QdiYl IgdwSH23T01Ptk4Dt0ljJoxPr6Eeq2zCre5DqUL+hiYS8hKnvTp4U7cZmnukiYA+VG7O GlBpA8MH8PABVadFbFctTXMbXjX8lD8rVPGPUDUwI1Trr3RT8J1ut9eU897y2SYQIlzQ TCpvzqvPyMJSPtWtfFkveor0x6a8urAu4Cn1eUhJ/PtPhoyWUohkntNBwJNekz87jXaA rNtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wE5MdMLS; 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 w19si1415259qkf.16.2019.06.11.04.13.24 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:13:24 -0700 (PDT) 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=wE5MdMLS; 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 ([::1]:56314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeiS-0000Ce-Hu for patch@linaro.org; Tue, 11 Jun 2019 07:13:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39109) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePu-0007DU-IU for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePp-0007MJ-Ar for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:14 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:40880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePl-0007IR-Pg for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:07 -0400 Received: by mail-wm1-x342.google.com with SMTP id v19so2373827wmj.5 for ; Tue, 11 Jun 2019 03:54:05 -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 :mime-version:content-transfer-encoding; bh=G1mXK/eH5N64QkDhmnkelnMmCB2hbh3lAb5CdjVow+A=; b=wE5MdMLSoUyrnoFfk4BadfOCp01wtILFUTTZuOW+3rjmHKgqowsvNeoOlh5ahbEim9 jbHv5S5R8QPb8ajTlWVT+8EvHzQQw4xH+Jmhl8TU+4y5X4+tWsEabAzXPeNEpfl44kox cRMxn2C1r02sbBPp1vSReoAKGaPHsvfTzL3eDp+I1Po5uNPjRyW32Ngms3MTqlc9WrFW gdpqYfva0PrQ5Jz/rZmSb33mdjVR9hZnijg8Hnq6p6eWlegPbNysGAXKjThi0R0pRr6g 1KxXPIig23UrCvzMGIBF+gz+WNybVVeRi5Qmaj0sLq9Dl1hp/vsLIuMCmdo2xZxaDb2w prSw== 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:mime-version:content-transfer-encoding; bh=G1mXK/eH5N64QkDhmnkelnMmCB2hbh3lAb5CdjVow+A=; b=VJRD/rvMwhTzECjbVyAR6sN6gpA/0CJVWzu92AuCQm1/6puHD1pLh5ZpF8tQyzxFGr 4iRXVO6jnKL+G4FxPi7CVNSKfA1Iok2za69ESLUgTQlc3zGl5RZF88YD9SKvKQgux1a3 +VBNlMEIcVWpR5bbBZAOQeW1Tu8D+kjh6gcoTK6Ju0wgcjKoM9AcH0GV/Y80GF5Xi378 eOdtGIfPax+E+N3KkAENEITc+VdjII2fvymDzYGXsV530diRIdvvbudeaxxQ+oVOwW6d frPAQjM2RyjKhQ8bJHOa10nlRl36SGMcrng6F7eVxm4zk2SnLPbheph3bmJMzPAbeX55 IPAw== X-Gm-Message-State: APjAAAV6oVGhpVf/ZeKWSdRTxvzIuSJnEc1/4Bn3J/o2i1fP76H6JCQK fBSqDp6PTTnvqHVrWhA2VX9jlw== X-Received: by 2002:a1c:e009:: with SMTP id x9mr17207611wmg.5.1560250444483; Tue, 11 Jun 2019 03:54:04 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:03 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:19 +0100 Message-Id: <20190611105351.9871-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 10/42] target/arm: Move the VFP trans_* functions to translate-vfp.inc.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move the trans_*() functions we've just created from translate.c to translate-vfp.inc.c. This is pure code motion with no textual changes (this can be checked with 'git show --color-moved'). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 337 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 337 --------------------------------- 2 files changed, 337 insertions(+), 337 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index f7535138d0f..2f070a6e0d9 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -138,3 +138,340 @@ static bool vfp_access_check(DisasContext *s) { return full_vfp_access_check(s, false); } + +static bool trans_VSEL(DisasContext *s, arg_VSEL *a) +{ + uint32_t rd, rn, rm; + bool dp = a->dp; + + if (!dc_isar_feature(aa32_vsel, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (dp && !dc_isar_feature(aa32_fp_d32, s) && + ((a->vm | a->vn | a->vd) & 0x10)) { + return false; + } + rd = a->vd; + rn = a->vn; + rm = a->vm; + + if (!vfp_access_check(s)) { + return true; + } + + if (dp) { + TCGv_i64 frn, frm, dest; + TCGv_i64 tmp, zero, zf, nf, vf; + + zero = tcg_const_i64(0); + + frn = tcg_temp_new_i64(); + frm = tcg_temp_new_i64(); + dest = tcg_temp_new_i64(); + + zf = tcg_temp_new_i64(); + nf = tcg_temp_new_i64(); + vf = tcg_temp_new_i64(); + + tcg_gen_extu_i32_i64(zf, cpu_ZF); + tcg_gen_ext_i32_i64(nf, cpu_NF); + tcg_gen_ext_i32_i64(vf, cpu_VF); + + tcg_gen_ld_f64(frn, cpu_env, vfp_reg_offset(dp, rn)); + tcg_gen_ld_f64(frm, cpu_env, vfp_reg_offset(dp, rm)); + switch (a->cc) { + case 0: /* eq: Z */ + tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero, + frn, frm); + break; + case 1: /* vs: V */ + tcg_gen_movcond_i64(TCG_COND_LT, dest, vf, zero, + frn, frm); + break; + case 2: /* ge: N == V -> N ^ V == 0 */ + tmp = tcg_temp_new_i64(); + tcg_gen_xor_i64(tmp, vf, nf); + tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, + frn, frm); + tcg_temp_free_i64(tmp); + break; + case 3: /* gt: !Z && N == V */ + tcg_gen_movcond_i64(TCG_COND_NE, dest, zf, zero, + frn, frm); + tmp = tcg_temp_new_i64(); + tcg_gen_xor_i64(tmp, vf, nf); + tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, + dest, frm); + tcg_temp_free_i64(tmp); + break; + } + tcg_gen_st_f64(dest, cpu_env, vfp_reg_offset(dp, rd)); + tcg_temp_free_i64(frn); + tcg_temp_free_i64(frm); + tcg_temp_free_i64(dest); + + tcg_temp_free_i64(zf); + tcg_temp_free_i64(nf); + tcg_temp_free_i64(vf); + + tcg_temp_free_i64(zero); + } else { + TCGv_i32 frn, frm, dest; + TCGv_i32 tmp, zero; + + zero = tcg_const_i32(0); + + frn = tcg_temp_new_i32(); + frm = tcg_temp_new_i32(); + dest = tcg_temp_new_i32(); + tcg_gen_ld_f32(frn, cpu_env, vfp_reg_offset(dp, rn)); + tcg_gen_ld_f32(frm, cpu_env, vfp_reg_offset(dp, rm)); + switch (a->cc) { + case 0: /* eq: Z */ + tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero, + frn, frm); + break; + case 1: /* vs: V */ + tcg_gen_movcond_i32(TCG_COND_LT, dest, cpu_VF, zero, + frn, frm); + break; + case 2: /* ge: N == V -> N ^ V == 0 */ + tmp = tcg_temp_new_i32(); + tcg_gen_xor_i32(tmp, cpu_VF, cpu_NF); + tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, + frn, frm); + tcg_temp_free_i32(tmp); + break; + case 3: /* gt: !Z && N == V */ + tcg_gen_movcond_i32(TCG_COND_NE, dest, cpu_ZF, zero, + frn, frm); + tmp = tcg_temp_new_i32(); + tcg_gen_xor_i32(tmp, cpu_VF, cpu_NF); + tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, + dest, frm); + tcg_temp_free_i32(tmp); + break; + } + tcg_gen_st_f32(dest, cpu_env, vfp_reg_offset(dp, rd)); + tcg_temp_free_i32(frn); + tcg_temp_free_i32(frm); + tcg_temp_free_i32(dest); + + tcg_temp_free_i32(zero); + } + + return true; +} + +static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) +{ + uint32_t rd, rn, rm; + bool dp = a->dp; + bool vmin = a->op; + TCGv_ptr fpst; + + if (!dc_isar_feature(aa32_vminmaxnm, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (dp && !dc_isar_feature(aa32_fp_d32, s) && + ((a->vm | a->vn | a->vd) & 0x10)) { + return false; + } + rd = a->vd; + rn = a->vn; + rm = a->vm; + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(0); + + if (dp) { + TCGv_i64 frn, frm, dest; + + frn = tcg_temp_new_i64(); + frm = tcg_temp_new_i64(); + dest = tcg_temp_new_i64(); + + tcg_gen_ld_f64(frn, cpu_env, vfp_reg_offset(dp, rn)); + tcg_gen_ld_f64(frm, cpu_env, vfp_reg_offset(dp, rm)); + if (vmin) { + gen_helper_vfp_minnumd(dest, frn, frm, fpst); + } else { + gen_helper_vfp_maxnumd(dest, frn, frm, fpst); + } + tcg_gen_st_f64(dest, cpu_env, vfp_reg_offset(dp, rd)); + tcg_temp_free_i64(frn); + tcg_temp_free_i64(frm); + tcg_temp_free_i64(dest); + } else { + TCGv_i32 frn, frm, dest; + + frn = tcg_temp_new_i32(); + frm = tcg_temp_new_i32(); + dest = tcg_temp_new_i32(); + + tcg_gen_ld_f32(frn, cpu_env, vfp_reg_offset(dp, rn)); + tcg_gen_ld_f32(frm, cpu_env, vfp_reg_offset(dp, rm)); + if (vmin) { + gen_helper_vfp_minnums(dest, frn, frm, fpst); + } else { + gen_helper_vfp_maxnums(dest, frn, frm, fpst); + } + tcg_gen_st_f32(dest, cpu_env, vfp_reg_offset(dp, rd)); + tcg_temp_free_i32(frn); + tcg_temp_free_i32(frm); + tcg_temp_free_i32(dest); + } + + tcg_temp_free_ptr(fpst); + return true; +} + +/* + * Table for converting the most common AArch32 encoding of + * rounding mode to arm_fprounding order (which matches the + * common AArch64 order); see ARM ARM pseudocode FPDecodeRM(). + */ +static const uint8_t fp_decode_rm[] = { + FPROUNDING_TIEAWAY, + FPROUNDING_TIEEVEN, + FPROUNDING_POSINF, + FPROUNDING_NEGINF, +}; + +static bool trans_VRINT(DisasContext *s, arg_VRINT *a) +{ + uint32_t rd, rm; + bool dp = a->dp; + TCGv_ptr fpst; + TCGv_i32 tcg_rmode; + int rounding = fp_decode_rm[a->rm]; + + if (!dc_isar_feature(aa32_vrint, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (dp && !dc_isar_feature(aa32_fp_d32, s) && + ((a->vm | a->vd) & 0x10)) { + return false; + } + rd = a->vd; + rm = a->vm; + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(0); + + tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding)); + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); + + if (dp) { + TCGv_i64 tcg_op; + TCGv_i64 tcg_res; + tcg_op = tcg_temp_new_i64(); + tcg_res = tcg_temp_new_i64(); + tcg_gen_ld_f64(tcg_op, cpu_env, vfp_reg_offset(dp, rm)); + gen_helper_rintd(tcg_res, tcg_op, fpst); + tcg_gen_st_f64(tcg_res, cpu_env, vfp_reg_offset(dp, rd)); + tcg_temp_free_i64(tcg_op); + tcg_temp_free_i64(tcg_res); + } else { + TCGv_i32 tcg_op; + TCGv_i32 tcg_res; + tcg_op = tcg_temp_new_i32(); + tcg_res = tcg_temp_new_i32(); + tcg_gen_ld_f32(tcg_op, cpu_env, vfp_reg_offset(dp, rm)); + gen_helper_rints(tcg_res, tcg_op, fpst); + tcg_gen_st_f32(tcg_res, cpu_env, vfp_reg_offset(dp, rd)); + tcg_temp_free_i32(tcg_op); + tcg_temp_free_i32(tcg_res); + } + + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); + tcg_temp_free_i32(tcg_rmode); + + tcg_temp_free_ptr(fpst); + return true; +} + +static bool trans_VCVT(DisasContext *s, arg_VCVT *a) +{ + uint32_t rd, rm; + bool dp = a->dp; + TCGv_ptr fpst; + TCGv_i32 tcg_rmode, tcg_shift; + int rounding = fp_decode_rm[a->rm]; + bool is_signed = a->op; + + if (!dc_isar_feature(aa32_vcvt_dr, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (dp && !dc_isar_feature(aa32_fp_d32, s) && (a->vm & 0x10)) { + return false; + } + rd = a->vd; + rm = a->vm; + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(0); + + tcg_shift = tcg_const_i32(0); + + tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding)); + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); + + if (dp) { + TCGv_i64 tcg_double, tcg_res; + TCGv_i32 tcg_tmp; + tcg_double = tcg_temp_new_i64(); + tcg_res = tcg_temp_new_i64(); + tcg_tmp = tcg_temp_new_i32(); + tcg_gen_ld_f64(tcg_double, cpu_env, vfp_reg_offset(1, rm)); + if (is_signed) { + gen_helper_vfp_tosld(tcg_res, tcg_double, tcg_shift, fpst); + } else { + gen_helper_vfp_tould(tcg_res, tcg_double, tcg_shift, fpst); + } + tcg_gen_extrl_i64_i32(tcg_tmp, tcg_res); + tcg_gen_st_f32(tcg_tmp, cpu_env, vfp_reg_offset(0, rd)); + tcg_temp_free_i32(tcg_tmp); + tcg_temp_free_i64(tcg_res); + tcg_temp_free_i64(tcg_double); + } else { + TCGv_i32 tcg_single, tcg_res; + tcg_single = tcg_temp_new_i32(); + tcg_res = tcg_temp_new_i32(); + tcg_gen_ld_f32(tcg_single, cpu_env, vfp_reg_offset(0, rm)); + if (is_signed) { + gen_helper_vfp_tosls(tcg_res, tcg_single, tcg_shift, fpst); + } else { + gen_helper_vfp_touls(tcg_res, tcg_single, tcg_shift, fpst); + } + tcg_gen_st_f32(tcg_res, cpu_env, vfp_reg_offset(0, rd)); + tcg_temp_free_i32(tcg_res); + tcg_temp_free_i32(tcg_single); + } + + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); + tcg_temp_free_i32(tcg_rmode); + + tcg_temp_free_i32(tcg_shift); + + tcg_temp_free_ptr(fpst); + + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 6da472dbca8..e42a21d4aa5 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3076,343 +3076,6 @@ static void gen_neon_dup_high16(TCGv_i32 var) tcg_temp_free_i32(tmp); } -static bool trans_VSEL(DisasContext *s, arg_VSEL *a) -{ - uint32_t rd, rn, rm; - bool dp = a->dp; - - if (!dc_isar_feature(aa32_vsel, s)) { - return false; - } - - /* UNDEF accesses to D16-D31 if they don't exist */ - if (dp && !dc_isar_feature(aa32_fp_d32, s) && - ((a->vm | a->vn | a->vd) & 0x10)) { - return false; - } - rd = a->vd; - rn = a->vn; - rm = a->vm; - - if (!vfp_access_check(s)) { - return true; - } - - if (dp) { - TCGv_i64 frn, frm, dest; - TCGv_i64 tmp, zero, zf, nf, vf; - - zero = tcg_const_i64(0); - - frn = tcg_temp_new_i64(); - frm = tcg_temp_new_i64(); - dest = tcg_temp_new_i64(); - - zf = tcg_temp_new_i64(); - nf = tcg_temp_new_i64(); - vf = tcg_temp_new_i64(); - - tcg_gen_extu_i32_i64(zf, cpu_ZF); - tcg_gen_ext_i32_i64(nf, cpu_NF); - tcg_gen_ext_i32_i64(vf, cpu_VF); - - tcg_gen_ld_f64(frn, cpu_env, vfp_reg_offset(dp, rn)); - tcg_gen_ld_f64(frm, cpu_env, vfp_reg_offset(dp, rm)); - switch (a->cc) { - case 0: /* eq: Z */ - tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero, - frn, frm); - break; - case 1: /* vs: V */ - tcg_gen_movcond_i64(TCG_COND_LT, dest, vf, zero, - frn, frm); - break; - case 2: /* ge: N == V -> N ^ V == 0 */ - tmp = tcg_temp_new_i64(); - tcg_gen_xor_i64(tmp, vf, nf); - tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, - frn, frm); - tcg_temp_free_i64(tmp); - break; - case 3: /* gt: !Z && N == V */ - tcg_gen_movcond_i64(TCG_COND_NE, dest, zf, zero, - frn, frm); - tmp = tcg_temp_new_i64(); - tcg_gen_xor_i64(tmp, vf, nf); - tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, - dest, frm); - tcg_temp_free_i64(tmp); - break; - } - tcg_gen_st_f64(dest, cpu_env, vfp_reg_offset(dp, rd)); - tcg_temp_free_i64(frn); - tcg_temp_free_i64(frm); - tcg_temp_free_i64(dest); - - tcg_temp_free_i64(zf); - tcg_temp_free_i64(nf); - tcg_temp_free_i64(vf); - - tcg_temp_free_i64(zero); - } else { - TCGv_i32 frn, frm, dest; - TCGv_i32 tmp, zero; - - zero = tcg_const_i32(0); - - frn = tcg_temp_new_i32(); - frm = tcg_temp_new_i32(); - dest = tcg_temp_new_i32(); - tcg_gen_ld_f32(frn, cpu_env, vfp_reg_offset(dp, rn)); - tcg_gen_ld_f32(frm, cpu_env, vfp_reg_offset(dp, rm)); - switch (a->cc) { - case 0: /* eq: Z */ - tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero, - frn, frm); - break; - case 1: /* vs: V */ - tcg_gen_movcond_i32(TCG_COND_LT, dest, cpu_VF, zero, - frn, frm); - break; - case 2: /* ge: N == V -> N ^ V == 0 */ - tmp = tcg_temp_new_i32(); - tcg_gen_xor_i32(tmp, cpu_VF, cpu_NF); - tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, - frn, frm); - tcg_temp_free_i32(tmp); - break; - case 3: /* gt: !Z && N == V */ - tcg_gen_movcond_i32(TCG_COND_NE, dest, cpu_ZF, zero, - frn, frm); - tmp = tcg_temp_new_i32(); - tcg_gen_xor_i32(tmp, cpu_VF, cpu_NF); - tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, - dest, frm); - tcg_temp_free_i32(tmp); - break; - } - tcg_gen_st_f32(dest, cpu_env, vfp_reg_offset(dp, rd)); - tcg_temp_free_i32(frn); - tcg_temp_free_i32(frm); - tcg_temp_free_i32(dest); - - tcg_temp_free_i32(zero); - } - - return true; -} - -static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) -{ - uint32_t rd, rn, rm; - bool dp = a->dp; - bool vmin = a->op; - TCGv_ptr fpst; - - if (!dc_isar_feature(aa32_vminmaxnm, s)) { - return false; - } - - /* UNDEF accesses to D16-D31 if they don't exist */ - if (dp && !dc_isar_feature(aa32_fp_d32, s) && - ((a->vm | a->vn | a->vd) & 0x10)) { - return false; - } - rd = a->vd; - rn = a->vn; - rm = a->vm; - - if (!vfp_access_check(s)) { - return true; - } - - fpst = get_fpstatus_ptr(0); - - if (dp) { - TCGv_i64 frn, frm, dest; - - frn = tcg_temp_new_i64(); - frm = tcg_temp_new_i64(); - dest = tcg_temp_new_i64(); - - tcg_gen_ld_f64(frn, cpu_env, vfp_reg_offset(dp, rn)); - tcg_gen_ld_f64(frm, cpu_env, vfp_reg_offset(dp, rm)); - if (vmin) { - gen_helper_vfp_minnumd(dest, frn, frm, fpst); - } else { - gen_helper_vfp_maxnumd(dest, frn, frm, fpst); - } - tcg_gen_st_f64(dest, cpu_env, vfp_reg_offset(dp, rd)); - tcg_temp_free_i64(frn); - tcg_temp_free_i64(frm); - tcg_temp_free_i64(dest); - } else { - TCGv_i32 frn, frm, dest; - - frn = tcg_temp_new_i32(); - frm = tcg_temp_new_i32(); - dest = tcg_temp_new_i32(); - - tcg_gen_ld_f32(frn, cpu_env, vfp_reg_offset(dp, rn)); - tcg_gen_ld_f32(frm, cpu_env, vfp_reg_offset(dp, rm)); - if (vmin) { - gen_helper_vfp_minnums(dest, frn, frm, fpst); - } else { - gen_helper_vfp_maxnums(dest, frn, frm, fpst); - } - tcg_gen_st_f32(dest, cpu_env, vfp_reg_offset(dp, rd)); - tcg_temp_free_i32(frn); - tcg_temp_free_i32(frm); - tcg_temp_free_i32(dest); - } - - tcg_temp_free_ptr(fpst); - return true; -} - -/* - * Table for converting the most common AArch32 encoding of - * rounding mode to arm_fprounding order (which matches the - * common AArch64 order); see ARM ARM pseudocode FPDecodeRM(). - */ -static const uint8_t fp_decode_rm[] = { - FPROUNDING_TIEAWAY, - FPROUNDING_TIEEVEN, - FPROUNDING_POSINF, - FPROUNDING_NEGINF, -}; - -static bool trans_VRINT(DisasContext *s, arg_VRINT *a) -{ - uint32_t rd, rm; - bool dp = a->dp; - TCGv_ptr fpst; - TCGv_i32 tcg_rmode; - int rounding = fp_decode_rm[a->rm]; - - if (!dc_isar_feature(aa32_vrint, s)) { - return false; - } - - /* UNDEF accesses to D16-D31 if they don't exist */ - if (dp && !dc_isar_feature(aa32_fp_d32, s) && - ((a->vm | a->vd) & 0x10)) { - return false; - } - rd = a->vd; - rm = a->vm; - - if (!vfp_access_check(s)) { - return true; - } - - fpst = get_fpstatus_ptr(0); - - tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding)); - gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); - - if (dp) { - TCGv_i64 tcg_op; - TCGv_i64 tcg_res; - tcg_op = tcg_temp_new_i64(); - tcg_res = tcg_temp_new_i64(); - tcg_gen_ld_f64(tcg_op, cpu_env, vfp_reg_offset(dp, rm)); - gen_helper_rintd(tcg_res, tcg_op, fpst); - tcg_gen_st_f64(tcg_res, cpu_env, vfp_reg_offset(dp, rd)); - tcg_temp_free_i64(tcg_op); - tcg_temp_free_i64(tcg_res); - } else { - TCGv_i32 tcg_op; - TCGv_i32 tcg_res; - tcg_op = tcg_temp_new_i32(); - tcg_res = tcg_temp_new_i32(); - tcg_gen_ld_f32(tcg_op, cpu_env, vfp_reg_offset(dp, rm)); - gen_helper_rints(tcg_res, tcg_op, fpst); - tcg_gen_st_f32(tcg_res, cpu_env, vfp_reg_offset(dp, rd)); - tcg_temp_free_i32(tcg_op); - tcg_temp_free_i32(tcg_res); - } - - gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); - tcg_temp_free_i32(tcg_rmode); - - tcg_temp_free_ptr(fpst); - return true; -} - -static bool trans_VCVT(DisasContext *s, arg_VCVT *a) -{ - uint32_t rd, rm; - bool dp = a->dp; - TCGv_ptr fpst; - TCGv_i32 tcg_rmode, tcg_shift; - int rounding = fp_decode_rm[a->rm]; - bool is_signed = a->op; - - if (!dc_isar_feature(aa32_vcvt_dr, s)) { - return false; - } - - /* UNDEF accesses to D16-D31 if they don't exist */ - if (dp && !dc_isar_feature(aa32_fp_d32, s) && (a->vm & 0x10)) { - return false; - } - rd = a->vd; - rm = a->vm; - - if (!vfp_access_check(s)) { - return true; - } - - fpst = get_fpstatus_ptr(0); - - tcg_shift = tcg_const_i32(0); - - tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding)); - gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); - - if (dp) { - TCGv_i64 tcg_double, tcg_res; - TCGv_i32 tcg_tmp; - tcg_double = tcg_temp_new_i64(); - tcg_res = tcg_temp_new_i64(); - tcg_tmp = tcg_temp_new_i32(); - tcg_gen_ld_f64(tcg_double, cpu_env, vfp_reg_offset(1, rm)); - if (is_signed) { - gen_helper_vfp_tosld(tcg_res, tcg_double, tcg_shift, fpst); - } else { - gen_helper_vfp_tould(tcg_res, tcg_double, tcg_shift, fpst); - } - tcg_gen_extrl_i64_i32(tcg_tmp, tcg_res); - tcg_gen_st_f32(tcg_tmp, cpu_env, vfp_reg_offset(0, rd)); - tcg_temp_free_i32(tcg_tmp); - tcg_temp_free_i64(tcg_res); - tcg_temp_free_i64(tcg_double); - } else { - TCGv_i32 tcg_single, tcg_res; - tcg_single = tcg_temp_new_i32(); - tcg_res = tcg_temp_new_i32(); - tcg_gen_ld_f32(tcg_single, cpu_env, vfp_reg_offset(0, rm)); - if (is_signed) { - gen_helper_vfp_tosls(tcg_res, tcg_single, tcg_shift, fpst); - } else { - gen_helper_vfp_touls(tcg_res, tcg_single, tcg_shift, fpst); - } - tcg_gen_st_f32(tcg_res, cpu_env, vfp_reg_offset(0, rd)); - tcg_temp_free_i32(tcg_res); - tcg_temp_free_i32(tcg_single); - } - - gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); - tcg_temp_free_i32(tcg_rmode); - - tcg_temp_free_i32(tcg_shift); - - tcg_temp_free_ptr(fpst); - - return true; -} - /* * Disassemble a VFP instruction. Returns nonzero if an error occurred * (ie. an undefined instruction). From patchwork Tue Jun 11 10:53:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166399 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2212818ilk; Tue, 11 Jun 2019 04:11:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqWhnnECCwgbAktXcNyinUum+lx0S14uHPP92YDcS/KdeqX6ZtV2uYfUdvk6gZVM3/pAUu X-Received: by 2002:a0c:d24d:: with SMTP id o13mr8678756qvh.86.1560251464123; Tue, 11 Jun 2019 04:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251464; cv=none; d=google.com; s=arc-20160816; b=UiPqOF8qHDD28TPFoz/nAvbtFQHL8rJlBHJHeJ8JNRXA3XQu77IE00s4Hpg1XC1fCo jlguHbfiZE3iTi1eqZccFTlYylfX9FSYqUUFHlMYS1b/h1cyZnlOVd+UN7aauguYDJWb rg5H9MQuC8tf/uaRrJhP09/8LzThBB6J+3AtQ8HJM0lskjivJ4ip/RCroEixzhDOsmXn xQQB0WUfO2tjs5p7vGBVcuNZ+ggtuIo3DBbngqdqcZ3rK2eD2adOzpDQjuTjd4ikAX8O 7tQhwExncdgutICoYslRb6JOKQfURhaw425YvqWxwGPn47z0ZVJamyZy4LLvP4FQFFpW a8ig== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=eNBmWZIm97TjmvwdrXNoqxnA5CbE2nGaaTGyw39+1hQ=; b=jpNYU4zki8r/T9Vw+SkeBTqsyvuoDlgDJeQExfDd1r2TJNM4ACTfzZuRMC0GU7tGVh 4Cg5xW/2x3KxuTvNSjpX7M0MkJIrm5Nr8eScIwXpdEHWMv45RW6jS28mqm+LZcZTsAvf ugWxdiv7pi+Mvzc2imJOCSbPs31tnyrkE/hkTn9xnLzV11L8gBLptVpjRDd92RJ2QeL9 cmY5HeM3TsEDpwfMUK/EcRIfXLet3wZEffE9bw2t6pvzwQe//DHE/ZATZ1W4o/Qtd2jx Yzv9nqJj0hIaKj/8C2s+Rm9zxwSDoVFTFE9ZNyfuw901XmBLNQk0GvyEn3nl+AEWLps5 QDAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GeVgCSSr; 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 h90si587801qva.0.2019.06.11.04.11.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:11:04 -0700 (PDT) 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=GeVgCSSr; 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 ([::1]:56292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haegB-0005Yh-MO for patch@linaro.org; Tue, 11 Jun 2019 07:11:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39113) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePu-0007Dg-JS for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePr-0007OM-BG for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:14 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:50487) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePp-0007Jp-7R for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:09 -0400 Received: by mail-wm1-x341.google.com with SMTP id c66so2435558wmf.0 for ; Tue, 11 Jun 2019 03:54:06 -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 :mime-version:content-transfer-encoding; bh=eNBmWZIm97TjmvwdrXNoqxnA5CbE2nGaaTGyw39+1hQ=; b=GeVgCSSrJwgGKnMbAnoCMdGxfXYsgbTA3poOHyG2jWs+p3uqLi92pWtE61FijJ+wil BCmYmDpnjqD+dKytPC5wy7wSUI363stV9Q9BjSf3/zyTe+7b1YaLDSDklZm/arABRWjh muUDRP+7d7Uq4q+9byBHFzmP21O9n68N6NDivBe7elrMrY5pHXa9XoTw/2o/Xy33IVTs YroBQfdXwfZBidmi7W1aGwdPCrhEE1CrxDVCONcCvYeKXx7XcZzYDZgaREtbDrr42D6f M/MRkZZguuJchZ8h7ao65QReIm8hJFirk2ppFIaSjZizFOymO1wYXx7LCbXwZwW9MkqX yxdQ== 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:mime-version:content-transfer-encoding; bh=eNBmWZIm97TjmvwdrXNoqxnA5CbE2nGaaTGyw39+1hQ=; b=LnaO48udcQhKjg8dOy551GP0EQczXkK/ThZe2OGMsv+y+slrHnjKvxSLNSDm863Phr 6GdH1AVRZKin7pNXLd9g6Xxb27XSQfL2CGvKqWwSNU1UZVJx5afp/8nASrJsym7e1slh WsRUi8ByJorIKGH9KinXD+hhCLW528NbU4dh7sDmkA+ksAGDgH0LybpqVI9+2YGGgZfm 6+9cMn5bAZ2geFmKnyyj8M+8pLLTkxs+wmsGj7Of1JlMgQpEOxMBmhKhh0FZzc+zqewV W/QwdgDFUeG+DZvs7q1kWuY7VVYgiVoEcuQmkUoQ5f4rpjHlE9ZBUO42EfvDG1r7cUTQ QP/g== X-Gm-Message-State: APjAAAXpGYrqu6Lhepf4GvHwyEiT5lYHmecE4DmCycAE08qET+dNH2tF ++uI39to+mwuD4wEo3kzDU9xAA== X-Received: by 2002:a1c:ed01:: with SMTP id l1mr17977485wmh.109.1560250445478; Tue, 11 Jun 2019 03:54:05 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:05 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:20 +0100 Message-Id: <20190611105351.9871-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v2 11/42] target/arm: Add helpers for VFP register loads and stores X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The current VFP code has two different idioms for loading and storing from the VFP register file: 1 using the gen_mov_F0_vreg() and similar functions, which load and store to a fixed set of TCG globals cpu_F0s, CPU_F0d, etc 2 by direct calls to tcg_gen_ld_f64() and friends We want to phase out idiom 1 (because the use of the fixed globals is a relic of a much older version of TCG), but idiom 2 is quite longwinded: tcg_gen_ld_f64(tmp, cpu_env, vfp_reg_offset(true, reg)) requires us to specify the 64-bitness twice, once in the function name and once by passing 'true' to vfp_reg_offset(). There's no guard against accidentally passing the wrong flag. Instead, let's move to a convention of accessing 64-bit registers via the existing neon_load_reg64() and neon_store_reg64(), and provide new neon_load_reg32() and neon_store_reg32() for the 32-bit equivalents. Implement the new functions and use them in the code in translate-vfp.inc.c. We will convert the rest of the VFP code as we do the decodetree conversion in subsequent commits. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 40 +++++++++++++++++----------------- target/arm/translate.c | 10 +++++++++ 2 files changed, 30 insertions(+), 20 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 2f070a6e0d9..24358f3d3eb 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -179,8 +179,8 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) tcg_gen_ext_i32_i64(nf, cpu_NF); tcg_gen_ext_i32_i64(vf, cpu_VF); - tcg_gen_ld_f64(frn, cpu_env, vfp_reg_offset(dp, rn)); - tcg_gen_ld_f64(frm, cpu_env, vfp_reg_offset(dp, rm)); + neon_load_reg64(frn, rn); + neon_load_reg64(frm, rm); switch (a->cc) { case 0: /* eq: Z */ tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero, @@ -207,7 +207,7 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) tcg_temp_free_i64(tmp); break; } - tcg_gen_st_f64(dest, cpu_env, vfp_reg_offset(dp, rd)); + neon_store_reg64(dest, rd); tcg_temp_free_i64(frn); tcg_temp_free_i64(frm); tcg_temp_free_i64(dest); @@ -226,8 +226,8 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) frn = tcg_temp_new_i32(); frm = tcg_temp_new_i32(); dest = tcg_temp_new_i32(); - tcg_gen_ld_f32(frn, cpu_env, vfp_reg_offset(dp, rn)); - tcg_gen_ld_f32(frm, cpu_env, vfp_reg_offset(dp, rm)); + neon_load_reg32(frn, rn); + neon_load_reg32(frm, rm); switch (a->cc) { case 0: /* eq: Z */ tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero, @@ -254,7 +254,7 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) tcg_temp_free_i32(tmp); break; } - tcg_gen_st_f32(dest, cpu_env, vfp_reg_offset(dp, rd)); + neon_store_reg32(dest, rd); tcg_temp_free_i32(frn); tcg_temp_free_i32(frm); tcg_temp_free_i32(dest); @@ -298,14 +298,14 @@ static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) frm = tcg_temp_new_i64(); dest = tcg_temp_new_i64(); - tcg_gen_ld_f64(frn, cpu_env, vfp_reg_offset(dp, rn)); - tcg_gen_ld_f64(frm, cpu_env, vfp_reg_offset(dp, rm)); + neon_load_reg64(frn, rn); + neon_load_reg64(frm, rm); if (vmin) { gen_helper_vfp_minnumd(dest, frn, frm, fpst); } else { gen_helper_vfp_maxnumd(dest, frn, frm, fpst); } - tcg_gen_st_f64(dest, cpu_env, vfp_reg_offset(dp, rd)); + neon_store_reg64(dest, rd); tcg_temp_free_i64(frn); tcg_temp_free_i64(frm); tcg_temp_free_i64(dest); @@ -316,14 +316,14 @@ static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a) frm = tcg_temp_new_i32(); dest = tcg_temp_new_i32(); - tcg_gen_ld_f32(frn, cpu_env, vfp_reg_offset(dp, rn)); - tcg_gen_ld_f32(frm, cpu_env, vfp_reg_offset(dp, rm)); + neon_load_reg32(frn, rn); + neon_load_reg32(frm, rm); if (vmin) { gen_helper_vfp_minnums(dest, frn, frm, fpst); } else { gen_helper_vfp_maxnums(dest, frn, frm, fpst); } - tcg_gen_st_f32(dest, cpu_env, vfp_reg_offset(dp, rd)); + neon_store_reg32(dest, rd); tcg_temp_free_i32(frn); tcg_temp_free_i32(frm); tcg_temp_free_i32(dest); @@ -379,9 +379,9 @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a) TCGv_i64 tcg_res; tcg_op = tcg_temp_new_i64(); tcg_res = tcg_temp_new_i64(); - tcg_gen_ld_f64(tcg_op, cpu_env, vfp_reg_offset(dp, rm)); + neon_load_reg64(tcg_op, rm); gen_helper_rintd(tcg_res, tcg_op, fpst); - tcg_gen_st_f64(tcg_res, cpu_env, vfp_reg_offset(dp, rd)); + neon_store_reg64(tcg_res, rd); tcg_temp_free_i64(tcg_op); tcg_temp_free_i64(tcg_res); } else { @@ -389,9 +389,9 @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a) TCGv_i32 tcg_res; tcg_op = tcg_temp_new_i32(); tcg_res = tcg_temp_new_i32(); - tcg_gen_ld_f32(tcg_op, cpu_env, vfp_reg_offset(dp, rm)); + neon_load_reg32(tcg_op, rm); gen_helper_rints(tcg_res, tcg_op, fpst); - tcg_gen_st_f32(tcg_res, cpu_env, vfp_reg_offset(dp, rd)); + neon_store_reg32(tcg_res, rd); tcg_temp_free_i32(tcg_op); tcg_temp_free_i32(tcg_res); } @@ -440,14 +440,14 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) tcg_double = tcg_temp_new_i64(); tcg_res = tcg_temp_new_i64(); tcg_tmp = tcg_temp_new_i32(); - tcg_gen_ld_f64(tcg_double, cpu_env, vfp_reg_offset(1, rm)); + neon_load_reg64(tcg_double, rm); if (is_signed) { gen_helper_vfp_tosld(tcg_res, tcg_double, tcg_shift, fpst); } else { gen_helper_vfp_tould(tcg_res, tcg_double, tcg_shift, fpst); } tcg_gen_extrl_i64_i32(tcg_tmp, tcg_res); - tcg_gen_st_f32(tcg_tmp, cpu_env, vfp_reg_offset(0, rd)); + neon_store_reg32(tcg_tmp, rd); tcg_temp_free_i32(tcg_tmp); tcg_temp_free_i64(tcg_res); tcg_temp_free_i64(tcg_double); @@ -455,13 +455,13 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) TCGv_i32 tcg_single, tcg_res; tcg_single = tcg_temp_new_i32(); tcg_res = tcg_temp_new_i32(); - tcg_gen_ld_f32(tcg_single, cpu_env, vfp_reg_offset(0, rm)); + neon_load_reg32(tcg_single, rm); if (is_signed) { gen_helper_vfp_tosls(tcg_res, tcg_single, tcg_shift, fpst); } else { gen_helper_vfp_touls(tcg_res, tcg_single, tcg_shift, fpst); } - tcg_gen_st_f32(tcg_res, cpu_env, vfp_reg_offset(0, rd)); + neon_store_reg32(tcg_res, rd); tcg_temp_free_i32(tcg_res); tcg_temp_free_i32(tcg_single); } diff --git a/target/arm/translate.c b/target/arm/translate.c index e42a21d4aa5..3661ed57cd3 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1689,6 +1689,16 @@ static inline void neon_store_reg64(TCGv_i64 var, int reg) tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(1, reg)); } +static inline void neon_load_reg32(TCGv_i32 var, int reg) +{ + tcg_gen_ld_i32(var, cpu_env, vfp_reg_offset(false, reg)); +} + +static inline void neon_store_reg32(TCGv_i32 var, int reg) +{ + tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg)); +} + static TCGv_ptr vfp_reg_ptr(bool dp, int reg) { TCGv_ptr ret = tcg_temp_new_ptr(); From patchwork Tue Jun 11 10:53:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166406 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2224939ilk; Tue, 11 Jun 2019 04:21:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyNhMxsH5H41nNrUuhtAzClUmw06oMMjdiYZTQ7ZmePVaLCUcuHtHXe7xbDVL2FGi92wA9 X-Received: by 2002:ac8:26d5:: with SMTP id 21mr6655470qtp.266.1560252113046; Tue, 11 Jun 2019 04:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560252113; cv=none; d=google.com; s=arc-20160816; b=AOT4HNxXHBvnfa7WjWz81RhhAsz4XNejlH9EAX21w83fDNTG4KCcuDfkkeg++MtOJb xTfceQo3dPUaL+/nsO11jO11zgvDuzAiHBQxzRRo0r2lK1VOz2qIl0nruY/YQWxg3SuE VS/cMQEQJp+w+Il6CDJLmgL/NcSHiO6UWkBhMDXCcDfw7gIskUWVzvMNNthvcpsGbPEh 7yO21EYQSoaD7vwoeuTfe2SDOBATLm72Yu3gSNkr0i1IZOGKk2UYtGv/QT+aIQk+1lDm tA1MocXWd+8OltWKJpP/wyGF9JdfwVQXRUMFTkUuGZrHVRKx/w277+y/kQ5AA4iFwe2u Sq1A== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=I5NVJmv9QCzY5wd+EPvdgPRW/eLGZfdGGf7zbG7fHeQ=; b=VShwi74+hLRJzD1Nta8y+gna2yoNkXEE6LhZ8wuq5sz/AaBK77ZmEb3TrMcLtgUdTz 3OIrMsGbacStN4A1186lpOrmbqILw/dhdfVWTAKNyBHXXNyvfFTcDS7cJsV/dPd407aG 4aOWfw0hobxZMqnozhQvzfyTEBsvDATE67lbvZ37d2vFcTu9C6awIELCqP/doAAuwZlT YBcZ6CzRA2iuOgpjtDYBAKVx3cHOJeqvP7jxs7wlC9UNMjnUHpuH6QZEj8mqv3haTw+4 Cg7KeYcqi2P4FfiOCVwSkzaDeeHvx4QBWp2KXz5xbfwURIR99lTVvMvPYyTU6uFUXtrQ Kt6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="nuOwlMM/"; 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 g64si6424308qkf.149.2019.06.11.04.21.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:21:53 -0700 (PDT) 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="nuOwlMM/"; 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 ([::1]:56374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeqe-0005Ol-FG for patch@linaro.org; Tue, 11 Jun 2019 07:21:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39137) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePv-0007Ex-Jb for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePr-0007P0-O7 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:15 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:37025) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePr-0007Kd-AZ for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:11 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 22so2394337wmg.2 for ; Tue, 11 Jun 2019 03:54:07 -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 :mime-version:content-transfer-encoding; bh=I5NVJmv9QCzY5wd+EPvdgPRW/eLGZfdGGf7zbG7fHeQ=; b=nuOwlMM/TzG3/QetfCKLe6y7JcVQEY7a1p5n0WW/DH5fyUFWBvwej67bqTYiFEwbfh qCI8EdlWY/s2pp/H3Kdilov8e0ZnF0/ljSHtuSb/A2Zi7ES0ftKMHtTTr/6QeNCIWxHu NztxKuTwrX9RWszkGSEVsJTuusUsxHBqzwDTYUagoVmrBR9aAFSrkHseuKksNB/T0gtY nk2L5rFBXBWH+GpEmrZ6aPiI+Ml4VSEZE6hVoAeSjm8rtEOTb6UNZpx7wuhGv72SHE/k UgqpH5R6K3DczpylQ2FkBbA57XwF86262OfLT53fmymIFLCjRaLX8aYTuJgI1lktuQoS sJow== 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:mime-version:content-transfer-encoding; bh=I5NVJmv9QCzY5wd+EPvdgPRW/eLGZfdGGf7zbG7fHeQ=; b=SPsSrCuVyTsd26mviunRUo3afWkFwUvwaApMHat2Esu5s8+48556/iTNa4IXjXg/yz D1kBXdXfXlmMN+LIbaiinWX5gqxk8xP6lfkHXTedwJa5t0L3yCMg9j9AfSq174Fc+zXP NagOlNjixSibssgbgxWMHrrqHqhTUCRXmQ6ZODitzoV57D0RE8uxHZA7grxaxM0MwxG/ olCH0aNMjrvA/tYYrTaQ3WzKhKflNqbBZusVK8NbaslDQbllChUcsP60rM8S4adPG7ot WdyjUr3Nnv0knvLaCnK1ojh7wAqCnT5+CR71LzbIGP3qd44nTDv4pJvvKZArmzYiIg26 2Kgg== X-Gm-Message-State: APjAAAW1MvjOojCrhNVHfImP984Lcf999KXfxurfFeUn7QTpli22mnCz 6IwLE4XK7hBz3c6VE+093WOydg== X-Received: by 2002:a1c:a983:: with SMTP id s125mr16393854wme.18.1560250446684; Tue, 11 Jun 2019 03:54:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:06 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:21 +0100 Message-Id: <20190611105351.9871-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32a Subject: [Qemu-devel] [PATCH v2 12/42] target/arm: Convert "double-precision" register moves to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the "double-precision" register moves to decodetree: this covers VMOV scalar-to-gpreg, VMOV gpreg-to-scalar and VDUP. Note that the conversion process has tightened up a few of the UNDEF encoding checks: we now correctly forbid: * VMOV-to-gpr with U:opc1:opc2 == 10x00 or x0x10 * VMOV-from-gpr with opc1:opc2 == 0x10 * VDUP with B:E == 11 * VDUP with Q == 1 and Vn<0> == 1 Signed-off-by: Peter Maydell --- The accesses of elements < 32 bits could be improved by doing direct ld/st of the right size rather than 32-bit read-and-shift or read-modify-write, but we leave this for later cleanup, since this series is generally trying to stick to fixing the decode. Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 147 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 83 +------------------ target/arm/vfp.decode | 36 ++++++++ 3 files changed, 185 insertions(+), 81 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 24358f3d3eb..8b0899fa05c 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -475,3 +475,150 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) return true; } + +static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a) +{ + /* VMOV scalar to general purpose register */ + TCGv_i32 tmp; + int pass; + uint32_t offset; + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vn & 0x10)) { + return false; + } + + offset = a->index << a->size; + pass = extract32(offset, 2, 1); + offset = extract32(offset, 0, 2) * 8; + + if (a->size != 2 && !arm_dc_feature(s, ARM_FEATURE_NEON)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + tmp = neon_load_reg(a->vn, pass); + switch (a->size) { + case 0: + if (offset) { + tcg_gen_shri_i32(tmp, tmp, offset); + } + if (a->u) { + gen_uxtb(tmp); + } else { + gen_sxtb(tmp); + } + break; + case 1: + if (a->u) { + if (offset) { + tcg_gen_shri_i32(tmp, tmp, 16); + } else { + gen_uxth(tmp); + } + } else { + if (offset) { + tcg_gen_sari_i32(tmp, tmp, 16); + } else { + gen_sxth(tmp); + } + } + break; + case 2: + break; + } + store_reg(s, a->rt, tmp); + + return true; +} + +static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a) +{ + /* VMOV general purpose register to scalar */ + TCGv_i32 tmp, tmp2; + int pass; + uint32_t offset; + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vn & 0x10)) { + return false; + } + + offset = a->index << a->size; + pass = extract32(offset, 2, 1); + offset = extract32(offset, 0, 2) * 8; + + if (a->size != 2 && !arm_dc_feature(s, ARM_FEATURE_NEON)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + tmp = load_reg(s, a->rt); + switch (a->size) { + case 0: + tmp2 = neon_load_reg(a->vn, pass); + tcg_gen_deposit_i32(tmp, tmp2, tmp, offset, 8); + tcg_temp_free_i32(tmp2); + break; + case 1: + tmp2 = neon_load_reg(a->vn, pass); + tcg_gen_deposit_i32(tmp, tmp2, tmp, offset, 16); + tcg_temp_free_i32(tmp2); + break; + case 2: + break; + } + neon_store_reg(a->vn, pass, tmp); + + return true; +} + +static bool trans_VDUP(DisasContext *s, arg_VDUP *a) +{ + /* VDUP (general purpose register) */ + TCGv_i32 tmp; + int size, vec_size; + + if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vn & 0x10)) { + return false; + } + + if (a->b && a->e) { + return false; + } + + if (a->q && (a->vn & 1)) { + return false; + } + + vec_size = a->q ? 16 : 8; + if (a->b) { + size = 0; + } else if (a->e) { + size = 1; + } else { + size = 2; + } + + if (!vfp_access_check(s)) { + return true; + } + + tmp = load_reg(s, a->rt); + tcg_gen_gvec_dup_i32(size, neon_reg_offset(a->vn, 0), + vec_size, vec_size, tmp); + tcg_temp_free_i32(tmp); + + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 3661ed57cd3..08307bb526d 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3151,87 +3151,8 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) /* single register transfer */ rd = (insn >> 12) & 0xf; if (dp) { - int size; - int pass; - - VFP_DREG_N(rn, insn); - if (insn & 0xf) - return 1; - if (insn & 0x00c00060 - && !arm_dc_feature(s, ARM_FEATURE_NEON)) { - return 1; - } - - pass = (insn >> 21) & 1; - if (insn & (1 << 22)) { - size = 0; - offset = ((insn >> 5) & 3) * 8; - } else if (insn & (1 << 5)) { - size = 1; - offset = (insn & (1 << 6)) ? 16 : 0; - } else { - size = 2; - offset = 0; - } - if (insn & ARM_CP_RW_BIT) { - /* vfp->arm */ - tmp = neon_load_reg(rn, pass); - switch (size) { - case 0: - if (offset) - tcg_gen_shri_i32(tmp, tmp, offset); - if (insn & (1 << 23)) - gen_uxtb(tmp); - else - gen_sxtb(tmp); - break; - case 1: - if (insn & (1 << 23)) { - if (offset) { - tcg_gen_shri_i32(tmp, tmp, 16); - } else { - gen_uxth(tmp); - } - } else { - if (offset) { - tcg_gen_sari_i32(tmp, tmp, 16); - } else { - gen_sxth(tmp); - } - } - break; - case 2: - break; - } - store_reg(s, rd, tmp); - } else { - /* arm->vfp */ - tmp = load_reg(s, rd); - if (insn & (1 << 23)) { - /* VDUP */ - int vec_size = pass ? 16 : 8; - tcg_gen_gvec_dup_i32(size, neon_reg_offset(rn, 0), - vec_size, vec_size, tmp); - tcg_temp_free_i32(tmp); - } else { - /* VMOV */ - switch (size) { - case 0: - tmp2 = neon_load_reg(rn, pass); - tcg_gen_deposit_i32(tmp, tmp2, tmp, offset, 8); - tcg_temp_free_i32(tmp2); - break; - case 1: - tmp2 = neon_load_reg(rn, pass); - tcg_gen_deposit_i32(tmp, tmp2, tmp, offset, 16); - tcg_temp_free_i32(tmp2); - break; - case 2: - break; - } - neon_store_reg(rn, pass, tmp); - } - } + /* already handled by decodetree */ + return 1; } else { /* !dp */ bool is_sysreg; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 28ee664d8c3..8286bdc0729 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -26,3 +26,39 @@ # 1110 1110 .... .... .... 101. .... .... # (but those patterns might also cover some Neon instructions, # which do not live in this file.) + +# VFP registers have an odd encoding with a four-bit field +# and a one-bit field which are assembled in different orders +# depending on whether the register is double or single precision. +# Each individual instruction function must do the checks for +# "double register selected but CPU does not have double support" +# and "double register number has bit 4 set but CPU does not +# support D16-D31" (which should UNDEF). +%vm_dp 5:1 0:4 +%vm_sp 0:4 5:1 +%vn_dp 7:1 16:4 +%vn_sp 16:4 7:1 +%vd_dp 22:1 12:4 +%vd_sp 12:4 22:1 + +%vmov_idx_b 21:1 5:2 +%vmov_idx_h 21:1 6:1 + +# VMOV scalar to general-purpose register; note that this does +# include some Neon cases. +VMOV_to_gp ---- 1110 u:1 1. 1 .... rt:4 1011 ... 1 0000 \ + vn=%vn_dp size=0 index=%vmov_idx_b +VMOV_to_gp ---- 1110 u:1 0. 1 .... rt:4 1011 ..1 1 0000 \ + vn=%vn_dp size=1 index=%vmov_idx_h +VMOV_to_gp ---- 1110 0 0 index:1 1 .... rt:4 1011 .00 1 0000 \ + vn=%vn_dp size=2 u=0 + +VMOV_from_gp ---- 1110 0 1. 0 .... rt:4 1011 ... 1 0000 \ + vn=%vn_dp size=0 index=%vmov_idx_b +VMOV_from_gp ---- 1110 0 0. 0 .... rt:4 1011 ..1 1 0000 \ + vn=%vn_dp size=1 index=%vmov_idx_h +VMOV_from_gp ---- 1110 0 0 index:1 0 .... rt:4 1011 .00 1 0000 \ + vn=%vn_dp size=2 + +VDUP ---- 1110 1 b:1 q:1 0 .... rt:4 1011 . 0 e:1 1 0000 \ + vn=%vn_dp From patchwork Tue Jun 11 10:53:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166405 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2223048ilk; Tue, 11 Jun 2019 04:19:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzD/V/+3E+ub49CGbTd8xzfWo78N39la1WNe47PeQZ7Ki7rT//49KMF0K0HExCFyCbNDwp+ X-Received: by 2002:a37:505:: with SMTP id 5mr42392771qkf.277.1560251998076; Tue, 11 Jun 2019 04:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251998; cv=none; d=google.com; s=arc-20160816; b=S+zFF6i/eFtrCpOgeNylBHePsKREnCRR3YoLamgHYDnhmLsjY1x9JO6rBUOs0ghod5 REq8hQ33Zb5yPo084E6ZKkIJWQph7xyjbIGogNCFogA5NHly5RBU17zktchhcJm0pX5h XKJjmfnmTJE/8UX+EFlpYa/y4AChczYr8AyNF4X95UQVnKtdjDcLhHrnr89/Y6r3BiTK DV/tlXP8H8x8uQZ2HysSz/SE7c8DhN3cC9OeLrkEcBa/ddP1cKRfFnZesuHOfe5mpLJk utpBKeuweon5JdLgVnCUr/YTPALAcb6+PjLMzG0Dt9zVuZXALEBiRcMYE4JLgrTg3Az1 +wSA== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=BRekI/r0JrL+EgGXfGboIlXRqShDBnXKTEq1yJIu1yc=; b=jCnciawIn8tWXw0xke6WZGeCfRm+sGs/xUjaDbh1gavvJppSHGif6SU7sNDGWFCh6/ VcotEjIwEALEqsEbeC0kob0kKqoVnTzo0NJASIBBntyjpxzHF1gHA/Q397pLOpGJDz6i AVd91ycyiFh3g+5i3cXcxVda9M+ElUlEdpcRB9gxCVmlzfWGCv/7yALbiBr5wk5YHPjp UqpxxgiUf39ZFDTB2BnlQUkMZ7VDTbqwrQRkbtaiFWckOc9BvLaQZakkOHgtab5TQxgp iIj79oe3iXnmTdZIOmBNWZ3N29DMTuR7P7NL38Bqbv3YvYzIVfoRjZEzTjM1zpvhG/ij p5Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=k30PTnuA; 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 u23si4293946qtq.369.2019.06.11.04.19.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:19:58 -0700 (PDT) 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=k30PTnuA; 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 ([::1]:56358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeon-0004ET-Ju for patch@linaro.org; Tue, 11 Jun 2019 07:19:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39164) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePx-0007FX-Lj for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePs-0007Q8-Dy for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:17 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:32809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePr-0007LY-OV for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:12 -0400 Received: by mail-wm1-x344.google.com with SMTP id h19so1657792wme.0 for ; Tue, 11 Jun 2019 03:54:08 -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 :mime-version:content-transfer-encoding; bh=BRekI/r0JrL+EgGXfGboIlXRqShDBnXKTEq1yJIu1yc=; b=k30PTnuAiIUQ0JkmxjG5TbQkaxpy3E8kzzy+2yAOwOeYZjSWjhWYeUitqMfdvBMpP8 V94Ast7boK25xf7YUZ0RMgxXA9LT4nMX7EQ8Dqy63974MwpS7rVUOKAu4HlGw+uMo5QZ BS/Mb0UqE2lMdF3GjkRHCplCp9h0eYFXqUoOr2fFz7Y/qhC6PDZJzx/U02E9mO8DCZsf 5YgxU6rKPJuSB7sH3SES0z7rDqiqVc9xQ6/eX+3g70EBnXfeQ89JcaeOFeekkuJIjNL3 lNSmpvH+AN37Xsq2jdU/H+2lbVLtvrhXvj6XlhSWi/VF07fPMvK/Hh1FeP73oJ7HzGTP CKog== 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:mime-version:content-transfer-encoding; bh=BRekI/r0JrL+EgGXfGboIlXRqShDBnXKTEq1yJIu1yc=; b=Ez7ar+qX6TmmpPTU9aEv6RB/bhnp5YqEAL5qkImLoG2UGiomzpnX6mKpvk0aqaE0Tq 7kDmP/fU8LOaQBPS8RRe8id+2jFIs/vAodhSSw7rxXVTDe+8JtRypt+P9rKjlFdFEiT3 j4k83JRWJ4kYEMHH1ddqEqpuYkSrhX6HOtpjhc1pEy0jq4/XmFoSwNSMhRPAS/93umSs klbAKHD0y/fyD6uyQO3YFhyTGf06nwU015gs/bRAlX9Jxg5XN+HZtOdqeXV92fnHjlNo zeu9HT9fAbXO8/dVSJhUi2Qhez5aqzCSgBx9n/BT9SjTeFI36OlNoQaG+uIwPWZRJpo5 TBtg== X-Gm-Message-State: APjAAAXZ6H4APIAmWOwuh+A3SjmLEn2G60k3jdUSYPNAxkp72vKU8Bng kMmCrMLzWMTYhju2grHEZ3W/jw== X-Received: by 2002:a1c:b684:: with SMTP id g126mr17091029wmf.176.1560250447807; Tue, 11 Jun 2019 03:54:07 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:07 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:22 +0100 Message-Id: <20190611105351.9871-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH v2 13/42] target/arm: Convert "single-precision" register moves to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the "single-precision" register moves to decodetree: * VMSR * VMRS * VMOV between general purpose register and single precision Note that the VMSR/VMRS conversions make our handling of the "should this UNDEF?" checks consistent between the two instructions: * VMSR to MVFR0, MVFR1, MVFR2 now UNDEF from EL0 (previously was a nop) * VMSR to FPSID now UNDEFs from EL0 or if VFPv3 or better (previously was a nop) * VMSR to FPINST and FPINST2 now UNDEF if VFPv3 or better (previously would write to the register, which had no guest-visible effect because we always UNDEF reads) We also tighten up the decode: we were previously underdecoding some SBZ or SBO bits. The conversion of VMOV_single includes the expansion out of the gen_mov_F0_vreg()/gen_vfp_mrs() and gen_mov_vreg_F0()/gen_vfp_msr() sequences into the simpler direct load/store of the TCG temp via neon_{load,store}_reg32(): we know in the new function that we're always single-precision, we don't need to use the old-and-deprecated cpu_F0* TCG globals, and we don't happen to have the declaration of gen_vfp_msr() and gen_vfp_mrs() at the point in the file where the new function is. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 161 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 148 +----------------------------- target/arm/vfp.decode | 4 + 3 files changed, 168 insertions(+), 145 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 8b0899fa05c..74c10f9024b 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -622,3 +622,164 @@ static bool trans_VDUP(DisasContext *s, arg_VDUP *a) return true; } + +static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a) +{ + TCGv_i32 tmp; + bool ignore_vfp_enabled = false; + + if (arm_dc_feature(s, ARM_FEATURE_M)) { + /* + * The only M-profile VFP vmrs/vmsr sysreg is FPSCR. + * Writes to R15 are UNPREDICTABLE; we choose to undef. + */ + if (a->rt == 15 || a->reg != ARM_VFP_FPSCR) { + return false; + } + } + + switch (a->reg) { + case ARM_VFP_FPSID: + /* + * VFPv2 allows access to FPSID from userspace; VFPv3 restricts + * all ID registers to privileged access only. + */ + if (IS_USER(s) && arm_dc_feature(s, ARM_FEATURE_VFP3)) { + return false; + } + ignore_vfp_enabled = true; + break; + case ARM_VFP_MVFR0: + case ARM_VFP_MVFR1: + if (IS_USER(s) || !arm_dc_feature(s, ARM_FEATURE_MVFR)) { + return false; + } + ignore_vfp_enabled = true; + break; + case ARM_VFP_MVFR2: + if (IS_USER(s) || !arm_dc_feature(s, ARM_FEATURE_V8)) { + return false; + } + ignore_vfp_enabled = true; + break; + case ARM_VFP_FPSCR: + break; + case ARM_VFP_FPEXC: + if (IS_USER(s)) { + return false; + } + ignore_vfp_enabled = true; + break; + case ARM_VFP_FPINST: + case ARM_VFP_FPINST2: + /* Not present in VFPv3 */ + if (IS_USER(s) || arm_dc_feature(s, ARM_FEATURE_VFP3)) { + return false; + } + break; + default: + return false; + } + + if (!full_vfp_access_check(s, ignore_vfp_enabled)) { + return true; + } + + if (a->l) { + /* VMRS, move VFP special register to gp register */ + switch (a->reg) { + case ARM_VFP_FPSID: + case ARM_VFP_FPEXC: + case ARM_VFP_FPINST: + case ARM_VFP_FPINST2: + case ARM_VFP_MVFR0: + case ARM_VFP_MVFR1: + case ARM_VFP_MVFR2: + tmp = load_cpu_field(vfp.xregs[a->reg]); + break; + case ARM_VFP_FPSCR: + if (a->rt == 15) { + tmp = load_cpu_field(vfp.xregs[ARM_VFP_FPSCR]); + tcg_gen_andi_i32(tmp, tmp, 0xf0000000); + } else { + tmp = tcg_temp_new_i32(); + gen_helper_vfp_get_fpscr(tmp, cpu_env); + } + break; + default: + g_assert_not_reached(); + } + + if (a->rt == 15) { + /* Set the 4 flag bits in the CPSR. */ + gen_set_nzcv(tmp); + tcg_temp_free_i32(tmp); + } else { + store_reg(s, a->rt, tmp); + } + } else { + /* VMSR, move gp register to VFP special register */ + switch (a->reg) { + case ARM_VFP_FPSID: + case ARM_VFP_MVFR0: + case ARM_VFP_MVFR1: + case ARM_VFP_MVFR2: + /* Writes are ignored. */ + break; + case ARM_VFP_FPSCR: + tmp = load_reg(s, a->rt); + gen_helper_vfp_set_fpscr(cpu_env, tmp); + tcg_temp_free_i32(tmp); + gen_lookup_tb(s); + break; + case ARM_VFP_FPEXC: + /* + * TODO: VFP subarchitecture support. + * For now, keep the EN bit only + */ + tmp = load_reg(s, a->rt); + tcg_gen_andi_i32(tmp, tmp, 1 << 30); + store_cpu_field(tmp, vfp.xregs[a->reg]); + gen_lookup_tb(s); + break; + case ARM_VFP_FPINST: + case ARM_VFP_FPINST2: + tmp = load_reg(s, a->rt); + store_cpu_field(tmp, vfp.xregs[a->reg]); + break; + default: + g_assert_not_reached(); + } + } + + return true; +} + +static bool trans_VMOV_single(DisasContext *s, arg_VMOV_single *a) +{ + TCGv_i32 tmp; + + if (!vfp_access_check(s)) { + return true; + } + + if (a->l) { + /* VFP to general purpose register */ + tmp = tcg_temp_new_i32(); + neon_load_reg32(tmp, a->vn); + if (a->rt == 15) { + /* Set the 4 flag bits in the CPSR. */ + gen_set_nzcv(tmp); + tcg_temp_free_i32(tmp); + } else { + store_reg(s, a->rt, tmp); + } + } else { + /* general purpose register to VFP */ + tmp = load_reg(s, a->rt); + neon_store_reg32(tmp, a->vn); + tcg_temp_free_i32(tmp); + } + + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 08307bb526d..cbb86a49213 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3097,7 +3097,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) TCGv_i32 addr; TCGv_i32 tmp; TCGv_i32 tmp2; - bool ignore_vfp_enabled = false; if (!arm_dc_feature(s, ARM_FEATURE_VFP)) { return 1; @@ -3133,14 +3132,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) * for invalid encodings; we will generate incorrect syndrome information * for attempts to execute invalid vfp/neon encodings with FP disabled. */ - if ((insn & 0x0fe00fff) == 0x0ee00a10) { - rn = (insn >> 16) & 0xf; - if (rn == ARM_VFP_FPSID || rn == ARM_VFP_FPEXC || rn == ARM_VFP_MVFR2 - || rn == ARM_VFP_MVFR1 || rn == ARM_VFP_MVFR0) { - ignore_vfp_enabled = true; - } - } - if (!full_vfp_access_check(s, ignore_vfp_enabled)) { + if (!vfp_access_check(s)) { return 0; } @@ -3148,142 +3140,8 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) switch ((insn >> 24) & 0xf) { case 0xe: if (insn & (1 << 4)) { - /* single register transfer */ - rd = (insn >> 12) & 0xf; - if (dp) { - /* already handled by decodetree */ - return 1; - } else { /* !dp */ - bool is_sysreg; - - if ((insn & 0x6f) != 0x00) - return 1; - rn = VFP_SREG_N(insn); - - is_sysreg = extract32(insn, 21, 1); - - if (arm_dc_feature(s, ARM_FEATURE_M)) { - /* - * The only M-profile VFP vmrs/vmsr sysreg is FPSCR. - * Writes to R15 are UNPREDICTABLE; we choose to undef. - */ - if (is_sysreg && (rd == 15 || (rn >> 1) != ARM_VFP_FPSCR)) { - return 1; - } - } - - if (insn & ARM_CP_RW_BIT) { - /* vfp->arm */ - if (is_sysreg) { - /* system register */ - rn >>= 1; - - switch (rn) { - case ARM_VFP_FPSID: - /* VFP2 allows access to FSID from userspace. - VFP3 restricts all id registers to privileged - accesses. */ - if (IS_USER(s) - && arm_dc_feature(s, ARM_FEATURE_VFP3)) { - return 1; - } - tmp = load_cpu_field(vfp.xregs[rn]); - break; - case ARM_VFP_FPEXC: - if (IS_USER(s)) - return 1; - tmp = load_cpu_field(vfp.xregs[rn]); - break; - case ARM_VFP_FPINST: - case ARM_VFP_FPINST2: - /* Not present in VFP3. */ - if (IS_USER(s) - || arm_dc_feature(s, ARM_FEATURE_VFP3)) { - return 1; - } - tmp = load_cpu_field(vfp.xregs[rn]); - break; - case ARM_VFP_FPSCR: - if (rd == 15) { - tmp = load_cpu_field(vfp.xregs[ARM_VFP_FPSCR]); - tcg_gen_andi_i32(tmp, tmp, 0xf0000000); - } else { - tmp = tcg_temp_new_i32(); - gen_helper_vfp_get_fpscr(tmp, cpu_env); - } - break; - case ARM_VFP_MVFR2: - if (!arm_dc_feature(s, ARM_FEATURE_V8)) { - return 1; - } - /* fall through */ - case ARM_VFP_MVFR0: - case ARM_VFP_MVFR1: - if (IS_USER(s) - || !arm_dc_feature(s, ARM_FEATURE_MVFR)) { - return 1; - } - tmp = load_cpu_field(vfp.xregs[rn]); - break; - default: - return 1; - } - } else { - gen_mov_F0_vreg(0, rn); - tmp = gen_vfp_mrs(); - } - if (rd == 15) { - /* Set the 4 flag bits in the CPSR. */ - gen_set_nzcv(tmp); - tcg_temp_free_i32(tmp); - } else { - store_reg(s, rd, tmp); - } - } else { - /* arm->vfp */ - if (is_sysreg) { - rn >>= 1; - /* system register */ - switch (rn) { - case ARM_VFP_FPSID: - case ARM_VFP_MVFR0: - case ARM_VFP_MVFR1: - /* Writes are ignored. */ - break; - case ARM_VFP_FPSCR: - tmp = load_reg(s, rd); - gen_helper_vfp_set_fpscr(cpu_env, tmp); - tcg_temp_free_i32(tmp); - gen_lookup_tb(s); - break; - case ARM_VFP_FPEXC: - if (IS_USER(s)) - return 1; - /* TODO: VFP subarchitecture support. - * For now, keep the EN bit only */ - tmp = load_reg(s, rd); - tcg_gen_andi_i32(tmp, tmp, 1 << 30); - store_cpu_field(tmp, vfp.xregs[rn]); - gen_lookup_tb(s); - break; - case ARM_VFP_FPINST: - case ARM_VFP_FPINST2: - if (IS_USER(s)) { - return 1; - } - tmp = load_reg(s, rd); - store_cpu_field(tmp, vfp.xregs[rn]); - break; - default: - return 1; - } - } else { - tmp = load_reg(s, rd); - gen_vfp_msr(tmp); - gen_mov_vreg_F0(0, rn); - } - } - } + /* already handled by decodetree */ + return 1; } else { /* data processing */ bool rd_is_dp = dp; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 8286bdc0729..bb7de403df3 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -62,3 +62,7 @@ VMOV_from_gp ---- 1110 0 0 index:1 0 .... rt:4 1011 .00 1 0000 \ VDUP ---- 1110 1 b:1 q:1 0 .... rt:4 1011 . 0 e:1 1 0000 \ vn=%vn_dp + +VMSR_VMRS ---- 1110 111 l:1 reg:4 rt:4 1010 0001 0000 +VMOV_single ---- 1110 000 l:1 .... rt:4 1010 . 001 0000 \ + vn=%vn_sp From patchwork Tue Jun 11 10:53:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166404 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2221993ilk; Tue, 11 Jun 2019 04:18:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzk8zaD0SEAe5vJmFYZal672MRdA4jwjS+EFJWD9H+EfB5rATNZw3e3jD1r9LDEMaAD5rl X-Received: by 2002:a37:6652:: with SMTP id a79mr41135894qkc.60.1560251937477; Tue, 11 Jun 2019 04:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251937; cv=none; d=google.com; s=arc-20160816; b=jBp+98tk+D9YqY0ma/XCTdvoiP8K1NhMnjFPH447zJhVVoRKha/yINZB84jH8OtNZF k7Zd6EIziwbE207Lc2q082HR3LO6gV7miDwadi454RFyDdPc+/MMPpkVDAtLKM4q72sg FlhrS6iD2fY5qU70PmMdBz/MHE4je8Ghz8AHLs8jp9CLpB6boMJvQwtNh0vk7VuYNWrM KMltopVqCzzfMSpEMS9SSo8AjJGow0Z/2xIAdBfr3rsQwEsicUmTOqAi730cU+Y+QPBX HeGv40rgbjzLNwWNQls6FVGTDhjKE1uXVTPSTfpfbQYP4tqaJmWzvM1d89YHGghaZuqj v+HA== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=JD4GO8F9aylwZA/zvoGNYNDsDGK74aumUd+PDKM7Pbc=; b=YgTa75HLl7ECzov2GPiIa+VYagHy+SShQXEzQKDu7bFmaHnHKtSMB0w2pwh/k0N6q+ ASi3yJQFaR2HPdH8vqTLQ9GOP1MaJEz2rWFEUlR5+L+okuZawQxAb0JZbf/XjeqnhAoV iCG69tFiDLyBYPFcbNi8g5l4i10+y25DkeAyVkOjeLbLlkUiYmG3C95bmScgzM0wK4Ha t3FSEmAwRTptUZ6brAsOnB1k004CXOnhBcXcaJDxz6Ag6X4/yLxc5yZ7hnL3eMt8VoVN gu3U91P0PP5e3sqOhOJVRMWFRAQh64RxahGfsXVFz/a2WbnYoGLkz20p71uGVZfA0/uH QMDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CWuiyj6v; 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 h32si1217645qtc.292.2019.06.11.04.18.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:18:57 -0700 (PDT) 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=CWuiyj6v; 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 ([::1]:56342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haenp-0003c6-0N for patch@linaro.org; Tue, 11 Jun 2019 07:18:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39108) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePu-0007DT-I5 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePr-0007PS-St for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:14 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:43062) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePr-0007Ly-IL for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:11 -0400 Received: by mail-wr1-x441.google.com with SMTP id p13so2387665wru.10 for ; Tue, 11 Jun 2019 03:54:09 -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 :mime-version:content-transfer-encoding; bh=JD4GO8F9aylwZA/zvoGNYNDsDGK74aumUd+PDKM7Pbc=; b=CWuiyj6vGqzaoYGguLMq8hLrRJ+JSgRtxxOhh5fbGudlG4+ClHm2Kx8ozTRh4WQIi2 +MBuTf0nEhwxNPqQeLsywME5mAXax8XWrvelYVVeF2rDAQXQg+BAlfCfDQkhXoEJYNSP zeorXa8sb56AItT79QilDjmvU2ecs0Wj8dIKdV/YOBbDPpsVUtwNLrqb4yq9IcuiQeX+ kgZXvqGplT+I598216NBuR7rkiY566TfTrs87d77xb6Ob39+tR9PkvrLaEXLvffo10ks JcHVkWBLyL2SjD7ZperMwKNYX4CZorHVM7Usu8yXElBktxPdn2xhvGUSGdCTFynnef5d pHZw== 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:mime-version:content-transfer-encoding; bh=JD4GO8F9aylwZA/zvoGNYNDsDGK74aumUd+PDKM7Pbc=; b=Yw2i0PWlsa1sedX5NxR0jC7E/w9IWmGeKj0CoTqXQuwLOak77plpKmmu28131sjyu/ 678aw2vPg9lrmywrYugwqOTi6up/6W0riJdbz/kqZB3qf6/NW8RNqFa7NxXFM/crD7ZU l1CiM2BU7grOAYYX09R6c0tUhNnaIMnRnf/Cv6GtO75eNcd9TBbRwG+0tJOVnixokkxF LitmGOaa1HH2KCr2yurLlMEdPzYY6Xq7YEd+Fg6BrYGrXwZTYXYYxmvtgp6oD0KhAZBw IuWmABRMEzRDQeR9+ShwdMeAp+iuNh1yrs4kJ8L9cAJLhJEtPy6OMMJb9U9Eo9OWtCqu 6rHg== X-Gm-Message-State: APjAAAWJC/fAVBLA1JZSkJO85JAc/73glwwB5FLtAoYXnJatLscXpKfR +dWdXDiYnugK/sHnR56xPpMCGg== X-Received: by 2002:adf:9dcc:: with SMTP id q12mr24218921wre.93.1560250448751; Tue, 11 Jun 2019 03:54:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:08 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:23 +0100 Message-Id: <20190611105351.9871-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH v2 14/42] target/arm: Convert VFP two-register transfer insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP two-register transfer instructions to decodetree (in the v8 Arm ARM these are the "Advanced SIMD and floating-point 64-bit move" encoding group). Again, we expand out the sequences involving gen_vfp_msr() and gen_msr_vfp(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 70 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 46 +--------------------- target/arm/vfp.decode | 5 +++ 3 files changed, 77 insertions(+), 44 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 74c10f9024b..5f081221b83 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -783,3 +783,73 @@ static bool trans_VMOV_single(DisasContext *s, arg_VMOV_single *a) return true; } + +static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a) +{ + TCGv_i32 tmp; + + /* + * VMOV between two general-purpose registers and two single precision + * floating point registers + */ + if (!vfp_access_check(s)) { + return true; + } + + if (a->op) { + /* fpreg to gpreg */ + tmp = tcg_temp_new_i32(); + neon_load_reg32(tmp, a->vm); + store_reg(s, a->rt, tmp); + tmp = tcg_temp_new_i32(); + neon_load_reg32(tmp, a->vm + 1); + store_reg(s, a->rt2, tmp); + } else { + /* gpreg to fpreg */ + tmp = load_reg(s, a->rt); + neon_store_reg32(tmp, a->vm); + tmp = load_reg(s, a->rt2); + neon_store_reg32(tmp, a->vm + 1); + } + + return true; +} + +static bool trans_VMOV_64_dp(DisasContext *s, arg_VMOV_64_sp *a) +{ + TCGv_i32 tmp; + + /* + * VMOV between two general-purpose registers and one double precision + * floating point register + */ + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vm & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (a->op) { + /* fpreg to gpreg */ + tmp = tcg_temp_new_i32(); + neon_load_reg32(tmp, a->vm * 2); + store_reg(s, a->rt, tmp); + tmp = tcg_temp_new_i32(); + neon_load_reg32(tmp, a->vm * 2 + 1); + store_reg(s, a->rt2, tmp); + } else { + /* gpreg to fpreg */ + tmp = load_reg(s, a->rt); + neon_store_reg32(tmp, a->vm * 2); + tcg_temp_free_i32(tmp); + tmp = load_reg(s, a->rt2); + neon_store_reg32(tmp, a->vm * 2 + 1); + tcg_temp_free_i32(tmp); + } + + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index cbb86a49213..d2dced7c45a 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3703,50 +3703,8 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) case 0xc: case 0xd: if ((insn & 0x03e00000) == 0x00400000) { - /* two-register transfer */ - rn = (insn >> 16) & 0xf; - rd = (insn >> 12) & 0xf; - if (dp) { - VFP_DREG_M(rm, insn); - } else { - rm = VFP_SREG_M(insn); - } - - if (insn & ARM_CP_RW_BIT) { - /* vfp->arm */ - if (dp) { - gen_mov_F0_vreg(0, rm * 2); - tmp = gen_vfp_mrs(); - store_reg(s, rd, tmp); - gen_mov_F0_vreg(0, rm * 2 + 1); - tmp = gen_vfp_mrs(); - store_reg(s, rn, tmp); - } else { - gen_mov_F0_vreg(0, rm); - tmp = gen_vfp_mrs(); - store_reg(s, rd, tmp); - gen_mov_F0_vreg(0, rm + 1); - tmp = gen_vfp_mrs(); - store_reg(s, rn, tmp); - } - } else { - /* arm->vfp */ - if (dp) { - tmp = load_reg(s, rd); - gen_vfp_msr(tmp); - gen_mov_vreg_F0(0, rm * 2); - tmp = load_reg(s, rn); - gen_vfp_msr(tmp); - gen_mov_vreg_F0(0, rm * 2 + 1); - } else { - tmp = load_reg(s, rd); - gen_vfp_msr(tmp); - gen_mov_vreg_F0(0, rm); - tmp = load_reg(s, rn); - gen_vfp_msr(tmp); - gen_mov_vreg_F0(0, rm + 1); - } - } + /* Already handled by decodetree */ + return 1; } else { /* Load/store */ rn = (insn >> 16) & 0xf; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index bb7de403df3..134f1c9ef58 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -66,3 +66,8 @@ VDUP ---- 1110 1 b:1 q:1 0 .... rt:4 1011 . 0 e:1 1 0000 \ VMSR_VMRS ---- 1110 111 l:1 reg:4 rt:4 1010 0001 0000 VMOV_single ---- 1110 000 l:1 .... rt:4 1010 . 001 0000 \ vn=%vn_sp + +VMOV_64_sp ---- 1100 010 op:1 rt2:4 rt:4 1010 00.1 .... \ + vm=%vm_sp +VMOV_64_dp ---- 1100 010 op:1 rt2:4 rt:4 1011 00.1 .... \ + vm=%vm_dp From patchwork Tue Jun 11 10:53:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166397 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2210331ilk; Tue, 11 Jun 2019 04:08:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVDzq1vJJzSb1l/wYL0ZP/JZpDG8dV8smVPQQ4EDNm4jB1yVYy1jHYNZMor7i99SGAeWzE X-Received: by 2002:a0c:95af:: with SMTP id s44mr33008132qvs.162.1560251336281; Tue, 11 Jun 2019 04:08:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251336; cv=none; d=google.com; s=arc-20160816; b=E1IFyOVelQplFDSO+k2YitiBP4K7aUsEHyj4vWZ3cPBzNu1Jru9oEP9V5nVmWzs02i Xq76DkdBav9fiy2GEZN/efcHFpYB5R8qanJYO7DcKogCX1FdB5+w8SNk+Z/k3saQdmnY sXhYQ9fBl/zLu9SA0kwYgeYS4m7zUX2e3DAe9uJ1AoP/FsnJ4Hem/CMeLSpKJJHJObbN 3PxLbOoTDCqjO50DYQe9YK+F3GcOvDFzDzjCo4SOwxrNrNK867aLSxo1PD0cDLIoSrIS 3Uy/pCZz/HryOz7x/JLofR4W0NShuQfy0PVBVdZs42YWgyTFmBoRMMP0j0co+LKgkgXf MhUQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=fwMmmCKnJhSZXRq+jzl94zmymegBLzgFopXz7If0aS4=; b=csDy07FiQqNjsiUeBOYjIPOvsX4Ev82pT8TBzsySDaQEMd4sQcoukqu2HqtUof4z9p nzZ/MA75NBycgOpwJ8R7aWRGDYNtE4JZrw0YT9jFiWNQSmqc5z81vCrETD4IuKwxWjr6 xWvRpQOHbrxyXtExN/CQ7LjgK5QpYyhT8yGgVT6N7znQkfp1TDN9qRF+ArGZI+o5oroo T94xFFZ9UZY2Q43wyDrodmrYAOA2EeYxqPJj/VNjRaYaTMZHajT58m2eaxgSuw/5jA6/ Mwx8xbEf8lfokzmh3lP9SEmAWyFgRNjW+IrG34LGNrw4GYq19KXq7coJWRFsQKKLcqtC Nlsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QmLMFaft; 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 a18si1651865qth.35.2019.06.11.04.08.56 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:08:56 -0700 (PDT) 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=QmLMFaft; 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 ([::1]:56280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haee7-0003z4-TQ for patch@linaro.org; Tue, 11 Jun 2019 07:08:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39112) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haePu-0007De-Jw for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePr-0007P1-NT for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:14 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:51682) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePr-0007NV-Cw for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:11 -0400 Received: by mail-wm1-x344.google.com with SMTP id 207so2438011wma.1 for ; Tue, 11 Jun 2019 03:54:10 -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 :mime-version:content-transfer-encoding; bh=fwMmmCKnJhSZXRq+jzl94zmymegBLzgFopXz7If0aS4=; b=QmLMFaftqF+/Pt0bEoGZqWf7ZE/vOQoE2lm6dnxDAVR6UNREY1dti/AQ31thzC4ozW W8DLZTUiCr5xv4bIGTnbKK0eEmaKkk9jZQn8D+A4lTZd3stMdf8DQhH7PC7zqknbo1IM hNF4vNYyBPgKYr4pSSFZa9TAtRmLLeBaY/inypTeG5nk1OljiKnVKp3XeAf7KSIeeqMu CrVBbLpYxcqaefg29iFiZiImdFvYj59DvgcOJU0vpOIsBERVlDfZp15jBHv0A3+Zk7C7 vbR2UyXR8Rv9VH7+F9MqdBYLWl46f++cNXBfwj94CUYkwN5tO3m5tVVdNLaypMWFM/gM LD+g== 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:mime-version:content-transfer-encoding; bh=fwMmmCKnJhSZXRq+jzl94zmymegBLzgFopXz7If0aS4=; b=jRUYNzy3RoTxX8H3Vs1Vsocz8uKaHy6jx55fKPX7GZq+4w/DXbEdr8GOOZUfKYuoNF qnfLATBdBX5ToXAbsmx9ggvLJmjY1HQjZvWxt5XR+CidxweO+tNdJb9VU/26nE8DCvrr hYYXK+W8aulludT8rMd4mkAF9tgwhz8EjZBGhy/0x87PsBtPVrTfXCMuIK+hMeT1nRV1 1ajSiPA6/v5Bq/F5eIX5aPoBdvC7WqTWV2UQSupYti8qBMNntpjZxr4XTAMngmKBL4vS PwEtjfTd/4CjehCpvPaTZvCxxvn0h6IsuWpvPMndxy76izAelLjYJMddPGP61owNaac6 UzjA== X-Gm-Message-State: APjAAAXT1Hx8xWR2/4/4NCauwvEojFRX67MGfG0W4gV/W7cFBeqCBiLh 7SF2CgMNJzYE2gtG0bkazEB0c9Wb4hNotw== X-Received: by 2002:a7b:cc09:: with SMTP id f9mr9242548wmh.68.1560250449938; Tue, 11 Jun 2019 03:54:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:09 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:24 +0100 Message-Id: <20190611105351.9871-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH v2 15/42] target/arm: Convert VFP VLDR and VSTR to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP single load/store insns VLDR and VSTR to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 73 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 22 +--------- target/arm/vfp.decode | 7 ++++ 3 files changed, 82 insertions(+), 20 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 5f081221b83..40f2cac3e2e 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -853,3 +853,76 @@ static bool trans_VMOV_64_dp(DisasContext *s, arg_VMOV_64_sp *a) return true; } + +static bool trans_VLDR_VSTR_sp(DisasContext *s, arg_VLDR_VSTR_sp *a) +{ + uint32_t offset; + TCGv_i32 addr; + + if (!vfp_access_check(s)) { + return true; + } + + offset = a->imm << 2; + if (!a->u) { + offset = -offset; + } + + if (s->thumb && a->rn == 15) { + /* This is actually UNPREDICTABLE */ + addr = tcg_temp_new_i32(); + tcg_gen_movi_i32(addr, s->pc & ~2); + } else { + addr = load_reg(s, a->rn); + } + tcg_gen_addi_i32(addr, addr, offset); + if (a->l) { + gen_vfp_ld(s, false, addr); + gen_mov_vreg_F0(false, a->vd); + } else { + gen_mov_F0_vreg(false, a->vd); + gen_vfp_st(s, false, addr); + } + tcg_temp_free_i32(addr); + + return true; +} + +static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_sp *a) +{ + uint32_t offset; + TCGv_i32 addr; + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vd & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + offset = a->imm << 2; + if (!a->u) { + offset = -offset; + } + + if (s->thumb && a->rn == 15) { + /* This is actually UNPREDICTABLE */ + addr = tcg_temp_new_i32(); + tcg_gen_movi_i32(addr, s->pc & ~2); + } else { + addr = load_reg(s, a->rn); + } + tcg_gen_addi_i32(addr, addr, offset); + if (a->l) { + gen_vfp_ld(s, true, addr); + gen_mov_vreg_F0(true, a->vd); + } else { + gen_mov_F0_vreg(true, a->vd); + gen_vfp_st(s, true, addr); + } + tcg_temp_free_i32(addr); + + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index d2dced7c45a..d954e8de1eb 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3713,26 +3713,8 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) else rd = VFP_SREG_D(insn); if ((insn & 0x01200000) == 0x01000000) { - /* Single load/store */ - offset = (insn & 0xff) << 2; - if ((insn & (1 << 23)) == 0) - offset = -offset; - if (s->thumb && rn == 15) { - /* This is actually UNPREDICTABLE */ - addr = tcg_temp_new_i32(); - tcg_gen_movi_i32(addr, s->pc & ~2); - } else { - addr = load_reg(s, rn); - } - tcg_gen_addi_i32(addr, addr, offset); - if (insn & (1 << 20)) { - gen_vfp_ld(s, dp, addr); - gen_mov_vreg_F0(dp, rd); - } else { - gen_mov_F0_vreg(dp, rd); - gen_vfp_st(s, dp, addr); - } - tcg_temp_free_i32(addr); + /* Already handled by decodetree */ + return 1; } else { /* load/store multiple */ int w = insn & (1 << 21); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 134f1c9ef58..8fa7fa0bead 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -71,3 +71,10 @@ VMOV_64_sp ---- 1100 010 op:1 rt2:4 rt:4 1010 00.1 .... \ vm=%vm_sp VMOV_64_dp ---- 1100 010 op:1 rt2:4 rt:4 1011 00.1 .... \ vm=%vm_dp + +# Note that the half-precision variants of VLDR and VSTR are +# not part of this decodetree at all because they have bits [9:8] == 0b01 +VLDR_VSTR_sp ---- 1101 u:1 .0 l:1 rn:4 .... 1010 imm:8 \ + vd=%vd_sp +VLDR_VSTR_dp ---- 1101 u:1 .0 l:1 rn:4 .... 1011 imm:8 \ + vd=%vd_dp From patchwork Tue Jun 11 10:53:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166407 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2225798ilk; Tue, 11 Jun 2019 04:22:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzywIgMx/cybdGfcDKj6F1lDHHm4tlItfb4nH+mDh4CkCVG33cuJ5DoM3r7FLnzUNeUIQq9 X-Received: by 2002:ac8:2a87:: with SMTP id b7mr21757472qta.74.1560252161261; Tue, 11 Jun 2019 04:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560252161; cv=none; d=google.com; s=arc-20160816; b=NpI9LbpeIe1IaOP96mWuThMBG1IW1343BF8zBfZFZAMT0sJcuOOVK6Hh/wnubRasAg OJmIblQvXO3EMEfGDuqWelEEJRyTD11ewtaeI+ln6qOPPhbZe3OuN+JcJLZwIk8TeG2Y xvYgp9obQaie5SqOvOF8J0MwGsqG4VMD8A8W54ehcK9j5VQZLqCEWTYwXUtEFxjhQdS1 zBedYFa0ulXm6M8NZ+HlnmG5QNyb7HzxkeeZ3zRyQ57LX4pcLxsc9q7YNAgV17HyCyXn I5/2Bq7H3KhDe5HRl2VToqJ7AiZBEjNRLYAhpyuEteR0mBfrRWHmbOWpWWKdFYHeRbLS U42A== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=uk5iEXDvYoBGczcV25RC53cZxZ7Mzp44JNFUSENfzow=; b=zhYDzwh8o6ZHAELBPFlyv2GwsAPPfiDuFUmBIn+k/Ewv/5FYSQ98OoD1BC8grrIZUI Bazv89kAmI0vO782lfSWhntCD+Fmm6Z3UFANm6rx+4X5V51CeF3kopwNS3mdJrJiZCQ7 YJXKLrFXSqCBCc03jpdvjVxKcFpgXlHjTnhJwdS2UjqaC2Y/gEPMtpzj07AUmuZW1p84 mANGGV1LJ0WzA8pFnoMb9dH9tIV80H1Bm27UbcV1KW0q5PKZFEipxQ062V6v2DZ4DqwY BMJMuppvzvia8LJ+65VVCXCjaVcp9lRLPvJggwzP21g9/3ddBZOxppznQFV4YaPO9+nT P+Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Xsx5VoJZ; 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 e65si558940qkf.138.2019.06.11.04.22.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:22:41 -0700 (PDT) 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=Xsx5VoJZ; 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 ([::1]:56390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haerP-0006MZ-V7 for patch@linaro.org; Tue, 11 Jun 2019 07:22:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39258) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQ1-0007Kl-Fc for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePu-0007TB-EW for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:21 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51681) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePs-0007Ok-86 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:12 -0400 Received: by mail-wm1-x342.google.com with SMTP id 207so2438145wma.1 for ; Tue, 11 Jun 2019 03:54:12 -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 :mime-version:content-transfer-encoding; bh=uk5iEXDvYoBGczcV25RC53cZxZ7Mzp44JNFUSENfzow=; b=Xsx5VoJZFL+8Ngb+L/eqUWkgrv/V+eO8mr/7z9yBT/Vii56/fIj9f02f/Vxj8CQ3GX 0TkRrtyoHbhwrma7JVd+K3GzbenwOyDJHhhHKYsUk9eUrraD3XYdlHnP8+aqdhEnyOMF f05zVIIETdEBRxBc39B4z1UStQ3fJCUW7j+d3OZv5J72YbA55+hE0YkTyjgkgmVINH0M iu7q3jlcsejpPuM/0VZt2oONdyXnqvMBgznrelQlrNMilqBc7YsBT3t9NfCE4VKnl/9Q 2jggfWzomnQ9oVZOs1LyENeoIQt60RU9s8qaIXZmHC0olfZNOUqM4R0CTC/jszkkkQrh +Tfg== 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:mime-version:content-transfer-encoding; bh=uk5iEXDvYoBGczcV25RC53cZxZ7Mzp44JNFUSENfzow=; b=mMjO2tPOrxtiXXeo56CfKRaGozPTJYOVE0LtBY1wDwzMK5RvhFGTRho0+V3AsjK1Yb FrE8rndMDCgbh+/t7BOjyOC2bKdMJq2eiKAp6LM6pBx0hNY9icqNQBbZGaiO2LUzXLQr YWOW7CXPR9qx3O68qwT4sDk5LiNvD/kBoGkeF9e9ncNHuT8HAdIrMkrO28JQ4d/vyGsU wsOpcz9Kx1BJmT5CEzdR+N7xu+vffi/SKkRBrwzrVfU0DHkULz9XGz9Q0mn+JTcMrQq/ CHpfFKQ5vb8bSZL2pnNs4m0x3CgvRb/q6DDDEC+MTbnUo08BqSipuv2Aytf6sFk3eVii Uyew== X-Gm-Message-State: APjAAAVZfueFZMazIRV8X1dUVsEsb2iqfyWK2HF/TfZEkCFVXeCmJV2z sDyFGfAcrFdrs7PEMNZoSC5wKg== X-Received: by 2002:a1c:e009:: with SMTP id x9mr17207987wmg.5.1560250451095; Tue, 11 Jun 2019 03:54:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:10 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:25 +0100 Message-Id: <20190611105351.9871-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 16/42] target/arm: Convert the VFP load/store multiple insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP load/store multiple insns to decodetree. This includes tightening up the UNDEF checking for pre-VFPv3 CPUs which only have D0-D15 : they now UNDEF for any access to D16-D31, not merely when the smallest register in the transfer list is in D16-D31. This conversion does not try to share code between the single precision and the double precision versions; this looks a bit duplicative of code, but it leaves the door open for a future refactoring which gets rid of the use of the "F0" registers by inlining the various functions like gen_vfp_ld() and gen_mov_F0_reg() which are hiding "if (dp) { ... } else { ... }" conditionalisation. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 162 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 97 +------------------- target/arm/vfp.decode | 18 ++++ 3 files changed, 183 insertions(+), 94 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 40f2cac3e2e..32a1805e582 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -926,3 +926,165 @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_sp *a) return true; } + +static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a) +{ + uint32_t offset; + TCGv_i32 addr; + int i, n; + + n = a->imm; + + if (n == 0 || (a->vd + n) > 32) { + /* + * UNPREDICTABLE cases for bad immediates: we choose to + * UNDEF to avoid generating huge numbers of TCG ops + */ + return false; + } + if (a->rn == 15 && a->w) { + /* writeback to PC is UNPREDICTABLE, we choose to UNDEF */ + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (s->thumb && a->rn == 15) { + /* This is actually UNPREDICTABLE */ + addr = tcg_temp_new_i32(); + tcg_gen_movi_i32(addr, s->pc & ~2); + } else { + addr = load_reg(s, a->rn); + } + if (a->p) { + /* pre-decrement */ + tcg_gen_addi_i32(addr, addr, -(a->imm << 2)); + } + + if (s->v8m_stackcheck && a->rn == 13 && a->w) { + /* + * Here 'addr' is the lowest address we will store to, + * and is either the old SP (if post-increment) or + * the new SP (if pre-decrement). For post-increment + * where the old value is below the limit and the new + * value is above, it is UNKNOWN whether the limit check + * triggers; we choose to trigger. + */ + gen_helper_v8m_stackcheck(cpu_env, addr); + } + + offset = 4; + for (i = 0; i < n; i++) { + if (a->l) { + /* load */ + gen_vfp_ld(s, false, addr); + gen_mov_vreg_F0(false, a->vd + i); + } else { + /* store */ + gen_mov_F0_vreg(false, a->vd + i); + gen_vfp_st(s, false, addr); + } + tcg_gen_addi_i32(addr, addr, offset); + } + if (a->w) { + /* writeback */ + if (a->p) { + offset = -offset * n; + tcg_gen_addi_i32(addr, addr, offset); + } + store_reg(s, a->rn, addr); + } else { + tcg_temp_free_i32(addr); + } + + return true; +} + +static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a) +{ + uint32_t offset; + TCGv_i32 addr; + int i, n; + + n = a->imm >> 1; + + if (n == 0 || (a->vd + n) > 32 || n > 16) { + /* + * UNPREDICTABLE cases for bad immediates: we choose to + * UNDEF to avoid generating huge numbers of TCG ops + */ + return false; + } + if (a->rn == 15 && a->w) { + /* writeback to PC is UNPREDICTABLE, we choose to UNDEF */ + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vd + n) > 16) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (s->thumb && a->rn == 15) { + /* This is actually UNPREDICTABLE */ + addr = tcg_temp_new_i32(); + tcg_gen_movi_i32(addr, s->pc & ~2); + } else { + addr = load_reg(s, a->rn); + } + if (a->p) { + /* pre-decrement */ + tcg_gen_addi_i32(addr, addr, -(a->imm << 2)); + } + + if (s->v8m_stackcheck && a->rn == 13 && a->w) { + /* + * Here 'addr' is the lowest address we will store to, + * and is either the old SP (if post-increment) or + * the new SP (if pre-decrement). For post-increment + * where the old value is below the limit and the new + * value is above, it is UNKNOWN whether the limit check + * triggers; we choose to trigger. + */ + gen_helper_v8m_stackcheck(cpu_env, addr); + } + + offset = 8; + for (i = 0; i < n; i++) { + if (a->l) { + /* load */ + gen_vfp_ld(s, true, addr); + gen_mov_vreg_F0(true, a->vd + i); + } else { + /* store */ + gen_mov_F0_vreg(true, a->vd + i); + gen_vfp_st(s, true, addr); + } + tcg_gen_addi_i32(addr, addr, offset); + } + if (a->w) { + /* writeback */ + if (a->p) { + offset = -offset * n; + } else if (a->imm & 1) { + offset = 4; + } else { + offset = 0; + } + + if (offset != 0) { + tcg_gen_addi_i32(addr, addr, offset); + } + store_reg(s, a->rn, addr); + } else { + tcg_temp_free_i32(addr); + } + + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index d954e8de1eb..5a9d0c30d3d 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3092,9 +3092,8 @@ static void gen_neon_dup_high16(TCGv_i32 var) */ static int disas_vfp_insn(DisasContext *s, uint32_t insn) { - uint32_t rd, rn, rm, op, i, n, offset, delta_d, delta_m, bank_mask; + uint32_t rd, rn, rm, op, i, n, delta_d, delta_m, bank_mask; int dp, veclen; - TCGv_i32 addr; TCGv_i32 tmp; TCGv_i32 tmp2; @@ -3702,98 +3701,8 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) break; case 0xc: case 0xd: - if ((insn & 0x03e00000) == 0x00400000) { - /* Already handled by decodetree */ - return 1; - } else { - /* Load/store */ - rn = (insn >> 16) & 0xf; - if (dp) - VFP_DREG_D(rd, insn); - else - rd = VFP_SREG_D(insn); - if ((insn & 0x01200000) == 0x01000000) { - /* Already handled by decodetree */ - return 1; - } else { - /* load/store multiple */ - int w = insn & (1 << 21); - if (dp) - n = (insn >> 1) & 0x7f; - else - n = insn & 0xff; - - if (w && !(((insn >> 23) ^ (insn >> 24)) & 1)) { - /* P == U , W == 1 => UNDEF */ - return 1; - } - if (n == 0 || (rd + n) > 32 || (dp && n > 16)) { - /* UNPREDICTABLE cases for bad immediates: we choose to - * UNDEF to avoid generating huge numbers of TCG ops - */ - return 1; - } - if (rn == 15 && w) { - /* writeback to PC is UNPREDICTABLE, we choose to UNDEF */ - return 1; - } - - if (s->thumb && rn == 15) { - /* This is actually UNPREDICTABLE */ - addr = tcg_temp_new_i32(); - tcg_gen_movi_i32(addr, s->pc & ~2); - } else { - addr = load_reg(s, rn); - } - if (insn & (1 << 24)) /* pre-decrement */ - tcg_gen_addi_i32(addr, addr, -((insn & 0xff) << 2)); - - if (s->v8m_stackcheck && rn == 13 && w) { - /* - * Here 'addr' is the lowest address we will store to, - * and is either the old SP (if post-increment) or - * the new SP (if pre-decrement). For post-increment - * where the old value is below the limit and the new - * value is above, it is UNKNOWN whether the limit check - * triggers; we choose to trigger. - */ - gen_helper_v8m_stackcheck(cpu_env, addr); - } - - if (dp) - offset = 8; - else - offset = 4; - for (i = 0; i < n; i++) { - if (insn & ARM_CP_RW_BIT) { - /* load */ - gen_vfp_ld(s, dp, addr); - gen_mov_vreg_F0(dp, rd + i); - } else { - /* store */ - gen_mov_F0_vreg(dp, rd + i); - gen_vfp_st(s, dp, addr); - } - tcg_gen_addi_i32(addr, addr, offset); - } - if (w) { - /* writeback */ - if (insn & (1 << 24)) - offset = -offset * n; - else if (dp && (insn & 1)) - offset = 4; - else - offset = 0; - - if (offset != 0) - tcg_gen_addi_i32(addr, addr, offset); - store_reg(s, rn, addr); - } else { - tcg_temp_free_i32(addr); - } - } - } - break; + /* Already handled by decodetree */ + return 1; default: /* Should never happen. */ return 1; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 8fa7fa0bead..68c9ffcfd3c 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -78,3 +78,21 @@ VLDR_VSTR_sp ---- 1101 u:1 .0 l:1 rn:4 .... 1010 imm:8 \ vd=%vd_sp VLDR_VSTR_dp ---- 1101 u:1 .0 l:1 rn:4 .... 1011 imm:8 \ vd=%vd_dp + +# We split the load/store multiple up into two patterns to avoid +# overlap with other insns in the "Advanced SIMD load/store and 64-bit move" +# grouping: +# P=0 U=0 W=0 is 64-bit VMOV +# P=1 W=0 is VLDR/VSTR +# P=U W=1 is UNDEF +# leaving P=0 U=1 W=x and P=1 U=0 W=1 for load/store multiple. +# These include FSTM/FLDM. +VLDM_VSTM_sp ---- 1100 1 . w:1 l:1 rn:4 .... 1010 imm:8 \ + vd=%vd_sp p=0 u=1 +VLDM_VSTM_dp ---- 1100 1 . w:1 l:1 rn:4 .... 1011 imm:8 \ + vd=%vd_dp p=0 u=1 + +VLDM_VSTM_sp ---- 1101 0.1 l:1 rn:4 .... 1010 imm:8 \ + vd=%vd_sp p=1 u=0 w=1 +VLDM_VSTM_dp ---- 1101 0.1 l:1 rn:4 .... 1011 imm:8 \ + vd=%vd_dp p=1 u=0 w=1 From patchwork Tue Jun 11 10:53:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166410 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2233917ilk; Tue, 11 Jun 2019 04:31:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyclWkRL8ZOZZ4t+wiUyBmIsUEKiLT3KqVJcs3VLXXKhiQUgJP+IbHsEJ5uQ9PrJI1ZQvMJ X-Received: by 2002:a37:744:: with SMTP id 65mr46535991qkh.239.1560252660137; Tue, 11 Jun 2019 04:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560252660; cv=none; d=google.com; s=arc-20160816; b=v0nfFAV/7L+8M00KegRoNaAxUodHxA/CHtq10UHPOujMvArKV6n64RzWIlcF01+gpW TYj9XlFkhoVncHBZ/wbkAKMy3gGTaPq3wUR6fjbV43sNsHEmLJxNZOeSZSy3BQIYM1RT PmxHZHL+H1P+pK3ldkeFlI2/aYJMlDC8RAHNjGDX3Xr7FZdTcKB/59lMQBCRjE2bY7WI lLXdD4U+awnTT1WMG1AuEyPTD3aaKuE4SYkzptpqGwPybG7EcpyoJ99TAa1pi0B2qi6W eUZMdzwTHKtEfG7vq+z1Jc4FDPXe+ZDkZNa8agakQm4YDlAxKrmMcYBoVYS3cxdEQKwT 8phw== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=o1g1mlYqkXicG5tKMTS6P/rwrLfAalPOGhMe2aL61GY=; b=AigUZlBRwPpyFgc9R/Gy7sEpgkdllSLC5wvcs5sJ2ZXG37OSzDHQXweCmw+Akb9ItS pBCeEp02tvUR+eNtjrpPt7UbW1BRnTXRyjnY4ccTaTIf8cgjGX61rHeSUeDYdnbbMqJM TmPMd0znV23gQjQv9PvoxO9QoeC2hATMycznT7QCrR9pjYzppapWuDQORCid54dpmSvJ xOR6XT1DPNqTPihLPR16Wm56EMolx+MNDIdl27pcvt6wKxvoNExYWn4YyvICagEGIMFx PZpzVsmHQgxls6ln9erOlkbSu2tmMcHrEHMsCaclpzN6rEqfyJP5TDhoVlUAEinKNH4N /G/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yMYbKOQW; 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 k16si3196628qta.161.2019.06.11.04.31.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:31:00 -0700 (PDT) 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=yMYbKOQW; 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 ([::1]:56486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haezT-0006fX-OD for patch@linaro.org; Tue, 11 Jun 2019 07:30:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39232) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQ0-0007Jo-Ng for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePu-0007UU-W0 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:20 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:34579) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePu-0007QF-JU for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:14 -0400 Received: by mail-wr1-x443.google.com with SMTP id e16so12521305wrn.1 for ; Tue, 11 Jun 2019 03:54:13 -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 :mime-version:content-transfer-encoding; bh=o1g1mlYqkXicG5tKMTS6P/rwrLfAalPOGhMe2aL61GY=; b=yMYbKOQWsut0TtFHRpRd1JuyEAa9J2shtRO/Yndu3Y/YBbTluc/0NFnO9x2tfYPptS EqNCApf51R1Cxbyu28A9lLmsH20YPdAJ8oEBDUVxIjA7wtpakx6wNNC3LwcRRSjE7iye /ZTRph8K1Osx1v7jQOgSkIDnS1UIes825S6sp7KVekxOyau0i4KNNlxYhKmSNBpXYs0Z 7pBUilAGSkhipE3XisvrJVZoCtr7GKX7/4P9+Um/dXadcqmijYZo1DHoFRngRamGK3Bq 2NDqBiPsW8FFeAhjnz0iKlacEbcU4ccayGhnae9yu81uT+MqFMklDXahQwq4v0hq/V75 9Nrg== 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:mime-version:content-transfer-encoding; bh=o1g1mlYqkXicG5tKMTS6P/rwrLfAalPOGhMe2aL61GY=; b=rKC/kqJ6H8Rhwbux7wIAHMN6M6HBtcoM8pviAs9Wfi1OCf6XM1yk1JeXjh+CUdqQ1p jd1hkY/5oORZe1TQfdaygzs+4+2k30I5I1vn3HcN/XAuhP/BMMRmJ7xj2i1l35DgM1+2 L3hAwM4yHs4wjYdRoMYIq+L+VqSB1kucZpV1lSrCFI9M8GcI6bP5piITpREYr400e2rg 6KbMC9KY7vrM8pB0dwJxRHf5D1cTXoTDGlw5HNQk5YTdnQkdaodqjpmd4i+J1q2ZNOoX ckhAESb0xK0MR6+/h34CqG5flqO2m3fE7HJ9yD6TrN4rxVdSOUEDj5ZsTqHE7DATBteL Nopw== X-Gm-Message-State: APjAAAVYI18cJKM4og6fZjc1u/+fbZsc2N3a4XYlm7jGkjXAhPHSARz8 QqUQSOgFNqh+U9bwX01inlj6Ug== X-Received: by 2002:a5d:4bc7:: with SMTP id l7mr20781538wrt.96.1560250452059; Tue, 11 Jun 2019 03:54:12 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:11 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:26 +0100 Message-Id: <20190611105351.9871-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH v2 17/42] target/arm: Remove VLDR/VSTR/VLDM/VSTM use of cpu_F0s and cpu_F0d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Expand out the sequences in the new decoder VLDR/VSTR/VLDM/VSTM trans functions which perform the memory accesses by going via the TCG globals cpu_F0s and cpu_F0d, to use local TCG temps instead. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 46 +++++++++++++++++++++------------- target/arm/translate.c | 18 ------------- 2 files changed, 28 insertions(+), 36 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 32a1805e582..9729946d734 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -857,7 +857,7 @@ static bool trans_VMOV_64_dp(DisasContext *s, arg_VMOV_64_sp *a) static bool trans_VLDR_VSTR_sp(DisasContext *s, arg_VLDR_VSTR_sp *a) { uint32_t offset; - TCGv_i32 addr; + TCGv_i32 addr, tmp; if (!vfp_access_check(s)) { return true; @@ -876,13 +876,15 @@ static bool trans_VLDR_VSTR_sp(DisasContext *s, arg_VLDR_VSTR_sp *a) addr = load_reg(s, a->rn); } tcg_gen_addi_i32(addr, addr, offset); + tmp = tcg_temp_new_i32(); if (a->l) { - gen_vfp_ld(s, false, addr); - gen_mov_vreg_F0(false, a->vd); + gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); + neon_store_reg32(tmp, a->vd); } else { - gen_mov_F0_vreg(false, a->vd); - gen_vfp_st(s, false, addr); + neon_load_reg32(tmp, a->vd); + gen_aa32_st32(s, tmp, addr, get_mem_index(s)); } + tcg_temp_free_i32(tmp); tcg_temp_free_i32(addr); return true; @@ -892,6 +894,7 @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_sp *a) { uint32_t offset; TCGv_i32 addr; + TCGv_i64 tmp; /* UNDEF accesses to D16-D31 if they don't exist */ if (!dc_isar_feature(aa32_fp_d32, s) && (a->vd & 0x10)) { @@ -915,13 +918,15 @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_sp *a) addr = load_reg(s, a->rn); } tcg_gen_addi_i32(addr, addr, offset); + tmp = tcg_temp_new_i64(); if (a->l) { - gen_vfp_ld(s, true, addr); - gen_mov_vreg_F0(true, a->vd); + gen_aa32_ld64(s, tmp, addr, get_mem_index(s)); + neon_store_reg64(tmp, a->vd); } else { - gen_mov_F0_vreg(true, a->vd); - gen_vfp_st(s, true, addr); + neon_load_reg64(tmp, a->vd); + gen_aa32_st64(s, tmp, addr, get_mem_index(s)); } + tcg_temp_free_i64(tmp); tcg_temp_free_i32(addr); return true; @@ -930,7 +935,7 @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_sp *a) static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a) { uint32_t offset; - TCGv_i32 addr; + TCGv_i32 addr, tmp; int i, n; n = a->imm; @@ -976,18 +981,20 @@ static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a) } offset = 4; + tmp = tcg_temp_new_i32(); for (i = 0; i < n; i++) { if (a->l) { /* load */ - gen_vfp_ld(s, false, addr); - gen_mov_vreg_F0(false, a->vd + i); + gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); + neon_store_reg32(tmp, a->vd + i); } else { /* store */ - gen_mov_F0_vreg(false, a->vd + i); - gen_vfp_st(s, false, addr); + neon_load_reg32(tmp, a->vd + i); + gen_aa32_st32(s, tmp, addr, get_mem_index(s)); } tcg_gen_addi_i32(addr, addr, offset); } + tcg_temp_free_i32(tmp); if (a->w) { /* writeback */ if (a->p) { @@ -1006,6 +1013,7 @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a) { uint32_t offset; TCGv_i32 addr; + TCGv_i64 tmp; int i, n; n = a->imm >> 1; @@ -1056,18 +1064,20 @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a) } offset = 8; + tmp = tcg_temp_new_i64(); for (i = 0; i < n; i++) { if (a->l) { /* load */ - gen_vfp_ld(s, true, addr); - gen_mov_vreg_F0(true, a->vd + i); + gen_aa32_ld64(s, tmp, addr, get_mem_index(s)); + neon_store_reg64(tmp, a->vd + i); } else { /* store */ - gen_mov_F0_vreg(true, a->vd + i); - gen_vfp_st(s, true, addr); + neon_load_reg64(tmp, a->vd + i); + gen_aa32_st64(s, tmp, addr, get_mem_index(s)); } tcg_gen_addi_i32(addr, addr, offset); } + tcg_temp_free_i64(tmp); if (a->w) { /* writeback */ if (a->p) { diff --git a/target/arm/translate.c b/target/arm/translate.c index 5a9d0c30d3d..c197084e925 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1522,24 +1522,6 @@ VFP_GEN_FIX(uhto, ) VFP_GEN_FIX(ulto, ) #undef VFP_GEN_FIX -static inline void gen_vfp_ld(DisasContext *s, int dp, TCGv_i32 addr) -{ - if (dp) { - gen_aa32_ld64(s, cpu_F0d, addr, get_mem_index(s)); - } else { - gen_aa32_ld32u(s, cpu_F0s, addr, get_mem_index(s)); - } -} - -static inline void gen_vfp_st(DisasContext *s, int dp, TCGv_i32 addr) -{ - if (dp) { - gen_aa32_st64(s, cpu_F0d, addr, get_mem_index(s)); - } else { - gen_aa32_st32(s, cpu_F0s, addr, get_mem_index(s)); - } -} - static inline long vfp_reg_offset(bool dp, unsigned reg) { if (dp) { From patchwork Tue Jun 11 10:53:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166418 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2242324ilk; Tue, 11 Jun 2019 04:39:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqE5p0xIEeaH9dvIw0nml0XxIFGGCKiuoe5zkx0iXeDiYvyyLHUjdLG5yb4LTUra+PkyQO X-Received: by 2002:ac8:2fb7:: with SMTP id l52mr41053071qta.93.1560253163116; Tue, 11 Jun 2019 04:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253163; cv=none; d=google.com; s=arc-20160816; b=edzFNIzdCkxDkeYHJPDnm50UEX2shhnt7WxpKfThp0Cyq7MjYqz3cwi5gJ3mCkQ74O W+NgzfO0zlPZQJJRWuTujRoVZhOr8BQ2u9S8ZFO1BY8jbtgPoY2jJuE/CbgBkgBNSnzF ku4Mb8O4VeBV0/7xJrrQEW/TDDy9lA7HyhncK8MSvEuC44L+vEDSWluBYLsttAkpnlbi RbVpXJeFRpOsOhAIJ+3Gv/5bmJOSiRbWJNF9P5dYfJ6R1VGJBNAcr4Q+4R4l+qyYeV7u zgeFrgOtO0NGSUbswu7+g24MdY19DeHQRaCeLx9P7K4YtscI0P7VOSdWaZ0phVDzkXYu +3Fw== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=s9/u0akcCIg85H7Vc1XkEKAn1NROIwXMSxW/q0daj80=; b=McBoq8Wl7149iLzIlU+85ZdWEEOTQUJq7oMgQOueTaSc094bhh7yMgjiRGREte1HTa 8mMm/x1nRllQ9i1QjWKsXgXeQkkV+Q8NavpwgzH/wkpv97YzQTkvLMhw2bfwyJa1M4Qi t1T1qOKAsO2Lkt/NmNkZ6gkBoY9tehkh7xMGKr+W4l1UiIF8yiUe3nIHqG6YCv/eYiWt j1TmtwSfVMl2aesiMgUKzX7wHkysLy71K/Kfh+kRIFl4d0CwQ1HhoazcWy3NMxdiywOo FCw9wz4dRMVliYzbNiQMhcHI463pfy614FXjdMaQMklg/+qqlqc8FYGOzM3WpE6jgML+ pT8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pH1zbHaJ; 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 f20si51137qte.401.2019.06.11.04.39.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:39:23 -0700 (PDT) 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=pH1zbHaJ; 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 ([::1]:56538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haf7a-00053y-Lf for patch@linaro.org; Tue, 11 Jun 2019 07:39:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39326) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQ3-0007Mg-Lf for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePv-0007Uw-8A for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:23 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:32810) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePu-0007Sf-P2 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:14 -0400 Received: by mail-wm1-x344.google.com with SMTP id h19so1657990wme.0 for ; Tue, 11 Jun 2019 03:54:14 -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 :mime-version:content-transfer-encoding; bh=s9/u0akcCIg85H7Vc1XkEKAn1NROIwXMSxW/q0daj80=; b=pH1zbHaJKS00mhHJxVNPovRHmir8D9s5qBTflU0VhwPop60+F/ieY+bI9T2C5ptSUp wGfK3Xx2wIC4/DQac49/ZmI7sHYaT03ah+KK6nwBsrP4o4MOsHzaHbrqQ72IKsSZKl1m cPXg36l55wFCMTB+1U8lZ8yjXchnZKowvyEyYy8+EiDNR88nVjdDrxT7Cx/aAkK75rCo +mCbVzykeNhk4MUSh7ZpN1/6OiaaUoVtRMp//EX5TstsjlHRnG0LHsw89DtfdIP9Rx0j 77Sc0uUx4PhLEQ2IyKDW7HHv48UpeVLliBj6/Dhbx8Qg1RwkaGVzokkCkXm0uMY7Ga4H Hj2w== 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:mime-version:content-transfer-encoding; bh=s9/u0akcCIg85H7Vc1XkEKAn1NROIwXMSxW/q0daj80=; b=Od3FBKlRo6GyjXdgSXU+bh1+wF5N23ljnQgmg+U4bPlZgG9XgbkO79NoBUwfGl9m4I OaNeAxeb/1Th9u0tge268mILS/1n1dwRaj/lvXbiNuBWl+FetOb2uCpSyrL+MqQEiFr7 vP21qitTW9rdvT6RV+fgtat9JvLNVKIfZFKGJcEgZOJF6Qb6m9Msd9kJ7Em+CqTFRjrF jaFpMvCpGaJh+Wl4jdxOIPHaTGWtXaJrf/1Z5I6/cgUfOGhWEtw2yrGLTMk3o6pOe1rJ 6E/1wMGEqzJK8vg4TtfVvXvzn0TZ1h4ZVzgqcC9tBIgHN/T4seXjuUZPi8BoxJCHKk40 S7TA== X-Gm-Message-State: APjAAAWm36DdNFOl+l3ZOSuRukZuZw9m8eJoyPqMi45Wgit3QBJmiZ8U 03K1J5BSK14ou4mXvhIGgGr+qSCwBJXNZw== X-Received: by 2002:a1c:e715:: with SMTP id e21mr18045164wmh.16.1560250453483; Tue, 11 Jun 2019 03:54:13 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:12 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:27 +0100 Message-Id: <20190611105351.9871-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH v2 18/42] target/arm: Convert VFP VMLA to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP VMLA instruction to decodetree. This is the first of the VFP 3-operand data processing instructions, so we include in this patch the code which loops over the elements for an old-style VFP vector operation. The existing code to do this looping uses the deprecated cpu_F0s/F0d/F1s/F1d TCG globals; since we are going to be converting instructions one at a time anyway we can take the opportunity to make the new loop use TCG temporaries, which means we can do that conversion one operation at a time rather than needing to do it all in one go. We include an UNDEF check which was missing in the old code: short-vector operations (with stride or length non-zero) were deprecated in v7A and must UNDEF in v8A, so if the MVFR0 FPShVec field does not indicate that support for short vectors is present we UNDEF the operations that would use them. (This is a change of behaviour for Cortex-A7, Cortex-A15 and the v8 CPUs, which previously were all incorrectly allowing short-vector operations.) Note that the conversion fixes a bug in the old code for the case of VFP short-vector "mixed scalar/vector operations". These happen where the destination register is in a vector bank but but the second operand is in a scalar bank. For example vmla.f64 d10, d1, d16 with length 2 stride 2 is equivalent to the pair of scalar operations vmla.f64 d10, d1, d16 vmla.f64 d8, d3, d16 where the destination and first input register cycle through their vector but the second input is scalar (d16). In the old decoder the gen_vfp_F1_mul() operation uses cpu_F1{s,d} as a temporary output for the multiply, which trashes the second input operand. For the fully-scalar case (where we never do a second iteration) and the fully-vector case (where the loop loads the new second input operand) this doesn't matter, but for the mixed scalar/vector case we will end up using the wrong value for later loop iterations. In the new code we use TCG temporaries and so avoid the bug. This bug is present for all the multiply-accumulate insns that operate on short vectors: VMLA, VMLS, VNMLA, VNMLS. Note 2: the expression used to calculate the next register number in the vector bank is not in fact correct; we leave this behaviour unchanged from the old decoder and will fix this bug later in the series. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 5 + target/arm/translate-vfp.inc.c | 205 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 14 ++- target/arm/vfp.decode | 6 + 4 files changed, 224 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index c612901daeb..135deb9cd62 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3378,6 +3378,11 @@ static inline bool isar_feature_aa32_fp_d32(const ARMISARegisters *id) return FIELD_EX64(id->mvfr0, MVFR0, SIMDREG) >= 2; } +static inline bool isar_feature_aa32_fpshvec(const ARMISARegisters *id) +{ + return FIELD_EX64(id->mvfr0, MVFR0, FPSHVEC) > 0; +} + /* * We always set the FP and SIMD FP16 fields to indicate identical * levels of support (assuming SIMD is implemented at all), so diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 9729946d734..4f922dc8405 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1098,3 +1098,208 @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a) return true; } + +/* + * Types for callbacks for do_vfp_3op_sp() and do_vfp_3op_dp(). + * The callback should emit code to write a value to vd. If + * do_vfp_3op_{sp,dp}() was passed reads_vd then the TCGv vd + * will contain the old value of the relevant VFP register; + * otherwise it must be written to only. + */ +typedef void VFPGen3OpSPFn(TCGv_i32 vd, + TCGv_i32 vn, TCGv_i32 vm, TCGv_ptr fpst); +typedef void VFPGen3OpDPFn(TCGv_i64 vd, + TCGv_i64 vn, TCGv_i64 vm, TCGv_ptr fpst); + +/* + * Perform a 3-operand VFP data processing instruction. fn is the + * callback to do the actual operation; this function deals with the + * code to handle looping around for VFP vector processing. + */ +static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn, + int vd, int vn, int vm, bool reads_vd) +{ + uint32_t delta_m = 0; + uint32_t delta_d = 0; + uint32_t bank_mask = 0; + int veclen = s->vec_len; + TCGv_i32 f0, f1, fd; + TCGv_ptr fpst; + + if (!dc_isar_feature(aa32_fpshvec, s) && + (veclen != 0 || s->vec_stride != 0)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (veclen > 0) { + bank_mask = 0x18; + + /* Figure out what type of vector operation this is. */ + if ((vd & bank_mask) == 0) { + /* scalar */ + veclen = 0; + } else { + delta_d = s->vec_stride + 1; + + if ((vm & bank_mask) == 0) { + /* mixed scalar/vector */ + delta_m = 0; + } else { + /* vector */ + delta_m = delta_d; + } + } + } + + f0 = tcg_temp_new_i32(); + f1 = tcg_temp_new_i32(); + fd = tcg_temp_new_i32(); + fpst = get_fpstatus_ptr(0); + + neon_load_reg32(f0, vn); + neon_load_reg32(f1, vm); + + for (;;) { + if (reads_vd) { + neon_load_reg32(fd, vd); + } + fn(fd, f0, f1, fpst); + neon_store_reg32(fd, vd); + + if (veclen == 0) { + break; + } + + /* Set up the operands for the next iteration */ + veclen--; + vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + vn = ((vn + delta_d) & (bank_mask - 1)) | (vn & bank_mask); + neon_load_reg32(f0, vn); + if (delta_m) { + vm = ((vm + delta_m) & (bank_mask - 1)) | (vm & bank_mask); + neon_load_reg32(f1, vm); + } + } + + tcg_temp_free_i32(f0); + tcg_temp_free_i32(f1); + tcg_temp_free_i32(fd); + tcg_temp_free_ptr(fpst); + + return true; +} + +static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, + int vd, int vn, int vm, bool reads_vd) +{ + uint32_t delta_m = 0; + uint32_t delta_d = 0; + uint32_t bank_mask = 0; + int veclen = s->vec_len; + TCGv_i64 f0, f1, fd; + TCGv_ptr fpst; + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (!dc_isar_feature(aa32_fp_d32, s) && ((vd | vn | vm) & 0x10)) { + return false; + } + + if (!dc_isar_feature(aa32_fpshvec, s) && + (veclen != 0 || s->vec_stride != 0)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (veclen > 0) { + bank_mask = 0xc; + + /* Figure out what type of vector operation this is. */ + if ((vd & bank_mask) == 0) { + /* scalar */ + veclen = 0; + } else { + delta_d = (s->vec_stride >> 1) + 1; + + if ((vm & bank_mask) == 0) { + /* mixed scalar/vector */ + delta_m = 0; + } else { + /* vector */ + delta_m = delta_d; + } + } + } + + f0 = tcg_temp_new_i64(); + f1 = tcg_temp_new_i64(); + fd = tcg_temp_new_i64(); + fpst = get_fpstatus_ptr(0); + + neon_load_reg64(f0, vn); + neon_load_reg64(f1, vm); + + for (;;) { + if (reads_vd) { + neon_load_reg64(fd, vd); + } + fn(fd, f0, f1, fpst); + neon_store_reg64(fd, vd); + + if (veclen == 0) { + break; + } + /* Set up the operands for the next iteration */ + veclen--; + vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + vn = ((vn + delta_d) & (bank_mask - 1)) | (vn & bank_mask); + neon_load_reg64(f0, vn); + if (delta_m) { + vm = ((vm + delta_m) & (bank_mask - 1)) | (vm & bank_mask); + neon_load_reg64(f1, vm); + } + } + + tcg_temp_free_i64(f0); + tcg_temp_free_i64(f1); + tcg_temp_free_i64(fd); + tcg_temp_free_ptr(fpst); + + return true; +} + +static void gen_VMLA_sp(TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm, TCGv_ptr fpst) +{ + /* Note that order of inputs to the add matters for NaNs */ + TCGv_i32 tmp = tcg_temp_new_i32(); + + gen_helper_vfp_muls(tmp, vn, vm, fpst); + gen_helper_vfp_adds(vd, vd, tmp, fpst); + tcg_temp_free_i32(tmp); +} + +static bool trans_VMLA_sp(DisasContext *s, arg_VMLA_sp *a) +{ + return do_vfp_3op_sp(s, gen_VMLA_sp, a->vd, a->vn, a->vm, true); +} + +static void gen_VMLA_dp(TCGv_i64 vd, TCGv_i64 vn, TCGv_i64 vm, TCGv_ptr fpst) +{ + /* Note that order of inputs to the add matters for NaNs */ + TCGv_i64 tmp = tcg_temp_new_i64(); + + gen_helper_vfp_muld(tmp, vn, vm, fpst); + gen_helper_vfp_addd(vd, vd, tmp, fpst); + tcg_temp_free_i64(tmp); +} + +static bool trans_VMLA_dp(DisasContext *s, arg_VMLA_sp *a) +{ + return do_vfp_3op_dp(s, gen_VMLA_dp, a->vd, a->vn, a->vm, true); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index c197084e925..4e40a8562c4 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3133,6 +3133,14 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) op = ((insn >> 20) & 8) | ((insn >> 19) & 6) | ((insn >> 6) & 1); rn = VFP_SREG_N(insn); + switch (op) { + case 0: + /* Already handled by decodetree */ + return 1; + default: + break; + } + if (op == 15) { /* rn is opcode, encoded as per VFP_SREG_N. */ switch (rn) { @@ -3312,12 +3320,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 0: /* VMLA: fd + (fn * fm) */ - /* Note that order of inputs to the add matters for NaNs */ - gen_vfp_F1_mul(dp); - gen_mov_F0_vreg(dp, rd); - gen_vfp_add(dp); - break; case 1: /* VMLS: fd + -(fn * fm) */ gen_vfp_mul(dp); gen_vfp_F1_neg(dp); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 68c9ffcfd3c..9530e17ae02 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -96,3 +96,9 @@ VLDM_VSTM_sp ---- 1101 0.1 l:1 rn:4 .... 1010 imm:8 \ vd=%vd_sp p=1 u=0 w=1 VLDM_VSTM_dp ---- 1101 0.1 l:1 rn:4 .... 1011 imm:8 \ vd=%vd_dp p=1 u=0 w=1 + +# 3-register VFP data-processing; bits [23,21:20,6] identify the operation. +VMLA_sp ---- 1110 0.00 .... .... 1010 .0.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp +VMLA_dp ---- 1110 0.00 .... .... 1011 .0.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp From patchwork Tue Jun 11 10:53:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166393 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2207418ilk; Tue, 11 Jun 2019 04:06:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfvDQ2LhnUxAXbMMh9W4WN1QegpaszoZe1uulkrSugH3d09vrqIEvDGhNxD0CV9r6FTlf2 X-Received: by 2002:a37:4e8f:: with SMTP id c137mr23427080qkb.127.1560251184259; Tue, 11 Jun 2019 04:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251184; cv=none; d=google.com; s=arc-20160816; b=GNeHJqIQRAYxJQ7zIgzGtP257w5FQXWVUeskQibHb4dylvrQy3uJw/1Z1cGArdeqkd /p1hE7BPwJNsOCg6bs8dEEA4EBUBZndHXIs1od6c5KNamh2vuiqmazfDV1gjWhDorvcN AHdfp88A0OR2hdbTGWXFFYZL4/6MspmQkrJjHk6sLXHyPF4JpDKb0D6lZFxSmZ0b/Rma mhOPnKAzDguODW8/S+UphlxsqIMgHhWVqDZF5kASMxm+AN7jwACAa5q3xpop2QE5UyyO nrRD+Q+a5BU95CN+PztZPnPSzS5tJnpmO4kZWSopKTeas0UyyWSuP5Fba0OyPLFi6K2i 2b5Q== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=CMrwrOJ95kW4T6/b8G/qtF8+mC0+yLfbGLY5ikylyb4=; b=QqUO2K+SCcZ38PuODIwdyCeFtPRYgJYTNsKtvKYvtyc/bWal9TkdO5bwKxhXD0gscK czvXV5Mv+J409d5fvAztjeW25KSS5ocfiVm2UHr8dJqTDNrH2d1W6SbvQyxa91oY323u bEYPlrBoQEbkcBNcfO91OVHhVmXRUTeZFkBC26gvyiAhpaBLmlJDADQZ4wL7gjmyYuBx XZYPcPk1eZIpbAStLY2dnsU3A+cIVlcjJBvZ+vGhrzaq/HZMcTwUyJqD3/i+abTMxkY7 fvnr+OCLzYRpv6xQlQWyKbq7AwJQN5EIL9Gg1QaOg/QhsCKEmnCJleQKiUeVCUCvTQ54 3xCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=j5WAFGK3; 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 x14si75286qth.58.2019.06.11.04.06.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:06:24 -0700 (PDT) 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=j5WAFGK3; 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 ([::1]:56262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haebf-0001ay-IV for patch@linaro.org; Tue, 11 Jun 2019 07:06:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39328) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQ3-0007Mo-Mm for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePy-0007XY-13 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:23 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:51682) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePx-0007Un-LD for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:17 -0400 Received: by mail-wm1-x341.google.com with SMTP id 207so2438343wma.1 for ; Tue, 11 Jun 2019 03:54:15 -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 :mime-version:content-transfer-encoding; bh=CMrwrOJ95kW4T6/b8G/qtF8+mC0+yLfbGLY5ikylyb4=; b=j5WAFGK3YwuUVLpCXXs+wSIwwcaCGhtbd+umCM6gl/H5cR+dllX9OTNvTbHPyCUt09 ZZbkd95C15o8hMp5JAxw8VQu99/KQuDwbSR9GBjKMruDwlLD318v0GmTeFcaiKYXGYtF tF6wgURuRvF5v4DkR/j6syJCIIekMjG9xTyL7mDHEDPjSxjcuR/6/UJhuYNciSbjE9hL cu0tAPmy5SklILvJWbySLEYXBZrX7bJr53DAvdFp+WnpKwo8A+H38mSOI0B3mWBQK82Q Stj00goUwio0MSSyc4ZDfg9oMbtAsdDMeQ3Tb3IfHxJojNnQhI2NmKyq/MLKDkaV9l7G pn9g== 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:mime-version:content-transfer-encoding; bh=CMrwrOJ95kW4T6/b8G/qtF8+mC0+yLfbGLY5ikylyb4=; b=gjc6ssZ9nHcY4Lc4/rxA4D1kWi/9jWlZoGCsw+CrdAUdWk6qf9gR8xcYucEylkltf0 imAcGQhWKv9cOmsdDGW1cJOUprJr7+aPjQE5Jl4r0cYULYpL1+zt8bk7MdC6a/+xMYIe IlVrLz/l6mCHF8NREb54qcBFe6x9Zmb608lfO6VEHcwQxv8dvAOkpp/nX1iZYF6IlJvA BYHXI4y507O379/hSxvoOdcuZJrhbkzPuNwD2Fo5Pg7ZdPT5/m8lZlXOoKBGcbpoe6Dg KFXCrvKURxYxKkFVkC5gFzvi/y6i4kbNuK0ui1yDX6swSaJiMJeG9iJi9DFa6g6z7PUc nO3A== X-Gm-Message-State: APjAAAVUu2exagX26eqCLGBPbKVOnpOHKvMnA8Pcr8K+R3VgAL2xGakG ps6NIYWPlITxDOcZpeE2IEEy5A== X-Received: by 2002:a1c:a983:: with SMTP id s125mr16394297wme.18.1560250454758; Tue, 11 Jun 2019 03:54:14 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:13 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:28 +0100 Message-Id: <20190611105351.9871-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v2 19/42] target/arm: Convert VFP VMLS to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP VMLS instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 38 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 8 +------ target/arm/vfp.decode | 5 +++++ 3 files changed, 44 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 4f922dc8405..00f64401dda 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1303,3 +1303,41 @@ static bool trans_VMLA_dp(DisasContext *s, arg_VMLA_sp *a) { return do_vfp_3op_dp(s, gen_VMLA_dp, a->vd, a->vn, a->vm, true); } + +static void gen_VMLS_sp(TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm, TCGv_ptr fpst) +{ + /* + * VMLS: vd = vd + -(vn * vm) + * Note that order of inputs to the add matters for NaNs. + */ + TCGv_i32 tmp = tcg_temp_new_i32(); + + gen_helper_vfp_muls(tmp, vn, vm, fpst); + gen_helper_vfp_negs(tmp, tmp); + gen_helper_vfp_adds(vd, vd, tmp, fpst); + tcg_temp_free_i32(tmp); +} + +static bool trans_VMLS_sp(DisasContext *s, arg_VMLS_sp *a) +{ + return do_vfp_3op_sp(s, gen_VMLS_sp, a->vd, a->vn, a->vm, true); +} + +static void gen_VMLS_dp(TCGv_i64 vd, TCGv_i64 vn, TCGv_i64 vm, TCGv_ptr fpst) +{ + /* + * VMLS: vd = vd + -(vn * vm) + * Note that order of inputs to the add matters for NaNs. + */ + TCGv_i64 tmp = tcg_temp_new_i64(); + + gen_helper_vfp_muld(tmp, vn, vm, fpst); + gen_helper_vfp_negd(tmp, tmp); + gen_helper_vfp_addd(vd, vd, tmp, fpst); + tcg_temp_free_i64(tmp); +} + +static bool trans_VMLS_dp(DisasContext *s, arg_VMLS_sp *a) +{ + return do_vfp_3op_dp(s, gen_VMLS_dp, a->vd, a->vn, a->vm, true); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 4e40a8562c4..bddc0d20447 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3134,7 +3134,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0: + case 0 ... 1: /* Already handled by decodetree */ return 1; default: @@ -3320,12 +3320,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 1: /* VMLS: fd + -(fn * fm) */ - gen_vfp_mul(dp); - gen_vfp_F1_neg(dp); - gen_mov_F0_vreg(dp, rd); - gen_vfp_add(dp); - break; case 2: /* VNMLS: -fd + (fn * fm) */ /* Note that it isn't valid to replace (-A + B) with (B - A) * or similar plausible looking simplifications diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 9530e17ae02..7bcf2260eec 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -102,3 +102,8 @@ VMLA_sp ---- 1110 0.00 .... .... 1010 .0.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp VMLA_dp ---- 1110 0.00 .... .... 1011 .0.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp + +VMLS_sp ---- 1110 0.00 .... .... 1010 .1.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp +VMLS_dp ---- 1110 0.00 .... .... 1011 .1.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp From patchwork Tue Jun 11 10:53:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166401 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2219449ilk; Tue, 11 Jun 2019 04:16:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmY00mxjkAdyLrB85A8/+R0U11LvzpoEfitynDfumxmTVt6ghK3K81u/kokEUqjr5Gaev7 X-Received: by 2002:ac8:2ac5:: with SMTP id c5mr59374895qta.332.1560251803378; Tue, 11 Jun 2019 04:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251803; cv=none; d=google.com; s=arc-20160816; b=kQeRhUSody4uzzRZNw4NIA15fn67n3mOAeuQEm7KJyhEO7Flmx6U9eoJooS6gg1EKH lBkT7oiZu65K82iFw1mCIlF4+GGprCKetKgnr1jwSSGwc5HW/+4+7Q9ruNUnY+cl8NMA 6fj+Ee/e4LpkhTPT1kAPvpfnTby2+DukSNNkMVTBocc8fZBDMTXniIfxrxowAs7aX94/ iAiPNJzUWkETPz90Jz+tBTCr9DFh16QP5CQiYYAXQJNm48rrd2m6nqsPf/il+il6BSAq IuFeD3RsRMNZq9hQoeq+NRTw9/3Xs0wpc/w2GeAw8MYUVyETNi4q8Pz4H5tEtDSJk28j giAA== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=n3MASxtEnCokj3COittArwSNYGq/3JuuvGmF9r8yZL4=; b=y/o+Ob0iTwtNdCH3xOJ0EEOD9+LjzkkOdhqTir8JL76khaSuJIbqVMRTwfwnzhk483 QSP2j1A5QiLkcz72HzJ8PjYIO182Qe2GymXIztuok0txEQOwdmjeMVnyidjFhzUR+b/H EEqbVg8m0iguDr0RS8Lgmo3ENS/Crgglny4NyuxO9LHcpe9oCRdsrcIDQw0Hre2Hp27P dcvmVzuwaY7Kv/jU8pZnBSDlml0OjiMCicxVRpC2gx5pV07Is+32cV+t/y7GtZjFbZEX cAQMgL50PwkDpgdOF+x0i/3vL3OmyhlvLKtJ5URa0oFFG/d8+mWEtWwpZx6oJL7P8nDb 1kdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MCaF04hc; 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 j91si7594986qte.107.2019.06.11.04.16.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:16:43 -0700 (PDT) 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=MCaF04hc; 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 ([::1]:56328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haele-0001Qx-VB for patch@linaro.org; Tue, 11 Jun 2019 07:16:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39330) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQ3-0007Ms-P0 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePx-0007XL-TS for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:23 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:40884) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePx-0007Vs-JV for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:17 -0400 Received: by mail-wm1-x342.google.com with SMTP id v19so2374414wmj.5 for ; Tue, 11 Jun 2019 03:54:16 -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 :mime-version:content-transfer-encoding; bh=n3MASxtEnCokj3COittArwSNYGq/3JuuvGmF9r8yZL4=; b=MCaF04hcvXMGxWhChHTbxUZ9Wo/z5+TCTzJFIiD2+xbdVG3SZNf5v6Xyqlgwxx4y6E hMF4sfVKW9vXb8LlNkNgz1evoj9o4SzS93+IhNVI2CqOA15G1HrqRghNl0QJQ+CJOcB6 +IpyQupcx2r0uHzw4m9QK2wANVpR3WgeMNWYQONfqDhuAWgUhxgpP+weAP+tTqCtTF1L Nxy5ypQVbrRAa4q8meD5Tm/yR9iAVhkJnGAV+FTYPTevRRHFiUBcZQXQF61Oz3nAYvZN zbsJPi18ScPR3qhdyXmqKx+BWGdPgw4NoQSP4fuRWGExi3R2NXhqQdovkxpIugFrybA0 Q/EA== 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:mime-version:content-transfer-encoding; bh=n3MASxtEnCokj3COittArwSNYGq/3JuuvGmF9r8yZL4=; b=Qy+Q3DtssXg/ZKI+Sq+rPqXVqZFVUpNqjHN7h80J68E7OcVql8tBw2WsJn6cmoCNnI qowMgWPt18OmxekRH6+rTdKFniNNGBa+ylZtc9m/P5Q+hKr8uGziawIOfLwTUa8v80t8 i/n0YbdIAFMBb2wwmsAqAjSPEYPHSj0HQdUuSI4XWEbBsV/kcsIUhpINJd8OcCx4PVpv MtegJ8TK0PdChqTkWMpj8syZXsWAnAhkrjOT2LFad72MTkvgUJivxLgG3D9I4baBdURB Be+Z343AVfpp8bYZWXpiDYU+Vy2LKpMxACMIfF2fTfb4pcbYux/eQmogyuEehB9tJ3dU 3y2A== X-Gm-Message-State: APjAAAVG57lulVmUi3gMyU3x2yomJGqe7tOSOTAZ4KqSvUO99/fkE147 WfmGnSoxQ2UXPpHoZJiYAyOgSg== X-Received: by 2002:a05:600c:2383:: with SMTP id m3mr15719919wma.20.1560250455854; Tue, 11 Jun 2019 03:54:15 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:15 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:29 +0100 Message-Id: <20190611105351.9871-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 20/42] target/arm: Convert VFP VNMLS to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP VNMLS instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 42 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 24 +------------------ target/arm/vfp.decode | 5 ++++ 3 files changed, 48 insertions(+), 23 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 00f64401dda..1d7100debe4 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1341,3 +1341,45 @@ static bool trans_VMLS_dp(DisasContext *s, arg_VMLS_sp *a) { return do_vfp_3op_dp(s, gen_VMLS_dp, a->vd, a->vn, a->vm, true); } + +static void gen_VNMLS_sp(TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm, TCGv_ptr fpst) +{ + /* + * VNMLS: -fd + (fn * fm) + * Note that it isn't valid to replace (-A + B) with (B - A) or similar + * plausible looking simplifications because this will give wrong results + * for NaNs. + */ + TCGv_i32 tmp = tcg_temp_new_i32(); + + gen_helper_vfp_muls(tmp, vn, vm, fpst); + gen_helper_vfp_negs(vd, vd); + gen_helper_vfp_adds(vd, vd, tmp, fpst); + tcg_temp_free_i32(tmp); +} + +static bool trans_VNMLS_sp(DisasContext *s, arg_VNMLS_sp *a) +{ + return do_vfp_3op_sp(s, gen_VNMLS_sp, a->vd, a->vn, a->vm, true); +} + +static void gen_VNMLS_dp(TCGv_i64 vd, TCGv_i64 vn, TCGv_i64 vm, TCGv_ptr fpst) +{ + /* + * VNMLS: -fd + (fn * fm) + * Note that it isn't valid to replace (-A + B) with (B - A) or similar + * plausible looking simplifications because this will give wrong results + * for NaNs. + */ + TCGv_i64 tmp = tcg_temp_new_i64(); + + gen_helper_vfp_muld(tmp, vn, vm, fpst); + gen_helper_vfp_negd(vd, vd); + gen_helper_vfp_addd(vd, vd, tmp, fpst); + tcg_temp_free_i64(tmp); +} + +static bool trans_VNMLS_dp(DisasContext *s, arg_VNMLS_sp *a) +{ + return do_vfp_3op_dp(s, gen_VNMLS_dp, a->vd, a->vn, a->vm, true); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index bddc0d20447..b3d0648bb50 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1393,18 +1393,6 @@ VFP_OP2(div) #undef VFP_OP2 -static inline void gen_vfp_F1_mul(int dp) -{ - /* Like gen_vfp_mul() but put result in F1 */ - TCGv_ptr fpst = get_fpstatus_ptr(0); - if (dp) { - gen_helper_vfp_muld(cpu_F1d, cpu_F0d, cpu_F1d, fpst); - } else { - gen_helper_vfp_muls(cpu_F1s, cpu_F0s, cpu_F1s, fpst); - } - tcg_temp_free_ptr(fpst); -} - static inline void gen_vfp_F1_neg(int dp) { /* Like gen_vfp_neg() but put result in F1 */ @@ -3134,7 +3122,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0 ... 1: + case 0 ... 2: /* Already handled by decodetree */ return 1; default: @@ -3320,16 +3308,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 2: /* VNMLS: -fd + (fn * fm) */ - /* Note that it isn't valid to replace (-A + B) with (B - A) - * or similar plausible looking simplifications - * because this will give wrong results for NaNs. - */ - gen_vfp_F1_mul(dp); - gen_mov_F0_vreg(dp, rd); - gen_vfp_neg(dp); - gen_vfp_add(dp); - break; case 3: /* VNMLA: -fd + -(fn * fm) */ gen_vfp_mul(dp); gen_vfp_F1_neg(dp); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 7bcf2260eec..08e4f427408 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -107,3 +107,8 @@ VMLS_sp ---- 1110 0.00 .... .... 1010 .1.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp VMLS_dp ---- 1110 0.00 .... .... 1011 .1.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp + +VNMLS_sp ---- 1110 0.01 .... .... 1010 .0.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp +VNMLS_dp ---- 1110 0.01 .... .... 1011 .0.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp From patchwork Tue Jun 11 10:53:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166398 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2212755ilk; Tue, 11 Jun 2019 04:11:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzj+BMtEdTT1SoBXDFJA+NReHHhQhhgGiLozvW4Mpa0MDry06TRSpJquc42wX94sbmeYnHV X-Received: by 2002:a37:a648:: with SMTP id p69mr45794451qke.136.1560251461349; Tue, 11 Jun 2019 04:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251461; cv=none; d=google.com; s=arc-20160816; b=mnB6wzogQOVQuN0TNY8RTB6HRrPV4Z+f3z2xMgLRWUncTpr/26CLzZ9Lk0F8/EVsBl OlfBOwf5AIG1M5XapkrumljVnCnZ25WS6XTOLF/9ubNcoKdVovlEmyNzxT7MJ55CtiWN 82ET6/dtATPgo+vETU4dOHOzJ3kKJp2cgCJDWF9MYc0DMyveKTzNioyQBt1RatNGb9+K HTza9zqp5t2gh0xdH9FmVB51kmBb670n9slZhB/bEqkpIhagLcpwyVjbQbVjSGFkF0bS YgweWf766GRZxjH29G36M0YCi72Myd48COip66a56kC8Vyx7Bav5aNWgia+umhYdmk+3 /erg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=cK7JkilQieDkUn82Nw1HdIxAvdbLi1r9HYhhZBb3zbw=; b=FiVGsf39XMs0sLVAGi8IUTREDHMh+Dk4kquiooZQaTeRch9EEdF7B8a97htT4KCgWT cL6XPP5yY/T5a45vMwAo6y8mmIo0RxTfjahElSZd07Z1QVhG5MLzXdhrzg6Q/0+gDi60 mumc3JNMlkpKuatF+HqR5LYP9SrHGZqOM8R9IsqpgzO8tw6XxO8slrOKRKzeTfJ/f5zJ 2Tl8SXBTP7gw4wV35d9I8Ufk56QrwBYlGGvv70U3J43naVuam6wVZ7a/heQYetA1+Lvb u+J86nyfK6Fnh+LlmKIDfpvTPV2XRjYxxeZDIrAlS11NQQecyx+yKsoHlGpV8JEmIQ/U wjnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jrY2w58p; 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 39si3318426qtr.30.2019.06.11.04.11.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:11:01 -0700 (PDT) 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=jrY2w58p; 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 ([::1]:56294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeg8-0006NQ-VB for patch@linaro.org; Tue, 11 Jun 2019 07:11:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39331) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQ3-0007Mt-Pv for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePy-0007Xl-2d for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:23 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:56298) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePx-0007WS-P2 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:17 -0400 Received: by mail-wm1-x343.google.com with SMTP id a15so2410654wmj.5 for ; Tue, 11 Jun 2019 03:54:17 -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 :mime-version:content-transfer-encoding; bh=cK7JkilQieDkUn82Nw1HdIxAvdbLi1r9HYhhZBb3zbw=; b=jrY2w58p5/FPOklE7DpeP1DdQbEpg86SDopTlM+5PKQQSjAkAqkoP95xHOOoj1GF7n YrcS2uK/iucVz8Assl8ExlgojXF5TcnuDBTZLMZazJmPD0orPU9eueQaMMdqdUMlQt80 NFTHTXFPotdS7fREjOnsqV9E2Xj7+mC2Qb2NMi4ustzSffBUt7dSJ9JwaXFxjffplin3 Bj0mSydensa5U0D9viZJYS1lUM8MhbQxB8VJ0jR+EyeoTzDz4nzWZQhmPC0kQEx9KZUT /rALcNoBY+se0+It0cQ6raNB6oBshms6G9I8xJ50kMlPWIaT22vXhbkBWDZX5ewmgdky ppWQ== 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:mime-version:content-transfer-encoding; bh=cK7JkilQieDkUn82Nw1HdIxAvdbLi1r9HYhhZBb3zbw=; b=bkxScvhnr/FJZX3mQqU+nXezg1m9OZvS8DYTTaLiKbPdTNb5Cb1nmhdhJqcGKPK6FD DMuFt5zI5yfkUwETEzkv8kRefKVVCpQuHwDHCCWERGRsbi6GHqNvDNuLKxb7kp/SGaKX fstMK06py7jWAMlQCMQvB3KkPiehmChnO1HhHtPGSAAjFoCKO85n5vv9lNpwSzq2YVFf KF9C5WnWP9JNWn/h7rlGvLdfcTPgVqwDDxxNi4Or88PuTKLfC+uyIvGE/3TXqv1m1uha UVt9zlRjGToVWM+QScVaGphhtCfiQROjJKPE4hKFl7jwx4Upjdu8chBySDh9NCHB0nPe WqbQ== X-Gm-Message-State: APjAAAUvXihoRe2U+DIW2QIyXStHG/3JkRWeq2iuGrRXMXAdOdeFPbd1 voXKaI7w6SODu1ahfGfHTixP5y503/xTHw== X-Received: by 2002:a1c:3c8a:: with SMTP id j132mr17006597wma.172.1560250456796; Tue, 11 Jun 2019 03:54:16 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:16 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:30 +0100 Message-Id: <20190611105351.9871-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH v2 21/42] target/arm: Convert VFP VNMLA to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP VNMLA instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 34 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 19 +------------------ target/arm/vfp.decode | 5 +++++ 3 files changed, 40 insertions(+), 18 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 1d7100debe4..8532bf4abcd 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1383,3 +1383,37 @@ static bool trans_VNMLS_dp(DisasContext *s, arg_VNMLS_sp *a) { return do_vfp_3op_dp(s, gen_VNMLS_dp, a->vd, a->vn, a->vm, true); } + +static void gen_VNMLA_sp(TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm, TCGv_ptr fpst) +{ + /* VNMLA: -fd + -(fn * fm) */ + TCGv_i32 tmp = tcg_temp_new_i32(); + + gen_helper_vfp_muls(tmp, vn, vm, fpst); + gen_helper_vfp_negs(tmp, tmp); + gen_helper_vfp_negs(vd, vd); + gen_helper_vfp_adds(vd, vd, tmp, fpst); + tcg_temp_free_i32(tmp); +} + +static bool trans_VNMLA_sp(DisasContext *s, arg_VNMLA_sp *a) +{ + return do_vfp_3op_sp(s, gen_VNMLA_sp, a->vd, a->vn, a->vm, true); +} + +static void gen_VNMLA_dp(TCGv_i64 vd, TCGv_i64 vn, TCGv_i64 vm, TCGv_ptr fpst) +{ + /* VNMLA: -fd + (fn * fm) */ + TCGv_i64 tmp = tcg_temp_new_i64(); + + gen_helper_vfp_muld(tmp, vn, vm, fpst); + gen_helper_vfp_negd(tmp, tmp); + gen_helper_vfp_negd(vd, vd); + gen_helper_vfp_addd(vd, vd, tmp, fpst); + tcg_temp_free_i64(tmp); +} + +static bool trans_VNMLA_dp(DisasContext *s, arg_VNMLA_sp *a) +{ + return do_vfp_3op_dp(s, gen_VNMLA_dp, a->vd, a->vn, a->vm, true); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index b3d0648bb50..1f83723b81a 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1393,16 +1393,6 @@ VFP_OP2(div) #undef VFP_OP2 -static inline void gen_vfp_F1_neg(int dp) -{ - /* Like gen_vfp_neg() but put result in F1 */ - if (dp) { - gen_helper_vfp_negd(cpu_F1d, cpu_F0d); - } else { - gen_helper_vfp_negs(cpu_F1s, cpu_F0s); - } -} - static inline void gen_vfp_abs(int dp) { if (dp) @@ -3122,7 +3112,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0 ... 2: + case 0 ... 3: /* Already handled by decodetree */ return 1; default: @@ -3308,13 +3298,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 3: /* VNMLA: -fd + -(fn * fm) */ - gen_vfp_mul(dp); - gen_vfp_F1_neg(dp); - gen_mov_F0_vreg(dp, rd); - gen_vfp_neg(dp); - gen_vfp_add(dp); - break; case 4: /* mul: fn * fm */ gen_vfp_mul(dp); break; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 08e4f427408..c50d2c3ebf3 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -112,3 +112,8 @@ VNMLS_sp ---- 1110 0.01 .... .... 1010 .0.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp VNMLS_dp ---- 1110 0.01 .... .... 1011 .0.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp + +VNMLA_sp ---- 1110 0.01 .... .... 1010 .1.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp +VNMLA_dp ---- 1110 0.01 .... .... 1011 .1.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp From patchwork Tue Jun 11 10:53:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166413 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2236895ilk; Tue, 11 Jun 2019 04:33:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqp8yIgp0Q/FBdkSMCezeTim6JX5wMxZQNmCuujvO0T4g6QJ98/2kYEZ2lHBU8Kzhm4LR8 X-Received: by 2002:ac8:28e2:: with SMTP id j31mr24093066qtj.274.1560252822252; Tue, 11 Jun 2019 04:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560252822; cv=none; d=google.com; s=arc-20160816; b=P06iX+9EVYamGFSNsBng7lmLyRYw2nwcew5X1471NyTWwUl9eqr1ZR2ynjCMs4Wv0R VS1hphvL02CEewPWnEyD9Gds6ljaPmMHcUyRJCb2Ax4dBPoELjvnf15jPXbr/oUahG0f 0RJqDdXx2V8gEWg8cccEfLvlDrfSv0F+BT4K972H3vkJumwaWaBx2IaFfHF5ERVD/Xrx nVItCHfX7YAkV4Myrm/+lZis7ZOzl6HSTjSqLhKpElG0ZiozgBkntMqmOGHUgiE6RllC Pr76vbbJFDyx4i/+D5pbH7SZAa0lLplJnCXZLz8iWksQMel+EZAmxHFKYJxLy8Rw3wLY Qw8g== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Re3Rqp+76+/FOhH4NrXDuyW0zbLxDuCIwdDqY4GSpxA=; b=ZowgfyE8Apabe1fa94HWLGSOAipAr1LQxnYsZud8xoPw32Hjl9c8LpqXk/PU3qOYqT tu6Ufa8k2wVGkSu5lRBfrY3n3KpYu5H7err78h6WajKIOOSBvpNJLGYCZSSgwpuEVLAW 2ABsHTzpfOlRSku1psANf+52hRJCHl6WzSCBt/hbI4/cLmc0MFdR+l5huNDvnl5DF110 bEco/j7n3XboDalPlsiAzBxSWXzCYd8ExOmcoqKkeFRBseQvQRR48ijburWTeflBSYiR pAT74XGKOTvOR1A/SO8Cb0yB9p4fx84F5ghZzDwEz5kN2LRxFYMClFO9t/WsVtCZ8Spz VXBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=h3rUufnt; 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 c9si367519qve.116.2019.06.11.04.33.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:33:42 -0700 (PDT) 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=h3rUufnt; 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 ([::1]:56490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haf25-0006vj-Rc for patch@linaro.org; Tue, 11 Jun 2019 07:33:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39342) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQ3-0007N0-RW for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haePz-0007Yk-7s for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:23 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:39794) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePy-0007Y0-SI for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:19 -0400 Received: by mail-wm1-x342.google.com with SMTP id z23so2380319wma.4 for ; Tue, 11 Jun 2019 03:54:18 -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 :mime-version:content-transfer-encoding; bh=Re3Rqp+76+/FOhH4NrXDuyW0zbLxDuCIwdDqY4GSpxA=; b=h3rUufntCtQj8CL09lEs84BRqUreCI9ffxDlFGY09Fn1UKqdBoRqXP9ByEuegCcMde A3veoIw9W8ubydh3CVW+3CQXt4PDsOYqtctgh1S8xJWI75TcEuq1kaioeTaReevJniMO kzbVseB1dcvg2gGZzmYGTv8pPwFZparlPAsxtWPy3zNY1HHdujrZ/Fq19/jCb8U+zoN4 MGL9UeAr4+jqy8OcLwgHXbl4jBkWTg8XiDE6kKmF4/szCt8XLPHeXdtBxh/SGcVa2Ty/ 7QQ2IwKMCfkxENBiof+caFHpCOpmqRGdExDVIvX6UzHkuiK9zOBbNiEkaHN001xfEs9A 8BDw== 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:mime-version:content-transfer-encoding; bh=Re3Rqp+76+/FOhH4NrXDuyW0zbLxDuCIwdDqY4GSpxA=; b=UoMUU/yZhjIzpcWV62+YiNb+8mEwBABT++LOnZ2vgJAtnpC5wuAlni6diOxW9sVc83 U3jThiM4s9hfHburO9QFqrYMYViQUtrIlaNJW/u0mqkCE1Uqm2hcJ3suPZuhv7GRE4zM t1v/Yt1oTmcROU3Rzv+kRnuJ9XHUGOb/4hYkOwJWQ8BTRNFN4wdw8Up6kt8N0ObOzefE eW+qoVn44YHVLch7odpXIaA/gIB8UXoroF6+oVRT8dmhC4cZQKfNYZtQbS1v92dF2I6K uTwNYXDy++n/JoL3/CF/iUBkhtNaOV94hIC4t2Jj7rKKPVgqu8bKXmV0mQktUnOLkF6b BSJg== X-Gm-Message-State: APjAAAWYhzPEQxxTxmrpgMjR7aUpenfjHQfRlucsrvVOKmzcVXCR8yNs NgCEbeD790LlsieZfbPBcdHw9y1ZzSWZXQ== X-Received: by 2002:a7b:cc09:: with SMTP id f9mr9243045wmh.68.1560250457857; Tue, 11 Jun 2019 03:54:17 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:17 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:31 +0100 Message-Id: <20190611105351.9871-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 22/42] target/arm: Convert VMUL to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VMUL instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 10 ++++++++++ target/arm/translate.c | 5 +---- target/arm/vfp.decode | 5 +++++ 3 files changed, 16 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 8532bf4abcd..a2afe82b349 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1417,3 +1417,13 @@ static bool trans_VNMLA_dp(DisasContext *s, arg_VNMLA_sp *a) { return do_vfp_3op_dp(s, gen_VNMLA_dp, a->vd, a->vn, a->vm, true); } + +static bool trans_VMUL_sp(DisasContext *s, arg_VMUL_sp *a) +{ + return do_vfp_3op_sp(s, gen_helper_vfp_muls, a->vd, a->vn, a->vm, false); +} + +static bool trans_VMUL_dp(DisasContext *s, arg_VMUL_sp *a) +{ + return do_vfp_3op_dp(s, gen_helper_vfp_muld, a->vd, a->vn, a->vm, false); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 1f83723b81a..96790e65c6f 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3112,7 +3112,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0 ... 3: + case 0 ... 4: /* Already handled by decodetree */ return 1; default: @@ -3298,9 +3298,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 4: /* mul: fn * fm */ - gen_vfp_mul(dp); - break; case 5: /* nmul: -(fn * fm) */ gen_vfp_mul(dp); gen_vfp_neg(dp); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index c50d2c3ebf3..d7fcb9709a9 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -117,3 +117,8 @@ VNMLA_sp ---- 1110 0.01 .... .... 1010 .1.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp VNMLA_dp ---- 1110 0.01 .... .... 1011 .1.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp + +VMUL_sp ---- 1110 0.10 .... .... 1010 .0.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp +VMUL_dp ---- 1110 0.10 .... .... 1011 .0.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp From patchwork Tue Jun 11 10:53:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166416 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2240045ilk; Tue, 11 Jun 2019 04:36:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1cm2v30fMS1JJl0tv7y0UkTEc6uf9sBlyx+uV1Dk5pI7T0XEAmpzsLHqhoV2Ei6k4mGjl X-Received: by 2002:a37:5645:: with SMTP id k66mr56875110qkb.177.1560253015663; Tue, 11 Jun 2019 04:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253015; cv=none; d=google.com; s=arc-20160816; b=oJd/ubYl9tn+KR7cnEFrDkunfQBP8qKjBbxvJMzttmArLxMMPUKf53gU3SKaNWrq9C IMl5DCgU7UppFfLND5wjxSAMwDkyk5sroUb+3JFCFrjllxvl89xwoJVJi9JAdXmOHsPr Wn2lPsDnofZGqKKK+Xrfb9O+r3dYJ12kRU3knPssIQsh60HhzbMbbuVUsGrvCBNOHfZU S3jDqyLIrQYoKdkM7ZVh2J8IszvcapTSvzXgL2p5ZaE870rnVYODN5IAAPgvDGDt+YEB s8UTk/83pypRPPVfrNRJHpwyAOXoKR1bhbL7TAXMfZofw0We231EZabL8T5ZPZw55WG1 j3Hw== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=RESFSOfye+/QpUNOwYF+OWDweWBNnoP2IOQhWx0uTd0=; b=wBvGdqkrEjmsRE2VgH7nZmV1bDixqFbekeKU3GQLsTsnZL4ssy3V/47JWa6BGJV+Mm KSJ/aeaOymyHJ9kAIRO6vZvfAvpyiS2uFRpkUSlOt2ZrJ9yGYT2IhxTNAVUTFedwoRqP Q+VCqPyCAuBJtExGnuD+sRIBviB4gtmeKlQVw4ZXU1cR3l1QH7GasZ9sTVo0rhe/+qv9 QKt/PjPp+q54z6blQyl9oxN1hfPYrCfEA5yECDeGt2Iy1gN149Oj4W2Ms9oJ05UwToER PuwL1T71ddPJnajarbeIhsE6b/EK1j/1NwLryt/ID/ODwyu3Pnf+hfU1WrmxoTyPXTr3 IH5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=E43A2t2S; 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 t188si4017072qkh.84.2019.06.11.04.36.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:36:55 -0700 (PDT) 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=E43A2t2S; 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 ([::1]:56516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haf5D-0002LX-8z for patch@linaro.org; Tue, 11 Jun 2019 07:36:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39374) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQ5-0007NP-Ln for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQ0-0007Zb-20 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:23 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:36479) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haePz-0007Yq-Ql for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:19 -0400 Received: by mail-wm1-x343.google.com with SMTP id u8so2399821wmm.1 for ; Tue, 11 Jun 2019 03:54:19 -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 :mime-version:content-transfer-encoding; bh=RESFSOfye+/QpUNOwYF+OWDweWBNnoP2IOQhWx0uTd0=; b=E43A2t2SDQeoLm2592JvpUMJQmpoXyummNYfKxxtlc4iZP78XXqb+3zBNOlV/LrP3e bn+DuUZb9soBvZ2NVgGZVHWe6Z7ieyjmbQydmuZmvSIg6CrOH//4bUCnEmht6JJoJPwh 6R0CbyfnSfqTb5JlEj8hW0rpw/J/mR+sP3L+ezth/j3rVVY/d6qe1fxWeG0KF/hV75A0 4tAGMdMv/Fo4GjnLTy0PPgr3xFUxA7tVdMraxRF1Gj46X9tLyzn2JOyWTZyNk6NNFMoG nBNkXluKSnE67IUgja/V21KVDEYSxy+6Bjy/85u9/4PfltUQ2212Ub1OY7Qnkw4rbLJ3 96lg== 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:mime-version:content-transfer-encoding; bh=RESFSOfye+/QpUNOwYF+OWDweWBNnoP2IOQhWx0uTd0=; b=gIUuQxPw39NUYTNUMpjbkzPfVn9Z/F5BTnGKcGQbOfvcQXQFqdCu4FHuuVZv2T9/Ft hGXTiPceNzH43B2fb+B9YGAtHjkx6bsMT9oCUnh+mhLOgBdqRKYq396OTGY4fDX4K1oM Jv3ZI82K6jJWPqRsyR4GzAYpAJCVXwmj7MxKHpZrUrUfHEE5kS59V1dep+cPfRBrO3zY FQaRCBkEQWJgzJpYI+Wrjb81qPGfj+vzc8p1wFxKNCntlZ1BhzGT97hpJoJYi4gUVly1 bmTObbT35xO02H1VUci20im7IYWkZXcaBeOH5hR9jAwC/NJTHVFmbvriXknVp5uJ7DeP xtPA== X-Gm-Message-State: APjAAAVSuwoIe/6479t6Vs38grJsy9Y7V+SljCYN9uTpG54Vq1OIxsQl klyq/s0zUgfWG4fvHRzk3xl85A== X-Received: by 2002:a1c:a848:: with SMTP id r69mr16623331wme.12.1560250458861; Tue, 11 Jun 2019 03:54:18 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:18 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:32 +0100 Message-Id: <20190611105351.9871-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH v2 23/42] target/arm: Convert VNMUL to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VNMUL instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 24 ++++++++++++++++++++++++ target/arm/translate.c | 7 +------ target/arm/vfp.decode | 5 +++++ 3 files changed, 30 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index a2afe82b349..4c684f033b6 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1427,3 +1427,27 @@ static bool trans_VMUL_dp(DisasContext *s, arg_VMUL_sp *a) { return do_vfp_3op_dp(s, gen_helper_vfp_muld, a->vd, a->vn, a->vm, false); } + +static void gen_VNMUL_sp(TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm, TCGv_ptr fpst) +{ + /* VNMUL: -(fn * fm) */ + gen_helper_vfp_muls(vd, vn, vm, fpst); + gen_helper_vfp_negs(vd, vd); +} + +static bool trans_VNMUL_sp(DisasContext *s, arg_VNMUL_sp *a) +{ + return do_vfp_3op_sp(s, gen_VNMUL_sp, a->vd, a->vn, a->vm, false); +} + +static void gen_VNMUL_dp(TCGv_i64 vd, TCGv_i64 vn, TCGv_i64 vm, TCGv_ptr fpst) +{ + /* VNMUL: -(fn * fm) */ + gen_helper_vfp_muld(vd, vn, vm, fpst); + gen_helper_vfp_negd(vd, vd); +} + +static bool trans_VNMUL_dp(DisasContext *s, arg_VNMUL_sp *a) +{ + return do_vfp_3op_dp(s, gen_VNMUL_dp, a->vd, a->vn, a->vm, false); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 96790e65c6f..1f9fa6b03a1 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1388,7 +1388,6 @@ static inline void gen_vfp_##name(int dp) \ VFP_OP2(add) VFP_OP2(sub) -VFP_OP2(mul) VFP_OP2(div) #undef VFP_OP2 @@ -3112,7 +3111,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0 ... 4: + case 0 ... 5: /* Already handled by decodetree */ return 1; default: @@ -3298,10 +3297,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 5: /* nmul: -(fn * fm) */ - gen_vfp_mul(dp); - gen_vfp_neg(dp); - break; case 6: /* add: fn + fm */ gen_vfp_add(dp); break; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index d7fcb9709a9..3063fcac23f 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -122,3 +122,8 @@ VMUL_sp ---- 1110 0.10 .... .... 1010 .0.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp VMUL_dp ---- 1110 0.10 .... .... 1011 .0.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp + +VNMUL_sp ---- 1110 0.10 .... .... 1010 .1.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp +VNMUL_dp ---- 1110 0.10 .... .... 1011 .1.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp From patchwork Tue Jun 11 10:53:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166403 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2220386ilk; Tue, 11 Jun 2019 04:17:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxB8akedmQ530qNJ8mJwta59cEBh2AgvM498h/8Dj87HB1DmVjbyuXJjJzz83ZZMbUW2vOn X-Received: by 2002:ac8:70cf:: with SMTP id g15mr59945061qtp.254.1560251849502; Tue, 11 Jun 2019 04:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560251849; cv=none; d=google.com; s=arc-20160816; b=uP+b51+uIwsUnhFGQrmGvVH2TB+5UpT2LdYU/tJOUGRbwBy+p0sGZq0kzd/f7gcRzH wCojECc7/RTBQGxA1YimCgpzuQMEUszBl62vj+GhgsRXFDRmAGnKHOOGhmySjBOdsIuw 4um1qztevQeobeYcc0k4PpIDvOdus9aMpefGEBvPaSMfooAJ5iAwWPkLw86YrlCJ102u kZ8Ag2xAaA4D8mjxP6PAtjvR6VL7tvqFS9De7dzgy/5ovZNUi7xjgB9mFW2O/zog8SBM ufoiBSgQSiC9iEtYyPcMtWqOk7Ws90+TK7zA3cQiHK3aV12a+xcpuUO1yMtOCXV/MyyK ZvAQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=mVemKtw+NqwwNaXEIQeiOSqrKqr9sziHV25BKLiiWOk=; b=C0QwJkhEsDHPfcaddTpAsyHFucJ7bLyZ9y4z08VEKuULIerhXCrxJbZ0ylvLOspMbn gabz0u5ug+7tMj0gUjCWvnMg0u7yK1KpE+XZS/aaNxDh3NFbz9ozUOVx5Bh0JJ9Az7pV mRaBOavhly0SJlVcbby4bTjm1b7r1Zj+e8Zp6Rql2RGiqdwdAHZjewP27L+WVXSJjmM4 5NhoWYFVKGRbubQG45OI310PcNQsQpT2/xyKzAGbMYLi0D5RRbRgt2copODDGvrvao3s Ho1CAYNO25QS2j9Sh7Xz2XZl+oAytjyarupto5B9U/OXi17/oYLeMzhJzJMVN+gyYXhY 1oLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UJKAF51z; 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 a21si291697qkl.269.2019.06.11.04.17.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:17:29 -0700 (PDT) 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=UJKAF51z; 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 ([::1]:56334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haemN-0002aG-ED for patch@linaro.org; Tue, 11 Jun 2019 07:17:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39416) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQ7-0007O8-Qx for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQ1-0007b1-Cx for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:25 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:41372) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQ0-0007Zt-Tb for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:21 -0400 Received: by mail-wr1-x442.google.com with SMTP id c2so12476791wrm.8 for ; Tue, 11 Jun 2019 03:54:20 -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 :mime-version:content-transfer-encoding; bh=mVemKtw+NqwwNaXEIQeiOSqrKqr9sziHV25BKLiiWOk=; b=UJKAF51z6h32ovZB0thLmYg+cw9qKp+oCkoCfCNPq6Tj6PVm4tVs+biYqJ7NrjoO0d Dph/kFiP2wqGvLGpPKt1nh8lAfkAj8A4UDcC0KWT+0MdizjUjwACqLrPskp0Yie6Poqe A1Lte8ba/9/EdBCvN1l7CJcsMDGzCjCknhTHc6TymuhiC/qqLVF3MllvblGtJtCqRphQ cyJZcqNZAwHYKg0vHzvfM1O5wUo+a2NP7JrvXztvprsMUvEh1pcLtKDRv89gACq63Fby e79Joo7FjZaaSV2CPgAYHDbdApvYZ3Z+f6K0nr2rC8RJg9JdMua3XTrypD2iXNzVU3i5 uHjg== 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:mime-version:content-transfer-encoding; bh=mVemKtw+NqwwNaXEIQeiOSqrKqr9sziHV25BKLiiWOk=; b=Fc/AQ+ZbfofPqftgH4n7IQlpsV9nfZ6HEOzv/4KXkgeYTQj1gwZ3pbKqSkvil8fHJ6 x4xwhj8ZfBjClEyVxt/Paj1LbTaWf+QAYhR+vcJZfZfl8n1N7qsFXXOCcrLM+dhMhJNO xd09ildMVHe6J3TADRqbQqFgdBLgcHZSxYUNeWnC4FTjsrLE6EXuxrJvQWHDFs8Bd+5d d36p1ozpq1p/0SDKR0W44ku8KUpuTo0wd8n1lAv/1q/iBFuEouUU9lBlwjqyEBJYruwm QGDxHU89p9JFYkyY8TdyXNlinwEHfq0ZsytR9nLlA5/r9k/stVhWjcQWuO82neBrR7Zo U2dg== X-Gm-Message-State: APjAAAWx2qaD8jMJTWj8MKCkJ9QNpVstqBSz1Fb5BybtdrkIunjoBG5E wJUtmLcldUKiLyVxts+HKSHsqMpQh+AIcA== X-Received: by 2002:adf:e691:: with SMTP id r17mr33139791wrm.67.1560250459975; Tue, 11 Jun 2019 03:54:19 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:19 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:33 +0100 Message-Id: <20190611105351.9871-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH v2 24/42] target/arm: Convert VADD to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VADD instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 10 ++++++++++ target/arm/translate.c | 6 +----- target/arm/vfp.decode | 5 +++++ 3 files changed, 16 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 4c684f033b6..14aeb25f597 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1451,3 +1451,13 @@ static bool trans_VNMUL_dp(DisasContext *s, arg_VNMUL_sp *a) { return do_vfp_3op_dp(s, gen_VNMUL_dp, a->vd, a->vn, a->vm, false); } + +static bool trans_VADD_sp(DisasContext *s, arg_VADD_sp *a) +{ + return do_vfp_3op_sp(s, gen_helper_vfp_adds, a->vd, a->vn, a->vm, false); +} + +static bool trans_VADD_dp(DisasContext *s, arg_VADD_sp *a) +{ + return do_vfp_3op_dp(s, gen_helper_vfp_addd, a->vd, a->vn, a->vm, false); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 1f9fa6b03a1..cd1f24798b1 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1386,7 +1386,6 @@ static inline void gen_vfp_##name(int dp) \ tcg_temp_free_ptr(fpst); \ } -VFP_OP2(add) VFP_OP2(sub) VFP_OP2(div) @@ -3111,7 +3110,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0 ... 5: + case 0 ... 6: /* Already handled by decodetree */ return 1; default: @@ -3297,9 +3296,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 6: /* add: fn + fm */ - gen_vfp_add(dp); - break; case 7: /* sub: fn - fm */ gen_vfp_sub(dp); break; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 3063fcac23f..d911f12dfd0 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -127,3 +127,8 @@ VNMUL_sp ---- 1110 0.10 .... .... 1010 .1.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp VNMUL_dp ---- 1110 0.10 .... .... 1011 .1.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp + +VADD_sp ---- 1110 0.11 .... .... 1010 .0.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp +VADD_dp ---- 1110 0.11 .... .... 1011 .0.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp From patchwork Tue Jun 11 10:53:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166409 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2229869ilk; Tue, 11 Jun 2019 04:26:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgfdl16EQY7p2BTzZsL0HdiNY0bJesfy8HpOy0TogFQLDqC2I7Go0EMyYmAxv+voCQCbSA X-Received: by 2002:ac8:1c54:: with SMTP id j20mr37458231qtk.158.1560252410960; Tue, 11 Jun 2019 04:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560252410; cv=none; d=google.com; s=arc-20160816; b=XPyuRtR2nKYi3kXdeSAV0uII1gG7c5iZUOYEuaorIHHlg6BQwKXHcLAH2HaAAx8MY6 FiWREj2QV0Pb4dyReYOTjXcnAc7NBKiTN6/Ol3sN9WOa4biBSoR0W6+UkxezPuZRuAHk B2Ruq5ICqOChz0gqTRYxno1KuN2ihWnIpLfj1AZA+J/cCsWZhVAqJMdEBuxVlZKxUb8n dill4WpoxPktRmc9bnIv7KRDoxUIu/f/t1TouzSAvO5eqztcWwK/UkZNj7Z3TUtCWnRr rmhRTwX6+jDpmJhOmyjgEscnkjHEUqKIUnAES1I6soCGQgWhiR14WU9xt96fNb8oNPCv Jyag== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=u6koW8F7IGLYBhWLi4hkXE4YWzeq3RGbqG4uQxIjef0=; b=ox7VHzoHQGM6YJreOsjJuzfUdYjzN0Hh8QHNJdRp04ko2hxncuv50tUhnKd8TpxRt0 Ju6lBHaxkMilazjpADrofbj62JlgBr9YOslKriJK+/HKruRdUEUZczridbihFYJIrMRe Z78uNwaeukC4C35nSTp0WzSVolg+a9pZ/C7h3DUDYkxFnhegABlJyDZDV8vZYgw+H+f+ +wTy/y8QNY3gICToeDwg5niNY+k2JwJ+GnCtpGICl9fME7JLLvc29YXHd6XjzQkMSDVa svxszdEuLv0DsvtAb78M7KUITEKjwtEKY6G4WpntMr/6853mNvBefwIxPRIkVqketH09 tKXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uiBUIWX9; 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 o38si5246657qte.117.2019.06.11.04.26.50 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:26:50 -0700 (PDT) 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=uiBUIWX9; 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 ([::1]:56416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haevR-00020h-EF for patch@linaro.org; Tue, 11 Jun 2019 07:26:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39457) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQH-0007Qx-Tu for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQA-0007ip-Tq for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:33 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:42833) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQ3-0007ax-Jt for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:25 -0400 Received: by mail-wr1-x444.google.com with SMTP id x17so12457325wrl.9 for ; Tue, 11 Jun 2019 03:54:21 -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 :mime-version:content-transfer-encoding; bh=u6koW8F7IGLYBhWLi4hkXE4YWzeq3RGbqG4uQxIjef0=; b=uiBUIWX9CE3A3gtpLKCkEj9wi8N3WsoIRjqX3OR6DQkwLD2pccKsXeZyFJk/pggek+ HHSwL/z4L298J0hopFiI8buAInr3v6u+M9ZTNz0QJAmkPpkYs8JeA4GPd+3CVL7mJWR0 58R9RgL7lMn2ctppdc4l9d6IV4nQgzKJf0IlNBlLyvon/s0pIlflTizUn1eSwcOl7IzQ +qun+a5xs9MiwtgCQOr1dYE9sYtzs8YSFSCXRapfnouxixgE9OsAQ6QTnGFRNQ4gBeCm J9iu8QoVJOGCycuhS/QRQEqc2h+MxtZG7nhPJ8y4KKAFNXa+VVqjegzTh3MEKZYuUsrG VmxA== 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:mime-version:content-transfer-encoding; bh=u6koW8F7IGLYBhWLi4hkXE4YWzeq3RGbqG4uQxIjef0=; b=SV9Kou2hkJxHlWtbxL0zPRmckC62bYdWfEkmqy/4P4mG6oRmxLAzzvIO/0vUQMVt56 i4E78Doi2V2mKeulyKAn7l3z/11sFhNb9/doHHQgILhcVSERi6A809MCLQC/RAxDLEK6 VNghbEuhVGfbt0MLL+QLp72L52hpC9TsIMjGwa8dQy8aaz14PUTg0t9195WwONzox7qt 0noAlw8d7jmqHeLptWu1RE7NXIjuWyU8mpO1vZ9/w907lz5b8jkePfQh6U98fRrzCnVO nnjxyXoBSKblFcb4GbgWHOuwmRp+HGpidY7yj2Lr0XEaYjEuNQx/eIMVcqE9NCwtr3Rc Jt9g== X-Gm-Message-State: APjAAAW8r/94MC7Vz4owkR0H+HUcGAAhFvrmXGzIcP+ka0resPckl9ew I3PmRtP0iGH1JOymSfstdMoJlQ== X-Received: by 2002:adf:8307:: with SMTP id 7mr32563552wrd.86.1560250460995; Tue, 11 Jun 2019 03:54:20 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:20 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:34 +0100 Message-Id: <20190611105351.9871-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH v2 25/42] target/arm: Convert VSUB to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VSUB instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 10 ++++++++++ target/arm/translate.c | 6 +----- target/arm/vfp.decode | 5 +++++ 3 files changed, 16 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 14aeb25f597..12da3b8acb8 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1461,3 +1461,13 @@ static bool trans_VADD_dp(DisasContext *s, arg_VADD_sp *a) { return do_vfp_3op_dp(s, gen_helper_vfp_addd, a->vd, a->vn, a->vm, false); } + +static bool trans_VSUB_sp(DisasContext *s, arg_VSUB_sp *a) +{ + return do_vfp_3op_sp(s, gen_helper_vfp_subs, a->vd, a->vn, a->vm, false); +} + +static bool trans_VSUB_dp(DisasContext *s, arg_VSUB_sp *a) +{ + return do_vfp_3op_dp(s, gen_helper_vfp_subd, a->vd, a->vn, a->vm, false); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index cd1f24798b1..18d4f9933ad 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1386,7 +1386,6 @@ static inline void gen_vfp_##name(int dp) \ tcg_temp_free_ptr(fpst); \ } -VFP_OP2(sub) VFP_OP2(div) #undef VFP_OP2 @@ -3110,7 +3109,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0 ... 6: + case 0 ... 7: /* Already handled by decodetree */ return 1; default: @@ -3296,9 +3295,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 7: /* sub: fn - fm */ - gen_vfp_sub(dp); - break; case 8: /* div: fn / fm */ gen_vfp_div(dp); break; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index d911f12dfd0..de56f44efc9 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -132,3 +132,8 @@ VADD_sp ---- 1110 0.11 .... .... 1010 .0.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp VADD_dp ---- 1110 0.11 .... .... 1011 .0.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp + +VSUB_sp ---- 1110 0.11 .... .... 1010 .1.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp +VSUB_dp ---- 1110 0.11 .... .... 1011 .1.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp From patchwork Tue Jun 11 10:53:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166411 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2234883ilk; Tue, 11 Jun 2019 04:31:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzy6ChbpAct/KklH1FQ0pu3ewcxEMxK0udI5/T7fu2qtT4gUeePhHXWs14W2KmM0VQ4TvRf X-Received: by 2002:a05:620a:1443:: with SMTP id i3mr39480765qkl.11.1560252712052; Tue, 11 Jun 2019 04:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560252712; cv=none; d=google.com; s=arc-20160816; b=pD5V/pF6rYbdhzeBlqszFFz0VjmsWRfdJ1/aTew/Y2YQLGe/muhhhYg8mjn4QoPobF rKnKxjwW7zQF8euKCVxROof8pBy9FsJXgauHEHP68is3vJdAFaX26tdI9ZRSm5lQ5jTI YLBeI77zA6QgDbG6V4U7zNrMlztLeQ1sBp9J9IqegmUyLne5JrxHdMRUaZ1UQ8S2AEld ofT1SCrQ005JtvIOT1kIprmOpT9tfgJ080ubALxI1DOh9uanwnhR1MWrhN2AMLKAeiUd IXYuUDZ8mLVADoEqjwpUf+i04XG4QjDLH8hh/vmuBTrkuRXcK2iih+YppFrA+BHe/gSc oCOg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=+1Eu0a2rG77UT6/ymd+XIjDhnuEka8Y1v776h2ywKc0=; b=yp8imhDFC1ctEaCSsWXL7b1OSK1LGZ7EeQB+EtdAq42w+bMbHXbyy+GgpxxLxugD9r G++Gbj2PVharp9nZTBpc/gytgvd6aE9jyWxAuf5L9JTv06VOJ6WkP+ToEn9830FCeg5P uoJohRdtzA7GpBjkbxxeAW7LOJBE1YPnXys7hVog2HXvKmXsXlOHuGRfZYjbSQx97Zuu FZIUN6aW/kKaOcMthcf574Epvg+IBcDOl9yMHlFzxP6nf5qBZfy4RljoW7wuvv0ODTh5 gTJJZkOqwNs46uKmBlLJ+YUBaxCzh3cOPwWsipmjIo9uM9zPNzKI35ML6kNmNqnkKmGz b73w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uT3zhEdn; 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 n202si5307866qkn.233.2019.06.11.04.31.51 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:31:52 -0700 (PDT) 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=uT3zhEdn; 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 ([::1]:56488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haf06-0006pn-S4 for patch@linaro.org; Tue, 11 Jun 2019 07:31:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39561) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQM-0007Wb-LC for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQK-0007pr-7H for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:42 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:44987) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQJ-0007bh-Pg for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:40 -0400 Received: by mail-wr1-x441.google.com with SMTP id b17so12468905wrq.11 for ; Tue, 11 Jun 2019 03:54:22 -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 :mime-version:content-transfer-encoding; bh=+1Eu0a2rG77UT6/ymd+XIjDhnuEka8Y1v776h2ywKc0=; b=uT3zhEdn0lKzwiheehj4venzx0QVhp5nQU8BhWubTNcf5Ml6Swr7amh7oUrn0/UMFR pb0BfVr62HPq1RZpOyRLcu/ztjSEOtSa3p+/NM26MQPnziyRoGCutZkcshxxrI5BjToe wmy8cuq4UHiLjCOs8awyvOMwY4AtYkfGQPCRAkhIv2gPdSH5a95DctwqfLrheXsz7CfE 9tVERF+SkSr6/pFyRnlZmjrK9o/ko0ToUzplTvUXjmIfkzK6dC0dOl6A1wbO8oOl/dY1 uwqCY7+tzHSvnMQ1/9nORn8xMg6UR8x1NtwYWSY4FcJCwjgtG4AU9SI2tl9Xv4kn/tWb EOzA== 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:mime-version:content-transfer-encoding; bh=+1Eu0a2rG77UT6/ymd+XIjDhnuEka8Y1v776h2ywKc0=; b=Iyr86uLgA2bSuj3HL4yzxlynKPmeOUAf5vBVvjEQ11oulYJ8SQSyiQsfOvq+kguMsQ 8BEOUN+HBUAbvlrbEul63B+ZPckqqnHksnFdEmwsdfDglIiXGrDYx0MHD12cjPWUkfLz OAehJWR0BemmNgzbikU1DMfXLJd9x6g73bXWECewxDOj1004S+jBfIqW5nT7p2rAzoNo f65BK+ydxxkk3tLcpAdgQBZ+vcK+9g0PcggeOVN6ougJ+50pnecdrz74t+pYxvh0E78L A6+XcK6OYZ4wTgviAPL7VSkSX/0Jv0OM7CywIqtW11M0g86jKW5FCSL89lgkaaEqkIQ6 0pFQ== X-Gm-Message-State: APjAAAUsx0f5PW8Cf8ImUvsQlrmsmr1pEe5TsSVafTVrnb86HNtJhsUK tlGx3a6ImZvyxJo2qfB1NnOVOfqlIJxeZA== X-Received: by 2002:adf:ead1:: with SMTP id o17mr4501460wrn.176.1560250461965; Tue, 11 Jun 2019 03:54:21 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:21 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:35 +0100 Message-Id: <20190611105351.9871-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH v2 26/42] target/arm: Convert VDIV to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VDIV instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 10 ++++++++++ target/arm/translate.c | 21 +-------------------- target/arm/vfp.decode | 5 +++++ 3 files changed, 16 insertions(+), 20 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 12da3b8acb8..6af99605d5c 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1471,3 +1471,13 @@ static bool trans_VSUB_dp(DisasContext *s, arg_VSUB_sp *a) { return do_vfp_3op_dp(s, gen_helper_vfp_subd, a->vd, a->vn, a->vm, false); } + +static bool trans_VDIV_sp(DisasContext *s, arg_VDIV_sp *a) +{ + return do_vfp_3op_sp(s, gen_helper_vfp_divs, a->vd, a->vn, a->vm, false); +} + +static bool trans_VDIV_dp(DisasContext *s, arg_VDIV_sp *a) +{ + return do_vfp_3op_dp(s, gen_helper_vfp_divd, a->vd, a->vn, a->vm, false); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 18d4f9933ad..a9ec6eaef80 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1374,22 +1374,6 @@ static TCGv_ptr get_fpstatus_ptr(int neon) return statusptr; } -#define VFP_OP2(name) \ -static inline void gen_vfp_##name(int dp) \ -{ \ - TCGv_ptr fpst = get_fpstatus_ptr(0); \ - if (dp) { \ - gen_helper_vfp_##name##d(cpu_F0d, cpu_F0d, cpu_F1d, fpst); \ - } else { \ - gen_helper_vfp_##name##s(cpu_F0s, cpu_F0s, cpu_F1s, fpst); \ - } \ - tcg_temp_free_ptr(fpst); \ -} - -VFP_OP2(div) - -#undef VFP_OP2 - static inline void gen_vfp_abs(int dp) { if (dp) @@ -3109,7 +3093,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0 ... 7: + case 0 ... 8: /* Already handled by decodetree */ return 1; default: @@ -3295,9 +3279,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 8: /* div: fn / fm */ - gen_vfp_div(dp); - break; case 10: /* VFNMA : fd = muladd(-fd, fn, fm) */ case 11: /* VFNMS : fd = muladd(-fd, -fn, fm) */ case 12: /* VFMA : fd = muladd( fd, fn, fm) */ diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index de56f44efc9..de305f60e18 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -137,3 +137,8 @@ VSUB_sp ---- 1110 0.11 .... .... 1010 .1.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp VSUB_dp ---- 1110 0.11 .... .... 1011 .1.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp + +VDIV_sp ---- 1110 1.00 .... .... 1010 .0.0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp +VDIV_dp ---- 1110 1.00 .... .... 1011 .0.0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp From patchwork Tue Jun 11 10:53:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166420 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2243599ilk; Tue, 11 Jun 2019 04:40:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkAlY9vgyafUydY5paX5rdwiogFZ1Jl6kqHGqvAcPYODExhD/KL8yfKCfXPFCZJufGHHyd X-Received: by 2002:ac8:5315:: with SMTP id t21mr53860243qtn.229.1560253242856; Tue, 11 Jun 2019 04:40:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253242; cv=none; d=google.com; s=arc-20160816; b=cZTnud6psuqi4uppykDE1y2thmb5zhbEB/BXMl74SRCQg1mgt2w6UIwFKQ9EtRSB6y JoC1ZSmM9XpfPouj/tre3PekZsydTdCAPMTmeVarGO1bYX2Qi5WdEYDbKK9tUF3H22k0 3luPAtjA0ek1FDXnx2bY/KLHmmCBxNSaajDVst2baoY+Gl9lRFKKhQSkWCFsn8u7W6Sc V8OA+thrX9dnfKTYHr+ZqA5laALAin1OrXx9PGd/IX6ZI0uCnX2gqRdqhvOALG/YefSs O5UQ4F2Sc1xd8N03AAYosBMYhV2zyEJZyCRFWjRKWV6XkFp3O+nJ+EVUhz+JigNEeoQ/ xn3w== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=l603ICjBj/bNnWiLy7Z7KbYvwUv/lg4mgF1RUwlM/1c=; b=AvuueQI7W6ERXklFWK4nk8jb8Zw/NddEtTQcZ0uje1dOypIyGoWeJr7y6aX2DpQSCJ uO41HrHh7u1x2ZrIWSlhvHMcXCUwDKOHS1QiWdpVMlTKR73S0jJweSB0OMZSS7aL0co/ lgpx4hGY7d0a6AWvxRI7Db42vV4q1gsgei1g+h+MtyzvY6kegoGPcOkw4ol5idyfk2hz jukyR+OhBkVAkyRtuSAKmfX1j95q71nP5fw6ljfPLPYy5yk7GFn2DvmKKqqzCmOAy7Il /+vmDaDFBFu/yxIUNjJWvExkJ2skz327JTpEK60WyPN514hmnWPOl9eG8KKX2jAZFItS 2zFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IdpnUrvv; 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 h47si3964514qtc.37.2019.06.11.04.40.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:40:42 -0700 (PDT) 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=IdpnUrvv; 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 ([::1]:56548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haf8s-00062j-1j for patch@linaro.org; Tue, 11 Jun 2019 07:40:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39751) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQT-0007kS-Us for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQM-0007tK-0Q for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:49 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:54218) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQL-0007cm-Iu for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:41 -0400 Received: by mail-wm1-x343.google.com with SMTP id x15so2421017wmj.3 for ; Tue, 11 Jun 2019 03:54:24 -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 :mime-version:content-transfer-encoding; bh=l603ICjBj/bNnWiLy7Z7KbYvwUv/lg4mgF1RUwlM/1c=; b=IdpnUrvvG273Dzkr9qUgFcUtFCk6RnyFZYWQ9gs2w92/Sg2PxIETP9N0F4rQmt846a NGWXh01hRAi/D0K1lFbl2FSpyC50ye7OHUK5Ik1cpHHPOHfxicr68tSeddnfVBgjtzQO 5efZg9415/JlbfyGlfe5WGRzfi5isM3eJQ/UxUmCSzpghfE6+tN1aivypn7/l0uCejiM u1uDY58QMQqkyNs2JhTmfjJJSKtU0radjb49vEHB1epehQNdY5euhVWs43Xq4m+EX2DZ W+1XPV443yu9R1hZcNUVhcrkjJ2ZF5evxmD/Z6AlNoUxqB0kqEWzoxx3srChWhafrny6 L5gA== 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:mime-version:content-transfer-encoding; bh=l603ICjBj/bNnWiLy7Z7KbYvwUv/lg4mgF1RUwlM/1c=; b=dm3X+w6c24B6DWQegFoX283DdmBZPx72m8MOxSeFu477WZks0bsruQcY4VEfLYQ3+I 2nhRb/VdSI/MLLe0Tu2ZCPjha8rlFNsmOc4bYPH0f9aeUavEXM6HlfqVkyB2kKfsv6Mg od3C1uAGrhFlYLwNyX/ZGqo4B+/fE2zPwr6oVL3oWLpcSXSchRe/VPEcGvGu1dWllwQS zqj51ZeoWAQQmt1Yueo2dl37Pf+oceH+5BZ+kZn5AEW/GfeOaVK0dRIxq0yysH/KxnAR E/r6LvTyyp0KTQANqJG8WGyfQQs9vpIsIAtjiawhug2Enr9U9pyHTopT9+VVPYz8SicB jdIA== X-Gm-Message-State: APjAAAXq0QQwqPJdqOZppv1KoQmTn2PcMKAF3edscS1B9hfDogrSJfLa k/kzx4Mtq0Em3jktoW/6AxDcGw== X-Received: by 2002:a1c:2d5:: with SMTP id 204mr18340701wmc.175.1560250463068; Tue, 11 Jun 2019 03:54:23 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:22 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:36 +0100 Message-Id: <20190611105351.9871-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH v2 27/42] target/arm: Convert VFP fused multiply-add insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP fused multiply-add instructions (VFNMA, VFNMS, VFMA, VFMS) to decodetree. Note that in the old decode structure we were implementing these to honour the VFP vector stride/length. These instructions were introduced in VFPv4, and in the v7A architecture they are UNPREDICTABLE if the vector stride or length are non-zero. In v8A they must UNDEF if stride or length are non-zero, like all VFP instructions; we choose to UNDEF always. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 121 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 53 +-------------- target/arm/vfp.decode | 9 +++ 3 files changed, 131 insertions(+), 52 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 6af99605d5c..ba6506a378c 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1481,3 +1481,124 @@ static bool trans_VDIV_dp(DisasContext *s, arg_VDIV_sp *a) { return do_vfp_3op_dp(s, gen_helper_vfp_divd, a->vd, a->vn, a->vm, false); } + +static bool trans_VFM_sp(DisasContext *s, arg_VFM_sp *a) +{ + /* + * VFNMA : fd = muladd(-fd, fn, fm) + * VFNMS : fd = muladd(-fd, -fn, fm) + * VFMA : fd = muladd( fd, fn, fm) + * VFMS : fd = muladd( fd, -fn, fm) + * + * These are fused multiply-add, and must be done as one floating + * point operation with no rounding between the multiplication and + * addition steps. NB that doing the negations here as separate + * steps is correct : an input NaN should come out with its sign + * bit flipped if it is a negated-input. + */ + TCGv_ptr fpst; + TCGv_i32 vn, vm, vd; + + /* + * Present in VFPv4 only. + * In v7A, UNPREDICTABLE with non-zero vector length/stride; from + * v8A, must UNDEF. We choose to UNDEF for both v7A and v8A. + */ + if (!arm_dc_feature(s, ARM_FEATURE_VFP4) || + (s->vec_len != 0 || s->vec_stride != 0)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vn = tcg_temp_new_i32(); + vm = tcg_temp_new_i32(); + vd = tcg_temp_new_i32(); + + neon_load_reg32(vn, a->vn); + neon_load_reg32(vm, a->vm); + if (a->o2) { + /* VFNMS, VFMS */ + gen_helper_vfp_negs(vn, vn); + } + neon_load_reg32(vd, a->vd); + if (a->o1 & 1) { + /* VFNMA, VFNMS */ + gen_helper_vfp_negs(vd, vd); + } + fpst = get_fpstatus_ptr(0); + gen_helper_vfp_muladds(vd, vn, vm, vd, fpst); + neon_store_reg32(vd, a->vd); + + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(vn); + tcg_temp_free_i32(vm); + tcg_temp_free_i32(vd); + + return true; +} + +static bool trans_VFM_dp(DisasContext *s, arg_VFM_sp *a) +{ + /* + * VFNMA : fd = muladd(-fd, fn, fm) + * VFNMS : fd = muladd(-fd, -fn, fm) + * VFMA : fd = muladd( fd, fn, fm) + * VFMS : fd = muladd( fd, -fn, fm) + * + * These are fused multiply-add, and must be done as one floating + * point operation with no rounding between the multiplication and + * addition steps. NB that doing the negations here as separate + * steps is correct : an input NaN should come out with its sign + * bit flipped if it is a negated-input. + */ + TCGv_ptr fpst; + TCGv_i64 vn, vm, vd; + + /* + * Present in VFPv4 only. + * In v7A, UNPREDICTABLE with non-zero vector length/stride; from + * v8A, must UNDEF. We choose to UNDEF for both v7A and v8A. + */ + if (!arm_dc_feature(s, ARM_FEATURE_VFP4) || + (s->vec_len != 0 || s->vec_stride != 0)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && ((a->vd | a->vn | a->vm) & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vn = tcg_temp_new_i64(); + vm = tcg_temp_new_i64(); + vd = tcg_temp_new_i64(); + + neon_load_reg64(vn, a->vn); + neon_load_reg64(vm, a->vm); + if (a->o2) { + /* VFNMS, VFMS */ + gen_helper_vfp_negd(vn, vn); + } + neon_load_reg64(vd, a->vd); + if (a->o1 & 1) { + /* VFNMA, VFNMS */ + gen_helper_vfp_negd(vd, vd); + } + fpst = get_fpstatus_ptr(0); + gen_helper_vfp_muladdd(vd, vn, vm, vd, fpst); + neon_store_reg64(vd, a->vd); + + tcg_temp_free_ptr(fpst); + tcg_temp_free_i64(vn); + tcg_temp_free_i64(vm); + tcg_temp_free_i64(vd); + + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index a9ec6eaef80..150e9e64cc3 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3093,7 +3093,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0 ... 8: + case 0 ... 13: /* Already handled by decodetree */ return 1; default: @@ -3279,57 +3279,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 10: /* VFNMA : fd = muladd(-fd, fn, fm) */ - case 11: /* VFNMS : fd = muladd(-fd, -fn, fm) */ - case 12: /* VFMA : fd = muladd( fd, fn, fm) */ - case 13: /* VFMS : fd = muladd( fd, -fn, fm) */ - /* These are fused multiply-add, and must be done as one - * floating point operation with no rounding between the - * multiplication and addition steps. - * NB that doing the negations here as separate steps is - * correct : an input NaN should come out with its sign bit - * flipped if it is a negated-input. - */ - if (!arm_dc_feature(s, ARM_FEATURE_VFP4)) { - return 1; - } - if (dp) { - TCGv_ptr fpst; - TCGv_i64 frd; - if (op & 1) { - /* VFNMS, VFMS */ - gen_helper_vfp_negd(cpu_F0d, cpu_F0d); - } - frd = tcg_temp_new_i64(); - tcg_gen_ld_f64(frd, cpu_env, vfp_reg_offset(dp, rd)); - if (op & 2) { - /* VFNMA, VFNMS */ - gen_helper_vfp_negd(frd, frd); - } - fpst = get_fpstatus_ptr(0); - gen_helper_vfp_muladdd(cpu_F0d, cpu_F0d, - cpu_F1d, frd, fpst); - tcg_temp_free_ptr(fpst); - tcg_temp_free_i64(frd); - } else { - TCGv_ptr fpst; - TCGv_i32 frd; - if (op & 1) { - /* VFNMS, VFMS */ - gen_helper_vfp_negs(cpu_F0s, cpu_F0s); - } - frd = tcg_temp_new_i32(); - tcg_gen_ld_f32(frd, cpu_env, vfp_reg_offset(dp, rd)); - if (op & 2) { - gen_helper_vfp_negs(frd, frd); - } - fpst = get_fpstatus_ptr(0); - gen_helper_vfp_muladds(cpu_F0s, cpu_F0s, - cpu_F1s, frd, fpst); - tcg_temp_free_ptr(fpst); - tcg_temp_free_i32(frd); - } - break; case 14: /* fconst */ if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { return 1; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index de305f60e18..37eec0e1310 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -142,3 +142,12 @@ VDIV_sp ---- 1110 1.00 .... .... 1010 .0.0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp VDIV_dp ---- 1110 1.00 .... .... 1011 .0.0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp + +VFM_sp ---- 1110 1.01 .... .... 1010 . o2:1 . 0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp o1=1 +VFM_dp ---- 1110 1.01 .... .... 1011 . o2:1 . 0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp o1=1 +VFM_sp ---- 1110 1.10 .... .... 1010 . o2:1 . 0 .... \ + vm=%vm_sp vn=%vn_sp vd=%vd_sp o1=2 +VFM_dp ---- 1110 1.10 .... .... 1011 . o2:1 . 0 .... \ + vm=%vm_dp vn=%vn_dp vd=%vd_dp o1=2 From patchwork Tue Jun 11 10:53:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166414 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2237115ilk; Tue, 11 Jun 2019 04:33:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0agRkb5Zz5hHs4rfEcKeDYrLtSwCQ7biTCJrEPXnulwkTI/+MJFd5pa2CrkO1x1DMx8ou X-Received: by 2002:ac8:2d81:: with SMTP id p1mr62685843qta.279.1560252835327; Tue, 11 Jun 2019 04:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560252835; cv=none; d=google.com; s=arc-20160816; b=bgDMJ6zJjKeGQcFMGCA+QZANnB59+7DS8qsxeDPA4lWnKMZf/WHEs61wvQ92Wa7Bhr HyIBjPLQsEHIilHx0c6Y3rbMxjXDdOUbgBcVaCu/YXa1oVXxgB0RtT3oUxDnOlpVRdLu KHicBp8oO6kAgznOKo4RA8yGScOTuxQQ78jg5U/jmCl2hai0IMlfBC607kJjcWy2Rrlt /MEWF2i8y80mIBSuZzI21sToCpvboioDT7PJRwRaMCZ3mIsdSqBlMwDZsI2xmPVmbIsG xlyQw/wYcolyCTLsERDWpIDsbNC9A1N4Lgx0a6Q/eCmcu8FmP4R858CixM0lRskouuWZ CpmQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ZPtpQbYnqnO0AW8FSKJH17NNbI92/M4av0fUdFiBpKI=; b=TIDSiDUBqQGJZuHsddlZhwEHMmYJbs0GaTeqHl/IoXu2cXwkv21PGy3OUQe2939OjD YJW60Yjr5oflBuAMYJ/z45fuowCRjbKI2DYcPXX0lRzgzE2QVbBwezZvVk7wE69+0Jzw EkCmY0WGdgM2rEVmgUI9W2PiMJgGT5GjLY8QInYwk+lE+fAwHxk3oj2gmEMKc0+Sn3Gl gkezlXODtoymAsUzjJPegB9po2sfx2M7TlGUxbXOrb/g09sIO+7pftdpkwT2DLQ8nP1e P7dCgiy9+w2LEFn985GNCjrE/AvB/k49DpBMF1Z8NNjZLxZwrxQQWh3IiKnQsl49HTHG 7eYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dHxEYC3x; 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 t17si2669835qvt.104.2019.06.11.04.33.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:33:55 -0700 (PDT) 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=dHxEYC3x; 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 ([::1]:56496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haf2I-0007XP-TR for patch@linaro.org; Tue, 11 Jun 2019 07:33:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39609) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQO-0007an-Vw for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQL-0007rZ-8A for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:44 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:55060) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQK-0007eA-Np for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:40 -0400 Received: by mail-wm1-x342.google.com with SMTP id g135so2422159wme.4 for ; Tue, 11 Jun 2019 03:54:24 -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 :mime-version:content-transfer-encoding; bh=ZPtpQbYnqnO0AW8FSKJH17NNbI92/M4av0fUdFiBpKI=; b=dHxEYC3xnSNYr11Jb+v3P/HvFLW2rFNu15ZaYeNmNj8SCocTPqqU/T3Gsm6p5etvG4 6ksqERbqdKKbo6yrfSt1fs2zTZIf9P5eKoJIsT0MrIF2svaiWzWizWYu6KSjWO495CrZ 7oR6o4zjgxYwoR8JjN415c6A6UJzE7rIBj/htElzjJbUmvIpjibajL5uxTea/6BcxVWy klBzO6vtOKUgIhCtBeOXaidc0jRgUN4ymwL5fvMpblILwi0SSgAlMzwoW4ENaatcNgUc tk2m+tI/AZwiczGzUy18n3bvbLX+klLAaA2ZJd49BglDabpo3P7JgNiQr+fe9bQpadOr P85A== 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:mime-version:content-transfer-encoding; bh=ZPtpQbYnqnO0AW8FSKJH17NNbI92/M4av0fUdFiBpKI=; b=Jf8SiG0nc4drcxJSFJVk3m4bNaYvldneIfUaYlErzSdDbtuk+g7kzLIvOLzEEZdrAs Es7bvUPnwNBVB3oGw1il3KpMnCQv2DwcvFbqcuBKsVQF9Tl+Pv8QKLE+32+yyECnq2W7 micFAeh0/JRdWK2ML4vsRus1Um4oeLh0zpM09RmjkIXSM/8D3/rOutdVJQJ34FgCOo+t JmJu5tYjZMcEc4Zg6FJTfgOUwVa3ZxpXXcv1FFzWubRr9yO2kYLx+Zd37tNzlrI7dAip 1IeD6KGSkZxB4mwKoWuiyQTRVy14cfCnbgCMTc+2pf7GQva843q6yt+V9kcVEWm9+2vd emGg== X-Gm-Message-State: APjAAAWpi1VeKIP+YJEwknP9SYtcqFJ6hxdP1ffXzUExs0UfFHiq6I4E qV8ea/nYutNDUlpbpsQPkejPIw== X-Received: by 2002:a7b:ce01:: with SMTP id m1mr17046256wmc.1.1560250464070; Tue, 11 Jun 2019 03:54:24 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:23 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:37 +0100 Message-Id: <20190611105351.9871-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 28/42] target/arm: Convert VMOV (imm) to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP VMOV (immediate) instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 129 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 27 +------ target/arm/vfp.decode | 5 ++ 3 files changed, 136 insertions(+), 25 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index ba6506a378c..a2eeb6cb511 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1602,3 +1602,132 @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_sp *a) return true; } + +static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) +{ + uint32_t delta_d = 0; + uint32_t bank_mask = 0; + int veclen = s->vec_len; + TCGv_i32 fd; + uint32_t n, i, vd; + + vd = a->vd; + + if (!dc_isar_feature(aa32_fpshvec, s) && + (veclen != 0 || s->vec_stride != 0)) { + return false; + } + + if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (veclen > 0) { + bank_mask = 0x18; + /* Figure out what type of vector operation this is. */ + if ((vd & bank_mask) == 0) { + /* scalar */ + veclen = 0; + } else { + delta_d = s->vec_stride + 1; + } + } + + n = (a->imm4h << 28) & 0x80000000; + i = ((a->imm4h << 4) & 0x70) | a->imm4l; + if (i & 0x40) { + i |= 0x780; + } else { + i |= 0x800; + } + n |= i << 19; + + fd = tcg_temp_new_i32(); + tcg_gen_movi_i32(fd, n); + + for (;;) { + neon_store_reg32(fd, vd); + + if (veclen == 0) { + break; + } + + /* Set up the operands for the next iteration */ + veclen--; + vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + } + + tcg_temp_free_i32(fd); + return true; +} + +static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) +{ + uint32_t delta_d = 0; + uint32_t bank_mask = 0; + int veclen = s->vec_len; + TCGv_i64 fd; + uint32_t n, i, vd; + + vd = a->vd; + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && (vd & 0x10)) { + return false; + } + + if (!dc_isar_feature(aa32_fpshvec, s) && + (veclen != 0 || s->vec_stride != 0)) { + return false; + } + + if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (veclen > 0) { + bank_mask = 0xc; + /* Figure out what type of vector operation this is. */ + if ((vd & bank_mask) == 0) { + /* scalar */ + veclen = 0; + } else { + delta_d = (s->vec_stride >> 1) + 1; + } + } + + n = (a->imm4h << 28) & 0x80000000; + i = ((a->imm4h << 4) & 0x70) | a->imm4l; + if (i & 0x40) { + i |= 0x3f80; + } else { + i |= 0x4000; + } + n |= i << 16; + + fd = tcg_temp_new_i64(); + tcg_gen_movi_i64(fd, ((uint64_t)n) << 32); + + for (;;) { + neon_store_reg64(fd, vd); + + if (veclen == 0) { + break; + } + + /* Set up the operands for the next iteration */ + veclen--; + vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + } + + tcg_temp_free_i64(fd); + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 150e9e64cc3..b0a12991131 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3033,7 +3033,7 @@ static void gen_neon_dup_high16(TCGv_i32 var) */ static int disas_vfp_insn(DisasContext *s, uint32_t insn) { - uint32_t rd, rn, rm, op, i, n, delta_d, delta_m, bank_mask; + uint32_t rd, rn, rm, op, delta_d, delta_m, bank_mask; int dp, veclen; TCGv_i32 tmp; TCGv_i32 tmp2; @@ -3093,7 +3093,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rn = VFP_SREG_N(insn); switch (op) { - case 0 ... 13: + case 0 ... 14: /* Already handled by decodetree */ return 1; default: @@ -3279,29 +3279,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) for (;;) { /* Perform the calculation. */ switch (op) { - case 14: /* fconst */ - if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { - return 1; - } - - n = (insn << 12) & 0x80000000; - i = ((insn >> 12) & 0x70) | (insn & 0xf); - if (dp) { - if (i & 0x40) - i |= 0x3f80; - else - i |= 0x4000; - n |= i << 16; - tcg_gen_movi_i64(cpu_F0d, ((uint64_t)n) << 32); - } else { - if (i & 0x40) - i |= 0x780; - else - i |= 0x800; - n |= i << 19; - tcg_gen_movi_i32(cpu_F0s, n); - } - break; case 15: /* extension space */ switch (rn) { case 0: /* cpy */ diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 37eec0e1310..1818d4f71e1 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -151,3 +151,8 @@ VFM_sp ---- 1110 1.10 .... .... 1010 . o2:1 . 0 .... \ vm=%vm_sp vn=%vn_sp vd=%vd_sp o1=2 VFM_dp ---- 1110 1.10 .... .... 1011 . o2:1 . 0 .... \ vm=%vm_dp vn=%vn_dp vd=%vd_dp o1=2 + +VMOV_imm_sp ---- 1110 1.11 imm4h:4 .... 1010 0000 imm4l:4 \ + vd=%vd_sp +VMOV_imm_dp ---- 1110 1.11 imm4h:4 .... 1011 0000 imm4l:4 \ + vd=%vd_dp From patchwork Tue Jun 11 10:53:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166425 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2253899ilk; Tue, 11 Jun 2019 04:51:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxykpSQFjcflT8XTbq4+c/EUXRuFMF3eFXmL8aaS+uvP8dVpozoLVCxoW6PsTZMGP67rXTD X-Received: by 2002:a37:6086:: with SMTP id u128mr40250188qkb.270.1560253891935; Tue, 11 Jun 2019 04:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253891; cv=none; d=google.com; s=arc-20160816; b=yx/hc1jXq3jguRf5Q1wMm08EolI4DJk0tZH+XYK2Vm7BeWRo73ljDqk8NJjXTp7WxE 9uCcPxOoPgcsh2wwALAGxjj1LTXbXMqpt1zZqamexb48OlYyAwdFAxHyyaUTganNFhyL adqje2T8iLcWtZ2a9ET+WPQNgw0IkPkINHLUjOqXtZZVuiov6SxY8fWcpt5Mkmqc90lR IaNaa86QS4GU3Ao/DwwXebYRDcIfqb/5NGKe8uAFxEtZBex+QotdrM86Ea/dkojWKQGh XW1vmRrlN64jD85pN4jIwmpxD2qp6pw0Cq35cF30eeELhQ5rRusAaWHFcgDjFKFlPudC 5pEQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=N8BOuezDpp42OnyV20yZBqANiSyilNmhgxUgVqhZzZc=; b=regIxRkRPGoBUKbHQ8n4h9BHL80y2kUlOLq/rhDT9V3Qtbrsra6wPk6+Xw53x5SGru 3J2KM5LaTu58PasiZVM9XXuWKVkFVrcX6yxjbos/XsrNTU43t5wueVTvyH7haoExa6Tr 1RKAdyQFK28VXX00nG7x6wJw2eESar864J5er2Lb7jEgUVucZb+DOJIFAsrs1aJWwh+P e7xyRNOslhS7cR3GgyH9QEOOoDeJbM6veiKeXsEnCZ1g97Khcp4GU2FS9j+iMchvdIIj sj7o5u+6aEP0m20Hp09kNokGb0qKtJ1kV+aDdDkmQEHlAEuVA3SK8SyLhowTlh8XVBN6 U71Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xpIiy7rW; 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 v65si5129373qka.78.2019.06.11.04.51.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:51:31 -0700 (PDT) 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=xpIiy7rW; 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 ([::1]:56672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafJL-0006qC-G5 for patch@linaro.org; Tue, 11 Jun 2019 07:51:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39692) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQR-0007fU-Ma for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQL-0007ru-Cc for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:47 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:46505) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQK-0007f6-Rc for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:41 -0400 Received: by mail-wr1-x444.google.com with SMTP id n4so12436115wrw.13 for ; Tue, 11 Jun 2019 03:54:26 -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 :mime-version:content-transfer-encoding; bh=N8BOuezDpp42OnyV20yZBqANiSyilNmhgxUgVqhZzZc=; b=xpIiy7rWyDUQhlNkVsTB0l81I2HfGBOEcc405QF6gh6QS1U2Xpg/3WLjD/Ye5qSXrG JztndLjMvNg1vpXTEnaQCLYZn48xGI4np0E94CeqrZCKx/oTpNDXADgjKGNRrF7/EGTc ogP0uLcIdybascNH3/6SB+p49LYepCQIcTMakRONpxH79gGLq7mVsieK3cce+rzkLnkU wqNcda9SZ35421zH5OTf44kWjK2aTkfWjWRUkIk9MihdHfJHcWiLEohBkl7E7RBO6q6Y g2qHj2VyLr8yOQG4b4g3wlg3WY/wCUEQxmqwVwdaGblyQM7jt+9d2Dr9mLY1s38i6J/7 H9LA== 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:mime-version:content-transfer-encoding; bh=N8BOuezDpp42OnyV20yZBqANiSyilNmhgxUgVqhZzZc=; b=MpGCY+HAb2dF5PDyyWqSTGZsg1pkY7UN8FP0pDhiZmIkne0q7nZlS8sZoFWZ7YuVgK LMpJeoSMqWT0I3OBm9E+9TbUwEf6xu6sZCFBH/xzDrFVxcwa4jouUoGa6CBYUs1jZAZZ 2kyWRDlb7Lto9XvUCMddSlKibIciohHhO3vmPIxyDHuKsi2qR5gJZAE0kwzudAD836m7 q6PDKU/j/fPRfCsl2AtttjzRiAGj1ngnWDfj1uAgBTtc0paR29Jq0U7TcMSggoCIOn8n 5wzlP/hWa0o8ciWTFJHwkNFx2jKc/FKndbB3DBrwvwVxPJqarU0qwy1Qz0Eg6sjqBuAN 9z/Q== X-Gm-Message-State: APjAAAWCuk5w6TefCfhkLHAlJv52gG2h8cPreVJEfJYAz5fWQF23Nvu4 mxPo3qsRz5qBAyffy2o8oT2AYA== X-Received: by 2002:adf:dd89:: with SMTP id x9mr14089087wrl.7.1560250465386; Tue, 11 Jun 2019 03:54:25 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:24 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:38 +0100 Message-Id: <20190611105351.9871-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH v2 29/42] target/arm: Convert VABS to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP VABS instruction to decodetree. Unlike the 3-op versions, we don't pass fpst to the VFPGen2OpSPFn or VFPGen2OpDPFn because none of the operations which use this format and support short vectors will need it. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 167 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 12 ++- target/arm/vfp.decode | 5 + 3 files changed, 180 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index a2eeb6cb511..d0282f1f921 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1111,6 +1111,14 @@ typedef void VFPGen3OpSPFn(TCGv_i32 vd, typedef void VFPGen3OpDPFn(TCGv_i64 vd, TCGv_i64 vn, TCGv_i64 vm, TCGv_ptr fpst); +/* + * Types for callbacks for do_vfp_2op_sp() and do_vfp_2op_dp(). + * The callback should emit code to write a value to vd (which + * should be written to only). + */ +typedef void VFPGen2OpSPFn(TCGv_i32 vd, TCGv_i32 vm); +typedef void VFPGen2OpDPFn(TCGv_i64 vd, TCGv_i64 vm); + /* * Perform a 3-operand VFP data processing instruction. fn is the * callback to do the actual operation; this function deals with the @@ -1274,6 +1282,155 @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, return true; } +static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm) +{ + uint32_t delta_m = 0; + uint32_t delta_d = 0; + uint32_t bank_mask = 0; + int veclen = s->vec_len; + TCGv_i32 f0, fd; + + if (!dc_isar_feature(aa32_fpshvec, s) && + (veclen != 0 || s->vec_stride != 0)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (veclen > 0) { + bank_mask = 0x18; + + /* Figure out what type of vector operation this is. */ + if ((vd & bank_mask) == 0) { + /* scalar */ + veclen = 0; + } else { + delta_d = s->vec_stride + 1; + + if ((vm & bank_mask) == 0) { + /* mixed scalar/vector */ + delta_m = 0; + } else { + /* vector */ + delta_m = delta_d; + } + } + } + + f0 = tcg_temp_new_i32(); + fd = tcg_temp_new_i32(); + + neon_load_reg32(f0, vm); + + for (;;) { + fn(fd, f0); + neon_store_reg32(fd, vd); + + if (veclen == 0) { + break; + } + + if (delta_m == 0) { + /* single source one-many */ + while (veclen--) { + vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + neon_store_reg32(fd, vd); + } + break; + } + + /* Set up the operands for the next iteration */ + veclen--; + vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + vm = ((vm + delta_m) & (bank_mask - 1)) | (vm & bank_mask); + neon_load_reg32(f0, vm); + } + + tcg_temp_free_i32(f0); + tcg_temp_free_i32(fd); + + return true; +} + +static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm) +{ + uint32_t delta_m = 0; + uint32_t delta_d = 0; + uint32_t bank_mask = 0; + int veclen = s->vec_len; + TCGv_i64 f0, fd; + + /* UNDEF accesses to D16-D31 if they don't exist */ + if (!dc_isar_feature(aa32_fp_d32, s) && ((vd | vm) & 0x10)) { + return false; + } + + if (!dc_isar_feature(aa32_fpshvec, s) && + (veclen != 0 || s->vec_stride != 0)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + if (veclen > 0) { + bank_mask = 0xc; + + /* Figure out what type of vector operation this is. */ + if ((vd & bank_mask) == 0) { + /* scalar */ + veclen = 0; + } else { + delta_d = (s->vec_stride >> 1) + 1; + + if ((vm & bank_mask) == 0) { + /* mixed scalar/vector */ + delta_m = 0; + } else { + /* vector */ + delta_m = delta_d; + } + } + } + + f0 = tcg_temp_new_i64(); + fd = tcg_temp_new_i64(); + + neon_load_reg64(f0, vm); + + for (;;) { + fn(fd, f0); + neon_store_reg64(fd, vd); + + if (veclen == 0) { + break; + } + + if (delta_m == 0) { + /* single source one-many */ + while (veclen--) { + vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + neon_store_reg64(fd, vd); + } + break; + } + + /* Set up the operands for the next iteration */ + veclen--; + vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + vm = ((vm + delta_m) & (bank_mask - 1)) | (vm & bank_mask); + neon_load_reg64(f0, vm); + } + + tcg_temp_free_i64(f0); + tcg_temp_free_i64(fd); + + return true; +} + static void gen_VMLA_sp(TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm, TCGv_ptr fpst) { /* Note that order of inputs to the add matters for NaNs */ @@ -1731,3 +1888,13 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) tcg_temp_free_i64(fd); return true; } + +static bool trans_VABS_sp(DisasContext *s, arg_VABS_sp *a) +{ + return do_vfp_2op_sp(s, gen_helper_vfp_abss, a->vd, a->vm); +} + +static bool trans_VABS_dp(DisasContext *s, arg_VABS_dp *a) +{ + return do_vfp_2op_dp(s, gen_helper_vfp_absd, a->vd, a->vm); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index b0a12991131..dc9076a60a3 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3096,6 +3096,14 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) case 0 ... 14: /* Already handled by decodetree */ return 1; + case 15: + switch (rn) { + case 1: + /* Already handled by decodetree */ + return 1; + default: + break; + } default: break; } @@ -3104,7 +3112,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) /* rn is opcode, encoded as per VFP_SREG_N. */ switch (rn) { case 0x00: /* vmov */ - case 0x01: /* vabs */ case 0x02: /* vneg */ case 0x03: /* vsqrt */ break; @@ -3284,9 +3291,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) case 0: /* cpy */ /* no-op */ break; - case 1: /* abs */ - gen_vfp_abs(dp); - break; case 2: /* neg */ gen_vfp_neg(dp); break; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 1818d4f71e1..7035861c270 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -156,3 +156,8 @@ VMOV_imm_sp ---- 1110 1.11 imm4h:4 .... 1010 0000 imm4l:4 \ vd=%vd_sp VMOV_imm_dp ---- 1110 1.11 imm4h:4 .... 1011 0000 imm4l:4 \ vd=%vd_dp + +VABS_sp ---- 1110 1.11 0000 .... 1010 11.0 .... \ + vd=%vd_sp vm=%vm_sp +VABS_dp ---- 1110 1.11 0000 .... 1011 11.0 .... \ + vd=%vd_dp vm=%vm_dp From patchwork Tue Jun 11 10:53:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166422 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2251858ilk; Tue, 11 Jun 2019 04:49:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyd3wIzSbLL1z6v+TtJufZXnlt8OjzHXXWTleIiExcNB/nlT/RqW2K5JLEOczcF1TGgiDNq X-Received: by 2002:a0c:8722:: with SMTP id 31mr27191926qvh.164.1560253760136; Tue, 11 Jun 2019 04:49:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253760; cv=none; d=google.com; s=arc-20160816; b=w1zgTcTqYu0vdWSLn3kqkH24oJztV/MQNzH0B72P70Ql+QE4IDyLxYNoqPDRuTy8+A 08P0wfD5k9l49KHfB1+RY73Mz/OGEIkYSrUi6RE3r7kFYMCs92CBqkFx1H4rqBaRl7ey Px1WubSHIanF4wU10ZTCiiASTejUW/2MLBGLepXXMhQgoQ3Z+3sa7yHSDLu857x02jX5 Xtm1QgBXi3Jk6QGryyEVTp29BOIFacbN9GsmunRph1ePf30DE5Y2gjos5kgDnTUKZEQW IhsAuJVOtBHjoHv2tl3rljUJQEU3X4cwZsgGQz50jULz62gEnxW7bM1kflF6sUPe3Xow WMzA== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=fcAWsgac4JAw4zukSEhib/ItxuFypx2icjrecghPreY=; b=P9bS+q4IP/Jo7aZsEGrffrDrKj+rotku6odzBZOFMlFkNW5RH5xSVzKNVuz+/YHTeo HcAsHTZYyR1B+Ug/GxcRDZKNVB5AGKZehBExOlWAOOFU4tiJOpqsAq5IuXz04AHyT8Cf U3fzUwlf+ctKQSBXtCFVIcOwHd8vad2GyCnpsM8Dtg5MU1jwO9pHdjAcVMDkVgUZE4kw Rj1gbwBW5mxy0mPmNcfobwznJMmKSW2psrP/6zEYmvwPGBQYhNzXSbM5cQAsuvlt0KEm ZTCmsg5WZ0aDt0uVZeNDPHEupI3yXwprQRW888g743Mu0fpwLlhafZSwUwxPkZkRiNSC 7vBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MIoEbvCM; 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 q19si1799659qtj.324.2019.06.11.04.49.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:49:20 -0700 (PDT) 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=MIoEbvCM; 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 ([::1]:56654 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafHD-00051l-MT for patch@linaro.org; Tue, 11 Jun 2019 07:49:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39731) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQS-0007hk-UW for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQM-0007tr-4C for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:48 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:34585) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQL-0007fp-Ma for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:41 -0400 Received: by mail-wr1-x443.google.com with SMTP id e16so12522063wrn.1 for ; Tue, 11 Jun 2019 03:54:27 -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 :mime-version:content-transfer-encoding; bh=fcAWsgac4JAw4zukSEhib/ItxuFypx2icjrecghPreY=; b=MIoEbvCMPWqqtTv1HZ0nqexfsLD4r4Jb0vCP59Di1EUIV9ad7p/cK5L6A7+vlMe+Rt sEOCVhlI2gaA2kQT3NbCT3IbQMJ19DdBF4fOMk8BYyH8YbmIZP0t9kgzU0mf5RSNwv5N zycJUYvjtwaeEtQN1eY8T00W2vvQ6kJe9ShS2jhBk+WJuGEjPgPdqHpFK+LHQ9bMHur+ CqvD5o6Vu9+r8OlVntXNMjWVzdrgFtGD2P7RpCHq8wQarrWfx1AmGOYiPGIn5sbDw3n7 SAYxpRqOq4eeE3dgpfIllTsK+gX6Z2yPMRsXIA7iQvaDC3wemI2AMu0gL43P29o6slWo nm0A== 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:mime-version:content-transfer-encoding; bh=fcAWsgac4JAw4zukSEhib/ItxuFypx2icjrecghPreY=; b=LHlPoHS6/MDSr+LOV4+gtUSi9aszXEMV1m0oNqmhYNo6wqo6EIr4JdfM1dvBlgkxrD 8GWZTRmzzcrpVSLnGhxAhhPigYo9pLQnzPkiD3DUhV0SHwMDpJBud9S7kLq6eLz6BrEL NUxfKq7ihnrRzQecC68k0tBojOxqT48dJJaPKbz/tANhmLCuxyPm1JO8T8qtjMd81x6m CcoKJdcaor28jYwLdk2GjxbgsLKetju6nXZo+2/0DEpFlHwNOvBJzBnE113I57ZVluG9 dJdg8wxt+udJRTInkKdXVLaJ/h1nNpKhxceWuQ0NeIiLujAsRJBvXuGdX9MqU9MVktKW YpTw== X-Gm-Message-State: APjAAAWsQrM0w2H/FxbmL4fkAoX9h+2/izHIxVtBmUlmJN5e86aWISEU Kx1DSCRfeZ2Vq/Vxjqp2LTKtVg== X-Received: by 2002:adf:de90:: with SMTP id w16mr17413792wrl.217.1560250466360; Tue, 11 Jun 2019 03:54:26 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:25 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:39 +0100 Message-Id: <20190611105351.9871-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH v2 30/42] target/arm: Convert VNEG to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VNEG instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 10 ++++++++++ target/arm/translate.c | 6 +----- target/arm/vfp.decode | 5 +++++ 3 files changed, 16 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index d0282f1f921..6e06b2a130a 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1898,3 +1898,13 @@ static bool trans_VABS_dp(DisasContext *s, arg_VABS_dp *a) { return do_vfp_2op_dp(s, gen_helper_vfp_absd, a->vd, a->vm); } + +static bool trans_VNEG_sp(DisasContext *s, arg_VNEG_sp *a) +{ + return do_vfp_2op_sp(s, gen_helper_vfp_negs, a->vd, a->vm); +} + +static bool trans_VNEG_dp(DisasContext *s, arg_VNEG_dp *a) +{ + return do_vfp_2op_dp(s, gen_helper_vfp_negd, a->vd, a->vm); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index dc9076a60a3..b0eecb6ca8f 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3098,7 +3098,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; case 15: switch (rn) { - case 1: + case 1 ... 2: /* Already handled by decodetree */ return 1; default: @@ -3112,7 +3112,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) /* rn is opcode, encoded as per VFP_SREG_N. */ switch (rn) { case 0x00: /* vmov */ - case 0x02: /* vneg */ case 0x03: /* vsqrt */ break; @@ -3291,9 +3290,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) case 0: /* cpy */ /* no-op */ break; - case 2: /* neg */ - gen_vfp_neg(dp); - break; case 3: /* sqrt */ gen_vfp_sqrt(dp); break; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 7035861c270..79e41963be4 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -161,3 +161,8 @@ VABS_sp ---- 1110 1.11 0000 .... 1010 11.0 .... \ vd=%vd_sp vm=%vm_sp VABS_dp ---- 1110 1.11 0000 .... 1011 11.0 .... \ vd=%vd_dp vm=%vm_dp + +VNEG_sp ---- 1110 1.11 0001 .... 1010 01.0 .... \ + vd=%vd_sp vm=%vm_sp +VNEG_dp ---- 1110 1.11 0001 .... 1011 01.0 .... \ + vd=%vd_dp vm=%vm_dp From patchwork Tue Jun 11 10:53:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166424 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2253647ilk; Tue, 11 Jun 2019 04:51:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxy9p98vBN3GOgy3jYg1Ug/YqKHyJX/IYEd6A+dB+RUllezWt1RjTV6Ig+y+MGQ3VOzUd6x X-Received: by 2002:ac8:1010:: with SMTP id z16mr52878833qti.367.1560253876341; Tue, 11 Jun 2019 04:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253876; cv=none; d=google.com; s=arc-20160816; b=W1A6sHUwP/bmceaucjQT9hg1P8ONqVuvLUQAg2JyI44itmCtT0WyPVlgTe+ICVMnD7 wSfG4eoXSHofpFdg4tOI+Zb6i2BLLlj5BJpqele9MoLBvbRGZ2Q6orqYeCVIFzcR1W5Z DAU1xgFYhZJikVvoW5+BmW3bUGp3tnBgG+Ys9Tb0MrKHFlMZ3vkMV6YLmuDYYkiurfUO LNTJd4iDeCuPJs98lZgoP/6C5sqSOMVkVbKo57aFGLhAsKaFS45CleLWvpNrH5WHwjNf faYT9UpDJUYClLILsSeHdKqX81lm5Ww3QERl0+rc1Mh5HI1PxAuQCoIhLucGugBeiWQt lzeA== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ArclSEoRm2zBs6YVh3NYURVc6boo9wJxlzan6nD1jCM=; b=pGosZjVQApwKyAEtdcbVFwsvh3p4cEHd90Y/T95P8sV+IjhxpckS7cHOPxdOPRco+2 0bNFpnoXasIbHKeYPvC8LyJVy65oFYMM9L/H/LYKhKEIUk4Lir4vmu+lypFjY/PiYNsI OnWNGkhn5BY03gz+dOtOeO4xXHbABZ+RJDq6iyICChlZq4jZSiJELM1Tp8HdkYtT39BB TqMNcsnV0xk/bgmGyNBGEGQZ1ZW1k/bEiyZJrwaEdJZfijfaVuxfxzTQb5vzSqkhac6d 2BNvy9vAFb+/Lzf9D0Fu9cupotfcE13Pi57f2fI8FEi0+rFaIQjNyrLOwROT2PtNeuo1 4i5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MDv3GQGD; 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 u6si6288465qte.126.2019.06.11.04.51.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:51:16 -0700 (PDT) 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=MDv3GQGD; 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 ([::1]:56670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafJ5-0006hC-Rw for patch@linaro.org; Tue, 11 Jun 2019 07:51:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39699) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQR-0007fa-RU for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQL-0007t7-Qk for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:47 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:41374) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQL-0007gR-Dz for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:41 -0400 Received: by mail-wr1-x443.google.com with SMTP id c2so12477164wrm.8 for ; Tue, 11 Jun 2019 03:54:28 -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 :mime-version:content-transfer-encoding; bh=ArclSEoRm2zBs6YVh3NYURVc6boo9wJxlzan6nD1jCM=; b=MDv3GQGDV37DbvwmtT3ayV+ug4cRNFprEwYhiO9vyIq/QSwpVWWDXY4P4uyH78y0oA BfB6mX0lss1ov48mInGJnxc6sV1kg7SUDkil+BdmQbD7bJWJaVtTJfiNK2Zt5xu4YhhM rRUU84N1eqSubhzPGH7IcSO43r6fcFGT3I/M69rUUsyTEsb7uBJ4Skjx53P72HQqKwEq w+g6UNQXZ5P8YdaBK/yn22mjp0uzwE8O8Ycej9T3Q5bfcHIHoFeo7zZonLAYX8w94PcI ozrCeiAosJJPlMxcoNCNffbx7sy46nubkOrw1TkpKktGZWrt17e7GkZlVxu/acHfsg/M 0Udg== 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:mime-version:content-transfer-encoding; bh=ArclSEoRm2zBs6YVh3NYURVc6boo9wJxlzan6nD1jCM=; b=obTOplNsR6m8xpuuARcITgIpks+gEUHTKKWVcjvaAMWupl90SPb9TNYSSJJ8hzSuR9 Ec3WreOjs1qzDizXKKaVzgIsOsB4e2qAOEw1CsoDWYjCJNY8bZ+tEtd9z7F+cYb+9tje f9Vs1GG+dFWn7UV8nUoXH4ReGk9iAE0uJBffkRTzCJQ0tZ1hEaDPLpGBF9gcs9HqsKkX 1pD7PGmoF5XvTWIP68S41sQE4mw+PiX0ts2vBgpIdskE1uFfd0E/K71NDGrrJpc6eLrl 0JxiC9SxT7qzTqHkxop3y71StHJpJkmB2a8c6IkG4pKjxc1sJMQJy1e/fbOSdvk2x85S iToQ== X-Gm-Message-State: APjAAAWzrD1HAKI7+YNtd4cMiGL5D7u3FT8zz8/b022yZB3UCbyfC4IU vPwy9urjJCBy6Ha454vYozt/Pg== X-Received: by 2002:a5d:5510:: with SMTP id b16mr14634904wrv.267.1560250467310; Tue, 11 Jun 2019 03:54:27 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:26 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:40 +0100 Message-Id: <20190611105351.9871-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH v2 31/42] target/arm: Convert VSQRT to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VSQRT instruction to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 20 ++++++++++++++++++++ target/arm/translate.c | 14 +------------- target/arm/vfp.decode | 5 +++++ 3 files changed, 26 insertions(+), 13 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 6e06b2a130a..ae2f77a873b 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1908,3 +1908,23 @@ static bool trans_VNEG_dp(DisasContext *s, arg_VNEG_dp *a) { return do_vfp_2op_dp(s, gen_helper_vfp_negd, a->vd, a->vm); } + +static void gen_VSQRT_sp(TCGv_i32 vd, TCGv_i32 vm) +{ + gen_helper_vfp_sqrts(vd, vm, cpu_env); +} + +static bool trans_VSQRT_sp(DisasContext *s, arg_VSQRT_sp *a) +{ + return do_vfp_2op_sp(s, gen_VSQRT_sp, a->vd, a->vm); +} + +static void gen_VSQRT_dp(TCGv_i64 vd, TCGv_i64 vm) +{ + gen_helper_vfp_sqrtd(vd, vm, cpu_env); +} + +static bool trans_VSQRT_dp(DisasContext *s, arg_VSQRT_dp *a) +{ + return do_vfp_2op_dp(s, gen_VSQRT_dp, a->vd, a->vm); +} diff --git a/target/arm/translate.c b/target/arm/translate.c index b0eecb6ca8f..ce805f0ab28 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1390,14 +1390,6 @@ static inline void gen_vfp_neg(int dp) gen_helper_vfp_negs(cpu_F0s, cpu_F0s); } -static inline void gen_vfp_sqrt(int dp) -{ - if (dp) - gen_helper_vfp_sqrtd(cpu_F0d, cpu_F0d, cpu_env); - else - gen_helper_vfp_sqrts(cpu_F0s, cpu_F0s, cpu_env); -} - static inline void gen_vfp_cmp(int dp) { if (dp) @@ -3098,7 +3090,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; case 15: switch (rn) { - case 1 ... 2: + case 1 ... 3: /* Already handled by decodetree */ return 1; default: @@ -3112,7 +3104,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) /* rn is opcode, encoded as per VFP_SREG_N. */ switch (rn) { case 0x00: /* vmov */ - case 0x03: /* vsqrt */ break; case 0x04: /* vcvtb.f64.f16, vcvtb.f32.f16 */ @@ -3290,9 +3281,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) case 0: /* cpy */ /* no-op */ break; - case 3: /* sqrt */ - gen_vfp_sqrt(dp); - break; case 4: /* vcvtb.f32.f16, vcvtb.f64.f16 */ { TCGv_ptr fpst = get_fpstatus_ptr(false); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 79e41963be4..2780e1ed9ea 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -166,3 +166,8 @@ VNEG_sp ---- 1110 1.11 0001 .... 1010 01.0 .... \ vd=%vd_sp vm=%vm_sp VNEG_dp ---- 1110 1.11 0001 .... 1011 01.0 .... \ vd=%vd_dp vm=%vm_dp + +VSQRT_sp ---- 1110 1.11 0001 .... 1010 11.0 .... \ + vd=%vd_sp vm=%vm_sp +VSQRT_dp ---- 1110 1.11 0001 .... 1011 11.0 .... \ + vd=%vd_dp vm=%vm_dp From patchwork Tue Jun 11 10:53:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166427 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2258263ilk; Tue, 11 Jun 2019 04:56:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBbf2OwynG2YAKNfwTXfV3RidPMDqAieUUmZzkdoo0tzmy/4uwtIoaESuVx4Ux3fE5LSVB X-Received: by 2002:ac8:7c7:: with SMTP id m7mr59729616qth.28.1560254180116; Tue, 11 Jun 2019 04:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560254180; cv=none; d=google.com; s=arc-20160816; b=H2omd95hMDXNQeiyT6pN2grl0g+ak2bpKxphYElO6S+CwxU1Apfjwf5AFZHv/4VuRL OAqaC5O3jlGOzYgzBJRnzVWEzhtmFYvCDEOrzqXYAhz4bzwmvdmPzS5TXi/MsV9JmLn6 wM4NoSHK6VwKiwo/F8r41yccSiY+C5pIUbj4ihyWAjHsEqYtISpDVUxRev5wfvnGThtL i24aJqufUfZgAhid4EjIpvZakJcp3Ad7QA8ZcCna8NBi/YW8IXjxOQebY/cwTPiFr99d wPtXAkThjzYreFTVOAj7X78NzDMV/gaGLE9f6J3eOIMjAtI4PadYjWR20NaLsK3gtIJn zc3A== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=OdD7ugR/BLvUdOtU43yNG5jqeDwBZd2sqvJMrpioEU0=; b=nDipO4FOfRuA/dlVUWV/L5G2SDYmGMXMsI1dHU+ti3UnuVRcPt2fc4WnhIWyuTYA+S ZmJFAwwbVMhDR6KV7sF5BWEfQe0SvngCwC3SFD3dTRSbRKL3uo/5xZzkS7gCSSjxECDq gLRLK3/ccOpb2hKtApaS9MCnokIVlVROQG67Dnvix+tvi4WzWrjkODu9ECQDTVtblZrY d108xfYtDw7bo3WrIMdCmAPL7mLyxEFX1v8sYUgP0AOHrm0yVKlNmNGOdh7gQO7d1krR geZ874oyFSSPP8glImR3Y73A4E+oKXQrytM991u8f9QwdDO4BvpldP2RGYUo3ErvAHmQ 5Z0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Y+Zd42k1; 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 b20si903183qte.321.2019.06.11.04.56.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:56:20 -0700 (PDT) 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=Y+Zd42k1; 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 ([::1]:56726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafNz-0005ao-Nd for patch@linaro.org; Tue, 11 Jun 2019 07:56:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39927) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQb-0007sH-M5 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQV-00083S-Mp for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:57 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:32811) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQV-0007h7-4i for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:51 -0400 Received: by mail-wm1-x344.google.com with SMTP id h19so1658467wme.0 for ; Tue, 11 Jun 2019 03:54: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 :mime-version:content-transfer-encoding; bh=OdD7ugR/BLvUdOtU43yNG5jqeDwBZd2sqvJMrpioEU0=; b=Y+Zd42k13VSc4UQ12TONhB2KWeELhzVPKxx7wJ74+r2TQ2UqNKsLcUq/FePrO6InZC x5+SlDtddq4Drbg06sOlTbxg1DJNgOBxft2Op4nEf2t///pwdrTNVJdn53D9Pt2fCAbu r/9NuFhkIa5NWqKH9toW9mnW2BxTpQd5/UcYpvmkT3zbixLIj7Tm3U0mnv6cREeCAROz 8WM8ZPVVwbZPTuqoVlg9YSG1jJ0C1Vfm4jWP50W/DlhHRApGQWiq7G6Qom5bYIvQ+XYa SOBSs4h8oOk9hqTWuv4Jv45zOeVNOMZ8EiQsQH3fte7U4HeD+kAiSS9Ab3lhapI7sjYM b5jQ== 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:mime-version:content-transfer-encoding; bh=OdD7ugR/BLvUdOtU43yNG5jqeDwBZd2sqvJMrpioEU0=; b=rQftt8WOucjXSWo+0ClbE48ChA/1d4ehctUExZbpoEY3yxu/GD14rzhPyHqQZxPAaJ Ar0yVHjveJ/BoH9cvG8htDJRvb7V8DwW3B7G85hloywcPeEg9P8pxDXnGWtOwzNFb0J2 4of+z/AsM/3wE+eWFSVVUqcoj/T2bKuQqCsaVKrz0n/+SDF4Z9PBmGUpkye5uXPwrBBP UqCQDuM4Ic+SyxU2I3l1Xc5YpiwL9OzG4L0NZLMJF9kmoVxc6EGTrsduBrHDLL2BQbW8 Vr2xDSJs2NShg/WUhR/roJ3GiUzgg9eEEJ1dw4+uJMkIgZkzbl7pCcGAcQWs0srTqTBy ksAA== X-Gm-Message-State: APjAAAX3uMCVAdSjVycPMM7a1av3UQ14tqGcO9WRbf18hIxApruY9/xf XuS8/2FT9lWn5s0CMIXw4NehQg== X-Received: by 2002:a1c:f001:: with SMTP id a1mr18329492wmb.130.1560250468231; Tue, 11 Jun 2019 03:54:28 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:27 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:41 +0100 Message-Id: <20190611105351.9871-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH v2 32/42] target/arm: Convert VMOV (register) to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 10 ++++++++++ target/arm/translate.c | 8 +------- target/arm/vfp.decode | 5 +++++ 3 files changed, 16 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index ae2f77a873b..a7e4ae31985 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1889,6 +1889,16 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) return true; } +static bool trans_VMOV_reg_sp(DisasContext *s, arg_VMOV_reg_sp *a) +{ + return do_vfp_2op_sp(s, tcg_gen_mov_i32, a->vd, a->vm); +} + +static bool trans_VMOV_reg_dp(DisasContext *s, arg_VMOV_reg_dp *a) +{ + return do_vfp_2op_dp(s, tcg_gen_mov_i64, a->vd, a->vm); +} + static bool trans_VABS_sp(DisasContext *s, arg_VABS_sp *a) { return do_vfp_2op_sp(s, gen_helper_vfp_abss, a->vd, a->vm); diff --git a/target/arm/translate.c b/target/arm/translate.c index ce805f0ab28..ad723466b18 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3090,7 +3090,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; case 15: switch (rn) { - case 1 ... 3: + case 0 ... 3: /* Already handled by decodetree */ return 1; default: @@ -3103,9 +3103,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) if (op == 15) { /* rn is opcode, encoded as per VFP_SREG_N. */ switch (rn) { - case 0x00: /* vmov */ - break; - case 0x04: /* vcvtb.f64.f16, vcvtb.f32.f16 */ case 0x05: /* vcvtt.f64.f16, vcvtt.f32.f16 */ /* @@ -3278,9 +3275,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) switch (op) { case 15: /* extension space */ switch (rn) { - case 0: /* cpy */ - /* no-op */ - break; case 4: /* vcvtb.f32.f16, vcvtb.f64.f16 */ { TCGv_ptr fpst = get_fpstatus_ptr(false); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 2780e1ed9ea..b72ab8b8067 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -157,6 +157,11 @@ VMOV_imm_sp ---- 1110 1.11 imm4h:4 .... 1010 0000 imm4l:4 \ VMOV_imm_dp ---- 1110 1.11 imm4h:4 .... 1011 0000 imm4l:4 \ vd=%vd_dp +VMOV_reg_sp ---- 1110 1.11 0000 .... 1010 01.0 .... \ + vd=%vd_sp vm=%vm_sp +VMOV_reg_dp ---- 1110 1.11 0000 .... 1011 01.0 .... \ + vd=%vd_dp vm=%vm_dp + VABS_sp ---- 1110 1.11 0000 .... 1010 11.0 .... \ vd=%vd_sp vm=%vm_sp VABS_dp ---- 1110 1.11 0000 .... 1011 11.0 .... \ From patchwork Tue Jun 11 10:53:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166429 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2259002ilk; Tue, 11 Jun 2019 04:57:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvOFwPqWZmLLqRZihS6Uv0wA7BhYhUt+JchAYqy5tJIQmknX+Mtq4yJtG9kO51Ja+98spb X-Received: by 2002:ac8:2bdc:: with SMTP id n28mr25824601qtn.197.1560254224284; Tue, 11 Jun 2019 04:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560254224; cv=none; d=google.com; s=arc-20160816; b=ThTZ6d2yaXF4FKlmVW/O1NsXxvzBTmPAJdPGHl2sKSVGsc4BPSiO+8WHbR6g0chXb3 fllqWzJF+zvQF7zZw8oI1CEqQhobgegHwaQjyp7SVS3EWAxxzZPjDzuDclY9WNVINrn9 er+FZVPAKusr5/ygxrd574Slt0v2vyhyX3suGtpqWxUOTN5ILmsM8WttvNJGVeE52dH8 ooVAWkaN9gH61Nl5Ikdmd0pXqzENujH6bX26cJIq7nsgIs8IJSytG7x3+r6M0NCEjtDd pFcyRVGloGhbACJ5A4/dCFTcVsxIABr4VALgohePN0eUGEcB4LeORNtUWI7k2NYbQKca pvIA== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=1Cb4GG/N0hQlMvIMpbgSnw6lrsX++V30qcwL0TcatYU=; b=ZEa75vB+I6TyEr3S56hKIyv/nACEHrSBoLaVpRRHGtDOp8QyTDEzZliQ3oj/oBNlIE Sb4so4Z1JLNrp9sMfkVYRNaoOg0EwWMAn5fKh3FsdgTjAEy1lIX4BGwlfJ3C/qLqcYj7 Sjf9ZdQ3H6MBRoaiQnKyrERZAQshLwPgjt14ib7FygYj8ZfYl+qhQi9Xkz2H3Gmz/buN 6uj2xLv2/+wDAAQqXkehQuy1zOkgcmuMvJe2VqqSUJBysacth9Jbc50m48VJcKrLhj26 n1SFlhQAXeQfLosWw2YbRtj0277ESJKW2Mz2oCXZ6mKutgnBmfvkLxF4m+o1gWMBhCfO +nbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MjuxaPYw; 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 o56si1783129qvc.130.2019.06.11.04.57.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:57:04 -0700 (PDT) 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=MjuxaPYw; 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 ([::1]:56732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafOg-0005wu-T6 for patch@linaro.org; Tue, 11 Jun 2019 07:57:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39932) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQb-0007sf-OV for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQV-00083M-Lh for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:57 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:35563) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQV-0007i3-48 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:51 -0400 Received: by mail-wm1-x342.google.com with SMTP id c6so2405353wml.0 for ; Tue, 11 Jun 2019 03:54:30 -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 :mime-version:content-transfer-encoding; bh=1Cb4GG/N0hQlMvIMpbgSnw6lrsX++V30qcwL0TcatYU=; b=MjuxaPYw8gZ0fEudszZMotW98mjs6hyxWmS/Wv4nepPT77OE3T3LfZoT5BOkfimoSQ 82psXIrCmPcZdzBQGvJLCQrA7XGiuiaOGzh73QEUmRYEG083Y5OnhbEm2vRUOhLPcNKl uNWBmQuXAF+NEs7d7fOD8z0mm8JFiNNaWTdw7cDMQWfOvnUsg80bjsJqzW3sFh1zPud/ ihZ0TcueJTGCxUulY6dBJdSii+2PEAWm4ny/mCzMjxu3IXyuz+oBBocp8k4KkemmULdm /loozQfDy/Sm9Pcd4CNeXRMMs3GWGVOOK23tEf+SeNTMkv8DliuMZ8EtARds7UDhVP3x +RrQ== 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:mime-version:content-transfer-encoding; bh=1Cb4GG/N0hQlMvIMpbgSnw6lrsX++V30qcwL0TcatYU=; b=A5uyOWhaZTGVS1l+mw2mXm6eqsoqq/qW7433IYzZfvimSNngnUTJoxFNSn6f/aRNfc 2ad8RiU3NyIE0dh6EG1CTvQzUPVZGZwJvqyLY241YR1JJz7S8EXE71FMkMbXF39VUfT+ +HX+b7iRmQJNLnVtNImYxs0NHQzFfM/xVqVX2IOn6cK3v2AMhYc3q0j99UpjHjnfB6fG EA7U+gBACCHV3Jh7AytBZJ5mQspVkhuGrEywXaIpiFwwNYUbd9UKetBCRrf3goFpJbS0 4nqqkQoJzGdt3uv9aZIZhL6yXnrRsrDenVrXQ0aLXujp72wcLrQv7cLPac6DSejvh0J1 Zk7g== X-Gm-Message-State: APjAAAUKtBg1LLYtFKv7oViVukTb9qX9G8NFmYt8kEjISi373RF1vslP Fe7I92PrKNXfSkASZ9dwEkBI/g== X-Received: by 2002:a05:600c:389:: with SMTP id w9mr16505061wmd.139.1560250469238; Tue, 11 Jun 2019 03:54:29 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:28 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:42 +0100 Message-Id: <20190611105351.9871-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 33/42] target/arm: Convert VFP comparison insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP comparison instructions to decodetree. Note that comparison instructions should not honour the VFP short-vector length and stride information: they are scalar-only operations. This applies to all the 2-operand instructions except for VMOV, VABS, VNEG and VSQRT. (In the old decoder this is implemented via the "if (op == 15 && rn > 3) { veclen = 0; }" check.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 75 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 51 +---------------------- target/arm/vfp.decode | 5 +++ 3 files changed, 81 insertions(+), 50 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index a7e4ae31985..ebde86210a6 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1938,3 +1938,78 @@ static bool trans_VSQRT_dp(DisasContext *s, arg_VSQRT_dp *a) { return do_vfp_2op_dp(s, gen_VSQRT_dp, a->vd, a->vm); } + +static bool trans_VCMP_sp(DisasContext *s, arg_VCMP_sp *a) +{ + TCGv_i32 vd, vm; + + /* Vm/M bits must be zero for the Z variant */ + if (a->z && a->vm != 0) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vd = tcg_temp_new_i32(); + vm = tcg_temp_new_i32(); + + neon_load_reg32(vd, a->vd); + if (a->z) { + tcg_gen_movi_i32(vm, 0); + } else { + neon_load_reg32(vm, a->vm); + } + + if (a->e) { + gen_helper_vfp_cmpes(vd, vm, cpu_env); + } else { + gen_helper_vfp_cmps(vd, vm, cpu_env); + } + + tcg_temp_free_i32(vd); + tcg_temp_free_i32(vm); + + return true; +} + +static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a) +{ + TCGv_i64 vd, vm; + + /* Vm/M bits must be zero for the Z variant */ + if (a->z && a->vm != 0) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && ((a->vd | a->vm) & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vd = tcg_temp_new_i64(); + vm = tcg_temp_new_i64(); + + neon_load_reg64(vd, a->vd); + if (a->z) { + tcg_gen_movi_i64(vm, 0); + } else { + neon_load_reg64(vm, a->vm); + } + + if (a->e) { + gen_helper_vfp_cmped(vd, vm, cpu_env); + } else { + gen_helper_vfp_cmpd(vd, vm, cpu_env); + } + + tcg_temp_free_i64(vd); + tcg_temp_free_i64(vm); + + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index ad723466b18..761e8347fa0 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1390,30 +1390,6 @@ static inline void gen_vfp_neg(int dp) gen_helper_vfp_negs(cpu_F0s, cpu_F0s); } -static inline void gen_vfp_cmp(int dp) -{ - if (dp) - gen_helper_vfp_cmpd(cpu_F0d, cpu_F1d, cpu_env); - else - gen_helper_vfp_cmps(cpu_F0s, cpu_F1s, cpu_env); -} - -static inline void gen_vfp_cmpe(int dp) -{ - if (dp) - gen_helper_vfp_cmped(cpu_F0d, cpu_F1d, cpu_env); - else - gen_helper_vfp_cmpes(cpu_F0s, cpu_F1s, cpu_env); -} - -static inline void gen_vfp_F1_ld0(int dp) -{ - if (dp) - tcg_gen_movi_i64(cpu_F1d, 0); - else - tcg_gen_movi_i32(cpu_F1s, 0); -} - #define VFP_GEN_ITOF(name) \ static inline void gen_vfp_##name(int dp, int neon) \ { \ @@ -3091,6 +3067,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) case 15: switch (rn) { case 0 ... 3: + case 8 ... 11: /* Already handled by decodetree */ return 1; default: @@ -3135,11 +3112,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rd_is_dp = false; break; - case 0x08: case 0x0a: /* vcmp, vcmpz */ - case 0x09: case 0x0b: /* vcmpe, vcmpez */ - no_output = true; - break; - case 0x0c: /* vrintr */ case 0x0d: /* vrintz */ case 0x0e: /* vrintx */ @@ -3240,14 +3212,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) /* Load the initial operands. */ if (op == 15) { switch (rn) { - case 0x08: case 0x09: /* Compare */ - gen_mov_F0_vreg(dp, rd); - gen_mov_F1_vreg(dp, rm); - break; - case 0x0a: case 0x0b: /* Compare with zero */ - gen_mov_F0_vreg(dp, rd); - gen_vfp_F1_ld0(dp); - break; case 0x14: /* vcvt fp <-> fixed */ case 0x15: case 0x16: @@ -3357,19 +3321,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) gen_vfp_msr(tmp); break; } - case 8: /* cmp */ - gen_vfp_cmp(dp); - break; - case 9: /* cmpe */ - gen_vfp_cmpe(dp); - break; - case 10: /* cmpz */ - gen_vfp_cmp(dp); - break; - case 11: /* cmpez */ - gen_vfp_F1_ld0(dp); - gen_vfp_cmpe(dp); - break; case 12: /* vrintr */ { TCGv_ptr fpst = get_fpstatus_ptr(0); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index b72ab8b8067..9db7aa7021a 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -176,3 +176,8 @@ VSQRT_sp ---- 1110 1.11 0001 .... 1010 11.0 .... \ vd=%vd_sp vm=%vm_sp VSQRT_dp ---- 1110 1.11 0001 .... 1011 11.0 .... \ vd=%vd_dp vm=%vm_dp + +VCMP_sp ---- 1110 1.11 010 z:1 .... 1010 e:1 1.0 .... \ + vd=%vd_sp vm=%vm_sp +VCMP_dp ---- 1110 1.11 010 z:1 .... 1011 e:1 1.0 .... \ + vd=%vd_dp vm=%vm_dp From patchwork Tue Jun 11 10:53:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166419 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2242746ilk; Tue, 11 Jun 2019 04:39:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmRtIuUc66nDw8/62w7UDlrYIsgPJpG5Nc/8oaBveMtfeAzZl7niRikBrVhpl6qD190Zc0 X-Received: by 2002:a0c:e705:: with SMTP id d5mr28367579qvn.11.1560253189684; Tue, 11 Jun 2019 04:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253189; cv=none; d=google.com; s=arc-20160816; b=0gN49LFEAQhPQayt4bt6mZ6tsWK1f/TroU5zvvaNqrKcpSOOR1ZrDWslIrU5wR1w/N PbRbru1j7m+ng0jeU49sm5RniakIBwWcbp+I0WndDkvZtAORevMVtnoqAH+vbkmhmxMP irMymQ7oQ6rwy/iBn8bZyj3UXm+4jg9hskKUwHlXEHn8xCQXq72in1fuak+ReuPe75yy EsNP7jcJutJuoS5zEIgwPMyKup5/EGbtgnoKleh6HTvGoN/yXGvtY4de/wDF3zS3u9m8 1SuRFg46ZhWtSh1/CM2LJZ3NClZ3oAhK4/VHinunI6jOyf7BvvPyQyS9tqHeHMkrdboV fN1Q== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=WpNh2pEc72OT/45x1zdU6rlyslDELvp+z0QBZzz6/wU=; b=S/2woAW+nKUgFh5QPGs5JR1epAlHFVLkA61Beaus+R5AQv8qPT5KgYPmZapM98Rht3 zATyzWmZXjzKwXOLJlsAVd3RFP9fRWONUYVXqh0qAr8GvoJgSH5a5YZ4pkIe+rDmPono MF915j4Lis1K2+iXzqtzgaEGrXRXVDcsII8im0D6/eKXTzhK//j56zIswcAkr/vbsbCg UEeIsZKKunauATPhxvHnmcWJnfg0VfWK2evAtlI429Ki46XA3G6DD87jDDAiGNdUiJzS PuK7QWlbPOW3uOuYkmvX54WvaMfO2gExLa4OFj1f4+R5IkSqBMLPXnGQi6/+oMnUektm waUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=atvBA759; 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 e63si3787855qkd.116.2019.06.11.04.39.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:39:49 -0700 (PDT) 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=atvBA759; 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 ([::1]:56544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haf81-0005oI-AP for patch@linaro.org; Tue, 11 Jun 2019 07:39:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39683) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQR-0007f3-E3 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQL-0007r8-2G for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:47 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:35563) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQK-0007iW-JN for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:40 -0400 Received: by mail-wm1-x341.google.com with SMTP id c6so2405420wml.0 for ; Tue, 11 Jun 2019 03:54:31 -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 :mime-version:content-transfer-encoding; bh=WpNh2pEc72OT/45x1zdU6rlyslDELvp+z0QBZzz6/wU=; b=atvBA759yPlBgHW7gFIQzJgj3UdW/wjknKgJgQ9vrlryn9glaKmYyKuHbUSBFlOsry XK+gGaEBSKcx6DArSaQxD5sUg8y2dKT/zGHHlHU5VAtSiB9NcNlVrSlkenGcxbDV6KR7 UsOWT43UBuh5ncPrYHMSZ4esaEKYuCzpt2VVxt17daVsJJG54z5FOZdk8UirGiBtAU2H EcxCG49l4zw099yqH6Do9Nb8BbHazMuUrUvOwaxDKD4mefdGVM3O8DmRrUCQxtKWPZNW j9J8xpvMNVP9VGxz/djoBcCWG6yckFb7LNG0/tdV2i6YwnimgbvqO4/ixKzsZ8HIy+Fe ktcw== 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:mime-version:content-transfer-encoding; bh=WpNh2pEc72OT/45x1zdU6rlyslDELvp+z0QBZzz6/wU=; b=fLc5T/AZJNxeQ+QIeAn63DgyzQgaXqCWkZayCToGPk9mwARCga2i5ZW7h/Qw/YnmTO Hl+Le2pv6UalQOXaAmH2esD/ftqk9DqT6nmQjnGZ4dMG4ccRCJOOEgYVk16+Za4HrDMG jLZi9xX9vWzFiJ8R1Q8DQOqUBV0bYzyZynEKwmxlNRpEeJwHtPvF2UyzbBu/NcrttDmK dgshL6CxlfvBOyzoZCwaZsrOOVnMDNtwiV73DbCgCFsiK+Gh8Ib//QMkbCJtn0irtMxD 25qZbEAIVcK2cFzm+ue+hNbooxjEyRYwA7fBzy2VGS/+FyN4RF7pknimWU+xOJWpQUPL FX1A== X-Gm-Message-State: APjAAAVEyIy+f7Cv5cLRJEueodYfcL2SFKTL3dF2ZtgqgGzkIKrHwiQC wGCYzq8X/XkE4R53deTBxYr5mbevAzZCfA== X-Received: by 2002:a1c:e009:: with SMTP id x9mr17209137wmg.5.1560250470197; Tue, 11 Jun 2019 03:54:30 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:29 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:43 +0100 Message-Id: <20190611105351.9871-35-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v2 34/42] target/arm: Convert the VCVT-from-f16 insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VCVTT, VCVTB instructions that deal with conversion from half-precision floats to f32 or 64 to decodetree. Since we're no longer constrained to the old decoder's style using cpu_F0s and cpu_F0d we can perform a direct 16 bit load of the right half of the input single-precision register rather than loading the full 32 bits and then doing a separate shift or sign-extension. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 82 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 56 +---------------------- target/arm/vfp.decode | 6 +++ 3 files changed, 89 insertions(+), 55 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index ebde86210a6..732bf6020a9 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -30,6 +30,26 @@ #include "decode-vfp.inc.c" #include "decode-vfp-uncond.inc.c" +/* + * Return the offset of a 16-bit half of the specified VFP single-precision + * register. If top is true, returns the top 16 bits; otherwise the bottom + * 16 bits. + */ +static inline long vfp_f16_offset(unsigned reg, bool top) +{ + long offs = vfp_reg_offset(false, reg); +#ifdef HOST_WORDS_BIGENDIAN + if (!top) { + offs += 2; + } +#else + if (top) { + offs += 2; + } +#endif + return offs; +} + /* * Check that VFP access is enabled. If it is, do the necessary * M-profile lazy-FP handling and then return true. @@ -2013,3 +2033,65 @@ static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a) return true; } + +static bool trans_VCVT_f32_f16(DisasContext *s, arg_VCVT_f32_f16 *a) +{ + TCGv_ptr fpst; + TCGv_i32 ahp_mode; + TCGv_i32 tmp; + + if (!dc_isar_feature(aa32_fp16_spconv, s)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(false); + ahp_mode = get_ahp_flag(); + tmp = tcg_temp_new_i32(); + /* The T bit tells us if we want the low or high 16 bits of Vm */ + tcg_gen_ld16u_i32(tmp, cpu_env, vfp_f16_offset(a->vm, a->t)); + gen_helper_vfp_fcvt_f16_to_f32(tmp, tmp, fpst, ahp_mode); + neon_store_reg32(tmp, a->vd); + tcg_temp_free_i32(ahp_mode); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tmp); + return true; +} + +static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a) +{ + TCGv_ptr fpst; + TCGv_i32 ahp_mode; + TCGv_i32 tmp; + TCGv_i64 vd; + + if (!dc_isar_feature(aa32_fp16_dpconv, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vd & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(false); + ahp_mode = get_ahp_flag(); + tmp = tcg_temp_new_i32(); + /* The T bit tells us if we want the low or high 16 bits of Vm */ + tcg_gen_ld16u_i32(tmp, cpu_env, vfp_f16_offset(a->vm, a->t)); + vd = tcg_temp_new_i64(); + gen_helper_vfp_fcvt_f16_to_f64(vd, tmp, fpst, ahp_mode); + neon_store_reg64(vd, a->vd); + tcg_temp_free_i32(ahp_mode); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tmp); + tcg_temp_free_i64(vd); + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 761e8347fa0..34a82cfa424 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3066,7 +3066,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; case 15: switch (rn) { - case 0 ... 3: + case 0 ... 5: case 8 ... 11: /* Already handled by decodetree */ return 1; @@ -3080,24 +3080,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) if (op == 15) { /* rn is opcode, encoded as per VFP_SREG_N. */ switch (rn) { - case 0x04: /* vcvtb.f64.f16, vcvtb.f32.f16 */ - case 0x05: /* vcvtt.f64.f16, vcvtt.f32.f16 */ - /* - * VCVTB, VCVTT: only present with the halfprec extension - * UNPREDICTABLE if bit 8 is set prior to ARMv8 - * (we choose to UNDEF) - */ - if (dp) { - if (!dc_isar_feature(aa32_fp16_dpconv, s)) { - return 1; - } - } else { - if (!dc_isar_feature(aa32_fp16_spconv, s)) { - return 1; - } - } - rm_is_dp = false; - break; case 0x06: /* vcvtb.f16.f32, vcvtb.f16.f64 */ case 0x07: /* vcvtt.f16.f32, vcvtt.f16.f64 */ if (dp) { @@ -3239,42 +3221,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) switch (op) { case 15: /* extension space */ switch (rn) { - case 4: /* vcvtb.f32.f16, vcvtb.f64.f16 */ - { - TCGv_ptr fpst = get_fpstatus_ptr(false); - TCGv_i32 ahp_mode = get_ahp_flag(); - tmp = gen_vfp_mrs(); - tcg_gen_ext16u_i32(tmp, tmp); - if (dp) { - gen_helper_vfp_fcvt_f16_to_f64(cpu_F0d, tmp, - fpst, ahp_mode); - } else { - gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp, - fpst, ahp_mode); - } - tcg_temp_free_i32(ahp_mode); - tcg_temp_free_ptr(fpst); - tcg_temp_free_i32(tmp); - break; - } - case 5: /* vcvtt.f32.f16, vcvtt.f64.f16 */ - { - TCGv_ptr fpst = get_fpstatus_ptr(false); - TCGv_i32 ahp = get_ahp_flag(); - tmp = gen_vfp_mrs(); - tcg_gen_shri_i32(tmp, tmp, 16); - if (dp) { - gen_helper_vfp_fcvt_f16_to_f64(cpu_F0d, tmp, - fpst, ahp); - } else { - gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp, - fpst, ahp); - } - tcg_temp_free_i32(tmp); - tcg_temp_free_i32(ahp); - tcg_temp_free_ptr(fpst); - break; - } case 6: /* vcvtb.f16.f32, vcvtb.f16.f64 */ { TCGv_ptr fpst = get_fpstatus_ptr(false); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 9db7aa7021a..53d9544f7cd 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -181,3 +181,9 @@ VCMP_sp ---- 1110 1.11 010 z:1 .... 1010 e:1 1.0 .... \ vd=%vd_sp vm=%vm_sp VCMP_dp ---- 1110 1.11 010 z:1 .... 1011 e:1 1.0 .... \ vd=%vd_dp vm=%vm_dp + +# VCVTT and VCVTB from f16: Vd format depends on size bit; Vm is always vm_sp +VCVT_f32_f16 ---- 1110 1.11 0010 .... 1010 t:1 1.0 .... \ + vd=%vd_sp vm=%vm_sp +VCVT_f64_f16 ---- 1110 1.11 0010 .... 1011 t:1 1.0 .... \ + vd=%vd_dp vm=%vm_sp From patchwork Tue Jun 11 10:53:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166415 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2239911ilk; Tue, 11 Jun 2019 04:36:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwT3/ZCDIFOa6l4tqyvGvOanpt9RMichTfj9ZbShQNGns3RervMzROi9UVg2Q0fgRGPd1fT X-Received: by 2002:a37:aa4d:: with SMTP id t74mr61016516qke.144.1560253005715; Tue, 11 Jun 2019 04:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253005; cv=none; d=google.com; s=arc-20160816; b=g6geW8CgAyCK+5ggYy8/m0BeXG0GOGPgFQmJzCSA6VKb5OAG6GdUb8TavCB0XloLKV UoxV2G5vGkrF5gkm3aN9p9TNHlPrV74Od8AxX7cMMVqbgSpgn8p5DbfvgxZvbou8e3uQ Q716hmoS1iZGOBFp5BCeii7qMafGK6OGCAwoQd9FRoEsRpIwvnJ7tfXEFSyNx7jhITb4 cRhMxpab3dGF09uAXJ7PGe/S6d6Vm9EZvzWG04T8mdVdXeoxRMsBBgYg3L3OKqCKrYGs s21aUgZgr+yezRDblISwXzTWMouUCHqH5TVxbMry7D93JM6o7uVIOo3D8MG77pKJO0Pq tL+A== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=r4ng9HLYZ5DFgnMk3vtI7Z+VfumqzZw467SH0uR5eNg=; b=bUajWD8h4E0IIjJwrGflJJjb+0CTYyI+MpDqwPbc1bDI1HdZCeJ4mnUu4URokXuFG3 jY1yeEOp/UABLYsBunIO8qOi1FnMzO2NeTcl1+KBTHAYaEjZLOWM8FKZhoFtahRquhLY tdqF8clHt4nq5A7pO0brDaYJEDVcdcRAffD1Jfe/rdjCXcjBrFq2GrpzM6LIgFVhRH6O C4piYydVWhsHvsE3xy/TW/kUHHHFwC4dP1SceA2O5e4XoHmRYhQGm7RcPqIrYLQHjs1M Vz0bdlSislcClxrtSa/0AXtsgI/S2zJmWt+tMly/C18+um2svQDfpk+BxAWUCWo1yxpr TmQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=h6XYekbM; 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 s29si6524383qth.286.2019.06.11.04.36.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:36:45 -0700 (PDT) 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=h6XYekbM; 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 ([::1]:56515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haf53-0002KX-AB for patch@linaro.org; Tue, 11 Jun 2019 07:36:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39590) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQO-0007ZG-42 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQK-0007pw-97 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:43 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:37458) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQJ-0007jC-T3 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:40 -0400 Received: by mail-wm1-x341.google.com with SMTP id 22so2395738wmg.2 for ; Tue, 11 Jun 2019 03:54: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 :mime-version:content-transfer-encoding; bh=r4ng9HLYZ5DFgnMk3vtI7Z+VfumqzZw467SH0uR5eNg=; b=h6XYekbM0bGXC/Dzl+dbx0U7JoYRQpiITF8Luh8oSFld6S/DRR7Me3t93zZOSECc4q vHrn5tCcPPLjX1W5+R8NZjZWoGzSEOlSB59704qs77K5fSlfdfAb6nEH9rzFRzNaLwh+ +mKl/ssVhhueYHV52j1WvBRveAolFcSsmO6pbOpFJbINSx9vHEoD5OfpDVEZoppmmHkL 216keWdYZrCPmRhxqh4OHU2AYPtqCjciZnUkjSWaqGXs7iVGioKnCDngzjPyQ8n4VQd5 bi2P9h7NJaK8VJRIrxbY9A6U9n21X1dFiwRE2GfcBCwAvR9lkwGiIaBuz6zSgchJVnDt /Pnw== 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:mime-version:content-transfer-encoding; bh=r4ng9HLYZ5DFgnMk3vtI7Z+VfumqzZw467SH0uR5eNg=; b=nxx6vKp02vbXpMZw+CtO6/NFf+zYQfjfkIGq+V1imzhPjQWWf+ylapCgQ9NsdOcLO3 ytC85OaQJSZvg6tth/kkI8gieiqLQLmUZtKxK6xs9+2+9JpmhHO53WoMxP0I4Zeoc9QA 4arOoTt8YWCe/NXZigBCXGaoxixVZmitT7wTbPbRjhre5Q/YJT5e2VKfO9PCwzon3LwV kdNYprW4UPSNqno1cGWbIn4iT4NDqtUo5B6A9km+i+EdIh17NUe4BZOl02spdDscYoAx TOdfmShlPk1dORX4iegYuaZUx/Vm9Hh0fLE3/BI0uKIaywlgbaaRcpu39hOIKpDfFHjP wYfA== X-Gm-Message-State: APjAAAWB1o1yDAddQyT3LtqmuZD3nv7P90CNeoL4P1VCZcIL+lpZdLMN NS4Imkzgxly5nsDGT+Rp49sPxA== X-Received: by 2002:a1c:238d:: with SMTP id j135mr17646467wmj.53.1560250471393; Tue, 11 Jun 2019 03:54:31 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:30 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:44 +0100 Message-Id: <20190611105351.9871-36-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v2 35/42] target/arm: Convert the VCVT-to-f16 insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VCVTT and VCVTB instructions which convert from f32 and f64 to f16 to decodetree. Since we're no longer constrained to the old decoder's style using cpu_F0s and cpu_F0d we can perform a direct 16 bit store of the right half of the input single-precision register rather than doing a load/modify/store sequence on the full 32 bits. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 62 ++++++++++++++++++++++++++ target/arm/translate.c | 79 +--------------------------------- target/arm/vfp.decode | 6 +++ 3 files changed, 69 insertions(+), 78 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 732bf6020a9..a19ede86719 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -2095,3 +2095,65 @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a) tcg_temp_free_i64(vd); return true; } + +static bool trans_VCVT_f16_f32(DisasContext *s, arg_VCVT_f16_f32 *a) +{ + TCGv_ptr fpst; + TCGv_i32 ahp_mode; + TCGv_i32 tmp; + + if (!dc_isar_feature(aa32_fp16_spconv, s)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(false); + ahp_mode = get_ahp_flag(); + tmp = tcg_temp_new_i32(); + + neon_load_reg32(tmp, a->vm); + gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp_mode); + tcg_gen_st16_i32(tmp, cpu_env, vfp_f16_offset(a->vd, a->t)); + tcg_temp_free_i32(ahp_mode); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tmp); + return true; +} + +static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a) +{ + TCGv_ptr fpst; + TCGv_i32 ahp_mode; + TCGv_i32 tmp; + TCGv_i64 vm; + + if (!dc_isar_feature(aa32_fp16_dpconv, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vm & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(false); + ahp_mode = get_ahp_flag(); + tmp = tcg_temp_new_i32(); + vm = tcg_temp_new_i64(); + + neon_load_reg64(vm, a->vm); + gen_helper_vfp_fcvt_f64_to_f16(tmp, vm, fpst, ahp_mode); + tcg_temp_free_i64(vm); + tcg_gen_st16_i32(tmp, cpu_env, vfp_f16_offset(a->vd, a->t)); + tcg_temp_free_i32(ahp_mode); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tmp); + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 34a82cfa424..143b250a996 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -2963,20 +2963,6 @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) #define VFP_SREG_M(insn) VFP_SREG(insn, 0, 5) #define VFP_DREG_M(reg, insn) VFP_DREG(reg, insn, 0, 5) -/* Move between integer and VFP cores. */ -static TCGv_i32 gen_vfp_mrs(void) -{ - TCGv_i32 tmp = tcg_temp_new_i32(); - tcg_gen_mov_i32(tmp, cpu_F0s); - return tmp; -} - -static void gen_vfp_msr(TCGv_i32 tmp) -{ - tcg_gen_mov_i32(cpu_F0s, tmp); - tcg_temp_free_i32(tmp); -} - static void gen_neon_dup_low16(TCGv_i32 var) { TCGv_i32 tmp = tcg_temp_new_i32(); @@ -3003,8 +2989,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) { uint32_t rd, rn, rm, op, delta_d, delta_m, bank_mask; int dp, veclen; - TCGv_i32 tmp; - TCGv_i32 tmp2; if (!arm_dc_feature(s, ARM_FEATURE_VFP)) { return 1; @@ -3066,8 +3050,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; case 15: switch (rn) { - case 0 ... 5: - case 8 ... 11: + case 0 ... 11: /* Already handled by decodetree */ return 1; default: @@ -3080,20 +3063,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) if (op == 15) { /* rn is opcode, encoded as per VFP_SREG_N. */ switch (rn) { - case 0x06: /* vcvtb.f16.f32, vcvtb.f16.f64 */ - case 0x07: /* vcvtt.f16.f32, vcvtt.f16.f64 */ - if (dp) { - if (!dc_isar_feature(aa32_fp16_dpconv, s)) { - return 1; - } - } else { - if (!dc_isar_feature(aa32_fp16_spconv, s)) { - return 1; - } - } - rd_is_dp = false; - break; - case 0x0c: /* vrintr */ case 0x0d: /* vrintz */ case 0x0e: /* vrintx */ @@ -3221,52 +3190,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) switch (op) { case 15: /* extension space */ switch (rn) { - case 6: /* vcvtb.f16.f32, vcvtb.f16.f64 */ - { - TCGv_ptr fpst = get_fpstatus_ptr(false); - TCGv_i32 ahp = get_ahp_flag(); - tmp = tcg_temp_new_i32(); - - if (dp) { - gen_helper_vfp_fcvt_f64_to_f16(tmp, cpu_F0d, - fpst, ahp); - } else { - gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, - fpst, ahp); - } - tcg_temp_free_i32(ahp); - tcg_temp_free_ptr(fpst); - gen_mov_F0_vreg(0, rd); - tmp2 = gen_vfp_mrs(); - tcg_gen_andi_i32(tmp2, tmp2, 0xffff0000); - tcg_gen_or_i32(tmp, tmp, tmp2); - tcg_temp_free_i32(tmp2); - gen_vfp_msr(tmp); - break; - } - case 7: /* vcvtt.f16.f32, vcvtt.f16.f64 */ - { - TCGv_ptr fpst = get_fpstatus_ptr(false); - TCGv_i32 ahp = get_ahp_flag(); - tmp = tcg_temp_new_i32(); - if (dp) { - gen_helper_vfp_fcvt_f64_to_f16(tmp, cpu_F0d, - fpst, ahp); - } else { - gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, - fpst, ahp); - } - tcg_temp_free_i32(ahp); - tcg_temp_free_ptr(fpst); - tcg_gen_shli_i32(tmp, tmp, 16); - gen_mov_F0_vreg(0, rd); - tmp2 = gen_vfp_mrs(); - tcg_gen_ext16u_i32(tmp2, tmp2); - tcg_gen_or_i32(tmp, tmp, tmp2); - tcg_temp_free_i32(tmp2); - gen_vfp_msr(tmp); - break; - } case 12: /* vrintr */ { TCGv_ptr fpst = get_fpstatus_ptr(0); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 53d9544f7cd..b88d1d06f02 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -187,3 +187,9 @@ VCVT_f32_f16 ---- 1110 1.11 0010 .... 1010 t:1 1.0 .... \ vd=%vd_sp vm=%vm_sp VCVT_f64_f16 ---- 1110 1.11 0010 .... 1011 t:1 1.0 .... \ vd=%vd_dp vm=%vm_sp + +# VCVTB and VCVTT to f16: Vd format is always vd_sp; Vm format depends on size bit +VCVT_f16_f32 ---- 1110 1.11 0011 .... 1010 t:1 1.0 .... \ + vd=%vd_sp vm=%vm_sp +VCVT_f16_f64 ---- 1110 1.11 0011 .... 1011 t:1 1.0 .... \ + vd=%vd_sp vm=%vm_dp From patchwork Tue Jun 11 10:53:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166421 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2248549ilk; Tue, 11 Jun 2019 04:45:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/vRAlZivgENTCh1HVvPhZjMy6MCYEhrb/6kRYJVJ0/lfEp5+mlhgjIPFl8ErM17QnyT1g X-Received: by 2002:a05:620a:687:: with SMTP id f7mr5230818qkh.238.1560253556377; Tue, 11 Jun 2019 04:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253556; cv=none; d=google.com; s=arc-20160816; b=0TC7iKnHW7ODz7aIz0JZWCi4+r0o3epiZUPYHS0Hq7oo11/3T5V7UDGA271+sm3s9/ 2Ce92NiZ0KSQSfT4N+nHIr9C+qKMYCQur+/RfeHIztbdcNP//wdD2Vx0ctER8vKk6inl FdjIPINWycdjhQC4+9GTOcSUCh3xtc2ZW9Bsf68ExBKBhkdcbwnw5R2TS9pbbKUzqCZq CaZLtymODb9aK/gxh1HVyfteJ4VFHi2Iiox1b3zPwBAizJ84/bqiSoOW2F5+yNoeiYPj zkcyEtVnhGK/5mIYvXL2rTDnrI9lyNYK6Wp6vwlNUCorqOB0aCayPf9o4BVXAmzJFHCn wESA== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=1VkCR1NkBZGtfT3jf+6dPh/fqnTQfgXi5PHrX9FURiE=; b=WQFKw469xGuSfZSuyVKhjnK/Si2cL/i5Ymysj0b/Syv4Vcqu4ipc+W2fsPwgpkXYr0 J4ohgdoD1CHcID5VYpblfOyPYNfs+j9zNwPppDzbGiPRy+AO39eqw0duscdLDVzKmL2A r9gW5rrZkF6qx4Gwjw8PokpSCejPYTugY7B/c42sYlXfvu2IH4L1sgkUUzzItsEfIHks FNujAHTMi1UsFjVHMGHY1RNurpUbOW0nyCcaKgmgzYWP6J0jl8EIhFq2oWnPC7p3yWOB zrMsOJaHnQ1ZdIws10X9vVTVyrtunueiuYjg+1C1FeRTH80GChvBzp92eVkKa3/37nqZ HnUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MgsPkfZQ; 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 j11si7672587qvn.199.2019.06.11.04.45.56 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:45:56 -0700 (PDT) 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=MgsPkfZQ; 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 ([::1]:56594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafDv-00016A-MM for patch@linaro.org; Tue, 11 Jun 2019 07:45:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39676) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQR-0007eb-6y for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQL-0007rS-4l for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:47 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:56301) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQK-0007jq-Pp for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:40 -0400 Received: by mail-wm1-x344.google.com with SMTP id a15so2411574wmj.5 for ; Tue, 11 Jun 2019 03:54:33 -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 :mime-version:content-transfer-encoding; bh=1VkCR1NkBZGtfT3jf+6dPh/fqnTQfgXi5PHrX9FURiE=; b=MgsPkfZQKvQhBOPeBVAvACORyU1TpD7mPMy3sEb+KIvgGfRziImaAvZhntqqrf4WI8 avf3cjf9eu26OKjib2d0vl979ST87jKdqL8I67Sq/N2J+u50Wl3V0lol7Hs0AhiMk4Al FSgIa+citxnvocXnjfeHwDixIyCc8GqF3uLyBmROtSEVzwzra2jlPenbypzl86ghNIxn keCe0j4MJDb5/PVVAMwsBziKtbLSrhpidr25yQOJKLc+e0XKDiOgBTS/SJfTk+hF3m8P QAbfxYgJ7uJADNZZ2de8Ffo4Unwj/wcB+l2Iyz5BWmBGze+am+fVlu2K1FWgA7by6eIq S9Cg== 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:mime-version:content-transfer-encoding; bh=1VkCR1NkBZGtfT3jf+6dPh/fqnTQfgXi5PHrX9FURiE=; b=SekcEG5OI/AQk84X5z1khs/W0EJa81v8YZenbOLC0Brw/1m0C6NY87r2COu6ZdYkMk sor1ms/whsRhyqKZbE0sKQOU7uEdRc2EBxXD2hzG14slYLMpNpGJcYQLwd0q5sfrXX5M Aib2HjbIZKCQv251Ck0ow2mjj7a2yRU+cRO24qvZ/tFBXDg3cGYnM+eG0aEcao1z0f0y J9Samw3+pRzvXCLDQLhNqgD/4TfJFjFvKvT2a91Bpwm6jxH45uOrKOziTkTSgSTAQdTk W0a83mA5xXH1l6fwpfgueZ0AthqkGnj3zpQ8YjxxWY6u11EIbS3tmk1ZkRXntZkb4rhg M7CA== X-Gm-Message-State: APjAAAUUXmNfmst6KHmQ+i7yMR/Ydx8AUe2LdxdqFnmk/HBRdnKi90d7 I3jSUGgmIzgZMeChpWabJB+KcA== X-Received: by 2002:a1c:2d5:: with SMTP id 204mr18341286wmc.175.1560250472416; Tue, 11 Jun 2019 03:54:32 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:31 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:45 +0100 Message-Id: <20190611105351.9871-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH v2 36/42] target/arm: Convert VFP round insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VFP round-to-integer instructions VRINTR, VRINTZ and VRINTX to decodetree. These instructions were only introduced as part of the "VFP misc" additions in v8A, so we check this. The old decoder's implementation was incorrectly providing them even for v7A CPUs. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 163 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 45 +-------- target/arm/vfp.decode | 15 +++ 3 files changed, 179 insertions(+), 44 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index a19ede86719..e94a8f2f0c5 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -2157,3 +2157,166 @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a) tcg_temp_free_i32(tmp); return true; } + +static bool trans_VRINTR_sp(DisasContext *s, arg_VRINTR_sp *a) +{ + TCGv_ptr fpst; + TCGv_i32 tmp; + + if (!dc_isar_feature(aa32_vrint, s)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + tmp = tcg_temp_new_i32(); + neon_load_reg32(tmp, a->vm); + fpst = get_fpstatus_ptr(false); + gen_helper_rints(tmp, tmp, fpst); + neon_store_reg32(tmp, a->vd); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tmp); + return true; +} + +static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_sp *a) +{ + TCGv_ptr fpst; + TCGv_i64 tmp; + + if (!dc_isar_feature(aa32_vrint, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && ((a->vd | a->vm) & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + tmp = tcg_temp_new_i64(); + neon_load_reg64(tmp, a->vm); + fpst = get_fpstatus_ptr(false); + gen_helper_rintd(tmp, tmp, fpst); + neon_store_reg64(tmp, a->vd); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i64(tmp); + return true; +} + +static bool trans_VRINTZ_sp(DisasContext *s, arg_VRINTZ_sp *a) +{ + TCGv_ptr fpst; + TCGv_i32 tmp; + TCGv_i32 tcg_rmode; + + if (!dc_isar_feature(aa32_vrint, s)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + tmp = tcg_temp_new_i32(); + neon_load_reg32(tmp, a->vm); + fpst = get_fpstatus_ptr(false); + tcg_rmode = tcg_const_i32(float_round_to_zero); + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); + gen_helper_rints(tmp, tmp, fpst); + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); + neon_store_reg32(tmp, a->vd); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tcg_rmode); + tcg_temp_free_i32(tmp); + return true; +} + +static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_sp *a) +{ + TCGv_ptr fpst; + TCGv_i64 tmp; + TCGv_i32 tcg_rmode; + + if (!dc_isar_feature(aa32_vrint, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && ((a->vd | a->vm) & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + tmp = tcg_temp_new_i64(); + neon_load_reg64(tmp, a->vm); + fpst = get_fpstatus_ptr(false); + tcg_rmode = tcg_const_i32(float_round_to_zero); + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); + gen_helper_rintd(tmp, tmp, fpst); + gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); + neon_store_reg64(tmp, a->vd); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i64(tmp); + tcg_temp_free_i32(tcg_rmode); + return true; +} + +static bool trans_VRINTX_sp(DisasContext *s, arg_VRINTX_sp *a) +{ + TCGv_ptr fpst; + TCGv_i32 tmp; + + if (!dc_isar_feature(aa32_vrint, s)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + tmp = tcg_temp_new_i32(); + neon_load_reg32(tmp, a->vm); + fpst = get_fpstatus_ptr(false); + gen_helper_rints_exact(tmp, tmp, fpst); + neon_store_reg32(tmp, a->vd); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tmp); + return true; +} + +static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a) +{ + TCGv_ptr fpst; + TCGv_i64 tmp; + + if (!dc_isar_feature(aa32_vrint, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && ((a->vd | a->vm) & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + tmp = tcg_temp_new_i64(); + neon_load_reg64(tmp, a->vm); + fpst = get_fpstatus_ptr(false); + gen_helper_rintd_exact(tmp, tmp, fpst); + neon_store_reg64(tmp, a->vd); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i64(tmp); + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 143b250a996..412d8aaedb2 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3050,7 +3050,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; case 15: switch (rn) { - case 0 ... 11: + case 0 ... 14: /* Already handled by decodetree */ return 1; default: @@ -3063,11 +3063,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) if (op == 15) { /* rn is opcode, encoded as per VFP_SREG_N. */ switch (rn) { - case 0x0c: /* vrintr */ - case 0x0d: /* vrintz */ - case 0x0e: /* vrintx */ - break; - case 0x0f: /* vcvt double<->single */ rd_is_dp = !dp; break; @@ -3190,44 +3185,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) switch (op) { case 15: /* extension space */ switch (rn) { - case 12: /* vrintr */ - { - TCGv_ptr fpst = get_fpstatus_ptr(0); - if (dp) { - gen_helper_rintd(cpu_F0d, cpu_F0d, fpst); - } else { - gen_helper_rints(cpu_F0s, cpu_F0s, fpst); - } - tcg_temp_free_ptr(fpst); - break; - } - case 13: /* vrintz */ - { - TCGv_ptr fpst = get_fpstatus_ptr(0); - TCGv_i32 tcg_rmode; - tcg_rmode = tcg_const_i32(float_round_to_zero); - gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); - if (dp) { - gen_helper_rintd(cpu_F0d, cpu_F0d, fpst); - } else { - gen_helper_rints(cpu_F0s, cpu_F0s, fpst); - } - gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); - tcg_temp_free_i32(tcg_rmode); - tcg_temp_free_ptr(fpst); - break; - } - case 14: /* vrintx */ - { - TCGv_ptr fpst = get_fpstatus_ptr(0); - if (dp) { - gen_helper_rintd_exact(cpu_F0d, cpu_F0d, fpst); - } else { - gen_helper_rints_exact(cpu_F0s, cpu_F0s, fpst); - } - tcg_temp_free_ptr(fpst); - break; - } case 15: /* single<->double conversion */ if (dp) { gen_helper_vfp_fcvtsd(cpu_F0s, cpu_F0d, cpu_env); diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index b88d1d06f02..9942d2ae7ad 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -193,3 +193,18 @@ VCVT_f16_f32 ---- 1110 1.11 0011 .... 1010 t:1 1.0 .... \ vd=%vd_sp vm=%vm_sp VCVT_f16_f64 ---- 1110 1.11 0011 .... 1011 t:1 1.0 .... \ vd=%vd_sp vm=%vm_dp + +VRINTR_sp ---- 1110 1.11 0110 .... 1010 01.0 .... \ + vd=%vd_sp vm=%vm_sp +VRINTR_dp ---- 1110 1.11 0110 .... 1011 01.0 .... \ + vd=%vd_dp vm=%vm_dp + +VRINTZ_sp ---- 1110 1.11 0110 .... 1010 11.0 .... \ + vd=%vd_sp vm=%vm_sp +VRINTZ_dp ---- 1110 1.11 0110 .... 1011 11.0 .... \ + vd=%vd_dp vm=%vm_dp + +VRINTX_sp ---- 1110 1.11 0111 .... 1010 01.0 .... \ + vd=%vd_sp vm=%vm_sp +VRINTX_dp ---- 1110 1.11 0111 .... 1011 01.0 .... \ + vd=%vd_dp vm=%vm_dp From patchwork Tue Jun 11 10:53:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166412 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2236707ilk; Tue, 11 Jun 2019 04:33:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjwBgI664DI9vCvNVAvvdNoS4Acs64mJyHVwHZV8UEhQNnXMPYBXbihmCMNNUUq1xsUCMQ X-Received: by 2002:a0c:add1:: with SMTP id x17mr30705651qvc.81.1560252812781; Tue, 11 Jun 2019 04:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560252812; cv=none; d=google.com; s=arc-20160816; b=RAlt2IEZJa41Zx9kuoYIE0Z05Cas1GXYvk9KfPL8X5V/ItUMHADd7I3hN6FChCV/qX 0UKHpSG5/r5eOdon/HpYD5c37X2oiXoCM6AL0oIKMYv1zHW/55vk67r/F0DxY/2RMjOg MGZ/mJSStx8Y/WcLXpZnQUFJMbuBvFpTqcQmhkcukBoJ8XM70MhwLB4H/afW+UyiJtkz YGcWW3T6qDpH5Lbdz3FkqfAdeL6lynhtjSyKcrt0nuWQT1d2bmsqUA9u0FYW1jsI5Mb6 7uDzxCNQU9vYqa5+tV9O0L7Ve1ZT4Hv1X0BE5SYeUOlG8YVhE3fTUJzy6ccstZmord3y L8TQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=78Ipc5UK7B7ARzS4SX5cy/iMal0ICqCZUARVRbwaHD8=; b=YOLG4bSDcGrWUaV/rg6yiapnfMOxPA1Sovtjrj3gEYliysTXI/ltf3lKcN6O04NW6U nE9fVoVnY95KNimCxGXrg/Hb7A8hRyH2mRBBCIb1JTNZEK2A2SXRR8uUcahojVsZA4CE Yq3wHlslncajWZ6GO2UYSRFzter2XKn6i1WML1S15D36uLc90fxAPlKSv+TpvJagCcc6 zwQmR2IeqFritCFBZ0J327UPAVLtMt/DrAC0VRwXVSkBTowpHFwKMPCLbmP3GL+MjwyA rtkP0SYd22jtPG0RE5gRvGD5e86W1yAJdGnsfIL5IaE3RUZH4TVEqxeEj3mJhV07Dqvn GmEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d41y8Qw7; 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 p70si4508178qka.86.2019.06.11.04.33.32 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:33:32 -0700 (PDT) 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=d41y8Qw7; 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 ([::1]:56494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haf1w-0007MK-DQ for patch@linaro.org; Tue, 11 Jun 2019 07:33:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39673) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQR-0007eW-5X for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQL-0007sd-LS for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:47 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:50497) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQL-0007kU-6I for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:41 -0400 Received: by mail-wm1-x342.google.com with SMTP id c66so2437100wmf.0 for ; Tue, 11 Jun 2019 03:54:34 -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 :mime-version:content-transfer-encoding; bh=78Ipc5UK7B7ARzS4SX5cy/iMal0ICqCZUARVRbwaHD8=; b=d41y8Qw7hXXr/ASEX4OaDToKboEiRHtpCeLUCaSP+oMX42nz+xtM1E0uzxzgBvp/jq FaBYGiF4i8G2D69O7Jydys+BdELmnYRW1LNvhg8rAtp+iK1ZRq7jg3FpygulKqnEgtjI EzFHRj9eQqG6EXY3vXrNnLD69nzMKur4LkCHGV3NJpdS+R2nuEd1REANKtwjPOMMNLv+ CQfTaYBdCuNuCGnXmNLUMUl+FpUr+nDWxvt1w664ZsH9AHdCMEQ2bq6HhH9VFQfM92t7 qoHxTFaZPNIlYk3CXvL/JqE1WBoL3v3Mo8czOMIbdJPQtAWDgLtA5Fw2KxrJtWO0Znk9 9TVg== 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:mime-version:content-transfer-encoding; bh=78Ipc5UK7B7ARzS4SX5cy/iMal0ICqCZUARVRbwaHD8=; b=NwgDS+F+i4LtXJmUbp7qGxfKSbKQu5gjVKMVK1PwfdVZjYc+dkfT7kXqWxVjbgruQ6 99qkp/pErpqYFCTmLK1QY9RTKOl/er7JTguMTVYQIX+M0VJUQRS9cR3B7WoBhnF+1jsE ikZdqPQkxZbdTao3sRRfd2k3iddN84yEtFwHStsUFd5qA89x7Jm9+Da6Nz79xs2doSpA uEpBeoeeb1G6dZ9UDA55RLe49twSMfDE5L4hIZe8Cbr2948KIArm+f4ALl6bR5a3i1pg 8ncwkcwWjZHM9i1dXJ4Q6dQzeIUysUn7+/iyKonh+9MhH2upzxMg0qo7Hsl94I7tATen KWAQ== X-Gm-Message-State: APjAAAVlZRCG4nGOnUQ6avX10gNKqeVvKfXmP2AZG0dvKB2xe3oIJtTf Hn8zhOpgZFHSb08Di/Yb8lsRMA== X-Received: by 2002:a1c:b684:: with SMTP id g126mr17092577wmf.176.1560250473428; Tue, 11 Jun 2019 03:54:33 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:32 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:46 +0100 Message-Id: <20190611105351.9871-38-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH v2 37/42] target/arm: Convert double-single precision conversion insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VCVT double/single precision conversion insns to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 48 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 13 +-------- target/arm/vfp.decode | 6 +++++ 3 files changed, 55 insertions(+), 12 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index e94a8f2f0c5..c50093776b6 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -2320,3 +2320,51 @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a) tcg_temp_free_i64(tmp); return true; } + +static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a) +{ + TCGv_i64 vd; + TCGv_i32 vm; + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vd & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vm = tcg_temp_new_i32(); + vd = tcg_temp_new_i64(); + neon_load_reg32(vm, a->vm); + gen_helper_vfp_fcvtds(vd, vm, cpu_env); + neon_store_reg64(vd, a->vd); + tcg_temp_free_i32(vm); + tcg_temp_free_i64(vd); + return true; +} + +static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a) +{ + TCGv_i64 vm; + TCGv_i32 vd; + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vm & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vd = tcg_temp_new_i32(); + vm = tcg_temp_new_i64(); + neon_load_reg64(vm, a->vm); + gen_helper_vfp_fcvtsd(vd, vm, cpu_env); + neon_store_reg32(vd, a->vd); + tcg_temp_free_i32(vd); + tcg_temp_free_i64(vm); + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 412d8aaedb2..05ee76da77c 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3050,7 +3050,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; case 15: switch (rn) { - case 0 ... 14: + case 0 ... 15: /* Already handled by decodetree */ return 1; default: @@ -3063,10 +3063,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) if (op == 15) { /* rn is opcode, encoded as per VFP_SREG_N. */ switch (rn) { - case 0x0f: /* vcvt double<->single */ - rd_is_dp = !dp; - break; - case 0x10: /* vcvt.fxx.u32 */ case 0x11: /* vcvt.fxx.s32 */ rm_is_dp = false; @@ -3185,13 +3181,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) switch (op) { case 15: /* extension space */ switch (rn) { - case 15: /* single<->double conversion */ - if (dp) { - gen_helper_vfp_fcvtsd(cpu_F0s, cpu_F0d, cpu_env); - } else { - gen_helper_vfp_fcvtds(cpu_F0d, cpu_F0s, cpu_env); - } - break; case 16: /* fuito */ gen_vfp_uito(dp, 0); break; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 9942d2ae7ad..56b8b4e6046 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -208,3 +208,9 @@ VRINTX_sp ---- 1110 1.11 0111 .... 1010 01.0 .... \ vd=%vd_sp vm=%vm_sp VRINTX_dp ---- 1110 1.11 0111 .... 1011 01.0 .... \ vd=%vd_dp vm=%vm_dp + +# VCVT between single and double: Vm precision depends on size; Vd is its reverse +VCVT_sp ---- 1110 1.11 0111 .... 1010 11.0 .... \ + vd=%vd_dp vm=%vm_sp +VCVT_dp ---- 1110 1.11 0111 .... 1011 11.0 .... \ + vd=%vd_sp vm=%vm_dp From patchwork Tue Jun 11 10:53:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166430 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2263940ilk; Tue, 11 Jun 2019 05:01:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpIu0gClyYnVdV6jRqmlXXTphvI5MV31jHqZ/iftanVdIUv4wIiiBLKyfOo1kBhn1rv4ha X-Received: by 2002:ac8:2bf1:: with SMTP id n46mr10922604qtn.372.1560254507111; Tue, 11 Jun 2019 05:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560254507; cv=none; d=google.com; s=arc-20160816; b=OWIkK3CiCZbZMBAILLmkcUtXpyvGtx71NReuTkRyWfRlZMGbuKJttQXgFD/5DKfyG5 3Q9oLSd8hPZWWW3LjN4hfTxpxArcuc8nnEkOHpmDxRqX44ykaG9EmXXG8ffqjnWhNuuG 9CoDq8DEFFlJ5VufB0SOoAU6/4WfExr/3eM7sDTfP7c4pnmGU190aJtMqk24xYmCddbz Vdid8HkEoQ2W7g8/mv0Cu+S38c1yR+MsepZAO2ZglcjQEspWFCYPYBhqPROHfI94k8nb SvnLm7SZsvjkMpMA/QgkuD97PNQaZCJdVsVeES3f/RlKLxx2D1Qa0Li4S3tsSrMVYpU8 pkeQ== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=kVKIoFWbneLBSnXC8j5sTcaVOKy6BEkeJ62qtn6SHIs=; b=X7GsQHyGSvNXEMGEXArQjFHYDzPMx/MxqCmFsMeqAp3bElf3mbo2I7Rh0pKJyyFL5+ Zh+nw9vSWJNubvXGf+mjQw6XwfpKkMLDDUTBnellrjWqUieB7KDgwXOwdGBvWAOZ3aaj IN20gUeCo72XNaZqBP6ELLBHfEBuwxGFqmeMPY04k8eOApqARltpYWjYu+Pdx5nX4kNX 7bz1n756GNwZHTGVIUpMHAxCNC1MhECsANXCr9/gT0yf4tFSbh+YxZvtUifvt5uOv4/M RnDtddb3MuY5rpVvzYssAn1NlJs+8XFmzHDFR2mNtRZLWGn8RtN1ewqzTLaS9Yb5fk1k pChw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xWjiRNZn; 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 28si5526536qtx.181.2019.06.11.05.01.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 05:01:47 -0700 (PDT) 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=xWjiRNZn; 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 ([::1]:56784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafTG-0001qu-LB for patch@linaro.org; Tue, 11 Jun 2019 08:01:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39971) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQd-0007sv-JZ for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:55:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQW-00084D-2w for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:59 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:35566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQV-0007l2-Q0 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:51 -0400 Received: by mail-wm1-x344.google.com with SMTP id c6so2405626wml.0 for ; Tue, 11 Jun 2019 03:54:35 -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 :mime-version:content-transfer-encoding; bh=kVKIoFWbneLBSnXC8j5sTcaVOKy6BEkeJ62qtn6SHIs=; b=xWjiRNZnt1lI5dWIBti/RuGrGxAlYXLsV72Fmz61JROZ62gL7oB5orPXBizWMufHjz wRq+IJVuLnPUK7bnNUBO7+tW9O0dC5jcJwe3qwLdsLTpWehJTogXjDPeQCfx3VRB6YlO 4Wgi/Jh0mdexxa4+8xsJg+SiRHbbyLXRHkPlECEuRT0w5R8zaM0CP3oorBugoauK/DpT 0mdcBJugt3EpVa9TxrVPAYmoG8kZU8TQ30V3qtz6AqrP6PQK7PxAeCK29tOgwvKY5saC rLmRcec3ATtsKtIvYIgW9UDqjvBqXdMbowSWvY1UROtrKibJZRzFaNWQR7zJt+zEBHGO CRZg== 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:mime-version:content-transfer-encoding; bh=kVKIoFWbneLBSnXC8j5sTcaVOKy6BEkeJ62qtn6SHIs=; b=BnybPvghP41Cfdu6qAxOg68eDWJYKAtmuWI1v4YkMwPLJ+5+DnmK3epNwyuYMddVQj Yd0P8zqdBsPgEVd1VLGTjikB2OGV+Y7OuJmGi+GWR2u284buzPu4fHxFe7tZrrl/afoo UHnAimaRjlvVo8IPj8/mjx/aH/TLm48DH3KL51q3ZQtRGbd/R26TZIQPJCeHMaK8beKg CxnaJH/JxUepQ872AUyThvoJEOTyoTCLMtmGvXEVdCxdrQ1PLKrlrU/CYGwMrXz7F6zU UzdUnHVM9g+nQ3AgAco9EJhdrYLXG0TMLJh297Knvx/seugjONRZfrWIRKrADNComRxY 8jlw== X-Gm-Message-State: APjAAAVbSxcckguMrcX+Bs45r3Gzz/8wRVQaWJvC7uIRuLNs1MJgsdQO BmTYbq/gIL4R3tHZ303ycylpreWqK+zb5g== X-Received: by 2002:a1c:9dc4:: with SMTP id g187mr15866026wme.86.1560250474395; Tue, 11 Jun 2019 03:54:34 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:33 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:47 +0100 Message-Id: <20190611105351.9871-39-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH v2 38/42] target/arm: Convert integer-to-float insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VCVT integer-to-float instructions to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 58 ++++++++++++++++++++++++++++++++++ target/arm/translate.c | 12 +------ target/arm/vfp.decode | 6 ++++ 3 files changed, 65 insertions(+), 11 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index c50093776b6..cc3f61d9c41 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -2368,3 +2368,61 @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a) tcg_temp_free_i64(vm); return true; } + +static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a) +{ + TCGv_i32 vm; + TCGv_ptr fpst; + + if (!vfp_access_check(s)) { + return true; + } + + vm = tcg_temp_new_i32(); + neon_load_reg32(vm, a->vm); + fpst = get_fpstatus_ptr(false); + if (a->s) { + /* i32 -> f32 */ + gen_helper_vfp_sitos(vm, vm, fpst); + } else { + /* u32 -> f32 */ + gen_helper_vfp_uitos(vm, vm, fpst); + } + neon_store_reg32(vm, a->vd); + tcg_temp_free_i32(vm); + tcg_temp_free_ptr(fpst); + return true; +} + +static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a) +{ + TCGv_i32 vm; + TCGv_i64 vd; + TCGv_ptr fpst; + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vd & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vm = tcg_temp_new_i32(); + vd = tcg_temp_new_i64(); + neon_load_reg32(vm, a->vm); + fpst = get_fpstatus_ptr(false); + if (a->s) { + /* i32 -> f64 */ + gen_helper_vfp_sitod(vd, vm, fpst); + } else { + /* u32 -> f64 */ + gen_helper_vfp_uitod(vd, vm, fpst); + } + neon_store_reg64(vd, a->vd); + tcg_temp_free_i32(vm); + tcg_temp_free_i64(vd); + tcg_temp_free_ptr(fpst); + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 05ee76da77c..1e28308aa6a 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3050,7 +3050,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; case 15: switch (rn) { - case 0 ... 15: + case 0 ... 17: /* Already handled by decodetree */ return 1; default: @@ -3063,10 +3063,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) if (op == 15) { /* rn is opcode, encoded as per VFP_SREG_N. */ switch (rn) { - case 0x10: /* vcvt.fxx.u32 */ - case 0x11: /* vcvt.fxx.s32 */ - rm_is_dp = false; - break; case 0x18: /* vcvtr.u32.fxx */ case 0x19: /* vcvtz.u32.fxx */ case 0x1a: /* vcvtr.s32.fxx */ @@ -3181,12 +3177,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) switch (op) { case 15: /* extension space */ switch (rn) { - case 16: /* fuito */ - gen_vfp_uito(dp, 0); - break; - case 17: /* fsito */ - gen_vfp_sito(dp, 0); - break; case 19: /* vjcvt */ gen_helper_vjcvt(cpu_F0s, cpu_F0d, cpu_env); break; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 56b8b4e6046..6da9a7913da 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -214,3 +214,9 @@ VCVT_sp ---- 1110 1.11 0111 .... 1010 11.0 .... \ vd=%vd_dp vm=%vm_sp VCVT_dp ---- 1110 1.11 0111 .... 1011 11.0 .... \ vd=%vd_sp vm=%vm_dp + +# VCVT from integer to floating point: Vm always single; Vd depends on size +VCVT_int_sp ---- 1110 1.11 1000 .... 1010 s:1 1.0 .... \ + vd=%vd_sp vm=%vm_sp +VCVT_int_dp ---- 1110 1.11 1000 .... 1011 s:1 1.0 .... \ + vd=%vd_dp vm=%vm_sp From patchwork Tue Jun 11 10:53:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166417 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2242136ilk; Tue, 11 Jun 2019 04:39:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBDxyfavjNJvbCUsVQ8ItUr4T2PHrJ8V4Lxdg8fe3PG7VFdKpvPxxPBamCuWbpzbpgf4ks X-Received: by 2002:a37:aa4d:: with SMTP id t74mr61026068qke.144.1560253152130; Tue, 11 Jun 2019 04:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253152; cv=none; d=google.com; s=arc-20160816; b=Tkqkl4B8FGQMBZLjrWTkyRMKKrNHnu+EjkMoVzYPIjXoGRhyj6Zu6FKXYeDQITOwv0 k/SVf/xWZGHJqweNxgRLeRvmOSpWXhQjW9n6hSpZAM3288herUunsBuEi7xxntq6tbot FmwQE5xrblsRYSLE1QVIPvBywNX0RRY/06IlmZkqhHSA/WyzVDKl70CU0WvTu8TLacyP 6MMFqsDJQSzBEVRFKviwS5Bofcph85vd/+sIZj+l5cVEZcWVgRra6Xfrl2lhQYaLL97N KFIGRd7mgEgo/GzLV425lXhnzImnsQqYFuftoNDtq1WTG7NKWy9eIA7j8FnZYX2FlFg3 ceeg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=8DDr7wU5Mf7FhJNHoQYd6MgxVhRgKHpZJzl/r4VHltc=; b=A177hXryp1x7WjZn6AA17L6TtEKNJ7lwb6FUXDIcDi43FNjiALTRCh+q81ddwpJ+Za ZT3HV7ZZbKLCtM37/pih0BOAWFoZp0EXn5ghixmpWInZNuK5WJNOXq1aHXMotm/u0ik9 HBn+cEu6v3YbYHgBVnjC0Bkkrt/HHRnNYfAHnx/n7RdJSDWI4os7WYWtzqcTVAZ4+BDG QbMZwDZflApIr1s83XXGMLbLjOVTBalJjy8ML5dPmcTYWW/nw4CCF1OBqk5TvhthUl2h Uptw/687rVBlSRUeQ31mo9/84DVZFl2gXIqu/fk63Fh+Z9cQ25/o274JIytzDTuqwQzo 91vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sWJ2XzSX; 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 c25si6339259qta.234.2019.06.11.04.39.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:39:12 -0700 (PDT) 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=sWJ2XzSX; 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 ([::1]:56540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haf7N-00058l-RI for patch@linaro.org; Tue, 11 Jun 2019 07:39:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39580) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQN-0007Y1-9l for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQK-0007qb-KA for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:43 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:39799) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQK-0007lw-9Q for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:40 -0400 Received: by mail-wm1-x341.google.com with SMTP id z23so2381268wma.4 for ; Tue, 11 Jun 2019 03:54:36 -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 :mime-version:content-transfer-encoding; bh=8DDr7wU5Mf7FhJNHoQYd6MgxVhRgKHpZJzl/r4VHltc=; b=sWJ2XzSXfgOq+HIiZxOjagrZLTKeBuNbzyT1ZEMWS1B3XcZYRuCWS4DG0t/5Rmcmrf Hs1rqcUGn7W8KOxqzpaF7WU5nI+pgqY0VP8FVmEwFYIYN2Aq8CPCbinDVjC5s4qoftRS Yw5X2JLClSRNtH8JTIbHoqC7+f1hl1gI3ljq1sByRq/wL0kVheS/AExR6iJp2SbgnWTk 2MdgGNVqjqDv8sKwNc8TWC7E0ahjclVhDvtdjfaZhQryBDeMpxJWN4i/V8TzrKN9mCrb 8kv5GcvvEG0D+CIl+LVT4KbryBrGz4wtDNj00Rk96Ubm3Vf+AHBFIAEu4ztgivxxyZGe B05Q== 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:mime-version:content-transfer-encoding; bh=8DDr7wU5Mf7FhJNHoQYd6MgxVhRgKHpZJzl/r4VHltc=; b=gExMgTPqMRM15jbtUmlEufsn6tfVTsz3ZIrswSNisGEXBezWvb12rA6SCPDufQqT7R U/KSjp/cYq1ePM55knn9uPhw31+pRx3i+pX7OIJfFqs82AfyyqynQJdz/KoqYUxdrQeM xhOzoAeqR5YBXhBwAMbxPLboPxKBCSwSV4iklh3t3d9yf0SjFgSElcYPqy317tpZ10Pg YTfh1ehpG4Rz0fAOgvggJZfIhEG4rPigfCk8zIuuOk6HEusFSMWh89zLfGSonKa1mIEg S3Hvg9xrc02fPRJGWkTDLWHUoHGWuUOG9Xat7liwM/Ob34XP6kqJ9DjeFk5Ys7rGPnj+ qwnA== X-Gm-Message-State: APjAAAVRsrIywA5fuoe2Faq4uGaTZ8pAWcOaokKmMx3fepD6r341Pu+P tOcHY72yVrBD/mNUWP0tlfTIPq+IM+WHhg== X-Received: by 2002:a1c:e009:: with SMTP id x9mr17209422wmg.5.1560250475482; Tue, 11 Jun 2019 03:54:35 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:35 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:48 +0100 Message-Id: <20190611105351.9871-40-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v2 39/42] target/arm: Convert VJCVT to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VJCVT instruction to decodetree. Signed-off-by: Peter Maydell --- target/arm/translate-vfp.inc.c | 28 ++++++++++++++++++++++++++++ target/arm/translate.c | 12 +----------- target/arm/vfp.decode | 4 ++++ 3 files changed, 33 insertions(+), 11 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index cc3f61d9c41..161f0fdd888 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -2426,3 +2426,31 @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a) tcg_temp_free_ptr(fpst); return true; } + +static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a) +{ + TCGv_i32 vd; + TCGv_i64 vm; + + if (!dc_isar_feature(aa32_jscvt, s)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vm & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + vm = tcg_temp_new_i64(); + vd = tcg_temp_new_i32(); + neon_load_reg64(vm, a->vm); + gen_helper_vjcvt(vd, vm, cpu_env); + neon_store_reg32(vd, a->vd); + tcg_temp_free_i64(vm); + tcg_temp_free_i32(vd); + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 1e28308aa6a..99b436ad6f7 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3050,7 +3050,7 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; case 15: switch (rn) { - case 0 ... 17: + case 0 ... 19: /* Already handled by decodetree */ return 1; default: @@ -3085,13 +3085,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rm_is_dp = false; break; - case 0x13: /* vjcvt */ - if (!dp || !dc_isar_feature(aa32_jscvt, s)) { - return 1; - } - rd_is_dp = false; - break; - default: return 1; } @@ -3177,9 +3170,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) switch (op) { case 15: /* extension space */ switch (rn) { - case 19: /* vjcvt */ - gen_helper_vjcvt(cpu_F0s, cpu_F0d, cpu_env); - break; case 20: /* fshto */ gen_vfp_shto(dp, 16 - rm, 0); break; diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 6da9a7913da..1a7c9b533de 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -220,3 +220,7 @@ VCVT_int_sp ---- 1110 1.11 1000 .... 1010 s:1 1.0 .... \ vd=%vd_sp vm=%vm_sp VCVT_int_dp ---- 1110 1.11 1000 .... 1011 s:1 1.0 .... \ vd=%vd_dp vm=%vm_sp + +# VJCVT is always dp to sp +VJCVT ---- 1110 1.11 1001 .... 1011 11.0 .... \ + vd=%vd_sp vm=%vm_dp From patchwork Tue Jun 11 10:53:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166428 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2258358ilk; Tue, 11 Jun 2019 04:56:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOyYMcFFuLJtp6Ln9o4ukoYEKjNHLnz5eZv3c+m3Ox9Y72rmVqiGxpjEM0FYpSFZgUixSD X-Received: by 2002:a37:d16:: with SMTP id 22mr40924165qkn.232.1560254185826; Tue, 11 Jun 2019 04:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560254185; cv=none; d=google.com; s=arc-20160816; b=rF2CJBau4V2tutg+7rDCv45wrAf23pCuO1qqepVTSE5fuNbB8uyaaJ55UAL+qOVlPe +6DxdvyD8fVjV1qDvK1aoTae7lSW7xeXdiMdHtnMi96oaoastXc6zuWVCaUNPT17nw0r UkE7yEZewoq4you2AKCgytqv5zawJc+fABoDR4PXJnbR2Xq4/52MMTFnjVG0FdgvkilA x1rJLmeRSCq7lR7IGVZaVHU+BUH8mxmHp1g0jr22u2GxiPCVLn/7SivQXWafpFXWIO1f SKjyO3ts8TgO5QV99U8aIOmt/bySedOtmch8c/HCxRCuQBsp/wJwxDwjzFcFzTJZVDBu +64Q== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=5kclgn/mhQ0nS8PSsHlo/mWH1a0d6xpWo9XIEBfVkVw=; b=sUCTQpNp47Q7bua9Lx8CFT4nuPOWvlrtELH24h9MTjjZ64aun8tpNu29LR3DYZvv3g hGKPHgW4AOZvVnyUC9Bf4IB4prOdMGVrIC4jK/fxn5TPOuygnZPw+h604d7Sfa/5VivV 0WWPhdV+TR9H6X73q5aWRs2dKuLzdlWZTya5MxAU8hsfhPoczyvUmOzzvLwG650FfJpR YM1JtoWnsm5a/2VPim866+zxlYOiupk3wq+hG5lb9NQ5TAg019PR7jh4YohYuxL8o7JY lw/fyQaEeJnTP+ar0MYOzIlPWm/YRWMwpIoc6HeWtBSZqDqEHmw+hntp6U32zZUkfCNC sCYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uQ3SYwIt; 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 f17si5174073qkm.270.2019.06.11.04.56.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:56:25 -0700 (PDT) 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=uQ3SYwIt; 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 ([::1]:56730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafO5-0005nf-Dc for patch@linaro.org; Tue, 11 Jun 2019 07:56:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39682) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQR-0007ev-C4 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQL-0007rD-1u for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:47 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:45357) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQK-0007n0-J5 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:40 -0400 Received: by mail-wr1-x442.google.com with SMTP id f9so12458108wre.12 for ; Tue, 11 Jun 2019 03:54:37 -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 :mime-version:content-transfer-encoding; bh=5kclgn/mhQ0nS8PSsHlo/mWH1a0d6xpWo9XIEBfVkVw=; b=uQ3SYwItXx9n5xeTrIbsCFvhAIWGIWRFC+o17wUQs5FpmIJzRyj7E0/SqfuvrkFpIM 7W9w4bHv7eSu/pqJACuEPQyA/4feDaZx1FCJqR/IFuyu/UxVfjkCEdMxc8VO77hgKkfg S/YV+46jBHDJPWeebeuQrV+jD0HZbuB69R7yjj0HJ43zsuESAZ/YhVAVmSWLhqOMxqQb ER/78zcTCH8qoB6rxfJjrFaHvAzZSYOATRSNS5aDeRuqsYGw9QqV47+8vp7Fx6hG45CB 6lkCcW2G5HDLMdNlwXc/qSGr5Pb+O0oNmBAZowoM9gzRdGUwTiqGD/LTeSM4b1on7ARn hmMw== 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:mime-version:content-transfer-encoding; bh=5kclgn/mhQ0nS8PSsHlo/mWH1a0d6xpWo9XIEBfVkVw=; b=QKC6bgb9Sm44v9TVouqQOABtseymMM5QCQt4sXeux9UtC/1JQI18SSI9Xbnz17tQI8 KMifk70fvbEXng41vn/6JwPSIQLf1Dkpj5l6cDxZlhwxZDj1LF+hdXWcD41/y7sgif7G OEoEySaZqmw5kuY//CVOrNPy2fwxxIzjHs8XJlFzdZQjx0c7TKQUnaGr1acVPsIT0hBG QyJAI4+0g/v2zetZISM/FEvJlglCl2z0BveqQ2IzX5JJHN8XfubsNTc/tnG12Klvvg7t AxwaeODBcrbgGZxP6YrDKwPXRdZN36LAS9iiMLEEuY/SMMq889gA/Z5x4SkIYGCeXzhA Na3A== X-Gm-Message-State: APjAAAUOTMM46i8uxg35mk6u8FD4e6nZttTiFBHO+WuQZ0YVpGEXUyDw U/N+B3LCmpZLFtrX8A5kjACtOw== X-Received: by 2002:adf:d081:: with SMTP id y1mr3431016wrh.34.1560250476510; Tue, 11 Jun 2019 03:54:36 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:36 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:49 +0100 Message-Id: <20190611105351.9871-41-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH v2 40/42] target/arm: Convert VCVT fp/fixed-point conversion insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the VCVT (between floating-point and fixed-point) instructions to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 124 +++++++++++++++++++++++++++++++++ target/arm/translate.c | 57 +-------------- target/arm/vfp.decode | 10 +++ 3 files changed, 136 insertions(+), 55 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 161f0fdd888..db07fdd8736 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -2454,3 +2454,127 @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a) tcg_temp_free_i32(vd); return true; } + +static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a) +{ + TCGv_i32 vd, shift; + TCGv_ptr fpst; + int frac_bits; + + if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + frac_bits = (a->opc & 1) ? (32 - a->imm) : (16 - a->imm); + + vd = tcg_temp_new_i32(); + neon_load_reg32(vd, a->vd); + + fpst = get_fpstatus_ptr(false); + shift = tcg_const_i32(frac_bits); + + /* Switch on op:U:sx bits */ + switch (a->opc) { + case 0: + gen_helper_vfp_shtos(vd, vd, shift, fpst); + break; + case 1: + gen_helper_vfp_sltos(vd, vd, shift, fpst); + break; + case 2: + gen_helper_vfp_uhtos(vd, vd, shift, fpst); + break; + case 3: + gen_helper_vfp_ultos(vd, vd, shift, fpst); + break; + case 4: + gen_helper_vfp_toshs_round_to_zero(vd, vd, shift, fpst); + break; + case 5: + gen_helper_vfp_tosls_round_to_zero(vd, vd, shift, fpst); + break; + case 6: + gen_helper_vfp_touhs_round_to_zero(vd, vd, shift, fpst); + break; + case 7: + gen_helper_vfp_touls_round_to_zero(vd, vd, shift, fpst); + break; + default: + g_assert_not_reached(); + } + + neon_store_reg32(vd, a->vd); + tcg_temp_free_i32(vd); + tcg_temp_free_i32(shift); + tcg_temp_free_ptr(fpst); + return true; +} + +static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) +{ + TCGv_i64 vd; + TCGv_i32 shift; + TCGv_ptr fpst; + int frac_bits; + + if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { + return false; + } + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vd & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + frac_bits = (a->opc & 1) ? (32 - a->imm) : (16 - a->imm); + + vd = tcg_temp_new_i64(); + neon_load_reg64(vd, a->vd); + + fpst = get_fpstatus_ptr(false); + shift = tcg_const_i32(frac_bits); + + /* Switch on op:U:sx bits */ + switch (a->opc) { + case 0: + gen_helper_vfp_shtod(vd, vd, shift, fpst); + break; + case 1: + gen_helper_vfp_sltod(vd, vd, shift, fpst); + break; + case 2: + gen_helper_vfp_uhtod(vd, vd, shift, fpst); + break; + case 3: + gen_helper_vfp_ultod(vd, vd, shift, fpst); + break; + case 4: + gen_helper_vfp_toshd_round_to_zero(vd, vd, shift, fpst); + break; + case 5: + gen_helper_vfp_tosld_round_to_zero(vd, vd, shift, fpst); + break; + case 6: + gen_helper_vfp_touhd_round_to_zero(vd, vd, shift, fpst); + break; + case 7: + gen_helper_vfp_tould_round_to_zero(vd, vd, shift, fpst); + break; + default: + g_assert_not_reached(); + } + + neon_store_reg64(vd, a->vd); + tcg_temp_free_i64(vd); + tcg_temp_free_i32(shift); + tcg_temp_free_ptr(fpst); + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 99b436ad6f7..6046bb32247 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1439,13 +1439,9 @@ static inline void gen_vfp_##name(int dp, int shift, int neon) \ tcg_temp_free_i32(tmp_shift); \ tcg_temp_free_ptr(statusptr); \ } -VFP_GEN_FIX(tosh, _round_to_zero) VFP_GEN_FIX(tosl, _round_to_zero) -VFP_GEN_FIX(touh, _round_to_zero) VFP_GEN_FIX(toul, _round_to_zero) -VFP_GEN_FIX(shto, ) VFP_GEN_FIX(slto, ) -VFP_GEN_FIX(uhto, ) VFP_GEN_FIX(ulto, ) #undef VFP_GEN_FIX @@ -3050,7 +3046,8 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 1; case 15: switch (rn) { - case 0 ... 19: + case 0 ... 23: + case 28 ... 31: /* Already handled by decodetree */ return 1; default: @@ -3070,21 +3067,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) rd_is_dp = false; break; - case 0x14: /* vcvt fp <-> fixed */ - case 0x15: - case 0x16: - case 0x17: - case 0x1c: - case 0x1d: - case 0x1e: - case 0x1f: - if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) { - return 1; - } - /* Immediate frac_bits has same format as SREG_M. */ - rm_is_dp = false; - break; - default: return 1; } @@ -3143,17 +3125,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) /* Load the initial operands. */ if (op == 15) { switch (rn) { - case 0x14: /* vcvt fp <-> fixed */ - case 0x15: - case 0x16: - case 0x17: - case 0x1c: - case 0x1d: - case 0x1e: - case 0x1f: - /* Source and destination the same. */ - gen_mov_F0_vreg(dp, rd); - break; default: /* One source operand. */ gen_mov_F0_vreg(rm_is_dp, rm); @@ -3170,18 +3141,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) switch (op) { case 15: /* extension space */ switch (rn) { - case 20: /* fshto */ - gen_vfp_shto(dp, 16 - rm, 0); - break; - case 21: /* fslto */ - gen_vfp_slto(dp, 32 - rm, 0); - break; - case 22: /* fuhto */ - gen_vfp_uhto(dp, 16 - rm, 0); - break; - case 23: /* fulto */ - gen_vfp_ulto(dp, 32 - rm, 0); - break; case 24: /* ftoui */ gen_vfp_toui(dp, 0); break; @@ -3194,18 +3153,6 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) case 27: /* ftosiz */ gen_vfp_tosiz(dp, 0); break; - case 28: /* ftosh */ - gen_vfp_tosh(dp, 16 - rm, 0); - break; - case 29: /* ftosl */ - gen_vfp_tosl(dp, 32 - rm, 0); - break; - case 30: /* ftouh */ - gen_vfp_touh(dp, 16 - rm, 0); - break; - case 31: /* ftoul */ - gen_vfp_toul(dp, 32 - rm, 0); - break; default: /* undefined */ g_assert_not_reached(); } diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index 1a7c9b533de..c3223a124ac 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -224,3 +224,13 @@ VCVT_int_dp ---- 1110 1.11 1000 .... 1011 s:1 1.0 .... \ # VJCVT is always dp to sp VJCVT ---- 1110 1.11 1001 .... 1011 11.0 .... \ vd=%vd_sp vm=%vm_dp + +# VCVT between floating-point and fixed-point. The immediate value +# is in the same format as a Vm single-precision register number. +# We assemble bits 18 (op), 16 (u) and 7 (sx) into a single opc field +# for the convenience of the trans_VCVT_fix functions. +%vcvt_fix_op 18:1 16:1 7:1 +VCVT_fix_sp ---- 1110 1.11 1.1. .... 1010 .1.0 .... \ + vd=%vd_sp imm=%vm_sp opc=%vcvt_fix_op +VCVT_fix_dp ---- 1110 1.11 1.1. .... 1011 .1.0 .... \ + vd=%vd_dp imm=%vm_sp opc=%vcvt_fix_op From patchwork Tue Jun 11 10:53:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166408 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2226431ilk; Tue, 11 Jun 2019 04:23:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKEqATH6JXZBQYs9YecTExVX0BIt0Kcbw3yLs1J59gZBOiEWLStRiJ+7ZjJm/gZj1ieaqN X-Received: by 2002:aed:3804:: with SMTP id j4mr63150792qte.361.1560252198999; Tue, 11 Jun 2019 04:23:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560252198; cv=none; d=google.com; s=arc-20160816; b=DVRJOUNDow7Dx34gOy9KKERKsBSqLpte2+KFq4SccyyJJw7GxlkWrPS1PIm8hQj2h7 wf+Z4oz7LpYS9UZ6O+nJH8e+InrfAHtZkW10RYelxANApKEEuZOy6cf2RLT4w5Mspory 7UYAc/YkTrHej6GtPdoAaH+HQoqIr24h2vjHd6otdFgWtnqvlk0Ck5H6AA2WgKlsYNqZ RivItPkSWL3BEuMigJRhGZcMS+ExJo3LVodIMcCzzaOhVEi0DJeVFUtjHFKbeuPmakrx IlOHIm5vARsSsSmeDVoouqv7xp+4ouD7pSK2dTqTJLg0EunRzC0fpwEBN9/hVK9orcLi X14A== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ofkFrPnbpYVeebJyYiTbSJ949rvcVU2W+f8AxYEMy4A=; b=BvCs3KbQYxBhi40TT+hZjp1CofEFU4kQ/tCHZtxUwUZBMqbvkRJitpdo91o65/i3gV itiJTJbNQbVIsADN6vDcuu3y3EvJkCs2Ee6NAL7C1qH7pVYyy3uNTbbkBFouUeqBZBK+ 5U0cP/c/gb0jYOshwdKNLee1Cyho3WOTHg/3M3ZtG1VbwXB708Q0yPkw6pCYvTDpZfYl JM040LHDrgpC5FLtYxTI68kVnaAxGEik4fuqXsO0tFH7Y8zHeMJpQP2IuPo+kZw4DYGE eVRWs1si7KemLKHYjpM0dUvxv1KLRZet+XsOJuEdLAQxmF/pqBu6P9aoyJj/yFOecjNV bOMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kdGTT0PX; 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 e65si559941qkf.138.2019.06.11.04.23.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:23:18 -0700 (PDT) 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=kdGTT0PX; 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 ([::1]:56396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haes2-00077Y-Hl for patch@linaro.org; Tue, 11 Jun 2019 07:23:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39828) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQW-0007pR-P4 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQM-0007tf-3y for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:52 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:56301) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQL-0007o4-Je for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:41 -0400 Received: by mail-wm1-x341.google.com with SMTP id a15so2411852wmj.5 for ; Tue, 11 Jun 2019 03:54:38 -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 :mime-version:content-transfer-encoding; bh=ofkFrPnbpYVeebJyYiTbSJ949rvcVU2W+f8AxYEMy4A=; b=kdGTT0PXbPTBO3gtZMn09SAlzsZ9bKN6Hly6NMkY13XV8TzR+uc0BSazv1WtyQ88DG BNZCsaO8bqC2tiFEFgQS9eEvBysRvhYd8+fcVt6E+4jjz2WSpLODlDvwGlKhxOeaQfnw TmitRLeO+/0tfXZeCHoAWfmp0oIBaOIvi59FYqCuGvZqZAWJ/p+Z2vds30pXDPKMO16G Fq0b83/bPToFMdyY/m1MAWyp8ieWVkzjLxSkKNikDRagdzMFa3gH3sBTQsuLYsI/uQC7 gd1eSha9OWKoMRxvcz2McDSYhs98D/eZFqLfW1/4zcRpaHJpE3USlggkJ0zpf/QwhSdy TPvQ== 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:mime-version:content-transfer-encoding; bh=ofkFrPnbpYVeebJyYiTbSJ949rvcVU2W+f8AxYEMy4A=; b=qyJ3oq3/DnxoI0JD0At1mjqzZsiYhgAPNoXFzWKH0N+ikVOHTIwgE3n//h5C8STnDk 1ftVRhEvxYz0uXrRe2DZeRWcEEmGq05CnxGVIHaPGxxPy2AbGyi90rlYHdNCLXdKMbOD FEFzoTjhTd6+micUe9vN7+2fWOJgy59+b7VDQ0Am7bWzsuBcsXy34WwqEE4/j/TlQYgb bRQDQim4Eajyf2dBRX1F6XIFy9XhK5LPK31MQHOA0FvoUIo5jWRh4YUcWjFpPb0k259S E3JXpAFwc8vO4CMRI0YjIwRLijj7/lyHgNCUeoYvEDxF91FHTjEwgowIF5XqIdFSMloj Ahjg== X-Gm-Message-State: APjAAAWnsf277F5p6TWh9jd2x/H0N4H9U/5/hD0k4OLjoSeuRQ1QB9/G YW2nxrS54U2+1MiasUJElAh6jfqwBKI14A== X-Received: by 2002:a1c:e715:: with SMTP id e21mr18046649wmh.16.1560250477579; Tue, 11 Jun 2019 03:54:37 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:37 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:50 +0100 Message-Id: <20190611105351.9871-42-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v2 41/42] target/arm: Convert float-to-integer VCVT insns to decodetree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the float-to-integer VCVT instructions to decodetree. Since these are the last unconverted instructions, we can delete the old decoder structure entirely now. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 72 ++++++++++ target/arm/translate.c | 241 +-------------------------------- target/arm/vfp.decode | 6 + 3 files changed, 80 insertions(+), 239 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index db07fdd8736..8216dba796e 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -2578,3 +2578,75 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) tcg_temp_free_ptr(fpst); return true; } + +static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a) +{ + TCGv_i32 vm; + TCGv_ptr fpst; + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(false); + vm = tcg_temp_new_i32(); + neon_load_reg32(vm, a->vm); + + if (a->s) { + if (a->rz) { + gen_helper_vfp_tosizs(vm, vm, fpst); + } else { + gen_helper_vfp_tosis(vm, vm, fpst); + } + } else { + if (a->rz) { + gen_helper_vfp_touizs(vm, vm, fpst); + } else { + gen_helper_vfp_touis(vm, vm, fpst); + } + } + neon_store_reg32(vm, a->vd); + tcg_temp_free_i32(vm); + tcg_temp_free_ptr(fpst); + return true; +} + +static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a) +{ + TCGv_i32 vd; + TCGv_i64 vm; + TCGv_ptr fpst; + + /* UNDEF accesses to D16-D31 if they don't exist. */ + if (!dc_isar_feature(aa32_fp_d32, s) && (a->vm & 0x10)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + fpst = get_fpstatus_ptr(false); + vm = tcg_temp_new_i64(); + vd = tcg_temp_new_i32(); + neon_load_reg64(vm, a->vm); + + if (a->s) { + if (a->rz) { + gen_helper_vfp_tosizd(vd, vm, fpst); + } else { + gen_helper_vfp_tosid(vd, vm, fpst); + } + } else { + if (a->rz) { + gen_helper_vfp_touizd(vd, vm, fpst); + } else { + gen_helper_vfp_touid(vd, vm, fpst); + } + } + neon_store_reg32(vd, a->vd); + tcg_temp_free_i32(vd); + tcg_temp_free_i64(vm); + tcg_temp_free_ptr(fpst); + return true; +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 6046bb32247..1e6b0fa769e 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1418,9 +1418,7 @@ static inline void gen_vfp_##name(int dp, int neon) \ tcg_temp_free_ptr(statusptr); \ } -VFP_GEN_FTOI(toui) VFP_GEN_FTOI(touiz) -VFP_GEN_FTOI(tosi) VFP_GEN_FTOI(tosiz) #undef VFP_GEN_FTOI @@ -1612,33 +1610,7 @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg) } #define tcg_gen_ld_f32 tcg_gen_ld_i32 -#define tcg_gen_ld_f64 tcg_gen_ld_i64 #define tcg_gen_st_f32 tcg_gen_st_i32 -#define tcg_gen_st_f64 tcg_gen_st_i64 - -static inline void gen_mov_F0_vreg(int dp, int reg) -{ - if (dp) - tcg_gen_ld_f64(cpu_F0d, cpu_env, vfp_reg_offset(dp, reg)); - else - tcg_gen_ld_f32(cpu_F0s, cpu_env, vfp_reg_offset(dp, reg)); -} - -static inline void gen_mov_F1_vreg(int dp, int reg) -{ - if (dp) - tcg_gen_ld_f64(cpu_F1d, cpu_env, vfp_reg_offset(dp, reg)); - else - tcg_gen_ld_f32(cpu_F1s, cpu_env, vfp_reg_offset(dp, reg)); -} - -static inline void gen_mov_vreg_F0(int dp, int reg) -{ - if (dp) - tcg_gen_st_f64(cpu_F0d, cpu_env, vfp_reg_offset(dp, reg)); - else - tcg_gen_st_f32(cpu_F0s, cpu_env, vfp_reg_offset(dp, reg)); -} #define ARM_CP_RW_BIT (1 << 20) @@ -2983,9 +2955,6 @@ static void gen_neon_dup_high16(TCGv_i32 var) */ static int disas_vfp_insn(DisasContext *s, uint32_t insn) { - uint32_t rd, rn, rm, op, delta_d, delta_m, bank_mask; - int dp, veclen; - if (!arm_dc_feature(s, ARM_FEATURE_VFP)) { return 1; } @@ -3005,214 +2974,8 @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) return 0; } } - - if (extract32(insn, 28, 4) == 0xf) { - /* - * Encodings with T=1 (Thumb) or unconditional (ARM): these - * were all handled by the decodetree decoder, so any insn - * patterns which get here must be UNDEF. - */ - return 1; - } - - /* - * FIXME: this access check should not take precedence over UNDEF - * for invalid encodings; we will generate incorrect syndrome information - * for attempts to execute invalid vfp/neon encodings with FP disabled. - */ - if (!vfp_access_check(s)) { - return 0; - } - - dp = ((insn & 0xf00) == 0xb00); - switch ((insn >> 24) & 0xf) { - case 0xe: - if (insn & (1 << 4)) { - /* already handled by decodetree */ - return 1; - } else { - /* data processing */ - bool rd_is_dp = dp; - bool rm_is_dp = dp; - bool no_output = false; - - /* The opcode is in bits 23, 21, 20 and 6. */ - op = ((insn >> 20) & 8) | ((insn >> 19) & 6) | ((insn >> 6) & 1); - rn = VFP_SREG_N(insn); - - switch (op) { - case 0 ... 14: - /* Already handled by decodetree */ - return 1; - case 15: - switch (rn) { - case 0 ... 23: - case 28 ... 31: - /* Already handled by decodetree */ - return 1; - default: - break; - } - default: - break; - } - - if (op == 15) { - /* rn is opcode, encoded as per VFP_SREG_N. */ - switch (rn) { - case 0x18: /* vcvtr.u32.fxx */ - case 0x19: /* vcvtz.u32.fxx */ - case 0x1a: /* vcvtr.s32.fxx */ - case 0x1b: /* vcvtz.s32.fxx */ - rd_is_dp = false; - break; - - default: - return 1; - } - } else if (dp) { - /* rn is register number */ - VFP_DREG_N(rn, insn); - } - - if (rd_is_dp) { - VFP_DREG_D(rd, insn); - } else { - rd = VFP_SREG_D(insn); - } - if (rm_is_dp) { - VFP_DREG_M(rm, insn); - } else { - rm = VFP_SREG_M(insn); - } - - veclen = s->vec_len; - if (op == 15 && rn > 3) { - veclen = 0; - } - - /* Shut up compiler warnings. */ - delta_m = 0; - delta_d = 0; - bank_mask = 0; - - if (veclen > 0) { - if (dp) - bank_mask = 0xc; - else - bank_mask = 0x18; - - /* Figure out what type of vector operation this is. */ - if ((rd & bank_mask) == 0) { - /* scalar */ - veclen = 0; - } else { - if (dp) - delta_d = (s->vec_stride >> 1) + 1; - else - delta_d = s->vec_stride + 1; - - if ((rm & bank_mask) == 0) { - /* mixed scalar/vector */ - delta_m = 0; - } else { - /* vector */ - delta_m = delta_d; - } - } - } - - /* Load the initial operands. */ - if (op == 15) { - switch (rn) { - default: - /* One source operand. */ - gen_mov_F0_vreg(rm_is_dp, rm); - break; - } - } else { - /* Two source operands. */ - gen_mov_F0_vreg(dp, rn); - gen_mov_F1_vreg(dp, rm); - } - - for (;;) { - /* Perform the calculation. */ - switch (op) { - case 15: /* extension space */ - switch (rn) { - case 24: /* ftoui */ - gen_vfp_toui(dp, 0); - break; - case 25: /* ftouiz */ - gen_vfp_touiz(dp, 0); - break; - case 26: /* ftosi */ - gen_vfp_tosi(dp, 0); - break; - case 27: /* ftosiz */ - gen_vfp_tosiz(dp, 0); - break; - default: /* undefined */ - g_assert_not_reached(); - } - break; - default: /* undefined */ - return 1; - } - - /* Write back the result, if any. */ - if (!no_output) { - gen_mov_vreg_F0(rd_is_dp, rd); - } - - /* break out of the loop if we have finished */ - if (veclen == 0) { - break; - } - - if (op == 15 && delta_m == 0) { - /* single source one-many */ - while (veclen--) { - rd = ((rd + delta_d) & (bank_mask - 1)) - | (rd & bank_mask); - gen_mov_vreg_F0(dp, rd); - } - break; - } - /* Setup the next operands. */ - veclen--; - rd = ((rd + delta_d) & (bank_mask - 1)) - | (rd & bank_mask); - - if (op == 15) { - /* One source operand. */ - rm = ((rm + delta_m) & (bank_mask - 1)) - | (rm & bank_mask); - gen_mov_F0_vreg(dp, rm); - } else { - /* Two source operands. */ - rn = ((rn + delta_d) & (bank_mask - 1)) - | (rn & bank_mask); - gen_mov_F0_vreg(dp, rn); - if (delta_m) { - rm = ((rm + delta_m) & (bank_mask - 1)) - | (rm & bank_mask); - gen_mov_F1_vreg(dp, rm); - } - } - } - } - break; - case 0xc: - case 0xd: - /* Already handled by decodetree */ - return 1; - default: - /* Should never happen. */ - return 1; - } - return 0; + /* If the decodetree decoder didn't handle this insn, it must be UNDEF */ + return 1; } static inline bool use_goto_tb(DisasContext *s, target_ulong dest) diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode index c3223a124ac..ea24365bb4c 100644 --- a/target/arm/vfp.decode +++ b/target/arm/vfp.decode @@ -234,3 +234,9 @@ VCVT_fix_sp ---- 1110 1.11 1.1. .... 1010 .1.0 .... \ vd=%vd_sp imm=%vm_sp opc=%vcvt_fix_op VCVT_fix_dp ---- 1110 1.11 1.1. .... 1011 .1.0 .... \ vd=%vd_dp imm=%vm_sp opc=%vcvt_fix_op + +# VCVT float to integer (VCVT and VCVTR): Vd always single; Vd depends on size +VCVT_sp_int ---- 1110 1.11 110 s:1 .... 1010 rz:1 1.0 .... \ + vd=%vd_sp vm=%vm_sp +VCVT_dp_int ---- 1110 1.11 110 s:1 .... 1011 rz:1 1.0 .... \ + vd=%vd_sp vm=%vm_dp From patchwork Tue Jun 11 10:53:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 166423 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2252117ilk; Tue, 11 Jun 2019 04:49:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzR4di9DMv8Zr31rNcWy8SfPPWrQBEWsh7ArVwGf+6zEvIs/ZAWC2W8MHNPHaJwnWfdN6A X-Received: by 2002:a37:ac14:: with SMTP id e20mr58539684qkm.243.1560253777695; Tue, 11 Jun 2019 04:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560253777; cv=none; d=google.com; s=arc-20160816; b=E17qu8qA1ZpGAG0sJTV3P+6FzxGjQwpHYk4lzS+2YqHp+MqReXuNZQYng7/NHDeUkO To2HCjwPMAEOuUWTA2QssI7G8XimcFrSAWYh2aHAQJsZhHtYlyJ91ADc/cN8otf9plcB 7j4E3RXH57nOBplAwrMasOOPZoXXbfwza0KrjhTYuYnN8NIG79POVxdOAk1U/bEUfuJf faBLF5d5lRnk9TSqQ+PKSbysjJEO0dyVsjYXMautVc9rEiwevbdqY4SJxcJ1L63/p0f8 7YUrc3g2yvUDrHea94WwuS1wXmnmDZN2vxCljyMApu3hU4l0gnEvdgQfN/vmS1mr0Fkb OXew== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=gPYLikUR5ZuBlGRaNvlfd3hHYV0xbs6/Y2luBsY5Vwk=; b=OwGXEcaDogqo3B6TZGB0ZRVYlb4eu8RJ801snOjRspCwT9BujLeyQp1+r12GLDUvEQ 2hSUbx4RkbXBRaJUGH7om2KuFdp6G0rwVpcweWEwzvVYZkYIyUcOB5ISG85aqYgkBzdG 9/EvMLvoTa9TsLQAescDfEpDzGGjhZnEaBBnIEy0N60Kj7TtCx/Bz1Z1A1cbTUkQRw/d YZ3m/xK96Ciiu/Dbz8BHBWKnVkWNNDQx4qhItJAO7myf5nLQATYcml+pG7bt/FTdbOmr FtGpH2yOrhQtS7/R5mVjoHrFkzl5kjG0JttJIN4aVfDQASY/ScgToEgG7VbzwCoZQyIu 0uSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cY2uIjwJ; 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 o38si5279201qte.117.2019.06.11.04.49.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 04:49:37 -0700 (PDT) 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=cY2uIjwJ; 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 ([::1]:56656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafHV-0005C2-3Q for patch@linaro.org; Tue, 11 Jun 2019 07:49:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39644) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haeQQ-0007de-Al for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haeQK-0007qU-L3 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:46 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:43071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haeQK-0007ot-2l for qemu-devel@nongnu.org; Tue, 11 Jun 2019 06:54:40 -0400 Received: by mail-wr1-x441.google.com with SMTP id p13so2389334wru.10 for ; Tue, 11 Jun 2019 03:54:39 -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 :mime-version:content-transfer-encoding; bh=gPYLikUR5ZuBlGRaNvlfd3hHYV0xbs6/Y2luBsY5Vwk=; b=cY2uIjwJlfKnxKC5LvBX2R1HHBm6XmPD5C5JRZiBG7PpDMpQ+ID1a3JR2qC9OezKYb xdL65tJIR84ZILz7hKKYNUVTM7g5g7ex+diwwX5wEYSnNze5WP1eGowKOX2u5NC7zf/O PFRKzrX8Rg/BqaAclpyrAetH8wsNT0wWo7FiYV/T40SKeDkOjA1JSRYhu6cPVdVQm5P5 IagG0rJX7+UG1FGCMDnpkixlHJ2AWAm9YoFFR2z6oDyT0BUF30ycTsu60bdeMGOmxS5W UKdlNIYM+JzvOPyOyRUoI3AGcENMyhUuID25v7U0eUzzao6YsObZaWN3/RUHEO0A09q9 4asA== 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:mime-version:content-transfer-encoding; bh=gPYLikUR5ZuBlGRaNvlfd3hHYV0xbs6/Y2luBsY5Vwk=; b=JYbHYxwA8G876965l9Pi2S4O969DZ10gYlGZvY3dwtlHHMw+dx+zBKHSL4GP0QO1vI i3hb3gbCACnApMx2b249ycQXaTAaqz8fbN4z2yp8M/bbclueZzdpMt3ky88s689TK2/N 5huKV1AvsEFPKg+E4lqkbKyaiB+Hz5lenwS+UeF6OmdsU6UJDtt0jWbaMH4PcBA6NJ+N 96mtrBA+oEvaYcqpzVkxMt3UPTLyE86h2FSe6lYSR7D1rKq7rQyK8yx40foyi0tQ6vIl d2UcZbHyW+NPit60iKlKsYjgKbhmUEXxENxT+sG3IqLVplAEl5PqcZrESLie89BQUZUL gTaQ== X-Gm-Message-State: APjAAAXaKvyJqlrEfE8UOKCgOgbAwiUrDyHV0kNUobCyFKkFU5gsI1XR +XI92jQmOxwHrwehVLHz95BnRQ== X-Received: by 2002:adf:9dcc:: with SMTP id q12mr24220861wre.93.1560250478626; Tue, 11 Jun 2019 03:54:38 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm10785945wrt.95.2019.06.11.03.54.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 03:54:38 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 11:53:51 +0100 Message-Id: <20190611105351.9871-43-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611105351.9871-1-peter.maydell@linaro.org> References: <20190611105351.9871-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH v2 42/42] target/arm: Fix short-vector increment behaviour X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For VFP short vectors, the VFP registers are divided into a series of banks: for single-precision these are s0-s7, s8-s15, s16-s23 and s24-s31; for double-precision they are d0-d3, d4-d7, ... d28-d31. Some banks are "scalar" meaning that use of a register within them triggers a pure-scalar or mixed vector-scalar operation rather than a full vector operation. The scalar banks are s0-s7, d0-d3 and d16-d19. When using a bank as part of a vector operation, we iterate through it, increasing the register number by the specified stride each time, and wrapping around to the beginning of the bank. Unfortunately our calculation of the "increment" part of this was incorrect: vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask) will only do the intended thing if bank_mask has exactly one set high bit. For instance for doubles (bank_mask = 0xc), if we start with vd = 6 and delta_d = 2 then vd is updated to 12 rather than the intended 4. This only causes problems in the unlikely case that the starting register is not the first in its bank: if the register number doesn't have to wrap around then the expression happens to give the right answer. Fix this bug by abstracting out the "check whether register is in a scalar bank" and "advance register within bank" operations to utility functions which use the right bit masking operations. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate-vfp.inc.c | 100 ++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 40 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c index 8216dba796e..709fc65374d 100644 --- a/target/arm/translate-vfp.inc.c +++ b/target/arm/translate-vfp.inc.c @@ -1139,6 +1139,42 @@ typedef void VFPGen3OpDPFn(TCGv_i64 vd, typedef void VFPGen2OpSPFn(TCGv_i32 vd, TCGv_i32 vm); typedef void VFPGen2OpDPFn(TCGv_i64 vd, TCGv_i64 vm); +/* + * Return true if the specified S reg is in a scalar bank + * (ie if it is s0..s7) + */ +static inline bool vfp_sreg_is_scalar(int reg) +{ + return (reg & 0x18) == 0; +} + +/* + * Return true if the specified D reg is in a scalar bank + * (ie if it is d0..d3 or d16..d19) + */ +static inline bool vfp_dreg_is_scalar(int reg) +{ + return (reg & 0xc) == 0; +} + +/* + * Advance the S reg number forwards by delta within its bank + * (ie increment the low 3 bits but leave the rest the same) + */ +static inline int vfp_advance_sreg(int reg, int delta) +{ + return ((reg + delta) & 0x7) | (reg & ~0x7); +} + +/* + * Advance the D reg number forwards by delta within its bank + * (ie increment the low 2 bits but leave the rest the same) + */ +static inline int vfp_advance_dreg(int reg, int delta) +{ + return ((reg + delta) & 0x3) | (reg & ~0x3); +} + /* * Perform a 3-operand VFP data processing instruction. fn is the * callback to do the actual operation; this function deals with the @@ -1149,7 +1185,6 @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn, { uint32_t delta_m = 0; uint32_t delta_d = 0; - uint32_t bank_mask = 0; int veclen = s->vec_len; TCGv_i32 f0, f1, fd; TCGv_ptr fpst; @@ -1164,16 +1199,14 @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn, } if (veclen > 0) { - bank_mask = 0x18; - /* Figure out what type of vector operation this is. */ - if ((vd & bank_mask) == 0) { + if (vfp_sreg_is_scalar(vd)) { /* scalar */ veclen = 0; } else { delta_d = s->vec_stride + 1; - if ((vm & bank_mask) == 0) { + if (vfp_sreg_is_scalar(vm)) { /* mixed scalar/vector */ delta_m = 0; } else { @@ -1204,11 +1237,11 @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn, /* Set up the operands for the next iteration */ veclen--; - vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); - vn = ((vn + delta_d) & (bank_mask - 1)) | (vn & bank_mask); + vd = vfp_advance_sreg(vd, delta_d); + vn = vfp_advance_sreg(vn, delta_d); neon_load_reg32(f0, vn); if (delta_m) { - vm = ((vm + delta_m) & (bank_mask - 1)) | (vm & bank_mask); + vm = vfp_advance_sreg(vm, delta_m); neon_load_reg32(f1, vm); } } @@ -1226,7 +1259,6 @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, { uint32_t delta_m = 0; uint32_t delta_d = 0; - uint32_t bank_mask = 0; int veclen = s->vec_len; TCGv_i64 f0, f1, fd; TCGv_ptr fpst; @@ -1246,16 +1278,14 @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, } if (veclen > 0) { - bank_mask = 0xc; - /* Figure out what type of vector operation this is. */ - if ((vd & bank_mask) == 0) { + if (vfp_dreg_is_scalar(vd)) { /* scalar */ veclen = 0; } else { delta_d = (s->vec_stride >> 1) + 1; - if ((vm & bank_mask) == 0) { + if (vfp_dreg_is_scalar(vm)) { /* mixed scalar/vector */ delta_m = 0; } else { @@ -1285,11 +1315,11 @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn, } /* Set up the operands for the next iteration */ veclen--; - vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); - vn = ((vn + delta_d) & (bank_mask - 1)) | (vn & bank_mask); + vd = vfp_advance_dreg(vd, delta_d); + vn = vfp_advance_dreg(vn, delta_d); neon_load_reg64(f0, vn); if (delta_m) { - vm = ((vm + delta_m) & (bank_mask - 1)) | (vm & bank_mask); + vm = vfp_advance_dreg(vm, delta_m); neon_load_reg64(f1, vm); } } @@ -1306,7 +1336,6 @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm) { uint32_t delta_m = 0; uint32_t delta_d = 0; - uint32_t bank_mask = 0; int veclen = s->vec_len; TCGv_i32 f0, fd; @@ -1320,16 +1349,14 @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm) } if (veclen > 0) { - bank_mask = 0x18; - /* Figure out what type of vector operation this is. */ - if ((vd & bank_mask) == 0) { + if (vfp_sreg_is_scalar(vd)) { /* scalar */ veclen = 0; } else { delta_d = s->vec_stride + 1; - if ((vm & bank_mask) == 0) { + if (vfp_sreg_is_scalar(vm)) { /* mixed scalar/vector */ delta_m = 0; } else { @@ -1355,7 +1382,7 @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm) if (delta_m == 0) { /* single source one-many */ while (veclen--) { - vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + vd = vfp_advance_sreg(vd, delta_d); neon_store_reg32(fd, vd); } break; @@ -1363,8 +1390,8 @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm) /* Set up the operands for the next iteration */ veclen--; - vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); - vm = ((vm + delta_m) & (bank_mask - 1)) | (vm & bank_mask); + vd = vfp_advance_sreg(vd, delta_d); + vm = vfp_advance_sreg(vm, delta_m); neon_load_reg32(f0, vm); } @@ -1378,7 +1405,6 @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm) { uint32_t delta_m = 0; uint32_t delta_d = 0; - uint32_t bank_mask = 0; int veclen = s->vec_len; TCGv_i64 f0, fd; @@ -1397,16 +1423,14 @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm) } if (veclen > 0) { - bank_mask = 0xc; - /* Figure out what type of vector operation this is. */ - if ((vd & bank_mask) == 0) { + if (vfp_dreg_is_scalar(vd)) { /* scalar */ veclen = 0; } else { delta_d = (s->vec_stride >> 1) + 1; - if ((vm & bank_mask) == 0) { + if (vfp_dreg_is_scalar(vm)) { /* mixed scalar/vector */ delta_m = 0; } else { @@ -1432,7 +1456,7 @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm) if (delta_m == 0) { /* single source one-many */ while (veclen--) { - vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + vd = vfp_advance_dreg(vd, delta_d); neon_store_reg64(fd, vd); } break; @@ -1440,8 +1464,8 @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm) /* Set up the operands for the next iteration */ veclen--; - vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); - vm = ((vm + delta_m) & (bank_mask - 1)) | (vm & bank_mask); + vd = vfp_advance_dreg(vd, delta_d); + vd = vfp_advance_dreg(vm, delta_m); neon_load_reg64(f0, vm); } @@ -1783,7 +1807,6 @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_sp *a) static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) { uint32_t delta_d = 0; - uint32_t bank_mask = 0; int veclen = s->vec_len; TCGv_i32 fd; uint32_t n, i, vd; @@ -1804,9 +1827,8 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) } if (veclen > 0) { - bank_mask = 0x18; /* Figure out what type of vector operation this is. */ - if ((vd & bank_mask) == 0) { + if (vfp_sreg_is_scalar(vd)) { /* scalar */ veclen = 0; } else { @@ -1835,7 +1857,7 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) /* Set up the operands for the next iteration */ veclen--; - vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + vd = vfp_advance_sreg(vd, delta_d); } tcg_temp_free_i32(fd); @@ -1845,7 +1867,6 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) { uint32_t delta_d = 0; - uint32_t bank_mask = 0; int veclen = s->vec_len; TCGv_i64 fd; uint32_t n, i, vd; @@ -1871,9 +1892,8 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) } if (veclen > 0) { - bank_mask = 0xc; /* Figure out what type of vector operation this is. */ - if ((vd & bank_mask) == 0) { + if (vfp_dreg_is_scalar(vd)) { /* scalar */ veclen = 0; } else { @@ -1902,7 +1922,7 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) /* Set up the operands for the next iteration */ veclen--; - vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask); + vfp_advance_dreg(vd, delta_d); } tcg_temp_free_i64(fd);