1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* U3memcpy.S: UltraSparc-III optimized memcpy 2 /* U3memcpy.S: UltraSparc-III optimized memcpy. 3 * 3 * 4 * Copyright (C) 1999, 2000, 2004 David S. Mil 4 * Copyright (C) 1999, 2000, 2004 David S. Miller (davem@redhat.com) 5 */ 5 */ 6 6 7 #ifdef __KERNEL__ 7 #ifdef __KERNEL__ 8 #include <linux/linkage.h> 8 #include <linux/linkage.h> 9 #include <asm/visasm.h> 9 #include <asm/visasm.h> 10 #include <asm/asi.h> 10 #include <asm/asi.h> 11 #define GLOBAL_SPARE %g7 11 #define GLOBAL_SPARE %g7 12 #else 12 #else 13 #define ASI_BLK_P 0xf0 13 #define ASI_BLK_P 0xf0 14 #define FPRS_FEF 0x04 14 #define FPRS_FEF 0x04 15 #ifdef MEMCPY_DEBUG 15 #ifdef MEMCPY_DEBUG 16 #define VISEntryHalf rd %fprs, %o5; wr %g0, FP 16 #define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs; \ 17 clr %g1; clr %g2; clr %g3 17 clr %g1; clr %g2; clr %g3; subcc %g0, %g0, %g0; 18 #define VISExitHalf and %o5, FPRS_FEF, %o5; wr 18 #define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs 19 #else 19 #else 20 #define VISEntryHalf rd %fprs, %o5; wr %g0, FP 20 #define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs 21 #define VISExitHalf and %o5, FPRS_FEF, %o5; wr 21 #define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs 22 #endif 22 #endif 23 #define GLOBAL_SPARE %g5 23 #define GLOBAL_SPARE %g5 24 #endif 24 #endif 25 25 26 #ifndef EX_LD 26 #ifndef EX_LD 27 #define EX_LD(x,y) x 27 #define EX_LD(x,y) x 28 #endif 28 #endif 29 #ifndef EX_LD_FP 29 #ifndef EX_LD_FP 30 #define EX_LD_FP(x,y) x 30 #define EX_LD_FP(x,y) x 31 #endif 31 #endif 32 32 33 #ifndef EX_ST 33 #ifndef EX_ST 34 #define EX_ST(x,y) x 34 #define EX_ST(x,y) x 35 #endif 35 #endif 36 #ifndef EX_ST_FP 36 #ifndef EX_ST_FP 37 #define EX_ST_FP(x,y) x 37 #define EX_ST_FP(x,y) x 38 #endif 38 #endif 39 39 40 #ifndef LOAD 40 #ifndef LOAD 41 #define LOAD(type,addr,dest) type [addr], d 41 #define LOAD(type,addr,dest) type [addr], dest 42 #endif 42 #endif 43 43 44 #ifndef STORE 44 #ifndef STORE 45 #define STORE(type,src,addr) type src, [add 45 #define STORE(type,src,addr) type src, [addr] 46 #endif 46 #endif 47 47 48 #ifndef STORE_BLK 48 #ifndef STORE_BLK 49 #define STORE_BLK(src,addr) stda src, [add 49 #define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_P 50 #endif 50 #endif 51 51 52 #ifndef FUNC_NAME 52 #ifndef FUNC_NAME 53 #define FUNC_NAME U3memcpy 53 #define FUNC_NAME U3memcpy 54 #endif 54 #endif 55 55 56 #ifndef PREAMBLE 56 #ifndef PREAMBLE 57 #define PREAMBLE 57 #define PREAMBLE 58 #endif 58 #endif 59 59 60 #ifndef XCC 60 #ifndef XCC 61 #define XCC xcc 61 #define XCC xcc 62 #endif 62 #endif 63 63 64 .register %g2,#scratch 64 .register %g2,#scratch 65 .register %g3,#scratch 65 .register %g3,#scratch 66 66 67 /* Special/non-trivial issues of this 67 /* Special/non-trivial issues of this code: 68 * 68 * 69 * 1) %o5 is preserved from VISEntryHa 69 * 1) %o5 is preserved from VISEntryHalf to VISExitHalf 70 * 2) Only low 32 FPU registers are us 70 * 2) Only low 32 FPU registers are used so that only the 71 * lower half of the FPU register s 71 * lower half of the FPU register set is dirtied by this 72 * code. This is especially import 72 * code. This is especially important in the kernel. 73 * 3) This code never prefetches cache 73 * 3) This code never prefetches cachelines past the end 74 * of the source buffer. 74 * of the source buffer. 75 */ 75 */ 76 76 77 .text 77 .text 78 #ifndef EX_RETVAL 78 #ifndef EX_RETVAL 79 #define EX_RETVAL(x) x 79 #define EX_RETVAL(x) x 80 __restore_fp: 80 __restore_fp: 81 VISExitHalf 81 VISExitHalf 82 retl 82 retl 83 nop 83 nop 84 ENTRY(U3_retl_o2_plus_g2_plus_g1_plus_1_fp) 84 ENTRY(U3_retl_o2_plus_g2_plus_g1_plus_1_fp) 85 add %g1, 1, %g1 85 add %g1, 1, %g1 86 add %g2, %g1, %g2 86 add %g2, %g1, %g2 87 ba,pt %xcc, __restore_fp 87 ba,pt %xcc, __restore_fp 88 add %o2, %g2, %o0 88 add %o2, %g2, %o0 89 ENDPROC(U3_retl_o2_plus_g2_plus_g1_plus_1_fp) 89 ENDPROC(U3_retl_o2_plus_g2_plus_g1_plus_1_fp) 90 ENTRY(U3_retl_o2_plus_g2_fp) 90 ENTRY(U3_retl_o2_plus_g2_fp) 91 ba,pt %xcc, __restore_fp 91 ba,pt %xcc, __restore_fp 92 add %o2, %g2, %o0 92 add %o2, %g2, %o0 93 ENDPROC(U3_retl_o2_plus_g2_fp) 93 ENDPROC(U3_retl_o2_plus_g2_fp) 94 ENTRY(U3_retl_o2_plus_g2_plus_8_fp) 94 ENTRY(U3_retl_o2_plus_g2_plus_8_fp) 95 add %g2, 8, %g2 95 add %g2, 8, %g2 96 ba,pt %xcc, __restore_fp 96 ba,pt %xcc, __restore_fp 97 add %o2, %g2, %o0 97 add %o2, %g2, %o0 98 ENDPROC(U3_retl_o2_plus_g2_plus_8_fp) 98 ENDPROC(U3_retl_o2_plus_g2_plus_8_fp) 99 ENTRY(U3_retl_o2) 99 ENTRY(U3_retl_o2) 100 retl 100 retl 101 mov %o2, %o0 101 mov %o2, %o0 102 ENDPROC(U3_retl_o2) 102 ENDPROC(U3_retl_o2) 103 ENTRY(U3_retl_o2_plus_1) 103 ENTRY(U3_retl_o2_plus_1) 104 retl 104 retl 105 add %o2, 1, %o0 105 add %o2, 1, %o0 106 ENDPROC(U3_retl_o2_plus_1) 106 ENDPROC(U3_retl_o2_plus_1) 107 ENTRY(U3_retl_o2_plus_4) 107 ENTRY(U3_retl_o2_plus_4) 108 retl 108 retl 109 add %o2, 4, %o0 109 add %o2, 4, %o0 110 ENDPROC(U3_retl_o2_plus_4) 110 ENDPROC(U3_retl_o2_plus_4) 111 ENTRY(U3_retl_o2_plus_8) 111 ENTRY(U3_retl_o2_plus_8) 112 retl 112 retl 113 add %o2, 8, %o0 113 add %o2, 8, %o0 114 ENDPROC(U3_retl_o2_plus_8) 114 ENDPROC(U3_retl_o2_plus_8) 115 ENTRY(U3_retl_o2_plus_g1_plus_1) 115 ENTRY(U3_retl_o2_plus_g1_plus_1) 116 add %g1, 1, %g1 116 add %g1, 1, %g1 117 retl 117 retl 118 add %o2, %g1, %o0 118 add %o2, %g1, %o0 119 ENDPROC(U3_retl_o2_plus_g1_plus_1) 119 ENDPROC(U3_retl_o2_plus_g1_plus_1) 120 ENTRY(U3_retl_o2_fp) 120 ENTRY(U3_retl_o2_fp) 121 ba,pt %xcc, __restore_fp 121 ba,pt %xcc, __restore_fp 122 mov %o2, %o0 122 mov %o2, %o0 123 ENDPROC(U3_retl_o2_fp) 123 ENDPROC(U3_retl_o2_fp) 124 ENTRY(U3_retl_o2_plus_o3_sll_6_plus_0x80_fp) 124 ENTRY(U3_retl_o2_plus_o3_sll_6_plus_0x80_fp) 125 sll %o3, 6, %o3 125 sll %o3, 6, %o3 126 add %o3, 0x80, %o3 126 add %o3, 0x80, %o3 127 ba,pt %xcc, __restore_fp 127 ba,pt %xcc, __restore_fp 128 add %o2, %o3, %o0 128 add %o2, %o3, %o0 129 ENDPROC(U3_retl_o2_plus_o3_sll_6_plus_0x80_fp) 129 ENDPROC(U3_retl_o2_plus_o3_sll_6_plus_0x80_fp) 130 ENTRY(U3_retl_o2_plus_o3_sll_6_plus_0x40_fp) 130 ENTRY(U3_retl_o2_plus_o3_sll_6_plus_0x40_fp) 131 sll %o3, 6, %o3 131 sll %o3, 6, %o3 132 add %o3, 0x40, %o3 132 add %o3, 0x40, %o3 133 ba,pt %xcc, __restore_fp 133 ba,pt %xcc, __restore_fp 134 add %o2, %o3, %o0 134 add %o2, %o3, %o0 135 ENDPROC(U3_retl_o2_plus_o3_sll_6_plus_0x40_fp) 135 ENDPROC(U3_retl_o2_plus_o3_sll_6_plus_0x40_fp) 136 ENTRY(U3_retl_o2_plus_GS_plus_0x10) 136 ENTRY(U3_retl_o2_plus_GS_plus_0x10) 137 add GLOBAL_SPARE, 0x10, GLOBAL_SPA 137 add GLOBAL_SPARE, 0x10, GLOBAL_SPARE 138 retl 138 retl 139 add %o2, GLOBAL_SPARE, %o0 139 add %o2, GLOBAL_SPARE, %o0 140 ENDPROC(U3_retl_o2_plus_GS_plus_0x10) 140 ENDPROC(U3_retl_o2_plus_GS_plus_0x10) 141 ENTRY(U3_retl_o2_plus_GS_plus_0x08) 141 ENTRY(U3_retl_o2_plus_GS_plus_0x08) 142 add GLOBAL_SPARE, 0x08, GLOBAL_SPA 142 add GLOBAL_SPARE, 0x08, GLOBAL_SPARE 143 retl 143 retl 144 add %o2, GLOBAL_SPARE, %o0 144 add %o2, GLOBAL_SPARE, %o0 145 ENDPROC(U3_retl_o2_plus_GS_plus_0x08) 145 ENDPROC(U3_retl_o2_plus_GS_plus_0x08) 146 ENTRY(U3_retl_o2_and_7_plus_GS) 146 ENTRY(U3_retl_o2_and_7_plus_GS) 147 and %o2, 7, %o2 147 and %o2, 7, %o2 148 retl 148 retl 149 add %o2, GLOBAL_SPARE, %o0 149 add %o2, GLOBAL_SPARE, %o0 150 ENDPROC(U3_retl_o2_and_7_plus_GS) 150 ENDPROC(U3_retl_o2_and_7_plus_GS) 151 ENTRY(U3_retl_o2_and_7_plus_GS_plus_8) 151 ENTRY(U3_retl_o2_and_7_plus_GS_plus_8) 152 add GLOBAL_SPARE, 8, GLOBAL_SPARE 152 add GLOBAL_SPARE, 8, GLOBAL_SPARE 153 and %o2, 7, %o2 153 and %o2, 7, %o2 154 retl 154 retl 155 add %o2, GLOBAL_SPARE, %o0 155 add %o2, GLOBAL_SPARE, %o0 156 ENDPROC(U3_retl_o2_and_7_plus_GS_plus_8) 156 ENDPROC(U3_retl_o2_and_7_plus_GS_plus_8) 157 #endif 157 #endif 158 158 159 .align 64 159 .align 64 160 160 161 /* The cheetah's flexible spine, overs 161 /* The cheetah's flexible spine, oversized liver, enlarged heart, 162 * slender muscular body, and claws ma 162 * slender muscular body, and claws make it the swiftest hunter 163 * in Africa and the fastest animal on 163 * in Africa and the fastest animal on land. Can reach speeds 164 * of up to 2.4GB per second. 164 * of up to 2.4GB per second. 165 */ 165 */ 166 166 167 .globl FUNC_NAME 167 .globl FUNC_NAME 168 .type FUNC_NAME,#function 168 .type FUNC_NAME,#function 169 FUNC_NAME: /* %o0=dst, %o1=src, %o2=len * 169 FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ 170 srlx %o2, 31, %g2 170 srlx %o2, 31, %g2 171 cmp %g2, 0 171 cmp %g2, 0 172 172 173 /* software trap 5 "Range Check" if ds 173 /* software trap 5 "Range Check" if dst >= 0x80000000 */ 174 tne %xcc, 5 174 tne %xcc, 5 175 PREAMBLE 175 PREAMBLE 176 mov %o0, %o4 176 mov %o0, %o4 177 177 178 /* if len == 0 */ 178 /* if len == 0 */ 179 cmp %o2, 0 179 cmp %o2, 0 180 be,pn %XCC, end_return 180 be,pn %XCC, end_return 181 or %o0, %o1, %o3 181 or %o0, %o1, %o3 182 182 183 /* if len < 16 */ 183 /* if len < 16 */ 184 cmp %o2, 16 184 cmp %o2, 16 185 blu,a,pn %XCC, less_than_16 185 blu,a,pn %XCC, less_than_16 186 or %o3, %o2, %o3 186 or %o3, %o2, %o3 187 187 188 /* if len < 192 */ 188 /* if len < 192 */ 189 cmp %o2, (3 * 64) 189 cmp %o2, (3 * 64) 190 blu,pt %XCC, less_than_192 190 blu,pt %XCC, less_than_192 191 andcc %o3, 0x7, %g0 191 andcc %o3, 0x7, %g0 192 192 193 /* Clobbers o5/g1/g2/g3/g7/icc/xcc. W 193 /* Clobbers o5/g1/g2/g3/g7/icc/xcc. We must preserve 194 * o5 from here until we hit VISExitHa 194 * o5 from here until we hit VISExitHalf. 195 */ 195 */ 196 VISEntryHalf 196 VISEntryHalf 197 197 198 /* Is 'dst' already aligned on an 64-b 198 /* Is 'dst' already aligned on an 64-byte boundary? */ 199 andcc %o0, 0x3f, %g2 199 andcc %o0, 0x3f, %g2 200 be,pt %XCC, 2f 200 be,pt %XCC, 2f 201 201 202 /* Compute abs((dst & 0x3f) - 0x40) in 202 /* Compute abs((dst & 0x3f) - 0x40) into %g2. This is the number 203 * of bytes to copy to make 'dst' 64-b 203 * of bytes to copy to make 'dst' 64-byte aligned. We pre- 204 * subtract this from 'len'. 204 * subtract this from 'len'. 205 */ 205 */ 206 sub %o0, %o1, GLOBAL_SPARE 206 sub %o0, %o1, GLOBAL_SPARE 207 sub %g2, 0x40, %g2 207 sub %g2, 0x40, %g2 208 sub %g0, %g2, %g2 208 sub %g0, %g2, %g2 209 sub %o2, %g2, %o2 209 sub %o2, %g2, %o2 210 andcc %g2, 0x7, %g1 210 andcc %g2, 0x7, %g1 211 be,pt %icc, 2f 211 be,pt %icc, 2f 212 and %g2, 0x38, %g2 212 and %g2, 0x38, %g2 213 213 214 1: subcc %g1, 0x1, %g1 214 1: subcc %g1, 0x1, %g1 215 EX_LD_FP(LOAD(ldub, %o1 + 0x00, %o3), 215 EX_LD_FP(LOAD(ldub, %o1 + 0x00, %o3), U3_retl_o2_plus_g2_plus_g1_plus_1) 216 EX_ST_FP(STORE(stb, %o3, %o1 + GLOBAL_ 216 EX_ST_FP(STORE(stb, %o3, %o1 + GLOBAL_SPARE), U3_retl_o2_plus_g2_plus_g1_plus_1) 217 bgu,pt %XCC, 1b 217 bgu,pt %XCC, 1b 218 add %o1, 0x1, %o1 218 add %o1, 0x1, %o1 219 219 220 add %o1, GLOBAL_SPARE, %o0 220 add %o1, GLOBAL_SPARE, %o0 221 221 222 2: cmp %g2, 0x0 222 2: cmp %g2, 0x0 223 and %o1, 0x7, %g1 223 and %o1, 0x7, %g1 224 be,pt %icc, 3f 224 be,pt %icc, 3f 225 alignaddr %o1, %g0, %o1 225 alignaddr %o1, %g0, %o1 226 226 227 EX_LD_FP(LOAD(ldd, %o1, %f4), U3_retl_ 227 EX_LD_FP(LOAD(ldd, %o1, %f4), U3_retl_o2_plus_g2) 228 1: EX_LD_FP(LOAD(ldd, %o1 + 0x8, %f6), U3 228 1: EX_LD_FP(LOAD(ldd, %o1 + 0x8, %f6), U3_retl_o2_plus_g2) 229 add %o1, 0x8, %o1 229 add %o1, 0x8, %o1 230 subcc %g2, 0x8, %g2 230 subcc %g2, 0x8, %g2 231 faligndata %f4, %f6, %f0 231 faligndata %f4, %f6, %f0 232 EX_ST_FP(STORE(std, %f0, %o0), U3_retl 232 EX_ST_FP(STORE(std, %f0, %o0), U3_retl_o2_plus_g2_plus_8) 233 be,pn %icc, 3f 233 be,pn %icc, 3f 234 add %o0, 0x8, %o0 234 add %o0, 0x8, %o0 235 235 236 EX_LD_FP(LOAD(ldd, %o1 + 0x8, %f4), U3 236 EX_LD_FP(LOAD(ldd, %o1 + 0x8, %f4), U3_retl_o2_plus_g2) 237 add %o1, 0x8, %o1 237 add %o1, 0x8, %o1 238 subcc %g2, 0x8, %g2 238 subcc %g2, 0x8, %g2 239 faligndata %f6, %f4, %f2 239 faligndata %f6, %f4, %f2 240 EX_ST_FP(STORE(std, %f2, %o0), U3_retl 240 EX_ST_FP(STORE(std, %f2, %o0), U3_retl_o2_plus_g2_plus_8) 241 bne,pt %icc, 1b 241 bne,pt %icc, 1b 242 add %o0, 0x8, %o0 242 add %o0, 0x8, %o0 243 243 244 3: LOAD(prefetch, %o1 + 0x000, #one_read) 244 3: LOAD(prefetch, %o1 + 0x000, #one_read) 245 LOAD(prefetch, %o1 + 0x040, #one_read) 245 LOAD(prefetch, %o1 + 0x040, #one_read) 246 andn %o2, (0x40 - 1), GLOBA 246 andn %o2, (0x40 - 1), GLOBAL_SPARE 247 LOAD(prefetch, %o1 + 0x080, #one_read) 247 LOAD(prefetch, %o1 + 0x080, #one_read) 248 LOAD(prefetch, %o1 + 0x0c0, #one_read) 248 LOAD(prefetch, %o1 + 0x0c0, #one_read) 249 LOAD(prefetch, %o1 + 0x100, #one_read) 249 LOAD(prefetch, %o1 + 0x100, #one_read) 250 EX_LD_FP(LOAD(ldd, %o1 + 0x000, %f0), 250 EX_LD_FP(LOAD(ldd, %o1 + 0x000, %f0), U3_retl_o2) 251 LOAD(prefetch, %o1 + 0x140, #one_read) 251 LOAD(prefetch, %o1 + 0x140, #one_read) 252 EX_LD_FP(LOAD(ldd, %o1 + 0x008, %f2), 252 EX_LD_FP(LOAD(ldd, %o1 + 0x008, %f2), U3_retl_o2) 253 LOAD(prefetch, %o1 + 0x180, #one_read) 253 LOAD(prefetch, %o1 + 0x180, #one_read) 254 EX_LD_FP(LOAD(ldd, %o1 + 0x010, %f4), 254 EX_LD_FP(LOAD(ldd, %o1 + 0x010, %f4), U3_retl_o2) 255 LOAD(prefetch, %o1 + 0x1c0, #one_read) 255 LOAD(prefetch, %o1 + 0x1c0, #one_read) 256 faligndata %f0, %f2, %f16 256 faligndata %f0, %f2, %f16 257 EX_LD_FP(LOAD(ldd, %o1 + 0x018, %f6), 257 EX_LD_FP(LOAD(ldd, %o1 + 0x018, %f6), U3_retl_o2) 258 faligndata %f2, %f4, %f18 258 faligndata %f2, %f4, %f18 259 EX_LD_FP(LOAD(ldd, %o1 + 0x020, %f8), 259 EX_LD_FP(LOAD(ldd, %o1 + 0x020, %f8), U3_retl_o2) 260 faligndata %f4, %f6, %f20 260 faligndata %f4, %f6, %f20 261 EX_LD_FP(LOAD(ldd, %o1 + 0x028, %f10), 261 EX_LD_FP(LOAD(ldd, %o1 + 0x028, %f10), U3_retl_o2) 262 faligndata %f6, %f8, %f22 262 faligndata %f6, %f8, %f22 263 263 264 EX_LD_FP(LOAD(ldd, %o1 + 0x030, %f12), 264 EX_LD_FP(LOAD(ldd, %o1 + 0x030, %f12), U3_retl_o2) 265 faligndata %f8, %f10, %f24 265 faligndata %f8, %f10, %f24 266 EX_LD_FP(LOAD(ldd, %o1 + 0x038, %f14), 266 EX_LD_FP(LOAD(ldd, %o1 + 0x038, %f14), U3_retl_o2) 267 faligndata %f10, %f12, %f26 267 faligndata %f10, %f12, %f26 268 EX_LD_FP(LOAD(ldd, %o1 + 0x040, %f0), 268 EX_LD_FP(LOAD(ldd, %o1 + 0x040, %f0), U3_retl_o2) 269 269 270 subcc GLOBAL_SPARE, 0x80, GL 270 subcc GLOBAL_SPARE, 0x80, GLOBAL_SPARE 271 add %o1, 0x40, %o1 271 add %o1, 0x40, %o1 272 bgu,pt %XCC, 1f 272 bgu,pt %XCC, 1f 273 srl GLOBAL_SPARE, 6, %o3 273 srl GLOBAL_SPARE, 6, %o3 274 ba,pt %xcc, 2f 274 ba,pt %xcc, 2f 275 nop 275 nop 276 276 277 .align 64 277 .align 64 278 1: 278 1: 279 EX_LD_FP(LOAD(ldd, %o1 + 0x008, %f2), 279 EX_LD_FP(LOAD(ldd, %o1 + 0x008, %f2), U3_retl_o2_plus_o3_sll_6_plus_0x80) 280 faligndata %f12, %f14, %f28 280 faligndata %f12, %f14, %f28 281 EX_LD_FP(LOAD(ldd, %o1 + 0x010, %f4), 281 EX_LD_FP(LOAD(ldd, %o1 + 0x010, %f4), U3_retl_o2_plus_o3_sll_6_plus_0x80) 282 faligndata %f14, %f0, %f30 282 faligndata %f14, %f0, %f30 283 EX_ST_FP(STORE_BLK(%f16, %o0), U3_retl 283 EX_ST_FP(STORE_BLK(%f16, %o0), U3_retl_o2_plus_o3_sll_6_plus_0x80) 284 EX_LD_FP(LOAD(ldd, %o1 + 0x018, %f6), 284 EX_LD_FP(LOAD(ldd, %o1 + 0x018, %f6), U3_retl_o2_plus_o3_sll_6_plus_0x40) 285 faligndata %f0, %f2, %f16 285 faligndata %f0, %f2, %f16 286 add %o0, 0x40, %o0 286 add %o0, 0x40, %o0 287 287 288 EX_LD_FP(LOAD(ldd, %o1 + 0x020, %f8), 288 EX_LD_FP(LOAD(ldd, %o1 + 0x020, %f8), U3_retl_o2_plus_o3_sll_6_plus_0x40) 289 faligndata %f2, %f4, %f18 289 faligndata %f2, %f4, %f18 290 EX_LD_FP(LOAD(ldd, %o1 + 0x028, %f10), 290 EX_LD_FP(LOAD(ldd, %o1 + 0x028, %f10), U3_retl_o2_plus_o3_sll_6_plus_0x40) 291 faligndata %f4, %f6, %f20 291 faligndata %f4, %f6, %f20 292 EX_LD_FP(LOAD(ldd, %o1 + 0x030, %f12), 292 EX_LD_FP(LOAD(ldd, %o1 + 0x030, %f12), U3_retl_o2_plus_o3_sll_6_plus_0x40) 293 subcc %o3, 0x01, %o3 293 subcc %o3, 0x01, %o3 294 faligndata %f6, %f8, %f22 294 faligndata %f6, %f8, %f22 295 EX_LD_FP(LOAD(ldd, %o1 + 0x038, %f14), 295 EX_LD_FP(LOAD(ldd, %o1 + 0x038, %f14), U3_retl_o2_plus_o3_sll_6_plus_0x80) 296 296 297 faligndata %f8, %f10, %f24 297 faligndata %f8, %f10, %f24 298 EX_LD_FP(LOAD(ldd, %o1 + 0x040, %f0), 298 EX_LD_FP(LOAD(ldd, %o1 + 0x040, %f0), U3_retl_o2_plus_o3_sll_6_plus_0x80) 299 LOAD(prefetch, %o1 + 0x1c0, #one_read) 299 LOAD(prefetch, %o1 + 0x1c0, #one_read) 300 faligndata %f10, %f12, %f26 300 faligndata %f10, %f12, %f26 301 bg,pt %XCC, 1b 301 bg,pt %XCC, 1b 302 add %o1, 0x40, %o1 302 add %o1, 0x40, %o1 303 303 304 /* Finally we copy the last full 64-by 304 /* Finally we copy the last full 64-byte block. */ 305 2: 305 2: 306 EX_LD_FP(LOAD(ldd, %o1 + 0x008, %f2), 306 EX_LD_FP(LOAD(ldd, %o1 + 0x008, %f2), U3_retl_o2_plus_o3_sll_6_plus_0x80) 307 faligndata %f12, %f14, %f28 307 faligndata %f12, %f14, %f28 308 EX_LD_FP(LOAD(ldd, %o1 + 0x010, %f4), 308 EX_LD_FP(LOAD(ldd, %o1 + 0x010, %f4), U3_retl_o2_plus_o3_sll_6_plus_0x80) 309 faligndata %f14, %f0, %f30 309 faligndata %f14, %f0, %f30 310 EX_ST_FP(STORE_BLK(%f16, %o0), U3_retl 310 EX_ST_FP(STORE_BLK(%f16, %o0), U3_retl_o2_plus_o3_sll_6_plus_0x80) 311 EX_LD_FP(LOAD(ldd, %o1 + 0x018, %f6), 311 EX_LD_FP(LOAD(ldd, %o1 + 0x018, %f6), U3_retl_o2_plus_o3_sll_6_plus_0x40) 312 faligndata %f0, %f2, %f16 312 faligndata %f0, %f2, %f16 313 EX_LD_FP(LOAD(ldd, %o1 + 0x020, %f8), 313 EX_LD_FP(LOAD(ldd, %o1 + 0x020, %f8), U3_retl_o2_plus_o3_sll_6_plus_0x40) 314 faligndata %f2, %f4, %f18 314 faligndata %f2, %f4, %f18 315 EX_LD_FP(LOAD(ldd, %o1 + 0x028, %f10), 315 EX_LD_FP(LOAD(ldd, %o1 + 0x028, %f10), U3_retl_o2_plus_o3_sll_6_plus_0x40) 316 faligndata %f4, %f6, %f20 316 faligndata %f4, %f6, %f20 317 EX_LD_FP(LOAD(ldd, %o1 + 0x030, %f12), 317 EX_LD_FP(LOAD(ldd, %o1 + 0x030, %f12), U3_retl_o2_plus_o3_sll_6_plus_0x40) 318 faligndata %f6, %f8, %f22 318 faligndata %f6, %f8, %f22 319 EX_LD_FP(LOAD(ldd, %o1 + 0x038, %f14), 319 EX_LD_FP(LOAD(ldd, %o1 + 0x038, %f14), U3_retl_o2_plus_o3_sll_6_plus_0x40) 320 faligndata %f8, %f10, %f24 320 faligndata %f8, %f10, %f24 321 cmp %g1, 0 321 cmp %g1, 0 322 be,pt %XCC, 1f 322 be,pt %XCC, 1f 323 add %o0, 0x40, %o0 323 add %o0, 0x40, %o0 324 EX_LD_FP(LOAD(ldd, %o1 + 0x040, %f0), 324 EX_LD_FP(LOAD(ldd, %o1 + 0x040, %f0), U3_retl_o2_plus_o3_sll_6_plus_0x40) 325 1: faligndata %f10, %f12, %f26 325 1: faligndata %f10, %f12, %f26 326 faligndata %f12, %f14, %f28 326 faligndata %f12, %f14, %f28 327 faligndata %f14, %f0, %f30 327 faligndata %f14, %f0, %f30 328 EX_ST_FP(STORE_BLK(%f16, %o0), U3_retl 328 EX_ST_FP(STORE_BLK(%f16, %o0), U3_retl_o2_plus_o3_sll_6_plus_0x40) 329 add %o0, 0x40, %o0 329 add %o0, 0x40, %o0 330 add %o1, 0x40, %o1 330 add %o1, 0x40, %o1 331 membar #Sync 331 membar #Sync 332 332 333 /* Now we copy the (len modulo 64) byt 333 /* Now we copy the (len modulo 64) bytes at the end. 334 * Note how we borrow the %f0 loaded a 334 * Note how we borrow the %f0 loaded above. 335 * 335 * 336 * Also notice how this code is carefu 336 * Also notice how this code is careful not to perform a 337 * load past the end of the src buffer 337 * load past the end of the src buffer. 338 */ 338 */ 339 and %o2, 0x3f, %o2 339 and %o2, 0x3f, %o2 340 andcc %o2, 0x38, %g2 340 andcc %o2, 0x38, %g2 341 be,pn %XCC, 2f 341 be,pn %XCC, 2f 342 subcc %g2, 0x8, %g2 342 subcc %g2, 0x8, %g2 343 be,pn %XCC, 2f 343 be,pn %XCC, 2f 344 cmp %g1, 0 344 cmp %g1, 0 345 345 346 sub %o2, %g2, %o2 346 sub %o2, %g2, %o2 347 be,a,pt %XCC, 1f 347 be,a,pt %XCC, 1f 348 EX_LD_FP(LOAD(ldd, %o1 + 0x00, %f0), 348 EX_LD_FP(LOAD(ldd, %o1 + 0x00, %f0), U3_retl_o2_plus_g2) 349 349 350 1: EX_LD_FP(LOAD(ldd, %o1 + 0x08, %f2), U 350 1: EX_LD_FP(LOAD(ldd, %o1 + 0x08, %f2), U3_retl_o2_plus_g2) 351 add %o1, 0x8, %o1 351 add %o1, 0x8, %o1 352 subcc %g2, 0x8, %g2 352 subcc %g2, 0x8, %g2 353 faligndata %f0, %f2, %f8 353 faligndata %f0, %f2, %f8 354 EX_ST_FP(STORE(std, %f8, %o0), U3_retl 354 EX_ST_FP(STORE(std, %f8, %o0), U3_retl_o2_plus_g2_plus_8) 355 be,pn %XCC, 2f 355 be,pn %XCC, 2f 356 add %o0, 0x8, %o0 356 add %o0, 0x8, %o0 357 EX_LD_FP(LOAD(ldd, %o1 + 0x08, %f0), U 357 EX_LD_FP(LOAD(ldd, %o1 + 0x08, %f0), U3_retl_o2_plus_g2) 358 add %o1, 0x8, %o1 358 add %o1, 0x8, %o1 359 subcc %g2, 0x8, %g2 359 subcc %g2, 0x8, %g2 360 faligndata %f2, %f0, %f8 360 faligndata %f2, %f0, %f8 361 EX_ST_FP(STORE(std, %f8, %o0), U3_retl 361 EX_ST_FP(STORE(std, %f8, %o0), U3_retl_o2_plus_g2_plus_8) 362 bne,pn %XCC, 1b 362 bne,pn %XCC, 1b 363 add %o0, 0x8, %o0 363 add %o0, 0x8, %o0 364 364 365 /* If anything is left, we copy it one 365 /* If anything is left, we copy it one byte at a time. 366 * Note that %g1 is (src & 0x3) saved 366 * Note that %g1 is (src & 0x3) saved above before the 367 * alignaddr was performed. 367 * alignaddr was performed. 368 */ 368 */ 369 2: 369 2: 370 cmp %o2, 0 370 cmp %o2, 0 371 add %o1, %g1, %o1 371 add %o1, %g1, %o1 372 VISExitHalf 372 VISExitHalf 373 be,pn %XCC, end_return 373 be,pn %XCC, end_return 374 sub %o0, %o1, %o3 374 sub %o0, %o1, %o3 375 375 376 andcc %g1, 0x7, %g0 376 andcc %g1, 0x7, %g0 377 bne,pn %icc, 90f 377 bne,pn %icc, 90f 378 andcc %o2, 0x8, %g0 378 andcc %o2, 0x8, %g0 379 be,pt %icc, 1f 379 be,pt %icc, 1f 380 nop 380 nop 381 EX_LD(LOAD(ldx, %o1, %o5), U3_retl_o2) 381 EX_LD(LOAD(ldx, %o1, %o5), U3_retl_o2) 382 EX_ST(STORE(stx, %o5, %o1 + %o3), U3_r 382 EX_ST(STORE(stx, %o5, %o1 + %o3), U3_retl_o2) 383 add %o1, 0x8, %o1 383 add %o1, 0x8, %o1 384 sub %o2, 8, %o2 384 sub %o2, 8, %o2 385 385 386 1: andcc %o2, 0x4, %g0 386 1: andcc %o2, 0x4, %g0 387 be,pt %icc, 1f 387 be,pt %icc, 1f 388 nop 388 nop 389 EX_LD(LOAD(lduw, %o1, %o5), U3_retl_o2 389 EX_LD(LOAD(lduw, %o1, %o5), U3_retl_o2) 390 EX_ST(STORE(stw, %o5, %o1 + %o3), U3_r 390 EX_ST(STORE(stw, %o5, %o1 + %o3), U3_retl_o2) 391 add %o1, 0x4, %o1 391 add %o1, 0x4, %o1 392 sub %o2, 4, %o2 392 sub %o2, 4, %o2 393 393 394 1: andcc %o2, 0x2, %g0 394 1: andcc %o2, 0x2, %g0 395 be,pt %icc, 1f 395 be,pt %icc, 1f 396 nop 396 nop 397 EX_LD(LOAD(lduh, %o1, %o5), U3_retl_o2 397 EX_LD(LOAD(lduh, %o1, %o5), U3_retl_o2) 398 EX_ST(STORE(sth, %o5, %o1 + %o3), U3_r 398 EX_ST(STORE(sth, %o5, %o1 + %o3), U3_retl_o2) 399 add %o1, 0x2, %o1 399 add %o1, 0x2, %o1 400 sub %o2, 2, %o2 400 sub %o2, 2, %o2 401 401 402 1: andcc %o2, 0x1, %g0 402 1: andcc %o2, 0x1, %g0 403 be,pt %icc, end_return 403 be,pt %icc, end_return 404 nop 404 nop 405 EX_LD(LOAD(ldub, %o1, %o5), U3_retl_o2 405 EX_LD(LOAD(ldub, %o1, %o5), U3_retl_o2) 406 ba,pt %xcc, end_return 406 ba,pt %xcc, end_return 407 EX_ST(STORE(stb, %o5, %o1 + %o3), U3_ 407 EX_ST(STORE(stb, %o5, %o1 + %o3), U3_retl_o2) 408 408 409 .align 64 409 .align 64 410 /* 16 <= len < 192 */ 410 /* 16 <= len < 192 */ 411 less_than_192: 411 less_than_192: 412 bne,pn %XCC, 75f 412 bne,pn %XCC, 75f 413 sub %o0, %o1, %o3 413 sub %o0, %o1, %o3 414 414 415 72: 415 72: 416 andn %o2, 0xf, GLOBAL_SPARE 416 andn %o2, 0xf, GLOBAL_SPARE 417 and %o2, 0xf, %o2 417 and %o2, 0xf, %o2 418 1: subcc GLOBAL_SPARE, 0x10, GL 418 1: subcc GLOBAL_SPARE, 0x10, GLOBAL_SPARE 419 EX_LD(LOAD(ldx, %o1 + 0x00, %o5), U3_r 419 EX_LD(LOAD(ldx, %o1 + 0x00, %o5), U3_retl_o2_plus_GS_plus_0x10) 420 EX_LD(LOAD(ldx, %o1 + 0x08, %g1), U3_r 420 EX_LD(LOAD(ldx, %o1 + 0x08, %g1), U3_retl_o2_plus_GS_plus_0x10) 421 EX_ST(STORE(stx, %o5, %o1 + %o3), U3_r 421 EX_ST(STORE(stx, %o5, %o1 + %o3), U3_retl_o2_plus_GS_plus_0x10) 422 add %o1, 0x8, %o1 422 add %o1, 0x8, %o1 423 EX_ST(STORE(stx, %g1, %o1 + %o3), U3_r 423 EX_ST(STORE(stx, %g1, %o1 + %o3), U3_retl_o2_plus_GS_plus_0x08) 424 bgu,pt %XCC, 1b 424 bgu,pt %XCC, 1b 425 add %o1, 0x8, %o1 425 add %o1, 0x8, %o1 426 73: andcc %o2, 0x8, %g0 426 73: andcc %o2, 0x8, %g0 427 be,pt %XCC, 1f 427 be,pt %XCC, 1f 428 nop 428 nop 429 sub %o2, 0x8, %o2 429 sub %o2, 0x8, %o2 430 EX_LD(LOAD(ldx, %o1, %o5), U3_retl_o2_ 430 EX_LD(LOAD(ldx, %o1, %o5), U3_retl_o2_plus_8) 431 EX_ST(STORE(stx, %o5, %o1 + %o3), U3_r 431 EX_ST(STORE(stx, %o5, %o1 + %o3), U3_retl_o2_plus_8) 432 add %o1, 0x8, %o1 432 add %o1, 0x8, %o1 433 1: andcc %o2, 0x4, %g0 433 1: andcc %o2, 0x4, %g0 434 be,pt %XCC, 1f 434 be,pt %XCC, 1f 435 nop 435 nop 436 sub %o2, 0x4, %o2 436 sub %o2, 0x4, %o2 437 EX_LD(LOAD(lduw, %o1, %o5), U3_retl_o2 437 EX_LD(LOAD(lduw, %o1, %o5), U3_retl_o2_plus_4) 438 EX_ST(STORE(stw, %o5, %o1 + %o3), U3_r 438 EX_ST(STORE(stw, %o5, %o1 + %o3), U3_retl_o2_plus_4) 439 add %o1, 0x4, %o1 439 add %o1, 0x4, %o1 440 1: cmp %o2, 0 440 1: cmp %o2, 0 441 be,pt %XCC, end_return 441 be,pt %XCC, end_return 442 nop 442 nop 443 ba,pt %xcc, 90f 443 ba,pt %xcc, 90f 444 nop 444 nop 445 445 446 75: 446 75: 447 andcc %o0, 0x7, %g1 447 andcc %o0, 0x7, %g1 448 sub %g1, 0x8, %g1 448 sub %g1, 0x8, %g1 449 be,pn %icc, 2f 449 be,pn %icc, 2f 450 sub %g0, %g1, %g1 450 sub %g0, %g1, %g1 451 sub %o2, %g1, %o2 451 sub %o2, %g1, %o2 452 452 453 1: subcc %g1, 1, %g1 453 1: subcc %g1, 1, %g1 454 EX_LD(LOAD(ldub, %o1, %o5), U3_retl_o2 454 EX_LD(LOAD(ldub, %o1, %o5), U3_retl_o2_plus_g1_plus_1) 455 EX_ST(STORE(stb, %o5, %o1 + %o3), U3_r 455 EX_ST(STORE(stb, %o5, %o1 + %o3), U3_retl_o2_plus_g1_plus_1) 456 bgu,pt %icc, 1b 456 bgu,pt %icc, 1b 457 add %o1, 1, %o1 457 add %o1, 1, %o1 458 458 459 2: add %o1, %o3, %o0 459 2: add %o1, %o3, %o0 460 andcc %o1, 0x7, %g1 460 andcc %o1, 0x7, %g1 461 bne,pt %icc, 8f 461 bne,pt %icc, 8f 462 sll %g1, 3, %g1 462 sll %g1, 3, %g1 463 463 464 cmp %o2, 16 464 cmp %o2, 16 465 bgeu,pt %icc, 72b 465 bgeu,pt %icc, 72b 466 nop 466 nop 467 ba,a,pt %xcc, 73b 467 ba,a,pt %xcc, 73b 468 468 469 8: mov 64, %o3 469 8: mov 64, %o3 470 andn %o1, 0x7, %o1 470 andn %o1, 0x7, %o1 471 EX_LD(LOAD(ldx, %o1, %g2), U3_retl_o2) 471 EX_LD(LOAD(ldx, %o1, %g2), U3_retl_o2) 472 sub %o3, %g1, %o3 472 sub %o3, %g1, %o3 473 andn %o2, 0x7, GLOBAL_SPARE 473 andn %o2, 0x7, GLOBAL_SPARE 474 sllx %g2, %g1, %g2 474 sllx %g2, %g1, %g2 475 1: EX_LD(LOAD(ldx, %o1 + 0x8, %g3), U3_re 475 1: EX_LD(LOAD(ldx, %o1 + 0x8, %g3), U3_retl_o2_and_7_plus_GS) 476 subcc GLOBAL_SPARE, 0x8, GLO 476 subcc GLOBAL_SPARE, 0x8, GLOBAL_SPARE 477 add %o1, 0x8, %o1 477 add %o1, 0x8, %o1 478 srlx %g3, %o3, %o5 478 srlx %g3, %o3, %o5 479 or %o5, %g2, %o5 479 or %o5, %g2, %o5 480 EX_ST(STORE(stx, %o5, %o0), U3_retl_o2 480 EX_ST(STORE(stx, %o5, %o0), U3_retl_o2_and_7_plus_GS_plus_8) 481 add %o0, 0x8, %o0 481 add %o0, 0x8, %o0 482 bgu,pt %icc, 1b 482 bgu,pt %icc, 1b 483 sllx %g3, %g1, %g2 483 sllx %g3, %g1, %g2 484 484 485 srl %g1, 3, %g1 485 srl %g1, 3, %g1 486 andcc %o2, 0x7, %o2 486 andcc %o2, 0x7, %o2 487 be,pn %icc, end_return 487 be,pn %icc, end_return 488 add %o1, %g1, %o1 488 add %o1, %g1, %o1 489 ba,pt %xcc, 90f 489 ba,pt %xcc, 90f 490 sub %o0, %o1, %o3 490 sub %o0, %o1, %o3 491 491 492 .align 64 492 .align 64 493 /* 0 < len < 16 */ 493 /* 0 < len < 16 */ 494 less_than_16: 494 less_than_16: 495 andcc %o3, 0x3, %g0 495 andcc %o3, 0x3, %g0 496 bne,pn %XCC, 90f 496 bne,pn %XCC, 90f 497 sub %o0, %o1, %o3 497 sub %o0, %o1, %o3 498 498 499 1: 499 1: 500 subcc %o2, 4, %o2 500 subcc %o2, 4, %o2 501 EX_LD(LOAD(lduw, %o1, %g1), U3_retl_o2 501 EX_LD(LOAD(lduw, %o1, %g1), U3_retl_o2_plus_4) 502 EX_ST(STORE(stw, %g1, %o1 + %o3), U3_r 502 EX_ST(STORE(stw, %g1, %o1 + %o3), U3_retl_o2_plus_4) 503 bgu,pt %XCC, 1b 503 bgu,pt %XCC, 1b 504 add %o1, 4, %o1 504 add %o1, 4, %o1 505 505 506 end_return: 506 end_return: 507 retl 507 retl 508 mov EX_RETVAL(%o4), %o0 508 mov EX_RETVAL(%o4), %o0 509 509 510 .align 32 510 .align 32 511 90: 511 90: 512 subcc %o2, 1, %o2 512 subcc %o2, 1, %o2 513 EX_LD(LOAD(ldub, %o1, %g1), U3_retl_o2 513 EX_LD(LOAD(ldub, %o1, %g1), U3_retl_o2_plus_1) 514 EX_ST(STORE(stb, %g1, %o1 + %o3), U3_r 514 EX_ST(STORE(stb, %g1, %o1 + %o3), U3_retl_o2_plus_1) 515 bgu,pt %XCC, 90b 515 bgu,pt %XCC, 90b 516 add %o1, 1, %o1 516 add %o1, 1, %o1 517 retl 517 retl 518 mov EX_RETVAL(%o4), %o0 518 mov EX_RETVAL(%o4), %o0 519 519 520 .size FUNC_NAME, .-FUNC_NAME 520 .size FUNC_NAME, .-FUNC_NAME
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.