Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1288741ybp; Fri, 11 Oct 2019 11:51:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqx985VQkoNhK44bykWjZGwKxLB+IRP4PVnGkmt9xa2GekXdQxULbDV/4NqX9Bm3seN87ynv X-Received: by 2002:aa7:cd43:: with SMTP id v3mr14708816edw.235.1570819875172; Fri, 11 Oct 2019 11:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570819875; cv=none; d=google.com; s=arc-20160816; b=CKhRhSK6MUor17q1qE6tUdMZNCbBmugQgqFD+YZStUhmCfx717jHg003GKLcQ/F2Lr ztwMA62r9Y2ITTPoJJkr03PpOYm40NpmzBcATU/GCPntCGWSo2ISMK9pTCqN1uds2DI6 VNriIcZu8HemOwFyeq+iRCvG0Oxb9VguBm4+7SX7Sbr7DTW1J1OQrD0KtvIClMFuLh8Q REg6WSDv1IuoNeNfb1+GmLNjxLuJSMNiXxO4E8ft8xxYEkiGCPZD7DCKCIiy01yuQBnL LwAxuddFMevHbeir9g2LhErCK0Ru+2zR0vB2/mmT6dzsHJnMgpxwyFqT3kBR24YaBVfc n63w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dLREoD8VZsbLG4RNnQzVU+lz0coRJeXKm7I6cQzHWCM=; b=WYPOENTxINvK4eEZdE09PqhDHVIaZYFgB8Zqfqkaz/C7t/jcRtcUbY36j+0Oh5Y312 mH3noqPXZp4Q55Oeh65QtKAIJKqYcWRKdiwbIDJErWSSsTz8E9K15DYuP8PzEu7Xmp0U 23OmkbC0LwyXVHbBw4GFxqipXxmjnVUPCp2R/MKnQ3JN/HOkuLppDqjpHff1xkHMZ9xE xFL/7Sx/HvlCpHwunRTicuNYGXCV1fcisFx2/0h/KPD+BHzjIhmF9cUiElauyxK1o0c3 EXmYJjH1mwExMTvbvWBz41+9olEqapwRXUgxiNoCyACs1jAVsfsUJDraIa8r6Cc6VDEk 4evA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cryptogams.org header.s=gmail header.b=FBpxSDHS; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c52si6559170eda.132.2019.10.11.11.50.43; Fri, 11 Oct 2019 11:51:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cryptogams.org header.s=gmail header.b=FBpxSDHS; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728978AbfJKStW (ORCPT + 99 others); Fri, 11 Oct 2019 14:49:22 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:37196 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728966AbfJKStW (ORCPT ); Fri, 11 Oct 2019 14:49:22 -0400 Received: by mail-ed1-f68.google.com with SMTP id r4so9557591edy.4 for ; Fri, 11 Oct 2019 11:49:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cryptogams.org; s=gmail; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=dLREoD8VZsbLG4RNnQzVU+lz0coRJeXKm7I6cQzHWCM=; b=FBpxSDHSl5h0D0K0CUSQr+iDnLFNRCThN7zywYEYH0IR45Qbjk8tE6aAW3jKmkvILr 1ycQbgRiNyEej71ci6GO46wkxLg0Sqv0cJhgCRe8u8gho8NL9NXAqBVjYfEywpRYIeLE f7i6kwJbP2dB/6ME1h7Tq2g49XPVe//Bojng+ID7FaFWcXmdJPRjFDOhtPMn8AwJ6nDj EYLBOO6nFuMHlJPEgWkAwWp2pEgCEWlKeD80JSufywSeySKIuh+ni1AVHuIqUUnrcVwj 0N/F71gdmFtAmeiQmWig7qFsdwN00PJebdbbYb1u4GraTZ1vogWYBBpONd6eXZ9SZ4NI 6HmQ== 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:content-transfer-encoding; bh=dLREoD8VZsbLG4RNnQzVU+lz0coRJeXKm7I6cQzHWCM=; b=hgQ63wmwlBixpGA00D8MTc6umvgZEQQM0vwgBq7kPXByYx3qki6XtYh0cCbKOq6hrT D+m3iqgWHOQrVMdieIqumocGfHQgznoPIY4g8MU8IsW72JSoR28rTsa4zk2zuhl365es 6/a3pCfblferRIoUWdnCTBAaJhUpIiHitBhMqkit6Gt0LdjmoDR4/XDAj9kT2M3cNerM +p43u6VAlzDQJVMF2NUYx6T0tA66qTJpCHvYQRgAa5il/BMgqtUJ9+WzneC/YAKq4U3s /vVq1GOMxw3dv060veJxUfdYcbIsKl8+ee3W7m1ZMvvBXd/AIAacTHhTaQeJ3cyb21bW 3FGw== X-Gm-Message-State: APjAAAXegEtERkhJPn+1GsBDn6jaxmBR74PK9e1rTAHBK5RRLpfU8Jfi /OqSpMFlH8V+tVsZBi9ujHFFu17KZEimfTRSxjd2mQ== X-Received: by 2002:a05:6402:21d6:: with SMTP id bi22mr14876917edb.19.1570819760376; Fri, 11 Oct 2019 11:49:20 -0700 (PDT) MIME-Version: 1.0 References: <20191007164610.6881-1-ard.biesheuvel@linaro.org> <20191007164610.6881-20-ard.biesheuvel@linaro.org> <20191007210242.Horde.FiSEhRSAuhKHgFx9ROLFIco@www.vdorst.com> <20191011172133.Horde.sxiyClHzSJAUvHtYJdMQEbN@www.vdorst.com> In-Reply-To: <20191011172133.Horde.sxiyClHzSJAUvHtYJdMQEbN@www.vdorst.com> From: Andy Polyakov Date: Fri, 11 Oct 2019 20:49:08 +0200 Message-ID: Subject: Re: [PATCH v3 19/29] crypto: mips/poly1305 - incorporate OpenSSL/CRYPTOGAMS optimized implementation To: =?UTF-8?Q?Ren=C3=A9_van_Dorst?= Cc: Ard Biesheuvel , linux-crypto@vger.kernel.org, Herbert Xu , David Miller , "Jason A . Donenfeld" , Samuel Neves , Arnd Bergmann , Eric Biggers , Andy Lutomirski , Martin Willi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi, On 10/11/2019 7:21 PM, Ren=C3=A9 van Dorst wrote: > > ... > > I also wonder if we can also replace the "li $x, -4" and "and $x" with > "sll $x" > combination on other places like [0], also on line 1169? > > Replace this on line 1169, works on my device. > > - li $in0,-4 > srl $ctx,$tmp4,2 > - and $in0,$in0,$tmp4 > andi $tmp4,$tmp4,3 > + sll $in0, $ctx, 2 > addu $ctx,$ctx,$in0 The reason for why I chose to keep 'li $in0,-4' in poly1305_emit is because the original sequence has higher instruction-level parallelism. Yes, it's one extra instruction, but if all of them get paired, they will execute faster. Yes, it doesn't help single-issue processors such as yours, but thing is that next instruction depends on last, and then *formally* it's more appropriate to aim for higher ILP as general rule. Just in case, in poly1305_blocks is different, because dependent instruction does not immediately follow one that computes the residue. >> As for multiply-by-1-n-add. >> > > I wonder how many devices do exist with the "poor man" version. Well, it's not just how many devices, but more specifically how many of those will end up running the code in question. I would guess poor-man's unit would be found in ultra-low-power microcontroller, so... As implied, it's probably sufficient to keep this in mind just in case :-) Cheers.