![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 /* 0003 * arch/alpha/lib/ev67-strlen.S 0004 * 21264 version by Rick Gorton <rick.gorton@alpha-processor.com> 0005 * 0006 * Finds length of a 0-terminated string. Optimized for the 0007 * Alpha architecture: 0008 * 0009 * - memory accessed as aligned quadwords only 0010 * - uses bcmpge to compare 8 bytes in parallel 0011 * 0012 * Much of the information about 21264 scheduling/coding comes from: 0013 * Compiler Writer's Guide for the Alpha 21264 0014 * abbreviated as 'CWG' in other comments here 0015 * ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.html 0016 * Scheduling notation: 0017 * E - either cluster 0018 * U - upper subcluster; U0 - subcluster U0; U1 - subcluster U1 0019 * L - lower subcluster; L0 - subcluster L0; L1 - subcluster L1 0020 */ 0021 #include <asm/export.h> 0022 .set noreorder 0023 .set noat 0024 0025 .globl strlen 0026 .ent strlen 0027 .align 4 0028 strlen: 0029 ldq_u $1, 0($16) # L : load first quadword ($16 may be misaligned) 0030 lda $2, -1($31) # E : 0031 insqh $2, $16, $2 # U : 0032 andnot $16, 7, $0 # E : 0033 0034 or $2, $1, $1 # E : 0035 cmpbge $31, $1, $2 # E : $2 <- bitmask: bit i == 1 <==> i-th byte == 0 0036 nop # E : 0037 bne $2, $found # U : 0038 0039 $loop: ldq $1, 8($0) # L : 0040 addq $0, 8, $0 # E : addr += 8 0041 cmpbge $31, $1, $2 # E : 0042 beq $2, $loop # U : 0043 0044 $found: 0045 cttz $2, $3 # U0 : 0046 addq $0, $3, $0 # E : 0047 subq $0, $16, $0 # E : 0048 ret $31, ($26) # L0 : 0049 0050 .end strlen 0051 EXPORT_SYMBOL(strlen)
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |