From patchwork Thu Jun 26 17:34:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 32587 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B88C4201EF for ; Thu, 26 Jun 2014 17:36:52 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id uy5sf21037748obc.1 for ; Thu, 26 Jun 2014 10:36:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=C3thtGDgD8QcUrvl9lC4n/Di5JXFEOq3WOoynAQV8QY=; b=kiB0ENHHh+E7+CekaiSjnomnqfkcie4S9+EORbvhqbCAF/a8k890Q+zOHimu3zeMbJ 440IGKrPqWtM8V0q1ZnEa9UiRxFKZz5rU6Em5D1mDd7GoN77vaMAuCHO66lMDkiYnCJu +lGHHjSwOIhqtCUe8Ff9iN7WdCadV6mjrqYga7r7lHoSJjQVpxm4DFdZlWZXgbQrVEcw GqJ5Tf4AAZOmfn5PAUCTgA0isQW4ICqdRrkmfJP5YNYVI7oi4P6sE4odjeUgEATkjX7y LRoYnLRcKsS0fRRxejBxctDXrSP4r27Vl4gqxw6/PTUErAQAoOnFzuyMlzh15YylKFLR LeaQ== X-Gm-Message-State: ALoCoQn4nWGjGj0Kcc69IMQmsor7sAvenYkQwvldC3LuNffgs4LGM7YU/cuyd5BVQFwkH5cNo3Th X-Received: by 10.182.120.129 with SMTP id lc1mr8490699obb.21.1403804212210; Thu, 26 Jun 2014 10:36:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.117 with SMTP id c108ls315804qge.67.gmail; Thu, 26 Jun 2014 10:36:52 -0700 (PDT) X-Received: by 10.58.229.162 with SMTP id sr2mr14759601vec.15.1403804212082; Thu, 26 Jun 2014 10:36:52 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id p7si5007430vda.40.2014.06.26.10.36.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 10:36:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id ij19so3818193vcb.8 for ; Thu, 26 Jun 2014 10:36:52 -0700 (PDT) X-Received: by 10.52.88.44 with SMTP id bd12mr1873651vdb.86.1403804211978; Thu, 26 Jun 2014 10:36:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp47061vcb; Thu, 26 Jun 2014 10:36:51 -0700 (PDT) X-Received: by 10.66.232.166 with SMTP id tp6mr23238425pac.127.1403804211255; Thu, 26 Jun 2014 10:36:51 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ic8si10852166pad.95.2014.06.26.10.36.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jun 2014 10:36:51 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0DZR-0004zx-9F; Thu, 26 Jun 2014 17:34:49 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0DZO-0004u9-6Y for linux-arm-kernel@lists.infradead.org; Thu, 26 Jun 2014 17:34:46 +0000 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.161]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s5QHYIwo003002; Thu, 26 Jun 2014 18:34:18 +0100 (BST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 37E691AE332C; Thu, 26 Jun 2014 18:34:23 +0100 (BST) From: Will Deacon To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: fpsimd: avoid restoring fpcr if the contents haven't changed Date: Thu, 26 Jun 2014 18:34:22 +0100 Message-Id: <1403804062-22239-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.0.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140626_103446_593635_C7283501 X-CRM114-Status: UNSURE ( 8.46 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: catalin.marinas@arm.com, Will Deacon X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: will.deacon@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Writing to the FPCR is commonly implemented as a self-synchronising operation in the CPU, so avoid writing to the register when the saved value matches that in the hardware already. Reviewed-by: Lorenzo Pieralisi Signed-off-by: Will Deacon --- arch/arm64/include/asm/fpsimdmacros.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/include/asm/fpsimdmacros.h b/arch/arm64/include/asm/fpsimdmacros.h index 768414d55e64..137c0f45b0a8 100644 --- a/arch/arm64/include/asm/fpsimdmacros.h +++ b/arch/arm64/include/asm/fpsimdmacros.h @@ -40,6 +40,7 @@ str w\tmpnr, [\state, #16 * 2 + 4] .endm +/* Clobbers \state */ .macro fpsimd_restore state, tmpnr ldp q0, q1, [\state, #16 * 0] ldp q2, q3, [\state, #16 * 2] @@ -60,7 +61,15 @@ ldr w\tmpnr, [\state, #16 * 2] msr fpsr, x\tmpnr ldr w\tmpnr, [\state, #16 * 2 + 4] + /* + * Writes to fpcr may be self-synchronising, so avoid restoring + * the register if it hasn't changed. + */ + mrs \state, fpcr + cmp x\tmpnr, \state + b.eq 9999f msr fpcr, x\tmpnr +9999: .endm .altmacro