Commit c37e4ef0 authored by Richard Henderson's avatar Richard Henderson

[ALPHA] Fix stxncpy zapping bytes outside the string.

From Ivan Kokshaysky <ink@jurassic.park.msu.ru>.
parent dd263728
...@@ -360,9 +360,9 @@ $unaligned: ...@@ -360,9 +360,9 @@ $unaligned:
lda t2, -1 # E : for creating masks later lda t2, -1 # E : for creating masks later
beq t12, $u_head # U : (stall) beq t12, $u_head # U : (stall)
nop
cmpbge zero, t1, t8 # E : is there a zero?
extql t2, a1, t2 # U : extql t2, a1, t2 # U :
cmpbge zero, t1, t8 # E : is there a zero?
andnot t2, t6, t12 # E : dest mask for a single word copy
or t8, t10, t5 # E : test for end-of-count too or t8, t10, t5 # E : test for end-of-count too
cmpbge zero, t2, t3 # E : cmpbge zero, t2, t3 # E :
...@@ -379,13 +379,13 @@ $unaligned: ...@@ -379,13 +379,13 @@ $unaligned:
negq t8, t6 # E : build bitmask of bytes <= zero negq t8, t6 # E : build bitmask of bytes <= zero
mskqh t1, t4, t1 # U : mskqh t1, t4, t1 # U :
and t6, t8, t12 # E : and t6, t8, t2 # E :
subq t12, 1, t6 # E : (stall) subq t2, 1, t6 # E : (stall)
or t6, t12, t8 # E : (stall) or t6, t2, t8 # E : (stall)
zapnot t2, t8, t2 # U : prepare source word; mirror changes (stall) zapnot t12, t8, t12 # U : prepare source word; mirror changes (stall)
zapnot t1, t8, t1 # U : to source validity mask zapnot t1, t8, t1 # U : to source validity mask
andnot t0, t2, t0 # E : zero place for source to reside andnot t0, t12, t0 # E : zero place for source to reside
or t0, t1, t0 # E : and put it there (stall both t0, t1) or t0, t1, t0 # E : and put it there (stall both t0, t1)
stq_u t0, 0(a0) # L : (stall) stq_u t0, 0(a0) # L : (stall)
......
...@@ -313,9 +313,9 @@ $unaligned: ...@@ -313,9 +313,9 @@ $unaligned:
lda t2, -1 # e0 : for creating masks later lda t2, -1 # e0 : for creating masks later
beq t12, $u_head # .. e1 : beq t12, $u_head # .. e1 :
nop # e0 :
cmpbge zero, t1, t8 # .. e1 : is there a zero?
extql t2, a1, t2 # e0 : extql t2, a1, t2 # e0 :
cmpbge zero, t1, t8 # .. e1 : is there a zero?
andnot t2, t6, t12 # e0 : dest mask for a single word copy
or t8, t10, t5 # .. e1 : test for end-of-count too or t8, t10, t5 # .. e1 : test for end-of-count too
cmpbge zero, t2, t3 # e0 : cmpbge zero, t2, t3 # e0 :
cmoveq a2, t5, t8 # .. e1 : cmoveq a2, t5, t8 # .. e1 :
...@@ -330,14 +330,14 @@ $unaligned: ...@@ -330,14 +330,14 @@ $unaligned:
ldq_u t0, 0(a0) # e0 : ldq_u t0, 0(a0) # e0 :
negq t8, t6 # .. e1 : build bitmask of bytes <= zero negq t8, t6 # .. e1 : build bitmask of bytes <= zero
mskqh t1, t4, t1 # e0 : mskqh t1, t4, t1 # e0 :
and t6, t8, t12 # .. e1 : and t6, t8, t2 # .. e1 :
subq t12, 1, t6 # e0 : subq t2, 1, t6 # e0 :
or t6, t12, t8 # e1 : or t6, t2, t8 # e1 :
zapnot t2, t8, t2 # e0 : prepare source word; mirror changes zapnot t12, t8, t12 # e0 : prepare source word; mirror changes
zapnot t1, t8, t1 # .. e1 : to source validity mask zapnot t1, t8, t1 # .. e1 : to source validity mask
andnot t0, t2, t0 # e0 : zero place for source to reside andnot t0, t12, t0 # e0 : zero place for source to reside
or t0, t1, t0 # e1 : and put it there or t0, t1, t0 # e1 : and put it there
stq_u t0, 0(a0) # e0 : stq_u t0, 0(a0) # e0 :
ret (t9) # .. e1 : ret (t9) # .. e1 :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment