]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] Use mtocrf instruction in asm when CONFIG_POWER4_ONLY=y
authorOlof Johansson <olof@lixom.net>
Thu, 22 Mar 2007 14:34:13 +0000 (09:34 -0500)
committerPaul Mackerras <paulus@samba.org>
Thu, 12 Apr 2007 17:55:13 +0000 (03:55 +1000)
mtocrf is a faster single-field mtcrf (move to condition register
fields) instruction available in POWER4 and later processors.  It can
make quite a difference in performance on some implementations, so use
it for CONFIG_POWER4_ONLY builds.

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/lib/copyuser_64.S
arch/powerpc/lib/mem_64.S
arch/powerpc/lib/memcpy_64.S
include/asm-powerpc/asm-compat.h

index a6b54cb97c4912a60a85bb41f8a7ce05a93becfb..25ec5378afa454232704d48c604e968efdd33cc0 100644 (file)
@@ -24,7 +24,7 @@ _GLOBAL(__copy_tofrom_user)
        dcbt    0,r4
        beq     .Lcopy_page_4K
        andi.   r6,r6,7
-       mtcrf   0x01,r5
+       PPC_MTOCRF      0x01,r5
        blt     cr1,.Lshort_copy
        bne     .Ldst_unaligned
 .Ldst_aligned:
@@ -135,7 +135,7 @@ _GLOBAL(__copy_tofrom_user)
        b       .Ldo_tail
 
 .Ldst_unaligned:
-       mtcrf   0x01,r6         /* put #bytes to 8B bdry into cr7 */
+       PPC_MTOCRF      0x01,r6         /* put #bytes to 8B bdry into cr7 */
        subf    r5,r6,r5
        li      r7,0
        cmpldi  r1,r5,16
@@ -150,7 +150,7 @@ _GLOBAL(__copy_tofrom_user)
 2:     bf      cr7*4+1,3f
 37:    lwzx    r0,r7,r4
 83:    stwx    r0,r7,r3
-3:     mtcrf   0x01,r5
+3:     PPC_MTOCRF      0x01,r5
        add     r4,r6,r4
        add     r3,r6,r3
        b       .Ldst_aligned
index 68df20283ff508c4ca28305ac7f29b6f56183765..11ce045e21fd1ab43518e6a58f8986d9390cb760 100644 (file)
@@ -19,7 +19,7 @@ _GLOBAL(memset)
        rlwimi  r4,r4,16,0,15
        cmplw   cr1,r5,r0               /* do we get that far? */
        rldimi  r4,r4,32,0
-       mtcrf   1,r0
+       PPC_MTOCRF      1,r0
        mr      r6,r3
        blt     cr1,8f
        beq+    3f                      /* if already 8-byte aligned */
@@ -49,7 +49,7 @@ _GLOBAL(memset)
        bdnz    4b
 5:     srwi.   r0,r5,3
        clrlwi  r5,r5,29
-       mtcrf   1,r0
+       PPC_MTOCRF      1,r0
        beq     8f
        bf      29,6f
        std     r4,0(r6)
@@ -65,7 +65,7 @@ _GLOBAL(memset)
        std     r4,0(r6)
        addi    r6,r6,8
 8:     cmpwi   r5,0
-       mtcrf   1,r5
+       PPC_MTOCRF      1,r5
        beqlr+
        bf      29,9f
        stw     r4,0(r6)
index 7173ba98f427d293fc6f66727a4448be2da40ff2..3f131129d1c1a496607637f39eb1f563596768d0 100644 (file)
@@ -12,7 +12,7 @@
        .align  7
 _GLOBAL(memcpy)
        std     r3,48(r1)       /* save destination pointer for return value */
-       mtcrf   0x01,r5
+       PPC_MTOCRF      0x01,r5
        cmpldi  cr1,r5,16
        neg     r6,r3           # LS 3 bits = # bytes to 8-byte dest bdry
        andi.   r6,r6,7
@@ -128,7 +128,7 @@ _GLOBAL(memcpy)
        b       .Ldo_tail
 
 .Ldst_unaligned:
-       mtcrf   0x01,r6         # put #bytes to 8B bdry into cr7
+       PPC_MTOCRF      0x01,r6         # put #bytes to 8B bdry into cr7
        subf    r5,r6,r5
        li      r7,0
        cmpldi  r1,r5,16
@@ -143,7 +143,7 @@ _GLOBAL(memcpy)
 2:     bf      cr7*4+1,3f
        lwzx    r0,r7,r4
        stwx    r0,r7,r3
-3:     mtcrf   0x01,r5
+3:     PPC_MTOCRF      0x01,r5
        add     r4,r6,r4
        add     r3,r6,r3
        b       .Ldst_aligned
index c89bd58ee2839be66fc98059172523d246d412b4..c19e7367fce67e9db83c1e59fc5c753898d3fffa 100644 (file)
 #define PPC_STLCX      stringify_in_c(stdcx.)
 #define PPC_CNTLZL     stringify_in_c(cntlzd)
 
+/* Move to CR, single-entry optimized version. Only available
+ * on POWER4 and later.
+ */
+#ifdef CONFIG_POWER4_ONLY
+#define PPC_MTOCRF     stringify_in_c(mtocrf)
+#else
+#define PPC_MTOCRF     stringify_in_c(mtcrf)
+#endif
+
 #else /* 32-bit */
 
 /* operations for longs and pointers */
@@ -89,6 +98,7 @@
 #define PPC_LLARX      stringify_in_c(lwarx)
 #define PPC_STLCX      stringify_in_c(stwcx.)
 #define PPC_CNTLZL     stringify_in_c(cntlzw)
+#define PPC_MTOCRF     stringify_in_c(mtcrf)
 
 #endif