From patchwork Thu Mar 26 23:08:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 184952 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp645482ilr; Thu, 26 Mar 2020 16:18:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv8HseQ1kLRotauV5TNHZgQ5BDeitnWeNaEGj/UU5pCFMh1IwWiozAA5srZ7gC302eJviL3 X-Received: by 2002:a0c:ba9d:: with SMTP id x29mr8866377qvf.207.1585264727264; Thu, 26 Mar 2020 16:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585264727; cv=none; d=google.com; s=arc-20160816; b=Rg91q95jX/I8hJzM9i2SgWUnyVouVJNR1At+Ipd+6SvkBnUcq+WcMX4/9UlUwLFB9B Ez29nPTrea2bx8T+8c+ASK4YNkbWUkTsafjGK4xs2IFX2wjm1F7rN5En2F8GhPjnr87w CoF/98Fag2NM099IBvVj33sXyc+TzLI25S8S7SNOwx6albpyOwxki6TuB3feeYxUIoz9 aKfCkSW+xJRGTFwt2/iUjQ3dSlWqqYJdTornevhK7A3Hk39rb9kuskRnJNyEd938gMay aylRiT0S0pJhqDKCN6ny99D9CZe1k/TRNPs8NbhPrTVmla6rKJhSsu7Zr1ZuIiTW1ExU JDbA== 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=shWQ4UzPuX9NwbrJUFloHvE+a/223KVCdbky39wDCzw=; b=0FdSRQAWCReOUdUIQROy+rWzwH4li090n600m8xRDjyAayoL4K+OUt3L9VTszGFPAS pJie2nwD0nvfVJH3XYf3eZvCeZTYrEbk6U1U3KGDxpgJ4osmgOQdUAlOJX/OSsxcT7uZ 2agor52aNhZlNbaKBmarqxJDLcJLDCBKUBviIO7JKm1+GqUPm5H9Vo5iZ/8BOs6b44Gj o9wh93Ai1SW9XVTn2YqXGxzJTwJboQFGbUGjQlrVY6aAEn27IjJsgPII6xmbmRQ5K0Da pavVUbd/+v0TCMW4LUMlrGqRpdKQTldr5oxEbK5iQ0bbvctkLVl7RcPbVXTk4svxyff0 VNng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="uZP/lhXQ"; 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 c58si2434099qtk.371.2020.03.26.16.18.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Mar 2020 16:18: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="uZP/lhXQ"; 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]:34752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHblu-0001LF-Kz for patch@linaro.org; Thu, 26 Mar 2020 19:18:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59043) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHbcc-0002p0-NG for qemu-devel@nongnu.org; Thu, 26 Mar 2020 19:09:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHbcb-0001o9-Ff for qemu-devel@nongnu.org; Thu, 26 Mar 2020 19:09:10 -0400 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:39645) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHbcb-0001nC-9n for qemu-devel@nongnu.org; Thu, 26 Mar 2020 19:09:09 -0400 Received: by mail-pj1-x1044.google.com with SMTP id z3so2516243pjr.4 for ; Thu, 26 Mar 2020 16:09: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=shWQ4UzPuX9NwbrJUFloHvE+a/223KVCdbky39wDCzw=; b=uZP/lhXQ9+6tllKEfEN0KkQUWibVsIqtbsoZx4jNPeMpoCPd23g11WKmPnIa24KHvk Z8auWRPUzDsWDFnhCnEDBhqnR4kbtFkKd9AHAO2D3CAjoPijiF54ECmCyfg1C9PfRIh8 upojrFhm9RyZD2WkX2yWbtqOBS2SDeOBjI9RxSd6zitwCvctGM4alAv4Cjf+6wZn5bnS 3r+cvru6wsrE8ht/2U/gR6IsiTRnmCRT7Oh0SyQG2tQaES7HFfV2fFkUmKK2ZOIu+O40 jwI0prwSLnx2LeKppVkYjRRWYj5B9mtLbdm6pBkOpr1fh+eyewl7MFbXpphdoKXBB+lU 7hOw== 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=shWQ4UzPuX9NwbrJUFloHvE+a/223KVCdbky39wDCzw=; b=XLXfp7MOZgIRLnTH45yw3lI5M1L/YUHL4Hnm1H7gXfQLZfrP5iwW+86wFr2XWeKKiO Rv9xlE/hv0dJ5oRFwgFhY5LVBVKsIYy5VXb+q/U+Sq3LXQZiJ2FQYmDrR7TXyOrQIo5g 5hm+D7hVlFfWv8KieKNLgt/lqZ+Np1Idhn7cq2ahqQ/E4FoQhf1Vu1PQZmLbQttOawZe 4ANdH6AFwMeTIVPP6BKEdpT64NvjdzG3/1ZYtsNSioOJId2AXHAlvuIMmbxFrxCYolpf Lv088/llDo//NOVERnUB39hULMeuMLPOJBQ+Ca4FMGvYgjAZq+XKjnGq5vu5POJugxD1 4d2A== X-Gm-Message-State: ANhLgQ3VTeK96CmeeTOC9l6kxVbNkIRuu11Q71uOA32uuEJMSVuGPq61 xepr2J9fGTLCLJu1qy/+Pv5qFzIu2Vs= X-Received: by 2002:a17:90a:9501:: with SMTP id t1mr2659209pjo.108.1585264147996; Thu, 26 Mar 2020 16:09:07 -0700 (PDT) Received: from localhost.localdomain (174-21-138-234.tukw.qwest.net. [174.21.138.234]) by smtp.gmail.com with ESMTPSA id i187sm2530037pfg.33.2020.03.26.16.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2020 16:09:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 22/31] target/arm: Implement SVE2 integer add/subtract long with carry Date: Thu, 26 Mar 2020 16:08:29 -0700 Message-Id: <20200326230838.31112-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326230838.31112-1-richard.henderson@linaro.org> References: <20200326230838.31112-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::1044 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: rajav@quicinc.com, qemu-arm@nongnu.org, apazos@quicinc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 3 +++ target/arm/sve.decode | 6 ++++++ target/arm/sve_helper.c | 33 +++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 23 +++++++++++++++++++++++ 4 files changed, 65 insertions(+) -- 2.20.1 diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index b48a88135f..cfc1357613 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -2424,3 +2424,6 @@ DEF_HELPER_FLAGS_5(sve2_uabal_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve2_uabal_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_5(sve2_adcl_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve2_adcl_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/sve.decode b/target/arm/sve.decode index f66a6c242f..5d46e3ab45 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -1247,3 +1247,9 @@ SABALB 01000101 .. 0 ..... 1100 00 ..... ..... @rda_rn_rm SABALT 01000101 .. 0 ..... 1100 01 ..... ..... @rda_rn_rm UABALB 01000101 .. 0 ..... 1100 10 ..... ..... @rda_rn_rm UABALT 01000101 .. 0 ..... 1100 11 ..... ..... @rda_rn_rm + +## SVE2 integer add/subtract long with carry + +# ADC and SBC decoded via size in helper dispatch. +ADCLB 01000101 .. 0 ..... 11010 0 ..... ..... @rda_rn_rm +ADCLT 01000101 .. 0 ..... 11010 1 ..... ..... @rda_rn_rm diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index a0995d95c7..aa330f75c3 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -1240,6 +1240,39 @@ DO_ABAL(sve2_uabal_d, uint64_t, uint32_t) #undef DO_ABAL +void HELPER(sve2_adcl_s)(void *vd, void *va, void *vn, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + int sel = extract32(desc, SIMD_DATA_SHIFT, 1) * 32; + uint32_t inv = -extract32(desc, SIMD_DATA_SHIFT + 1, 1); + uint64_t *d = vd, *a = va, *n = vn, *m = vm; + + for (i = 0; i < opr_sz / 8; ++i) { + uint32_t e1 = (uint32_t)a[i]; + uint32_t e2 = (uint32_t)(n[i] >> sel) ^ inv; + uint64_t c = extract64(m[i], 32, 1); + /* Compute and store the entire 33-bit result at once. */ + d[i] = c + e1 + e2; + } +} + +void HELPER(sve2_adcl_d)(void *vd, void *va, void *vn, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + int sel = extract32(desc, SIMD_DATA_SHIFT, 1) * 32; + uint64_t inv = -(uint64_t)extract32(desc, SIMD_DATA_SHIFT + 1, 1); + uint64_t *d = vd, *a = va, *n = vn, *m = vm; + + for (i = 0; i < opr_sz / 8; i += 2) { + Int128 e1 = int128_make64(a[i]); + Int128 e2 = int128_make64(n[i + sel] ^ inv); + Int128 c = int128_make64(m[i + 1] & 1); + Int128 r = int128_add(int128_add(e1, e2), c); + d[i + 0] = int128_getlo(r); + d[i + 1] = int128_gethi(r); + } +} + #define DO_BITPERM(NAME, TYPE, OP) \ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ { \ diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index c6161d2ce2..a80765a978 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -6294,3 +6294,26 @@ static bool trans_UABALT(DisasContext *s, arg_rrrr_esz *a) { return do_abal(s, a, true, true); } + +static bool do_adcl(DisasContext *s, arg_rrrr_esz *a, bool sel) +{ + static gen_helper_gvec_4 * const fns[2] = { + gen_helper_sve2_adcl_s, + gen_helper_sve2_adcl_d, + }; + /* + * Note that in this case the ESZ field encodes both size and sign. + * Split out 'subtract' into bit 1 of the data field for the helper. + */ + return do_sve2_zzzz_ool(s, a, fns[a->esz & 1], (a->esz & 2) | sel); +} + +static bool trans_ADCLB(DisasContext *s, arg_rrrr_esz *a) +{ + return do_adcl(s, a, false); +} + +static bool trans_ADCLT(DisasContext *s, arg_rrrr_esz *a) +{ + return do_adcl(s, a, true); +}