strcmp.s

来自「mips架构的bootloader,99左右的版本 但源代码现在没人更新了」· S 代码 · 共 61 行

S
61
字号
/************************************************************* * File: lib/strcmp.s * Purpose: Part of C runtime library * Author: Phil Bunce (pjb@carmel.com) * Revision History: *	970304	Start of revision history *//* Note that the Algorithmics assembler generates 6 warnings for this * file.  This is because the assembler considers the load instructions * are not save in the delay slot of a branch.  You can safely ignore  * the warnings.   */#include <regdef.h>#ifdef TEST#define strcmp xstrcmp#endif/*** Loop unrolled four times*/	.globl	strcmp	.ent	strcmpstrcmp:	.set noreorder	# main loop1:	lbu	t0, (a0)	lbu	t1, (a1)	beq	t0, zero, 2f	# brif end of string	 lbu	t2, 1(a0)	bne	t0, t1, 2f	# brif bytes not equal	 lbu	t3, 1(a1)	beq	t2, zero, 3f	# brif end of string	 lbu	t4, 2(a0)	bne	t2, t3, 3f	# brif bytes not equal	 lbu	t5, 2(a1)	beq	t4, zero, 4f	# brif end of string	 lbu	t6, 3(a0)	bne	t4, t5, 4f	# brif bytes not equal	 lbu	t7, 3(a1)	beq	t6, zero, 5f	# brif end of string	 addu	a0, 4	beq	t6, t7, 1b	# brif bytes equal	 addu	a1, 45:	j	ra	 subu	v0, t6, t72:	j	ra	 subu	v0, t0, t13:	j	ra	 subu	v0, t2, t34:	j	ra	 subu	v0, t4, t5	.set reorder	.end	strcmp

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?