From patchwork Fri Oct 20 20:43:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736324 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp502741wrl; Fri, 20 Oct 2023 13:50:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFB5lB9IGFNbu6YabuyVeuRNb9unSoStx5M+p+ZL8ofPaLaXdG4iRDRXC376YBnPBXHlv6w X-Received: by 2002:a05:620a:2a16:b0:778:ab96:e75c with SMTP id o22-20020a05620a2a1600b00778ab96e75cmr3283359qkp.20.1697835055727; Fri, 20 Oct 2023 13:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697835055; cv=none; d=google.com; s=arc-20160816; b=zFCfVrthSRgD+oG7iLaGG1OH+KeenoNuIrxIZrTGnG+ICOqZc+aTmdr57DqD8D9wls Rs0sktn3XWsjkEh6VUITJfH3Ihcq8WugusPNwnDriNx6HSkI3c+zVOu8t6JXsoBriASh UI6LAdMRPxknunqdKOFyHCtca6mPJ6liJ34frjBuyQH4Y/oqSsCQ4fyItFxnYD6aZ3LM IZnJqp5tH+S6WJH5xvOI8PzgEUjVECim9+w52VE0YUS9YrLAt0UoJXl7ahTufXpuQmKt DU5ooY7Xk5kj0MjAJrWHK/lG5PECvSYCzAOV8Vbq5DyWTBLwddPigixR5u/eeM+jpOV4 KWhw== 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:cc:to :from:dkim-signature; bh=Sna123inmZqckkeeCG7fnD84UjYEicGgdYJ35WhU9q8=; fh=f2WZoDMBYjCKWIIOoPI+rQtxlv4fmOm4u+dLdQLqpOk=; b=hIhDpiMnCnshzC+FcuXqZmTzaLrnJgd0ELQXP93XeQuXHn4rx6qQbrB0Y8YTc9YrwL lO4Nwlhvgie5Xh1kfEiUAt9ubjgyhCtMAgjpRfwjzutK4EOVN/n7WUr9wnsSonybybwK x/MbVGAIlrV61/QlLDOmJ3H+JgnCP4sXnNSMp1Jan9fnBKNEmeJbJF3oCiG6T/dtfYTZ EI4R3epFdGTZUaYc8JSakEdNETW9N2KFHQ3uPWUcUkAS1TkB0Ta2QSwYnLi1lmFzCTT1 1fHEYQsYndvZOONRIp7R0Eoqey9XfcNnGBOqFdR3x9RLsaXJJwIBSLt7SuJ0p2DFRzF3 ciaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ENQOdX3H; 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 s19-20020a05620a16b300b007758f5499b0si1857894qkj.426.2023.10.20.13.50.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 13:50: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=pass header.i=@linaro.org header.s=google header.b=ENQOdX3H; 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 1qtwP1-00020N-CR; Fri, 20 Oct 2023 16:47:27 -0400 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 1qtwOy-0001v8-2S for qemu-devel@nongnu.org; Fri, 20 Oct 2023 16:47:24 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtwOw-0001CJ-CU for qemu-devel@nongnu.org; Fri, 20 Oct 2023 16:47:23 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-68fb85afef4so1246595b3a.1 for ; Fri, 20 Oct 2023 13:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697834841; x=1698439641; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Sna123inmZqckkeeCG7fnD84UjYEicGgdYJ35WhU9q8=; b=ENQOdX3HUt2FlYbRfe0OEx9SCkHd67r5OVAHCwF0Ze5aboGIdd4FZwwwZ2CsmM50U1 hOewFv32dAUEK9piyShD0puv8aSbE8NYTdWB/rKdsXzpctSwEMtW+GHbvIk2pU4nyJnp MVUszJbqHRKTd6OvvxLLGQdzfSZnvZFaaLBrqVx8JuNjfrE6cP97YQaOigd+2BVNo43u Zr7lNHJpBgE3R+grwlXYZB53qo2gX2Wq1qOLwFrpH+6L4aTe37LkjWGcgOrCWxUTEcfr dv0yOrkoq+KSlszqjOPfMQeo645tp4uKqZ4et2Ki53RmbasVHCfSpYd2Y8FHXtvdZ0nA Y0dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697834841; x=1698439641; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sna123inmZqckkeeCG7fnD84UjYEicGgdYJ35WhU9q8=; b=afV+sptHw20k4+515YuRBZRBTXreClZe9/SLgbuTLQzh8gUwxizTUNRbvJrrlILEI7 whTqAGE9oXw+SW+bKWao3oPdU2rHnLbrN8jSFnLmcIBK92gQAdG7+Ae+ahaKpO0Kmrdk EblNhQGgKmwp3p+lh2cdd+Hac11GWmUx0RIvhKyX0ILsQOplnWwilpyXr8KFOu1jnA+0 LJTf7CnsO6aZpkyYOsRAhPVBbwKQSdOirlilt8vlTZa0kPiNc5TsRd7F2Z+QXYe7NChm z6hGEBfoecRhiMVCCsZ+7HgidhlWR6efeaf4pyhopOku7u6RdnzZwGal9pYUBDk2YSiF zWrg== X-Gm-Message-State: AOJu0YykDnXGRGZgQSrhEPLzneGFOo7dGTSiR8y8LqX06m1KbEVGxDpw GuWRQoGKdcXKoWeroV184M6CHw1kVjSjAIINvBs= X-Received: by 2002:a05:6a00:15c2:b0:6bc:c242:7915 with SMTP id o2-20020a056a0015c200b006bcc2427915mr3003178pfu.28.1697834840881; Fri, 20 Oct 2023 13:47:20 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id u7-20020aa78487000000b00694fee1011asm1946775pfn.208.2023.10.20.13.47.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 13:47:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH v2 54/65] target/hppa: Implement HAVG Date: Fri, 20 Oct 2023 13:43:20 -0700 Message-Id: <20231020204331.139847-55-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020204331.139847-1-richard.henderson@linaro.org> References: <20231020204331.139847-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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 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 99486f4cf8..1feb2fdfc4 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, i64, i64, i64) DEF_HELPER_FLAGS_2(hadd_us, TCG_CALL_NO_RWG, i64, i64, i64) +DEF_HELPER_FLAGS_2(havg, TCG_CALL_NO_RWG, i64, i64, i64) DEF_HELPER_FLAGS_2(hsub_ss, TCG_CALL_NO_RWG, i64, i64, i64) DEF_HELPER_FLAGS_2(hsub_us, TCG_CALL_NO_RWG, i64, i64, i64) diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode index 1830b06c76..fb0f9d6dbd 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 ece523bea0..cba610ac75 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 63c6a28cef..c1ca4db099 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2776,6 +2776,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);