From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1D26C636C8 for ; Tue, 20 Jul 2021 18:23:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41751610C7 for ; Tue, 20 Jul 2021 18:23:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41751610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5uOm-0000tE-Db for qemu-devel@archiver.kernel.org; Tue, 20 Jul 2021 14:23:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5uNl-0008RI-Iv for qemu-devel@nongnu.org; Tue, 20 Jul 2021 14:22:18 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:42786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5uNi-000492-Np for qemu-devel@nongnu.org; Tue, 20 Jul 2021 14:22:17 -0400 Received: by mail-ed1-x52e.google.com with SMTP id k27so29628591edk.9 for ; Tue, 20 Jul 2021 11:22:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+YfAD22Jw66ezaOC24V5pE3rC5yvIvB10KUaXT9/HQ0=; b=qNpK5rNnju2eEomZC8nan0xpOHcD4hSwKVvjrTX0oGhep+gC8BedgpOLchS3v4evkZ qnuvp6AA3zOb3VOUWeybnqHrmjgvrptvXeYb3OaxStAJl7rXWLS1WkaYD/tj5fTGfdQR rLZjrApurINZdvg5bFsB7tKLkl5kigdIZIHRT76ap/DdEs+ag34G3SdUGkW/jwJK9ZsF 9ZhPr8nSoIp95WHkzOwCUmFdjBDjK5DPJn61O+HDA1OS5duIkcFfSnYESldmQTii9aqF OprAppLpN1c+ZggtTq6IyFS3MjFrZT84TssOiPpD3KF6nLduimuZ+p7kkP2SikUlEU1E vI0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+YfAD22Jw66ezaOC24V5pE3rC5yvIvB10KUaXT9/HQ0=; b=NtVGfL73cElAY8OV9TdF4ScxdD8WkPwmfF+ondbW9Nuk0jFfggDFYbkiioGyl6f8zJ CeMJMvCviYG0JnrTFTnKUDWOIS1rey2KgjmE3g0fcreoZDZTgM4ZA4SK3uTPVC6TH5o8 IzRs7RYet15DNBLi3XXU61LEgotSs6tguvFMebTfQPFMteZ+N/S5CYhNsf36Ww5w5jSU zxpuYd7uCnXg/Ba/stfXjmCyhanDx52wnKsJV7dfE8wq9FC0Bl1tfdgc27vkAY/OcYHc ThSSNKDrtL8cWZ/Nm/T8ONA5yoCUaCp/mjgcJRmfD2P4EAL2VVClTojrxpsQGDfyq0CN CQvQ== X-Gm-Message-State: AOAM531xeVpJw7KJNR7mMZxMsyNG8c3XHg67AYtlcWPNZf7r8V9/o6gm BU+56QbiPgArFbZ++iHr2bu38gxKQjgFwzUWki2LLQ== X-Google-Smtp-Source: ABdhPJxlkBXq75KPSaSrGN12++TW/K5bvnQ3vB1D60Qi0dwCiTmGA+yP7l6LwSMZ13NgD7M0RgBBpdS2CtDJ5UV/LaQ= X-Received: by 2002:a05:6402:1ca4:: with SMTP id cz4mr42765840edb.52.1626805332299; Tue, 20 Jul 2021 11:22:12 -0700 (PDT) MIME-Version: 1.0 References: <20210713133726.26842-1-peter.maydell@linaro.org> <20210713133726.26842-21-peter.maydell@linaro.org> In-Reply-To: From: Peter Maydell Date: Tue, 20 Jul 2021 19:21:31 +0100 Message-ID: Subject: Re: [PATCH for-6.2 20/34] target/arm: Implement MVE integer min/max across vector To: Richard Henderson Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=peter.maydell@linaro.org; helo=mail-ed1-x52e.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=unavailable autolearn_force=no X-Spam_action: no action 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: qemu-arm , QEMU Developers Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Mon, 19 Jul 2021 at 16:28, Peter Maydell wrote: > > On Sat, 17 Jul 2021 at 21:46, Richard Henderson > wrote: > > > > On 7/13/21 6:37 AM, Peter Maydell wrote: > > > +/* Max and min of absolute values */ > > > +static int64_t do_maxa(int64_t n, int64_t m) > > > +{ > > > + if (n < 0) { > > > + n = -n; > > > + } > > > + if (m < 0) { > > > + m = -m; > > > + } > > > + return MAX(n, m); > > > +} > > > > This doesn't look quite right. The n operand is extracted unsigned, and only the m > > operand is subjected to ABS. > > Yes, you're right (this patch does always extract ra (here n) > unsigned, so the only case where it makes a difference is > VMINAV when the input ra is negative). I noticed this wrinkle > when implementing the FP variant of this insn, but missed it here. In fact it doesn't make a difference for this integer version: because we always extract n as an unsigned value, 'n' is always positive (either because it's the initial unsigned 'ra' or because it's the result of a previous do_maxa/do_mina, which must also always be positive) and so taking the absolute value of 'n' never affects it. But we might as well delete the unused code. (For float it *does* make a difference, because there's no "extract as unsigned" for floats, and so the input 'ra' and thus the first 'n' can be negative there.) -- PMM