MIPS汇编的问题
.text_rom:90015290 addiu $sp, -0x10
.text_rom:90015294 sw $fp, 0x10+var_8($sp)
.text_rom:90015298 move $fp, $sp
.text_rom:9001529C sw $a0, 0x10+arg_0($fp)
.text_rom:900152A0 sw $a1, 0x10+arg_4($fp)
.text_rom:900152A4 lw $v0, 0x10+arg_0($fp)
.text_rom:900152A8 bnez $v0, loc_900152BC
生成上面的汇编是不是编译器的bug?load delay slot里面怎么能立即使用$v0寄存器?
我用
-march=mips32 -mtune=r4600 -mabi=32 -G 0 -ansi -fno-builtin -fdelayed-branch -fthread-jumps -fno-pic -mno-abicalls -O0 -g -fschedule-insns2 -msoft-float
[]# mipsel-linux-uclibc-gcc -v
Using built-in specs.
Target: mipsel-linux-uclibc
Configured with: xxxx/gcc-4.1.2/configure --prefix xxxxx --build=i386-redhat-linux --host=i386-redhat-linux --target=mipsel-linux-uclibc --enable-languages=c,c++ --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls
Thread model: posix
gcc version 4.1.2
汇编回应的源码是
int strcmp(const char *cs, const char *ct)
{
if(!cs) return -1;
if(!ct) return1;
while (*cs || *ct)
if (*cs++ != *ct++)
return (*--cs - *--ct);
return 0;
}
[ 本帖最后由 mjdcl 于 2007-7-10 14:47 编辑 ]
回复 #1 mjdcl 的帖子
-mtune=r4600R4K有互锁机制,不用填充nop。
页:
[1]