From patchwork Tue Jan 17 15:22:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 91677 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp543276qgi; Tue, 17 Jan 2017 07:24:02 -0800 (PST) X-Received: by 10.99.204.81 with SMTP id q17mr46847363pgi.168.1484666641979; Tue, 17 Jan 2017 07:24:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e13si25201758pgf.220.2017.01.17.07.24.01; Tue, 17 Jan 2017 07:24:01 -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 S1750947AbdAQPX7 (ORCPT + 1 other); Tue, 17 Jan 2017 10:23:59 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:35379 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750918AbdAQPX4 (ORCPT ); Tue, 17 Jan 2017 10:23:56 -0500 Received: by mail-wm0-f54.google.com with SMTP id r126so205373708wmr.0 for ; Tue, 17 Jan 2017 07:23:08 -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=f3o5yeDD2oOal5vVG+0NVGTJbOfmfe1kO3rbDt5ggkiXIzrQnYIXEakvkWxXiU54mi bwYKGSzfuVLggSKLWaFyuZcspQE575HkqrlGj+EyygChomctnAhzqvNkHyttaRwIIPCl qB/baS0nfKAccWRMV0802JcAVVkkuHoFj8imM= 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=i3/3iXMgtLsl4TCUaBAtdM4iThHyrtOzeG5zKX7JKqEB3qX6ik74h4dBfxPDP5c2NG IKiRlxGkVclGG34/LYtHLjPDbBYq3X8wP6foKVuKtARIGfpoke2QgReVYxhP9Z8HqdKU 6QPlwYZGrTABIUJPrCY+zefkpcJG3ZV8xuY97j/l88sznjOQFa0pw3ibfd312OHkPQ1m wnCmGqlyA7G1xglN9iC4kKnsWyKizYiYvZg4a34YfAAnVLVd+BGjLkcYON3P2SpA29Yc C8s1iLe/E3MsrCPq0r0YY4b+RkkbM7u911ckEEk29I8aiE7InO1Ez+g9vPm5QbY9T9OB 9FUw== X-Gm-Message-State: AIkVDXKmKGFc751/GBvIxjt3yh2l7kX4q9PWs5+gexk7+VMFRUE/MolW70MFrfxMvv3rdu0l X-Received: by 10.223.145.161 with SMTP id 30mr20215400wri.199.1484666588028; Tue, 17 Jan 2017 07:23:08 -0800 (PST) Received: from localhost.localdomain ([160.167.203.25]) by smtp.gmail.com with ESMTPSA id y127sm37590359wmg.12.2017.01.17.07.23.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 07:23:07 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH 08/10] crypto: arm64/aes - performance tweak Date: Tue, 17 Jan 2017 15:22:35 +0000 Message-Id: <1484666557-31458-9-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484666557-31458-1-git-send-email-ard.biesheuvel@linaro.org> References: <1484666557-31458-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