From patchwork Sat Jan 28 23:25:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 92773 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp847284qgi; Sat, 28 Jan 2017 15:26:31 -0800 (PST) X-Received: by 10.84.192.137 with SMTP id c9mr21705110pld.7.1485645991128; Sat, 28 Jan 2017 15:26:31 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d65si8383902pfl.73.2017.01.28.15.26.31; Sat, 28 Jan 2017 15:26:31 -0800 (PST) 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=neutral (body hash did not verify) header.i=@linaro.org; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752613AbdA1X0N (ORCPT + 1 other); Sat, 28 Jan 2017 18:26:13 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:38104 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752164AbdA1X0K (ORCPT ); Sat, 28 Jan 2017 18:26:10 -0500 Received: by mail-wm0-f45.google.com with SMTP id r126so35382017wmr.1 for ; Sat, 28 Jan 2017 15:26:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Cy9yiOmXCCJTU3CWvHqx5pREGmQmzaCRklJ9F/Bb1ZQ=; b=WAGFg0mcwChi41+74l8Iy5TaFAalfHJP7u89iP9SxQxjooOkkuRReUgSdRT74eYWgu B5arvHL2V7XCmT2h2AOQ+nzduoKDOHtJFj+mzOiamHMDraOoI6+oWa3KaL67YQ+Qeri+ +U2RkR7HDFa6OxdJ2GGhjghHPP6P6lxDFlvDw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Cy9yiOmXCCJTU3CWvHqx5pREGmQmzaCRklJ9F/Bb1ZQ=; b=EL7wh5yjv7YGsa6gI4t0HLRBwh8NwVEM/Y73qvwzFT0hT+4J8ubwafuTbQ+TNlZmq9 xq7an+nX1W4iIgeIKeSmdeDfp6PXd73PoMQTuGeMp1ZSfwVh0f7kEV6kxuea+ZiZm4IV 9zssXhvQqmndjr+dInlwXECSvPqmHFuS+Q/Bq714qDPnVRFLxpHkz4FbWOq6D0KOewvA qX/0QjPK1NQu341hYqCkZIyw+P+INQwt979y9oealVQiRcjuOK+I7J6Dvnh4lTSbpdSp UtMRouiqtK/vIalGubdR6oODUxV6S0ofREIszVE1aeUTwzeH5BSjXxWjHYWbpeGxC7E6 StUw== X-Gm-Message-State: AIkVDXIGTJNF24cdR9kg0xB8XdFBIHclQfmxMBYgHn3/h22Otj82rmmuDgkvaPFhKCQw9Ehs X-Received: by 10.28.23.70 with SMTP id 67mr7806623wmx.23.1485645968757; Sat, 28 Jan 2017 15:26:08 -0800 (PST) Received: from localhost.localdomain ([160.163.215.165]) by smtp.gmail.com with ESMTPSA id 33sm14992064wrd.34.2017.01.28.15.26.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 Jan 2017 15:26:07 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, herbert@gondor.apana.org.au, Ard Biesheuvel Subject: [PATCH v3 08/10] crypto: arm64/aes - performance tweak Date: Sat, 28 Jan 2017 23:25:37 +0000 Message-Id: <1485645939-17126-9-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485645939-17126-1-git-send-email-ard.biesheuvel@linaro.org> References: <1485645939-17126-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Shuffle some instructions around in the __hround macro to shave off 0.1 cycles per byte on Cortex-A57. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/aes-cipher-core.S | 52 +++++++------------- 1 file changed, 19 insertions(+), 33 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/crypto/aes-cipher-core.S b/arch/arm64/crypto/aes-cipher-core.S index cd58c61e6677..f2f9cc519309 100644 --- a/arch/arm64/crypto/aes-cipher-core.S +++ b/arch/arm64/crypto/aes-cipher-core.S @@ -20,46 +20,32 @@ tt .req x4 lt .req x2 - .macro __hround, out0, out1, in0, in1, in2, in3, t0, t1, enc - ldp \out0, \out1, [rk], #8 - - ubfx w13, \in0, #0, #8 - ubfx w14, \in1, #8, #8 - ldr w13, [tt, w13, uxtw #2] - ldr w14, [tt, w14, uxtw #2] - + .macro __pair, enc, reg0, reg1, in0, in1e, in1d, shift + ubfx \reg0, \in0, #\shift, #8 .if \enc - ubfx w17, \in1, #0, #8 - ubfx w18, \in2, #8, #8 + ubfx \reg1, \in1e, #\shift, #8 .else - ubfx w17, \in3, #0, #8 - ubfx w18, \in0, #8, #8 + ubfx \reg1, \in1d, #\shift, #8 .endif - ldr w17, [tt, w17, uxtw #2] - ldr w18, [tt, w18, uxtw #2] + ldr \reg0, [tt, \reg0, uxtw #2] + ldr \reg1, [tt, \reg1, uxtw #2] + .endm - ubfx w15, \in2, #16, #8 - ubfx w16, \in3, #24, #8 - ldr w15, [tt, w15, uxtw #2] - ldr w16, [tt, w16, uxtw #2] + .macro __hround, out0, out1, in0, in1, in2, in3, t0, t1, enc + ldp \out0, \out1, [rk], #8 - .if \enc - ubfx \t0, \in3, #16, #8 - ubfx \t1, \in0, #24, #8 - .else - ubfx \t0, \in1, #16, #8 - ubfx \t1, \in2, #24, #8 - .endif - ldr \t0, [tt, \t0, uxtw #2] - ldr \t1, [tt, \t1, uxtw #2] + __pair \enc, w13, w14, \in0, \in1, \in3, 0 + __pair \enc, w15, w16, \in1, \in2, \in0, 8 + __pair \enc, w17, w18, \in2, \in3, \in1, 16 + __pair \enc, \t0, \t1, \in3, \in0, \in2, 24 eor \out0, \out0, w13 - eor \out1, \out1, w17 - eor \out0, \out0, w14, ror #24 - eor \out1, \out1, w18, ror #24 - eor \out0, \out0, w15, ror #16 - eor \out1, \out1, \t0, ror #16 - eor \out0, \out0, w16, ror #8 + eor \out1, \out1, w14 + eor \out0, \out0, w15, ror #24 + eor \out1, \out1, w16, ror #24 + eor \out0, \out0, w17, ror #16 + eor \out1, \out1, w18, ror #16 + eor \out0, \out0, \t0, ror #8 eor \out1, \out1, \t1, ror #8 .endm