From patchwork Thu Nov 2 01:29:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 740393 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp596152wrv; Wed, 1 Nov 2023 18:41:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHymxniU6ceM3F0JDt+MjXxL4NCZuQUmUrueaY2YP2s9C8lHtDO1T6xfBXKpsFlPiVoUXFG X-Received: by 2002:a05:6214:1bc6:b0:671:1d67:cc1e with SMTP id m6-20020a0562141bc600b006711d67cc1emr15059236qvc.39.1698889309662; Wed, 01 Nov 2023 18:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698889309; cv=none; d=google.com; s=arc-20160816; b=P/a2k/Cmhzt23a9iLPcNZB0jkzG20HIGNAcz/5g3rdpBNS/cJiwcr6L3C1umb3HJLu QDrxcSImSfsZPNe1J9okmNSpZcn4SIlt3OKy/3aB4rQE0Hs4l4rno6S4LfV4ziN9hWNv onzMzaSDVicABI4pOa/VXMjZyLxIXgSNUqJIjhKh5s6RSgdARJVBbRu1vnOjREkToA0j 0HN38LsgxhC9P7P0QUOXMXSYc45wAzaaUqxd147rzvAj70iNz2QCZe0CJGE6e6WTCXKe UoGHObGD/0nyq8U+AO5+pn7C/CypqvIN5oifLebhF+/kcEyptMNLVcNbBE2/KWl7XV7b Pq+w== 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=eDzYxooTETsUZpkDPcJF0snGWWzzcelkJpEZxKcE6J8=; fh=f2WZoDMBYjCKWIIOoPI+rQtxlv4fmOm4u+dLdQLqpOk=; b=CjseSKfUbmJgzR38wLlTNiHW/mJfBNyUoeMsPP9iGjlcoRRPUBkU4QK9QP4yWmwHYt IWZWY2qQtAHySo0J3/jht6wP7KgmoU+EdXOqUE6p6xskkbFybpU8r+xdqkc3nSH1n1ck WfpAG4uJ3mJhx8y1Bm6B1IUNaWUuy/r6NZ5IIfVoRNnwdxXc49RhTJ8nfl+52PaVcyvF 8Wisyd5nhtblperL/FA1G3IYlwllc1q3RO+aHdDXr8V1ii6FNB+4TQc8iJbc0j/jNbUE sY4h+6TWXjRg22Py9byr6QRA8SuGQePMFKjWMT0O8nhCkOyIxctjwDIzkWB4NSh3Ccp8 P7NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AhlRKFdl; 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 y17-20020a0cec11000000b006707e236e9dsi3707889qvo.378.2023.11.01.18.41.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Nov 2023 18:41: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=pass header.i=@linaro.org header.s=google header.b=AhlRKFdl; 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 1qyMcX-0008C9-OV; Wed, 01 Nov 2023 21:35:42 -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 1qyMbB-0006Ze-Jp for qemu-devel@nongnu.org; Wed, 01 Nov 2023 21:34:18 -0400 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 1qyMb8-00022i-Pd for qemu-devel@nongnu.org; Wed, 01 Nov 2023 21:34:17 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-5aaebfac4b0so305506a12.2 for ; Wed, 01 Nov 2023 18:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698888853; x=1699493653; 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=eDzYxooTETsUZpkDPcJF0snGWWzzcelkJpEZxKcE6J8=; b=AhlRKFdl3Uy5YU6mTDgjI0/UkwijiUE+3yDdZBZaxThYQXPIQQ60Nn8qWIJEZDgBJ3 LRBNvmM8IiFHBlN6QcBGh4nITpyJzvkSZvSeiJRWG1/68AXaroUrpUEWX3P0sQX1mMmR sJC567chgQMve7PEZNOfhOgS8TIL8zW4z46Yhqm6CwCxsOVK46sq2peBOXsfmdsC7aOW coNTXhX+uwvhTsKcY9NdatjTWoBra+d1vy7lilhxrccBe6Rd5cPOzNVMO85MfvOFVyqH y1IXLPLeTLW21yOrJSm8qoG/Ty1xJdZxAYouD5c36J0DIPyq+CR/mWoUqi1l97ncwMBW SFGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698888853; x=1699493653; 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=eDzYxooTETsUZpkDPcJF0snGWWzzcelkJpEZxKcE6J8=; b=QiyDxxKki5923CBlP1Skt1hv+36x/XmheB3eikV9mZyDFuBZK6Ez2wA/T+Bzm6c+VI DJsCz4ZD6Xvh4HxDToTNglw6IRcawz7IuRNZ3eGyZ0qNzpRgm66+FTduR75SCsF4sRGP lxPiVyF9mfFmSzQE8Bm8jOeHGEEKrjhnS0qKMzJx8SkQXnm8c4hrRInvT9icmUt0NPgU OR8t+q/yScFMBvDn+LEBl05OxyJ3rkcMQeDQzmn+eC4pq2IiNQz41Clr+SInnWdDDppH +iJZjZeSFMH3WKmAO5Ke6+9YSBRL5841SDcsTteXRMu+E9+0WxZFxo2Cwlt+4B03YtJ5 N2jg== X-Gm-Message-State: AOJu0YyPGIs+H08xZGhBz8zMpErNRI7B6c4HZYNWr2jBKB4uSHGRhxyn YF5wDe5cC5oA4EtX+hZD8FkypozxOBNxgFEXOVU= X-Received: by 2002:a17:903:22c5:b0:1cc:4669:c0eb with SMTP id y5-20020a17090322c500b001cc4669c0ebmr9957733plg.21.1698888853487; Wed, 01 Nov 2023 18:34:13 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id t2-20020a1709027fc200b001a98f844e60sm1918125plb.263.2023.11.01.18.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 18:34:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH v3 65/88] target/hppa: Implement HAVG Date: Wed, 1 Nov 2023 18:29:53 -0700 Message-Id: <20231102013016.369010-66-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102013016.369010-1-richard.henderson@linaro.org> References: <20231102013016.369010-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 02798aa105..51c24b31b0 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 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 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 2f1333b91c..2fdd4448ae 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);