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