From patchwork Tue Nov 7 03:03:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741858 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1422585wrr; Mon, 6 Nov 2023 19:17:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOKosCoYSpZ0AsCJxNF2t9sOEXucjwrBfPHyT5fLNu/ivmH6Nj8sNd4FcALfXCVcHm+J5e X-Received: by 2002:a05:620a:400a:b0:774:9dc7:ce3d with SMTP id h10-20020a05620a400a00b007749dc7ce3dmr33572906qko.12.1699327051541; Mon, 06 Nov 2023 19:17:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699327051; cv=none; d=google.com; s=arc-20160816; b=d/v0SvlNr4qSPmqXUMG7TtC3VHnMfWDwy5I/NVsKOKM1vAqfi/T1CVPzEqgxpr9enX BGcOj7HCmvPoEB6d8MwGF1iUo97pOqVpKipqxfNSHl0XD/YO12Lqkzfg7DwJrVa3cSzY GdJPw8y2yUGt9FfOF9Vd4/kIxF7+FC3jQWysmUwGX0dweBZJGW4BOj2TYjwjyH6QwnE8 JCVd9zpwzedn6JuJjPo+2imt70GSlrNK/+gSfPlgPIbxxQoX/jQusKXzuE46QfQ0NiGQ 6F7MLFG9z7sjOtgUUaTnejcoOf53qOOd8AA4pWACeZTzVJTNh8v/1SGHZ3ztli8LPvBj bwPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=eZfz6CwDToub3uloE73o6N9zkTY/K6RLHbmy8kpVa68=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=VevLFnFVCag/yS1/rWhR37d8ltYCRitrRjRRuV0Qdb2a73a/Td5bboFhOgl6oK5HUK AoSmnoFHr5ADT5MaC1JZ3TiICC1QCeUuiuH+YIEsb+Jha011ttJjHYpsvd8eG4Na49de 48TWf0dymUQjbqC/7pA5tqsfJHYe/mZI1ZL2INjUqjGnMB4mO/k5Pgx/DzXz0Rrr5zj+ 4dukJHxpDv9LORh1xpnuyOHNsvT8Oe0vRxJiSbnFLc76MDCz5+GwLPQHKJ4T8X4Dl4hB lAhuYNeiarXh0UBM/dWMGeBQH99pMWbwgFRgD1PKtVMSwis4jfS29QB2A8dQ3x8+fMX2 LlZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iaAeyV8U; 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 o6-20020a05620a22c600b007757f6e5c87si6234231qki.185.2023.11.06.19.17.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 19:17:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iaAeyV8U; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0CRr-0005gk-Ur; Mon, 06 Nov 2023 22:08:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0CRe-0004s1-00 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 22:08:02 -0500 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0CRZ-0001Pj-Er for qemu-devel@nongnu.org; Mon, 06 Nov 2023 22:08:01 -0500 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-5b980391d70so3939836a12.0 for ; Mon, 06 Nov 2023 19:07:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699326476; x=1699931276; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=eZfz6CwDToub3uloE73o6N9zkTY/K6RLHbmy8kpVa68=; b=iaAeyV8UslAlA+V5u9nFHn0XQ2lbMxwBChKtlZ8/NVlO4yr7A35liNbJ3CvXa7dzgb 1LA+Kxd2uf1WAmZKNnz8xMLXeIkld7I3FVaqJfX9nJEAa9mHvNzzs+RgmmfzxgxZ2GSw wGUVyXg0N7n32N9ftsio4o/JVMvT0VvAi7eUJRrmwJ9aJ2b0ELTXS+rrOtlmeQ47msko rX1+1Dbay0GG6GVG71MP2f5yfe9ePRp4MDhdZAA3EoLSx5c2bg/OSbwBSa1VO+qJJUSn ls/aq6n8SMrQiEdG1oTiSCkgQXLMi3W3tI36xIp9Y4O+pOqBI5By7GilwHnVpt1rrAzM i23g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699326476; x=1699931276; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eZfz6CwDToub3uloE73o6N9zkTY/K6RLHbmy8kpVa68=; b=SwfcBv2NgBoJcI2jODT6P4ZbwmnvHJZhFirNfUc5pSMM3ihWhzUWdwgwBVmLm3HjD9 pgdcfMFvBYiPN4+C77wm8QER9FYFMh1Rnfa2Czw6F4vxEmXPymO+fS0eykB1/UyAVtp8 kD014Fo6VEezgHjSm9Heuf9IvR3gBNMjntDGw3eHbMdYUE4B4yylOefq22Fov2thkMnU 1raqs0lcdQ+BA8IvSiOsJ+hI0DcLzmQe5ipSqplqlyPo4eVnL1uH62rCxaGpJI11iy6y jqeDUKusXMQNW2dVvh1RJgFyKE14Ov/7kSn51QgdPmqPyG9B9rBsC/+9pKQFGVj2G5Zl tzyg== X-Gm-Message-State: AOJu0YwW90nyw3pJZK/7/+u5VofQDPpMe1fcdLVFvNtCdKCUPFzXZfj7 V/8A/U8ODhybKyVvmnw7avklM5g8s1xy4Ygv/1E= X-Received: by 2002:a05:6a21:3d84:b0:184:1c37:c3d2 with SMTP id bj4-20020a056a213d8400b001841c37c3d2mr6151608pzc.21.1699326475886; Mon, 06 Nov 2023 19:07:55 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 13-20020a17090a004d00b0027782f611d1sm6744883pjb.36.2023.11.06.19.07.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 19:07:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 63/85] target/hppa: Implement HAVG Date: Mon, 6 Nov 2023 19:03:45 -0800 Message-Id: <20231107030407.8979-64-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107030407.8979-1-richard.henderson@linaro.org> References: <20231107030407.8979-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- target/hppa/helper.h | 1 + target/hppa/insns.decode | 2 ++ target/hppa/op_helper.c | 14 ++++++++++++++ target/hppa/translate.c | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/target/hppa/helper.h b/target/hppa/helper.h index 64fd1ef1ef..3b3a543216 100644 --- a/target/hppa/helper.h +++ b/target/hppa/helper.h @@ -16,6 +16,7 @@ DEF_HELPER_FLAGS_1(ldc_check, TCG_CALL_NO_RWG, void, tl) DEF_HELPER_FLAGS_2(hadd_ss, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(hadd_us, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_2(havg, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(hsub_ss, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(hsub_us, TCG_CALL_NO_RWG_SE, i64, i64, i64) diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode index 29b49c6cf4..6959555bf3 100644 --- a/target/hppa/insns.decode +++ b/target/hppa/insns.decode @@ -214,6 +214,8 @@ hadd 000010 ..... ..... 00000011 11 0 ..... @rrr hadd_ss 000010 ..... ..... 00000011 01 0 ..... @rrr hadd_us 000010 ..... ..... 00000011 00 0 ..... @rrr +havg 000010 ..... ..... 00000010 11 0 ..... @rrr + hsub 000010 ..... ..... 00000001 11 0 ..... @rrr hsub_ss 000010 ..... ..... 00000001 01 0 ..... @rrr hsub_us 000010 ..... ..... 00000001 00 0 ..... @rrr diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index de51905428..e76f201472 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -410,6 +410,20 @@ uint64_t HELPER(hadd_us)(uint64_t r1, uint64_t r2) return ret; } +uint64_t HELPER(havg)(uint64_t r1, uint64_t r2) +{ + uint64_t ret = 0; + + for (int i = 0; i < 64; i += 16) { + int f1 = extract64(r1, i, 16); + int f2 = extract64(r2, i, 16); + int fr = f1 + f2; + + ret = deposit64(ret, i, 16, (fr >> 1) | (fr & 1)); + } + return ret; +} + uint64_t HELPER(hsub_ss)(uint64_t r1, uint64_t r2) { uint64_t ret = 0; diff --git a/target/hppa/translate.c b/target/hppa/translate.c index e5a3873d25..e20ce40fe3 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2804,6 +2804,11 @@ static bool trans_hadd_us(DisasContext *ctx, arg_rrr *a) return do_multimedia(ctx, a, gen_helper_hadd_us); } +static bool trans_havg(DisasContext *ctx, arg_rrr *a) +{ + return do_multimedia(ctx, a, gen_helper_havg); +} + static bool trans_hsub(DisasContext *ctx, arg_rrr *a) { return do_multimedia(ctx, a, tcg_gen_vec_sub16_i64);