Received: from mail.onstor.com (66.201.51.107) by exch1.onstor.net
 (10.0.0.225) with Microsoft SMTP Server id 8.1.311.2; Tue, 18 Nov 2008
 15:36:08 -0800
Received: from ausesmta2-3.messageone.com ([64.20.241.45]) by mail.onstor.com
 with Microsoft SMTPSVC(6.0.3790.3959);	 Tue, 18 Nov 2008 15:36:08 -0800
Received: from ftp.linux-mips.org (ftp.linux-mips.org [213.58.128.207])	by
 ausesmta2-3.messageone.com (8.13.8/8.13.8) with ESMTP id mAINa7nt028095	for
 <andy.sharp@onstor.com>; Tue, 18 Nov 2008 17:36:07 -0600
Received: from localhost.localdomain ([127.0.0.1]:18666 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP	id S23755515AbYKRXdk
 (ORCPT <rfc822;andy.sharp@onstor.com>);	Tue, 18 Nov 2008 23:33:40 +0000
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 18 Nov 2008 23:33:23
 +0000 (GMT)
Received: from mail3.caviumnetworks.com ([12.108.191.235]:13498 "EHLO
	mail3.caviumnetworks.com") by ftp.linux-mips.org with ESMTP	id
 S23755514AbYKRXdP (ORCPT <rfc822;linux-mips@linux-mips.org>);	Tue, 18 Nov
 2008 23:33:15 +0000
Received: from exch4.caveonetworks.com (Not Verified[192.168.16.23]) by
 mail3.caviumnetworks.com with MailMarshal (v6,2,2,3503)	id <B492350a90001>;
 Tue, 18 Nov 2008 18:32:57 -0500
Received: from exch4.caveonetworks.com ([192.168.16.23]) by
 exch4.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959);	 Tue, 18 Nov
 2008 15:32:17 -0800
Received: from dd1.caveonetworks.com ([64.169.86.201]) by
 exch4.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959);	 Tue, 18 Nov
 2008 15:32:16 -0800
From: David Daney <ddaney@caviumnetworks.com>
To: linux-mips <linux-mips@linux-mips.org>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Tue, 18 Nov 2008 15:32:16 -0800
Subject: [PATCH] MIPS: Reorder operations in stackframe.h for better
 scheduling
Thread-Topic: [PATCH] MIPS: Reorder operations in stackframe.h for better
 scheduling
Thread-Index: AclJ1m8Z1l1I3HB2RkGdZQs9vSWh9Q==
Message-ID: <49235080.3070202@caviumnetworks.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 0b
X-MS-Exchange-Organization-AuthSource: exch1.onstor.net
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-originalarrivaltime: 18 Nov 2008 23:32:16.0949 (UTC)
 FILETIME=[E4A28E50:01C949D5]
user-agent: Thunderbird 2.0.0.16 (X11/20080723)
errors-to: linux-mips-bounce@linux-mips.org
x-ems-proccessed: 2K3Xl1OQTInXD6xxuA8z3Q==
x-ems-stamp: r6nFFTyJrwtm+luY9RHeKA==
x-messageone-virus-version: vendor=fsecure
 engine=4.65.7400:2.4.4,1.2.40,4.0.164
 definitions=2008-11-18_12:2008-11-10,2008-11-18,2008-11-18 signatures=0
x-messageone-virus-scanned: Clean
x-messageone-envelope-sender: linux-mips-bounce@linux-mips.org
x-messageone-spam-details: rule=m773emszm_notspam policy=m773emszm score=0
 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam
 adjust=0 reason=mlx engine=3.1.0-0810130000 definitions=main-0811180152
x-messageone-spam-score: 0
x-messageone-spam-bar:
x-list: linux-mips
x-archive-position: 21333
x-ecartis-version: Ecartis v1.0.0
x-original-sender: ddaney@caviumnetworks.com
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

Reorder PT ops to avoid pipeline stalls.

Signed-off-by: Tomaso Paoletti <tpaoletti@caviumnetworks.com>
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/include/asm/stackframe.h |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/sta=
ckframe.h
index db0fa7b..b858d52 100644
--- a/arch/mips/include/asm/stackframe.h
+++ b/arch/mips/include/asm/stackframe.h
@@ -51,9 +51,6 @@
 		LONG_S	v1, PT_ACX(sp)
 #else
 		mfhi	v1
-		LONG_S	v1, PT_HI(sp)
-		mflo	v1
-		LONG_S	v1, PT_LO(sp)
 #endif
 #ifdef CONFIG_32BIT
 		LONG_S	$8, PT_R8(sp)
@@ -62,10 +59,13 @@
 		LONG_S	$10, PT_R10(sp)
 		LONG_S	$11, PT_R11(sp)
 		LONG_S	$12, PT_R12(sp)
+		LONG_S	v1, PT_HI(sp)
+		mflo	v1
 		LONG_S	$13, PT_R13(sp)
 		LONG_S	$14, PT_R14(sp)
 		LONG_S	$15, PT_R15(sp)
 		LONG_S	$24, PT_R24(sp)
+		LONG_S	v1, PT_LO(sp)
 		.endm
=20
 		.macro	SAVE_STATIC
@@ -166,7 +166,6 @@
 		LONG_S	$0, PT_R0(sp)
 		mfc0	v1, CP0_STATUS
 		LONG_S	$2, PT_R2(sp)
-		LONG_S	v1, PT_STATUS(sp)
 #ifdef CONFIG_MIPS_MT_SMTC
 		/*
 		 * Ideally, these instructions would be shuffled in
@@ -178,19 +177,20 @@
 		LONG_S	v1, PT_TCSTATUS(sp)
 #endif /* CONFIG_MIPS_MT_SMTC */
 		LONG_S	$4, PT_R4(sp)
-		mfc0	v1, CP0_CAUSE
 		LONG_S	$5, PT_R5(sp)
-		LONG_S	v1, PT_CAUSE(sp)
+		LONG_S	v1, PT_STATUS(sp)
+		mfc0	v1, CP0_CAUSE
 		LONG_S	$6, PT_R6(sp)
-		MFC0	v1, CP0_EPC
 		LONG_S	$7, PT_R7(sp)
+		LONG_S	v1, PT_CAUSE(sp)
+		MFC0	v1, CP0_EPC
 #ifdef CONFIG_64BIT
 		LONG_S	$8, PT_R8(sp)
 		LONG_S	$9, PT_R9(sp)
 #endif
-		LONG_S	v1, PT_EPC(sp)
 		LONG_S	$25, PT_R25(sp)
 		LONG_S	$28, PT_R28(sp)
 		LONG_S	$31, PT_R31(sp)
+		LONG_S	v1, PT_EPC(sp)
 		ori	$28, sp, _THREAD_MASK
 		xori	$28, _THREAD_MASK


