mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-23 11:20:07 +00:00
* sysdeps/alpha/strncmp.S: Don't read too much data when pointers are co-aligned, and count is aligned with the end of the word.
2005-11-26 Richard Henderson <rth@redhat.com> * sysdeps/alpha/strncmp.S: Don't read too much data when pointers are co-aligned, and count is aligned with the end of the word.
This commit is contained in:
parent
d00002ed88
commit
0af1870a5c
@ -1,3 +1,8 @@
|
|||||||
|
2005-11-26 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/alpha/strncmp.S: Don't read too much data when pointers
|
||||||
|
are co-aligned, and count is aligned with the end of the word.
|
||||||
|
|
||||||
2005-11-26 Ulrich Drepper <drepper@redhat.com>
|
2005-11-26 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* nis/nis_lookup.c (nis_lookup): Mark RPCTIMEOUT as const. Pretty
|
* nis/nis_lookup.c (nis_lookup): Mark RPCTIMEOUT as const. Pretty
|
||||||
|
@ -61,8 +61,10 @@ $aligned:
|
|||||||
ornot t0, t3, t0 # .. e1 :
|
ornot t0, t3, t0 # .. e1 :
|
||||||
cmpbge zero, t1, t7 # e0 : bits set iff null found
|
cmpbge zero, t1, t7 # e0 : bits set iff null found
|
||||||
beq a2, $eoc # .. e1 : check end of count
|
beq a2, $eoc # .. e1 : check end of count
|
||||||
subq a2, 1, a2 # e0 :
|
unop # e0 :
|
||||||
bne t7, $eos # .. e1 :
|
bne t7, $eos # .. e1 :
|
||||||
|
unop # e0 :
|
||||||
|
beq t10, $ant_loop # .. e1 :
|
||||||
|
|
||||||
/* Aligned compare main loop.
|
/* Aligned compare main loop.
|
||||||
On entry to this basic block:
|
On entry to this basic block:
|
||||||
@ -74,13 +76,30 @@ $a_loop:
|
|||||||
bne t2, $wordcmp # .. e1 (zdb)
|
bne t2, $wordcmp # .. e1 (zdb)
|
||||||
ldq_u t1, 8(a1) # e0 :
|
ldq_u t1, 8(a1) # e0 :
|
||||||
ldq_u t0, 8(a0) # .. e1 :
|
ldq_u t0, 8(a0) # .. e1 :
|
||||||
|
subq a2, 1, a2 # e0 :
|
||||||
|
addq a1, 8, a1 # .. e1 :
|
||||||
|
addq a0, 8, a0 # e0 :
|
||||||
|
beq a2, $eoc # .. e1 :
|
||||||
|
cmpbge zero, t1, t7 # e0 :
|
||||||
|
beq t7, $a_loop # .. e1 :
|
||||||
|
unop # e0 :
|
||||||
|
br $eos # .. e1 :
|
||||||
|
|
||||||
|
/* Alternate aligned compare loop, for when there's no trailing
|
||||||
|
bytes on the count. We have to avoid reading too much data. */
|
||||||
|
$ant_loop:
|
||||||
|
xor t0, t1, t2 # e0 :
|
||||||
|
bne t2, $wordcmp # .. e1 (zdb)
|
||||||
|
subq a2, 1, a2 # e0 :
|
||||||
|
beq a2, $zerolength # .. e1 :
|
||||||
|
ldq_u t1, 8(a1) # e0 :
|
||||||
|
ldq_u t0, 8(a0) # .. e1 :
|
||||||
addq a1, 8, a1 # e0 :
|
addq a1, 8, a1 # e0 :
|
||||||
addq a0, 8, a0 # .. e1 :
|
addq a0, 8, a0 # .. e1 :
|
||||||
cmpbge zero, t1, t7 # e0 :
|
cmpbge zero, t1, t7 # e0 :
|
||||||
beq a2, $eoc # .. e1 :
|
beq t7, $ant_loop # .. e1 :
|
||||||
subq a2, 1, a2 # e0 :
|
unop # e0 :
|
||||||
beq t7, $a_loop # .. e1 :
|
br $eos # .. e1 :
|
||||||
br $eos # e1 :
|
|
||||||
|
|
||||||
/* The two strings are not co-aligned. Align s1 and cope. */
|
/* The two strings are not co-aligned. Align s1 and cope. */
|
||||||
$unaligned:
|
$unaligned:
|
||||||
@ -184,6 +203,8 @@ $u_final:
|
|||||||
$eoc:
|
$eoc:
|
||||||
mskql t0, t10, t0
|
mskql t0, t10, t0
|
||||||
mskql t1, t10, t1
|
mskql t1, t10, t1
|
||||||
|
unop
|
||||||
|
cmpbge zero, t1, t7
|
||||||
|
|
||||||
/* We've found a zero somewhere in a word we just read.
|
/* We've found a zero somewhere in a word we just read.
|
||||||
On entry to this basic block:
|
On entry to this basic block:
|
||||||
@ -203,6 +224,7 @@ $eos:
|
|||||||
|
|
||||||
/* Here we have two differing co-aligned words in t0 & t1.
|
/* Here we have two differing co-aligned words in t0 & t1.
|
||||||
Bytewise compare them and return (t0 > t1 ? 1 : -1). */
|
Bytewise compare them and return (t0 > t1 ? 1 : -1). */
|
||||||
|
.align 3
|
||||||
$wordcmp:
|
$wordcmp:
|
||||||
cmpbge t0, t1, t2 # e0 : comparison yields bit mask of ge
|
cmpbge t0, t1, t2 # e0 : comparison yields bit mask of ge
|
||||||
cmpbge t1, t0, t3 # .. e1 :
|
cmpbge t1, t0, t3 # .. e1 :
|
||||||
@ -216,6 +238,7 @@ $wordcmp:
|
|||||||
$done:
|
$done:
|
||||||
ret # e1 :
|
ret # e1 :
|
||||||
|
|
||||||
|
.align 3
|
||||||
$zerolength:
|
$zerolength:
|
||||||
clr v0
|
clr v0
|
||||||
ret
|
ret
|
||||||
|
Loading…
Reference in New Issue
Block a user