1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 /* 1 /* 3 * arch/alpha/lib/ev6-stxncpy.S 2 * arch/alpha/lib/ev6-stxncpy.S 4 * 21264 version contributed by Rick Gorton <ri 3 * 21264 version contributed by Rick Gorton <rick.gorton@api-networks.com> 5 * 4 * 6 * Copy no more than COUNT bytes of the null-t 5 * Copy no more than COUNT bytes of the null-terminated string from 7 * SRC to DST. 6 * SRC to DST. 8 * 7 * 9 * This is an internal routine used by strncpy 8 * This is an internal routine used by strncpy, stpncpy, and strncat. 10 * As such, it uses special linkage convention 9 * As such, it uses special linkage conventions to make implementation 11 * of these public functions more efficient. 10 * of these public functions more efficient. 12 * 11 * 13 * On input: 12 * On input: 14 * t9 = return address 13 * t9 = return address 15 * a0 = DST 14 * a0 = DST 16 * a1 = SRC 15 * a1 = SRC 17 * a2 = COUNT 16 * a2 = COUNT 18 * 17 * 19 * Furthermore, COUNT may not be zero. 18 * Furthermore, COUNT may not be zero. 20 * 19 * 21 * On output: 20 * On output: 22 * t0 = last word written 21 * t0 = last word written 23 * t10 = bitmask (with one bit set) indic 22 * t10 = bitmask (with one bit set) indicating the byte position of 24 * the end of the range specified b 23 * the end of the range specified by COUNT 25 * t12 = bitmask (with one bit set) indic 24 * t12 = bitmask (with one bit set) indicating the last byte written 26 * a0 = unaligned address of the last *w 25 * a0 = unaligned address of the last *word* written 27 * a2 = the number of full words left in 26 * a2 = the number of full words left in COUNT 28 * 27 * 29 * Furthermore, v0, a3-a5, t11, and $at are un 28 * Furthermore, v0, a3-a5, t11, and $at are untouched. 30 * 29 * 31 * Much of the information about 21264 schedul 30 * Much of the information about 21264 scheduling/coding comes from: 32 * Compiler Writer's Guide for the Alpha 31 * Compiler Writer's Guide for the Alpha 21264 33 * abbreviated as 'CWG' in other comments 32 * abbreviated as 'CWG' in other comments here 34 * ftp.digital.com/pub/Digital/info/semic 33 * ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.html 35 * Scheduling notation: 34 * Scheduling notation: 36 * E - either cluster 35 * E - either cluster 37 * U - upper subcluster; U0 - subcl 36 * U - upper subcluster; U0 - subcluster U0; U1 - subcluster U1 38 * L - lower subcluster; L0 - subcl 37 * L - lower subcluster; L0 - subcluster L0; L1 - subcluster L1 39 * Try not to change the actual algorithm if p 38 * Try not to change the actual algorithm if possible for consistency. 40 */ 39 */ 41 40 42 #include <asm/regdef.h> 41 #include <asm/regdef.h> 43 42 44 .set noat 43 .set noat 45 .set noreorder 44 .set noreorder 46 45 47 .text 46 .text 48 47 49 /* There is a problem with either gdb (as of 4 48 /* There is a problem with either gdb (as of 4.16) or gas (as of 2.7) that 50 doesn't like putting the entry point for a 49 doesn't like putting the entry point for a procedure somewhere in the 51 middle of the procedure descriptor. Work a 50 middle of the procedure descriptor. Work around this by putting the 52 aligned copy in its own procedure descripto 51 aligned copy in its own procedure descriptor */ 53 52 54 53 55 .ent stxncpy_aligned 54 .ent stxncpy_aligned 56 .align 4 55 .align 4 57 stxncpy_aligned: 56 stxncpy_aligned: 58 .frame sp, 0, t9, 0 57 .frame sp, 0, t9, 0 59 .prologue 0 58 .prologue 0 60 59 61 /* On entry to this basic block: 60 /* On entry to this basic block: 62 t0 == the first destination word fo 61 t0 == the first destination word for masking back in 63 t1 == the first source word. */ 62 t1 == the first source word. */ 64 63 65 /* Create the 1st output word and dete 64 /* Create the 1st output word and detect 0's in the 1st input word. */ 66 lda t2, -1 # E : build a 65 lda t2, -1 # E : build a mask against false zero 67 mskqh t2, a1, t2 # U : detect 66 mskqh t2, a1, t2 # U : detection in the src word (stall) 68 mskqh t1, a1, t3 # U : 67 mskqh t1, a1, t3 # U : 69 ornot t1, t2, t2 # E : (stall) 68 ornot t1, t2, t2 # E : (stall) 70 69 71 mskql t0, a1, t0 # U : assemble 70 mskql t0, a1, t0 # U : assemble the first output word 72 cmpbge zero, t2, t8 # E : bits set 71 cmpbge zero, t2, t8 # E : bits set iff null found 73 or t0, t3, t0 # E : (stall) 72 or t0, t3, t0 # E : (stall) 74 beq a2, $a_eoc # U : 73 beq a2, $a_eoc # U : 75 74 76 bne t8, $a_eos # U : 75 bne t8, $a_eos # U : 77 nop 76 nop 78 nop 77 nop 79 nop 78 nop 80 79 81 /* On entry to this basic block: 80 /* On entry to this basic block: 82 t0 == a source word not containing 81 t0 == a source word not containing a null. */ 83 82 84 /* 83 /* 85 * nops here to: 84 * nops here to: 86 * separate store quads from load 85 * separate store quads from load quads 87 * limit of 1 bcond/quad to permi 86 * limit of 1 bcond/quad to permit training 88 */ 87 */ 89 $a_loop: 88 $a_loop: 90 stq_u t0, 0(a0) # L : 89 stq_u t0, 0(a0) # L : 91 addq a0, 8, a0 # E : 90 addq a0, 8, a0 # E : 92 subq a2, 1, a2 # E : 91 subq a2, 1, a2 # E : 93 nop 92 nop 94 93 95 ldq_u t0, 0(a1) # L : 94 ldq_u t0, 0(a1) # L : 96 addq a1, 8, a1 # E : 95 addq a1, 8, a1 # E : 97 cmpbge zero, t0, t8 # E : 96 cmpbge zero, t0, t8 # E : 98 beq a2, $a_eoc # U : 97 beq a2, $a_eoc # U : 99 98 100 beq t8, $a_loop # U : 99 beq t8, $a_loop # U : 101 nop 100 nop 102 nop 101 nop 103 nop 102 nop 104 103 105 /* Take care of the final (partial) wo 104 /* Take care of the final (partial) word store. At this point 106 the end-of-count bit is set in t8 i 105 the end-of-count bit is set in t8 iff it applies. 107 106 108 On entry to this basic block we hav 107 On entry to this basic block we have: 109 t0 == the source word containing th 108 t0 == the source word containing the null 110 t8 == the cmpbge mask that found it 109 t8 == the cmpbge mask that found it. */ 111 110 112 $a_eos: 111 $a_eos: 113 negq t8, t12 # E : find low 112 negq t8, t12 # E : find low bit set 114 and t8, t12, t12 # E : (stall) 113 and t8, t12, t12 # E : (stall) 115 /* For the sake of the cache, don't re 114 /* For the sake of the cache, don't read a destination word 116 if we're not going to need it. */ 115 if we're not going to need it. */ 117 and t12, 0x80, t6 # E : (stall) 116 and t12, 0x80, t6 # E : (stall) 118 bne t6, 1f # U : (stall) 117 bne t6, 1f # U : (stall) 119 118 120 /* We're doing a partial word store an 119 /* We're doing a partial word store and so need to combine 121 our source and original destination 120 our source and original destination words. */ 122 ldq_u t1, 0(a0) # L : 121 ldq_u t1, 0(a0) # L : 123 subq t12, 1, t6 # E : 122 subq t12, 1, t6 # E : 124 or t12, t6, t8 # E : (stall) 123 or t12, t6, t8 # E : (stall) 125 zapnot t0, t8, t0 # U : clear sr 124 zapnot t0, t8, t0 # U : clear src bytes > null (stall) 126 125 127 zap t1, t8, t1 # .. e1 : clea 126 zap t1, t8, t1 # .. e1 : clear dst bytes <= null 128 or t0, t1, t0 # e1 : (sta 127 or t0, t1, t0 # e1 : (stall) 129 nop 128 nop 130 nop 129 nop 131 130 132 1: stq_u t0, 0(a0) # L : 131 1: stq_u t0, 0(a0) # L : 133 ret (t9) # L0 : Latency 132 ret (t9) # L0 : Latency=3 134 nop 133 nop 135 nop 134 nop 136 135 137 /* Add the end-of-count bit to the eos 136 /* Add the end-of-count bit to the eos detection bitmask. */ 138 $a_eoc: 137 $a_eoc: 139 or t10, t8, t8 # E : 138 or t10, t8, t8 # E : 140 br $a_eos # L0 : Latency 139 br $a_eos # L0 : Latency=3 141 nop 140 nop 142 nop 141 nop 143 142 144 .end stxncpy_aligned 143 .end stxncpy_aligned 145 144 146 .align 4 145 .align 4 147 .ent __stxncpy 146 .ent __stxncpy 148 .globl __stxncpy 147 .globl __stxncpy 149 __stxncpy: 148 __stxncpy: 150 .frame sp, 0, t9, 0 149 .frame sp, 0, t9, 0 151 .prologue 0 150 .prologue 0 152 151 153 /* Are source and destination co-align 152 /* Are source and destination co-aligned? */ 154 xor a0, a1, t1 # E : 153 xor a0, a1, t1 # E : 155 and a0, 7, t0 # E : find des 154 and a0, 7, t0 # E : find dest misalignment 156 and t1, 7, t1 # E : (stall) 155 and t1, 7, t1 # E : (stall) 157 addq a2, t0, a2 # E : bias cou 156 addq a2, t0, a2 # E : bias count by dest misalignment (stall) 158 157 159 subq a2, 1, a2 # E : 158 subq a2, 1, a2 # E : 160 and a2, 7, t2 # E : (stall) 159 and a2, 7, t2 # E : (stall) 161 srl a2, 3, a2 # U : a2 = loo 160 srl a2, 3, a2 # U : a2 = loop counter = (count - 1)/8 (stall) 162 addq zero, 1, t10 # E : 161 addq zero, 1, t10 # E : 163 162 164 sll t10, t2, t10 # U : t10 = bi 163 sll t10, t2, t10 # U : t10 = bitmask of last count byte 165 bne t1, $unaligned # U : 164 bne t1, $unaligned # U : 166 /* We are co-aligned; take care of a p 165 /* We are co-aligned; take care of a partial first word. */ 167 ldq_u t1, 0(a1) # L : load fir 166 ldq_u t1, 0(a1) # L : load first src word 168 addq a1, 8, a1 # E : 167 addq a1, 8, a1 # E : 169 168 170 beq t0, stxncpy_aligned # U : 169 beq t0, stxncpy_aligned # U : avoid loading dest word if not needed 171 ldq_u t0, 0(a0) # L : 170 ldq_u t0, 0(a0) # L : 172 nop 171 nop 173 nop 172 nop 174 173 175 br stxncpy_aligned # .. e1 : 174 br stxncpy_aligned # .. e1 : 176 nop 175 nop 177 nop 176 nop 178 nop 177 nop 179 178 180 179 181 180 182 /* The source and destination are not co-align 181 /* The source and destination are not co-aligned. Align the destination 183 and cope. We have to be very careful about 182 and cope. We have to be very careful about not reading too much and 184 causing a SEGV. */ 183 causing a SEGV. */ 185 184 186 .align 4 185 .align 4 187 $u_head: 186 $u_head: 188 /* We know just enough now to be able 187 /* We know just enough now to be able to assemble the first 189 full source word. We can still fin 188 full source word. We can still find a zero at the end of it 190 that prevents us from outputting th 189 that prevents us from outputting the whole thing. 191 190 192 On entry to this basic block: 191 On entry to this basic block: 193 t0 == the first dest word, unmasked 192 t0 == the first dest word, unmasked 194 t1 == the shifted low bits of the f 193 t1 == the shifted low bits of the first source word 195 t6 == bytemask that is -1 in dest w 194 t6 == bytemask that is -1 in dest word bytes */ 196 195 197 ldq_u t2, 8(a1) # L : Latency= 196 ldq_u t2, 8(a1) # L : Latency=3 load second src word 198 addq a1, 8, a1 # E : 197 addq a1, 8, a1 # E : 199 mskql t0, a0, t0 # U : mask tra 198 mskql t0, a0, t0 # U : mask trailing garbage in dst 200 extqh t2, a1, t4 # U : (3 cycle 199 extqh t2, a1, t4 # U : (3 cycle stall on t2) 201 200 202 or t1, t4, t1 # E : first al 201 or t1, t4, t1 # E : first aligned src word complete (stall) 203 mskqh t1, a0, t1 # U : mask lea 202 mskqh t1, a0, t1 # U : mask leading garbage in src (stall) 204 or t0, t1, t0 # E : first ou 203 or t0, t1, t0 # E : first output word complete (stall) 205 or t0, t6, t6 # E : mask ori 204 or t0, t6, t6 # E : mask original data for zero test (stall) 206 205 207 cmpbge zero, t6, t8 # E : 206 cmpbge zero, t6, t8 # E : 208 beq a2, $u_eocfin # U : 207 beq a2, $u_eocfin # U : 209 lda t6, -1 # E : 208 lda t6, -1 # E : 210 nop 209 nop 211 210 212 bne t8, $u_final # U : 211 bne t8, $u_final # U : 213 mskql t6, a1, t6 # U : mask out 212 mskql t6, a1, t6 # U : mask out bits already seen 214 stq_u t0, 0(a0) # L : store fi 213 stq_u t0, 0(a0) # L : store first output word 215 or t6, t2, t2 # E : (stall) 214 or t6, t2, t2 # E : (stall) 216 215 217 cmpbge zero, t2, t8 # E : find nul 216 cmpbge zero, t2, t8 # E : find nulls in second partial 218 addq a0, 8, a0 # E : 217 addq a0, 8, a0 # E : 219 subq a2, 1, a2 # E : 218 subq a2, 1, a2 # E : 220 bne t8, $u_late_head_exit # U : 219 bne t8, $u_late_head_exit # U : 221 220 222 /* Finally, we've got all the stupid l 221 /* Finally, we've got all the stupid leading edge cases taken care 223 of and we can set up to enter the m 222 of and we can set up to enter the main loop. */ 224 extql t2, a1, t1 # U : position 223 extql t2, a1, t1 # U : position hi-bits of lo word 225 beq a2, $u_eoc # U : 224 beq a2, $u_eoc # U : 226 ldq_u t2, 8(a1) # L : read nex 225 ldq_u t2, 8(a1) # L : read next high-order source word 227 addq a1, 8, a1 # E : 226 addq a1, 8, a1 # E : 228 227 229 extqh t2, a1, t0 # U : position 228 extqh t2, a1, t0 # U : position lo-bits of hi word (stall) 230 cmpbge zero, t2, t8 # E : 229 cmpbge zero, t2, t8 # E : 231 nop 230 nop 232 bne t8, $u_eos # U : 231 bne t8, $u_eos # U : 233 232 234 /* Unaligned copy main loop. In order 233 /* Unaligned copy main loop. In order to avoid reading too much, 235 the loop is structured to detect ze 234 the loop is structured to detect zeros in aligned source words. 236 This has, unfortunately, effectivel 235 This has, unfortunately, effectively pulled half of a loop 237 iteration out into the head and hal 236 iteration out into the head and half into the tail, but it does 238 prevent nastiness from accumulating 237 prevent nastiness from accumulating in the very thing we want 239 to run as fast as possible. 238 to run as fast as possible. 240 239 241 On entry to this basic block: 240 On entry to this basic block: 242 t0 == the shifted low-order bits fr 241 t0 == the shifted low-order bits from the current source word 243 t1 == the shifted high-order bits f 242 t1 == the shifted high-order bits from the previous source word 244 t2 == the unshifted current source 243 t2 == the unshifted current source word 245 244 246 We further know that t2 does not co 245 We further know that t2 does not contain a null terminator. */ 247 246 248 .align 4 247 .align 4 249 $u_loop: 248 $u_loop: 250 or t0, t1, t0 # E : current 249 or t0, t1, t0 # E : current dst word now complete 251 subq a2, 1, a2 # E : decremen 250 subq a2, 1, a2 # E : decrement word count 252 extql t2, a1, t1 # U : extract 251 extql t2, a1, t1 # U : extract low bits for next time 253 addq a0, 8, a0 # E : 252 addq a0, 8, a0 # E : 254 253 255 stq_u t0, -8(a0) # U : save the 254 stq_u t0, -8(a0) # U : save the current word 256 beq a2, $u_eoc # U : 255 beq a2, $u_eoc # U : 257 ldq_u t2, 8(a1) # U : Latency= 256 ldq_u t2, 8(a1) # U : Latency=3 load high word for next time 258 addq a1, 8, a1 # E : 257 addq a1, 8, a1 # E : 259 258 260 extqh t2, a1, t0 # U : extract 259 extqh t2, a1, t0 # U : extract low bits (2 cycle stall) 261 cmpbge zero, t2, t8 # E : test new 260 cmpbge zero, t2, t8 # E : test new word for eos 262 nop 261 nop 263 beq t8, $u_loop # U : 262 beq t8, $u_loop # U : 264 263 265 /* We've found a zero somewhere in the 264 /* We've found a zero somewhere in the source word we just read. 266 If it resides in the lower half, we 265 If it resides in the lower half, we have one (probably partial) 267 word to write out, and if it reside 266 word to write out, and if it resides in the upper half, we 268 have one full and one partial word 267 have one full and one partial word left to write out. 269 268 270 On entry to this basic block: 269 On entry to this basic block: 271 t0 == the shifted low-order bits fr 270 t0 == the shifted low-order bits from the current source word 272 t1 == the shifted high-order bits f 271 t1 == the shifted high-order bits from the previous source word 273 t2 == the unshifted current source 272 t2 == the unshifted current source word. */ 274 $u_eos: 273 $u_eos: 275 or t0, t1, t0 # E : first (p 274 or t0, t1, t0 # E : first (partial) source word complete 276 nop 275 nop 277 cmpbge zero, t0, t8 # E : is the n 276 cmpbge zero, t0, t8 # E : is the null in this first bit? (stall) 278 bne t8, $u_final # U : (stall) 277 bne t8, $u_final # U : (stall) 279 278 280 stq_u t0, 0(a0) # L : the null 279 stq_u t0, 0(a0) # L : the null was in the high-order bits 281 addq a0, 8, a0 # E : 280 addq a0, 8, a0 # E : 282 subq a2, 1, a2 # E : 281 subq a2, 1, a2 # E : 283 nop 282 nop 284 283 285 $u_late_head_exit: 284 $u_late_head_exit: 286 extql t2, a1, t0 # U : 285 extql t2, a1, t0 # U : 287 cmpbge zero, t0, t8 # E : 286 cmpbge zero, t0, t8 # E : 288 or t8, t10, t6 # E : (stall) 287 or t8, t10, t6 # E : (stall) 289 cmoveq a2, t6, t8 # E : Latency= 288 cmoveq a2, t6, t8 # E : Latency=2, extra map slot (stall) 290 289 291 /* Take care of a final (probably part 290 /* Take care of a final (probably partial) result word. 292 On entry to this basic block: 291 On entry to this basic block: 293 t0 == assembled source word 292 t0 == assembled source word 294 t8 == cmpbge mask that found the nu 293 t8 == cmpbge mask that found the null. */ 295 $u_final: 294 $u_final: 296 negq t8, t6 # E : isolate 295 negq t8, t6 # E : isolate low bit set 297 and t6, t8, t12 # E : (stall) 296 and t6, t8, t12 # E : (stall) 298 and t12, 0x80, t6 # E : avoid de 297 and t12, 0x80, t6 # E : avoid dest word load if we can (stall) 299 bne t6, 1f # U : (stall) 298 bne t6, 1f # U : (stall) 300 299 301 ldq_u t1, 0(a0) # L : 300 ldq_u t1, 0(a0) # L : 302 subq t12, 1, t6 # E : 301 subq t12, 1, t6 # E : 303 or t6, t12, t8 # E : (stall) 302 or t6, t12, t8 # E : (stall) 304 zapnot t0, t8, t0 # U : kill sou 303 zapnot t0, t8, t0 # U : kill source bytes > null 305 304 306 zap t1, t8, t1 # U : kill des 305 zap t1, t8, t1 # U : kill dest bytes <= null 307 or t0, t1, t0 # E : (stall) 306 or t0, t1, t0 # E : (stall) 308 nop 307 nop 309 nop 308 nop 310 309 311 1: stq_u t0, 0(a0) # L : 310 1: stq_u t0, 0(a0) # L : 312 ret (t9) # L0 : Latency 311 ret (t9) # L0 : Latency=3 313 312 314 /* Got to end-of-count before end of 313 /* Got to end-of-count before end of string. 315 On entry to this basic block: 314 On entry to this basic block: 316 t1 == the shifted high-order bits 315 t1 == the shifted high-order bits from the previous source word */ 317 $u_eoc: 316 $u_eoc: 318 and a1, 7, t6 # E : avoid fi 317 and a1, 7, t6 # E : avoid final load if possible 319 sll t10, t6, t6 # U : (stall) 318 sll t10, t6, t6 # U : (stall) 320 and t6, 0xff, t6 # E : (stall) 319 and t6, 0xff, t6 # E : (stall) 321 bne t6, 1f # U : (stall) 320 bne t6, 1f # U : (stall) 322 321 323 ldq_u t2, 8(a1) # L : load fin 322 ldq_u t2, 8(a1) # L : load final src word 324 nop 323 nop 325 extqh t2, a1, t0 # U : extract 324 extqh t2, a1, t0 # U : extract low bits for last word (stall) 326 or t1, t0, t1 # E : (stall) 325 or t1, t0, t1 # E : (stall) 327 326 328 1: cmpbge zero, t1, t8 # E : 327 1: cmpbge zero, t1, t8 # E : 329 mov t1, t0 # E : 328 mov t1, t0 # E : 330 329 331 $u_eocfin: # end-of-count 330 $u_eocfin: # end-of-count, final word 332 or t10, t8, t8 # E : 331 or t10, t8, t8 # E : 333 br $u_final # L0 : Latency 332 br $u_final # L0 : Latency=3 334 333 335 /* Unaligned copy entry point. */ 334 /* Unaligned copy entry point. */ 336 .align 4 335 .align 4 337 $unaligned: 336 $unaligned: 338 337 339 ldq_u t1, 0(a1) # L : load fir 338 ldq_u t1, 0(a1) # L : load first source word 340 and a0, 7, t4 # E : find des 339 and a0, 7, t4 # E : find dest misalignment 341 and a1, 7, t5 # E : find src 340 and a1, 7, t5 # E : find src misalignment 342 /* Conditionally load the first destin 341 /* Conditionally load the first destination word and a bytemask 343 with 0xff indicating that the desti 342 with 0xff indicating that the destination byte is sacrosanct. */ 344 mov zero, t0 # E : 343 mov zero, t0 # E : 345 344 346 mov zero, t6 # E : 345 mov zero, t6 # E : 347 beq t4, 1f # U : 346 beq t4, 1f # U : 348 ldq_u t0, 0(a0) # L : 347 ldq_u t0, 0(a0) # L : 349 lda t6, -1 # E : 348 lda t6, -1 # E : 350 349 351 mskql t6, a0, t6 # U : 350 mskql t6, a0, t6 # U : 352 nop 351 nop 353 nop 352 nop 354 subq a1, t4, a1 # E : sub dest 353 subq a1, t4, a1 # E : sub dest misalignment from src addr 355 354 356 /* If source misalignment is larger th 355 /* If source misalignment is larger than dest misalignment, we need 357 extra startup checks to avoid SEGV. 356 extra startup checks to avoid SEGV. */ 358 357 359 1: cmplt t4, t5, t12 # E : 358 1: cmplt t4, t5, t12 # E : 360 extql t1, a1, t1 # U : shift sr 359 extql t1, a1, t1 # U : shift src into place 361 lda t2, -1 # E : for crea 360 lda t2, -1 # E : for creating masks later 362 beq t12, $u_head # U : (stall) 361 beq t12, $u_head # U : (stall) 363 362 364 extql t2, a1, t2 # U : 363 extql t2, a1, t2 # U : 365 cmpbge zero, t1, t8 # E : is there 364 cmpbge zero, t1, t8 # E : is there a zero? 366 andnot t2, t6, t2 # E : dest mas !! 365 andnot t2, t6, t12 # E : dest mask for a single word copy 367 or t8, t10, t5 # E : test for 366 or t8, t10, t5 # E : test for end-of-count too 368 367 369 cmpbge zero, t2, t3 # E : 368 cmpbge zero, t2, t3 # E : 370 cmoveq a2, t5, t8 # E : Latency= 369 cmoveq a2, t5, t8 # E : Latency=2, extra map slot 371 nop # E : keep wit 370 nop # E : keep with cmoveq 372 andnot t8, t3, t8 # E : (stall) 371 andnot t8, t3, t8 # E : (stall) 373 372 374 beq t8, $u_head # U : 373 beq t8, $u_head # U : 375 /* At this point we've found a zero in 374 /* At this point we've found a zero in the first partial word of 376 the source. We need to isolate the 375 the source. We need to isolate the valid source data and mask 377 it into the original destination da 376 it into the original destination data. (Incidentally, we know 378 that we'll need at least one byte o 377 that we'll need at least one byte of that original dest word.) */ 379 ldq_u t0, 0(a0) # L : 378 ldq_u t0, 0(a0) # L : 380 negq t8, t6 # E : build bi 379 negq t8, t6 # E : build bitmask of bytes <= zero 381 mskqh t1, t4, t1 # U : 380 mskqh t1, t4, t1 # U : 382 381 383 and t6, t8, t12 # E : !! 382 and t6, t8, t2 # E : 384 subq t12, 1, t6 # E : (stall) !! 383 subq t2, 1, t6 # E : (stall) 385 or t6, t12, t8 # E : (stall) !! 384 or t6, t2, t8 # E : (stall) 386 zapnot t2, t8, t2 # U : prepare !! 385 zapnot t12, t8, t12 # U : prepare source word; mirror changes (stall) 387 386 388 zapnot t1, t8, t1 # U : to sourc 387 zapnot t1, t8, t1 # U : to source validity mask 389 andnot t0, t2, t0 # E : zero pla !! 388 andnot t0, t12, t0 # E : zero place for source to reside 390 or t0, t1, t0 # E : and put 389 or t0, t1, t0 # E : and put it there (stall both t0, t1) 391 stq_u t0, 0(a0) # L : (stall) 390 stq_u t0, 0(a0) # L : (stall) 392 391 393 ret (t9) # L0 : Latency 392 ret (t9) # L0 : Latency=3 394 nop 393 nop 395 nop 394 nop 396 nop 395 nop 397 396 398 .end __stxncpy 397 .end __stxncpy
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.