Port-mips archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

COP0_SYNC definition



Hi,

We define in sys/arch/mips/include/cpuregs.h:157
#  define JR_HB_RA              .set push; .set mips32r2; jr.hb ra; nop;

for case of MIPSnnR2 only.

I think that either this nop is superfluous, or it should be ehb/ssnop.
I can't imagine a new implementation will ever require just a simple nop
as padding, aren't they all likely superscalar?

secondary (and possible replacement question),
I think this entire conditional can be simplified to two cases:

MIPS1-2:
# define COP0_SYNC              sll $0,$0,3
# define JR_HB_RA               jr ra; sll $0,$0,3

Any other cases:
#  define COP0_SYNC             sll $0,$0,1; sll $0,$0,1; sll $0,$0,3
#  define JR_HB_RA              sll $0,$0,1; sll $0,$0,1; jr ra; sll $0,$0,3

Not sure if MIPS1-2 is ever superscalar, but in case anyone accidentially made one,
we'll handle this case too with minimal negative effect.

I'm not sure there is no performance penalty for >=MIPSnnR6.

Diff will look like this (OK?):

Index: include/cpuregs.h
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/include/cpuregs.h,v
retrieving revision 1.94
diff -u -p -r1.94 cpuregs.h
--- include/cpuregs.h	11 Jun 2015 05:15:49 -0000	1.94
+++ include/cpuregs.h	18 Jun 2016 13:31:50 -0000
@@ -151,23 +151,12 @@
 #define	CCA_ACCEL		7	/* non-cached, write combining */
 
 /* CPU dependent mtc0 hazard hook */
-#if (MIPS32R2 + MIPS64R2) > 0
-# if (MIPS1 + MIPS3 + MIPS32 + MIPS64) == 0
-#  define COP0_SYNC		sll $0,$0,3	/* EHB */
-#  define JR_HB_RA		.set push; .set mips32r2; jr.hb ra; nop; .set pop
-# else
-#  define COP0_SYNC		sll $0,$0,1; sll $0,$0,1; sll $0,$0,3
-#  define JR_HB_RA		sll $0,$0,1; sll $0,$0,1; jr ra; sll $0,$0,3
-# endif
-#elif (MIPS32 + MIPS64) > 0
-# define COP0_SYNC		sll $0,$0,1; sll $0,$0,1; sll $0,$0,1
-# define JR_HB_RA		sll $0,$0,1; sll $0,$0,1; jr ra; sll $0,$0,1
-#elif MIPS3 > 0
-# define COP0_SYNC		nop; nop; nop
-# define JR_HB_RA		nop; nop; jr ra; nop
+#if (MIPS3 + MIPS32 + MIPS64) == 0
+# define COP0_SYNC		sll $0,$0,3
+# define JR_HB_RA		jr ra; sll $0,$0,3
 #else
-# define COP0_SYNC		nop
-# define JR_HB_RA		jr ra; nop
+# define COP0_SYNC		sll $0,$0,1; sll $0,$0,1; sll $0,$0,3
+# define JR_HB_RA		sll $0,$0,1; sll $0,$0,1; jr ra; sll $0,$0,3
 #endif
 #define	COP0_HAZARD_FPUENABLE	nop; nop; nop; nop;
 



Home | Main Index | Thread Index | Old Index