From patchwork Thu Mar 12 19:41:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 184515 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp957798ile; Thu, 12 Mar 2020 12:50:04 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsjSYzOZgmZHxIt7j7q7r1Nzw7GippTpV75DEGpCBZuPsGCoNqIP/k3WnfvLigfK4QQ91Mg X-Received: by 2002:a37:888:: with SMTP id 130mr8915059qki.261.1584042604431; Thu, 12 Mar 2020 12:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584042604; cv=none; d=google.com; s=arc-20160816; b=mufRZtOQFeDVCsSpE8kEzO5hchAqbUqdV+ChSp8prr+v5y1lhdkrEubprapTl+2CNO PDfcmCo5EufxQBwk/BaXqyHP/rPSgrD4jTvRdJhFreSqA236eVL3WCVBR/EAePh0r3P0 piHGmfEkIgM088vqXXRLXX0wHDleLpyOdC6CLkEuhQFFJFvX0/eFwsYESxxTDSuWegGq 3aU6bTjyqJhZEVu1Zl/cBlb3XJ1J/u7DS+7VUN30Xsm2G76+bTZ/c8Lw6oOuGorG68c3 o10X1SQzmoojXzRRMRpAd7k3Z2AY/zKn6W1u0xgm60PZ3zo0MHUaEnE5mMypIXvZZVga zG+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+pq9oFT7R9IJPpeslQpwFqiLS0a1utLd0OoEdcej/ZM=; b=nR99i5FAZ8NjP/Xrxgoyoo87NOdrkWqvRvgaTITztRZIDWVpUf1FV7qh+SxNFnNkMM dJy1Vc0jDNanmU7q3w37IhlJDoogfhoFOkTcEn8xW2fEWLT1bxDTHUUuFGrYSITxehag u2UItqWoB5gOW2KZYfeQQ1qDemmNQE45LJhL/Ro0RL+v0iIQ01T0a7aQmneKdjEk7HpK kOgKBnoeCm3HRXMPiQwyKN3HnPRKet/jfdF1gRqpkHDJ7FySGQ9IA9QYzedrHXQopvmt iOVgX5ehgNdY8nBHAAb5c8zxUCeXyF2JoTmp6vF0cNefF+atg4PamMuHIcx7QSdFStGF uGNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z0f6CdgR; 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=pass (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 s33si3514390qth.112.2020.03.12.12.50.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Mar 2020 12:50: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=pass header.i=@linaro.org header.s=google header.b=Z0f6CdgR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCTqF-0000v5-RU for patch@linaro.org; Thu, 12 Mar 2020 15:50:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45307) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCTj5-0005D9-Ml for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCTj4-0001uc-L2 for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:39 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:43121) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCTj4-0001te-Eu for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:38 -0400 Received: by mail-pf1-x444.google.com with SMTP id c144so3759906pfb.10 for ; Thu, 12 Mar 2020 12:42: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=+pq9oFT7R9IJPpeslQpwFqiLS0a1utLd0OoEdcej/ZM=; b=Z0f6CdgRbrkF9SqFjCgN7a+fM09hvkMXdpxNmFJzThEMQUaDC7XLqeqIg6BDO31+lx ZoFgzfgx0CJT35KjBo7Yfl2io/0+gcoIZ+wkC+SlhmBLYUelCLumX7MOX8n7j/YGFwbp E+K0KP6NXUaOIPP7d/zsKPlnbEuCm14x19KWM4l5SuIlfvbhJiylZMxuE4Hk/OBOlt69 McDJlI4Y5i5BIOUPhhKShACXfzYaZCVjQdda28G+b6+hzhq60IlD5Ur2We12nNIk511j iVFDNX2hBuU0g6dOEXNczsPjIdGRpJmzcuoi3Zox6lbb6GEFdADZhAvi6XPkZEwZA4Rq BhBg== 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=+pq9oFT7R9IJPpeslQpwFqiLS0a1utLd0OoEdcej/ZM=; b=BNh2a0c3o89Kabt3Oq+GxrpICR5RADnu1kUzH+4K/awUHz5eX7qcj/Y+PeOGpG3IFH vXWgW1XdYQ6AwIMFKMj/VxudVDFXu96zP8rSma+BuwH7tRjs9EPX9TibFKpx9VTWI4OM 7fF9cgcnamM05P4w/NnwkBrTadNm2sOLslH1PeebXek9Sc6SYA76noH4Wuy4iKraAgmR A7wR1cEricgHeKfi1kZGj5HFQqgFNepZTNhr3hPZrQz3YoWClRYJWK7n5P3v0vSccVTm Vi/a1eh9kXpiN31+kAyHOZBRhEVpyQPiN29B1Elb+5VEGQJyJEAxELuvsDPGWPkl7l2T MgkA== X-Gm-Message-State: ANhLgQ0SRSDmrk1vh6fOd+pLBEH+f6/699FawRXkeCX3HK2mSSxcSsPo ayESrbeF2afo55/a5oWQyCtNMX5wpUY= X-Received: by 2002:a62:ed19:: with SMTP id u25mr9482465pfh.173.1584042157146; Thu, 12 Mar 2020 12:42:37 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id g69sm6824842pje.34.2020.03.12.12.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 12:42:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 12/42] target/arm: Implement the SUBP instruction Date: Thu, 12 Mar 2020 12:41:49 -0700 Message-Id: <20200312194219.24406-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312194219.24406-1-richard.henderson@linaro.org> References: <20200312194219.24406-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 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: peter.maydell@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v2: Fix extraction length. --- target/arm/translate-a64.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 9adc259186..49c94bc565 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -5348,19 +5348,39 @@ static void handle_crc32(DisasContext *s, */ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) { - unsigned int sf, rm, opcode, rn, rd; + unsigned int sf, rm, opcode, rn, rd, setflag; sf = extract32(insn, 31, 1); + setflag = extract32(insn, 29, 1); rm = extract32(insn, 16, 5); opcode = extract32(insn, 10, 6); rn = extract32(insn, 5, 5); rd = extract32(insn, 0, 5); - if (extract32(insn, 29, 1)) { + if (setflag && opcode != 0) { unallocated_encoding(s); return; } switch (opcode) { + case 0: /* SUBP(S) */ + if (sf == 0 || !dc_isar_feature(aa64_mte_insn_reg, s)) { + goto do_unallocated; + } else { + TCGv_i64 tcg_n, tcg_m, tcg_d; + + tcg_n = read_cpu_reg_sp(s, rn, true); + tcg_m = read_cpu_reg_sp(s, rm, true); + tcg_gen_sextract_i64(tcg_n, tcg_n, 0, 56); + tcg_gen_sextract_i64(tcg_m, tcg_m, 0, 56); + tcg_d = cpu_reg(s, rd); + + if (setflag) { + gen_sub_CC(true, tcg_d, tcg_n, tcg_m); + } else { + tcg_gen_sub_i64(tcg_d, tcg_n, tcg_m); + } + } + break; case 2: /* UDIV */ handle_div(s, false, sf, rm, rn, rd); break;