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=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 0909CC48BCF for ; Wed, 9 Jun 2021 18:47:13 +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 73897613E1 for ; Wed, 9 Jun 2021 18:47:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73897613E1 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]:35604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lr3EN-0005Ib-Hq for qemu-devel@archiver.kernel.org; Wed, 09 Jun 2021 14:47:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lr3Dl-0004Qb-Tx for qemu-devel@nongnu.org; Wed, 09 Jun 2021 14:46:34 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:50727) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lr3Dk-0001wB-7K for qemu-devel@nongnu.org; Wed, 09 Jun 2021 14:46:33 -0400 Received: by mail-pj1-x1032.google.com with SMTP id g4so1993135pjk.0 for ; Wed, 09 Jun 2021 11:46:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=/Uin4XqPrAz2/vNBHfGwPiaqhkIxO96IYuRI8mGtWpk=; b=aFNsQAuwEFATaKo/VXuzkt5Hh/xB/VN2PvT8+ov1M/tMdg7QKsGhaRBZNLilnCbust AIkHmV8tZvRJuBbfRvzp39emgepR31JymMMAa1Vcz9pQww+s6gCHRdZYFtLTMLDf/cKQ 3qIMGcKyyLuYAZKKgAbh7hyZm8YRxJQo/ktd7J48ZwiQi9ApbME2GHejXMiTcz1XECum E3ay96OLP6xtwwcC/1ywPSGPlvavpw2LQKYdgfEhtULJMJuydvnwD34DJRffCU0EryDn H0MjHQsItPSxgbFTwrBZM8BJwGDP5DKvrRIjI/EoPxJKtlgGJdVW9zGjPERjKPj9siE+ zbzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/Uin4XqPrAz2/vNBHfGwPiaqhkIxO96IYuRI8mGtWpk=; b=giEpoYRgbiNcpG4zOLiLt15I+ve5THzdV56qZJ4Lmx7IRINpfgS+yRikAy9Ul0JTOK tTT7BMI5FdDlWFkhDd5IkQZxawNIuNF2yySp5vOSVV+G2vS/oGH34F8sXaaiVboeFG9y KjWzpQrfJ7+HWiBqF6tq/NoZ5PtM+cExLS7RCpHWISNCzzs7/oMZD5OZC08/5o0aUE6s FXe2ggi/npq47yxYHnmld5I0LfxKyJ9CHFdWh4rf1XrTcJARizjhTYEtKL9Edl5Uuzz6 Fu9knQK5IfNsIP+PSrWxyoJZzJibx84ZBpU9NXrbmQrzbJUntFY8DPKesK8NtL+uWR6o a9IQ== X-Gm-Message-State: AOAM531ovDq048zn3Otbx6AckcE4A4F3j6HkSj1f/Xyd1xVq0eR2Th9O +1qyssgyofrSqMB2iZHbbg1ErH9DT9PEew== X-Google-Smtp-Source: ABdhPJxi56YmmpJMRBPqusZbBLAAcmDjYBnDRxaC+MF98izNpTU4Nfcej50LQ4+3cYzNtsIz3DWU0Q== X-Received: by 2002:a17:90a:f193:: with SMTP id bv19mr12262310pjb.86.1623264390683; Wed, 09 Jun 2021 11:46:30 -0700 (PDT) Received: from [192.168.1.11] (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id e2sm463954pgh.5.2021.06.09.11.46.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Jun 2021 11:46:30 -0700 (PDT) Subject: Re: [PATCH 38/55] target/arm: Implement MVE VQADD and VQSUB To: Peter Maydell , qemu-arm@nongnu.org, qemu-devel@nongnu.org References: <20210607165821.9892-1-peter.maydell@linaro.org> <20210607165821.9892-39-peter.maydell@linaro.org> From: Richard Henderson Message-ID: <78b08f04-6d1c-4cd8-df76-436b9a2380d8@linaro.org> Date: Wed, 9 Jun 2021 11:46:28 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210607165821.9892-39-peter.maydell@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, NICE_REPLY_A=-0.001, 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 6/7/21 9:58 AM, Peter Maydell wrote: > +#define DO_2OP_SAT_SCALAR(OP, ESIZE, TYPE, H, FN) \ > + void HELPER(glue(mve_, OP))(CPUARMState *env, void *vd, void *vn, \ > + uint32_t rm) \ > + { \ > + TYPE *d = vd, *n = vn; \ > + TYPE m = rm; \ > + uint16_t mask = mve_element_mask(env); \ > + unsigned e; \ > + for (e = 0; e < 16 / ESIZE; e++, mask >>= ESIZE) { \ > + bool sat = false; \ > + TYPE r = FN(n[H(e)], m, &sat); \ > + uint64_t bytemask = mask_to_bytemask##ESIZE(mask); \ > + d[H(e)] &= ~bytemask; \ > + d[H(e)] |= (r & bytemask); \ > + if (sat && (mask & 1)) { \ > + env->vfp.qc[0] = 1; \ > + } \ > + } \ > + mve_advance_vpt(env); \ > + } Perhaps slightly better as bool qc = false; qc |= sat & mask & 1; if (qc) { env->vfp.qc[0] = qc; } Maybe reverse the store into &sat (set false if no saturation), and init as bool sat = mask & 1; Though if you choose not to exploit this kind of conditional store, perhaps it would be better to fully set *s within do_sat_bhw. That is, do not rely on initialization to false outside the subroutine. Which you choose, Reviewed-by: Richard Henderson r~