aboutsummaryrefslogtreecommitdiff
path: root/src/internal/bytealg/compare_ppc64x.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/bytealg/compare_ppc64x.s')
-rw-r--r--src/internal/bytealg/compare_ppc64x.s75
1 files changed, 63 insertions, 12 deletions
diff --git a/src/internal/bytealg/compare_ppc64x.s b/src/internal/bytealg/compare_ppc64x.s
index 83444fa826..390a72688b 100644
--- a/src/internal/bytealg/compare_ppc64x.s
+++ b/src/internal/bytealg/compare_ppc64x.s
@@ -8,64 +8,99 @@
#include "go_asm.h"
#include "textflag.h"
-TEXT ·Compare(SB),NOSPLIT|NOFRAME,$0-56
+TEXT ·Compare<ABIInternal>(SB),NOSPLIT|NOFRAME,$0-56
+#ifdef GOEXPERIMENT_regabiargs
+// incoming:
+// R3 a addr -> R5
+// R4 a len -> R3
+// R5 a cap unused
+// R6 b addr -> R6
+// R7 b len -> R4
+// R8 b cap unused
+ MOVD R3, R5
+ MOVD R4, R3
+ MOVD R7, R4
+#else
MOVD a_base+0(FP), R5
MOVD b_base+24(FP), R6
MOVD a_len+8(FP), R3
- CMP R5,R6,CR7
MOVD b_len+32(FP), R4
MOVD $ret+48(FP), R7
+#endif
+ CMP R5,R6,CR7
CMP R3,R4,CR6
BEQ CR7,equal
-
#ifdef GOARCH_ppc64le
BR cmpbodyLE<>(SB)
#else
BR cmpbodyBE<>(SB)
#endif
-
equal:
BEQ CR6,done
MOVD $1, R8
BGT CR6,greater
NEG R8
-
greater:
+#ifdef GOEXPERIMENT_regabiargs
+ MOVD R8, R3
+#else
MOVD R8, (R7)
+#endif
RET
-
done:
+#ifdef GOEXPERIMENT_regabiargs
+ MOVD $0, R3
+#else
MOVD $0, (R7)
+#endif
RET
-TEXT runtime·cmpstring(SB),NOSPLIT|NOFRAME,$0-40
+TEXT runtime·cmpstring<ABIInternal>(SB),NOSPLIT|NOFRAME,$0-40
+#ifdef GOEXPERIMENT_regabiargs
+// incoming:
+// R3 a addr -> R5
+// R4 a len -> R3
+// R5 b addr -> R6
+// R6 b len -> R4
+ MOVD R6, R7
+ MOVD R5, R6
+ MOVD R3, R5
+ MOVD R4, R3
+ MOVD R7, R4
+#else
MOVD a_base+0(FP), R5
MOVD b_base+16(FP), R6
MOVD a_len+8(FP), R3
- CMP R5,R6,CR7
MOVD b_len+24(FP), R4
MOVD $ret+32(FP), R7
+#endif
+ CMP R5,R6,CR7
CMP R3,R4,CR6
BEQ CR7,equal
-
#ifdef GOARCH_ppc64le
BR cmpbodyLE<>(SB)
#else
BR cmpbodyBE<>(SB)
#endif
-
equal:
BEQ CR6,done
MOVD $1, R8
BGT CR6,greater
NEG R8
-
greater:
+#ifdef GOEXPERIMENT_regabiargs
+ MOVD R8, R3
+#else
MOVD R8, (R7)
+#endif
RET
done:
+#ifdef GOEXPERIMENT_regabiargs
+ MOVD $0, R3
+#else
MOVD $0, (R7)
+#endif
RET
// Do an efficient memcmp for ppc64le
@@ -73,7 +108,7 @@ done:
// R4 = b len
// R5 = a addr
// R6 = b addr
-// R7 = addr of return value
+// R7 = addr of return value if not regabi
TEXT cmpbodyLE<>(SB),NOSPLIT|NOFRAME,$0-0
MOVD R3,R8 // set up length
CMP R3,R4,CR2 // unequal?
@@ -168,14 +203,22 @@ cmpne: // only here is not equal
BGT greater // here only if NE
less:
MOVD $-1,R3
+#ifndef GOEXPERIMENT_regabiargs
MOVD R3,(R7) // return value if A < B
+#endif
RET
equal:
+#ifdef GOEXPERIMENT_regabiargs
+ MOVD $0, R3
+#else
MOVD $0,(R7) // return value if A == B
+#endif
RET
greater:
MOVD $1,R3
+#ifndef GOEXPERIMENT_regabiargs
MOVD R3,(R7) // return value if A > B
+#endif
RET
// Do an efficient memcmp for ppc64 (BE)
@@ -267,12 +310,20 @@ simple:
BC 12,9,greater // 2nd len > 1st len
less:
MOVD $-1,R3
+#ifndef GOEXPERIMENT_regabiargs
MOVD R3,(R7) // return value if A < B
+#endif
RET
equal:
+#ifdef GOEXPERIMENT_regabiargs
+ MOVD $0, R3
+#else
MOVD $0,(R7) // return value if A == B
+#endif
RET
greater:
MOVD $1,R3
+#ifndef GOEXPERIMENT_regabiargs
MOVD R3,(R7) // return value if A > B
+#endif
RET