免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3509 | 回复: 1
打印 上一主题 下一主题

MIPS汇编的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-07-10 14:42 |只看该作者 |倒序浏览

  1. .text_rom:90015290                 addiu   $sp, -0x10
  2. .text_rom:90015294                 sw      $fp, 0x10+var_8($sp)
  3. .text_rom:90015298                 move    $fp, $sp
  4. .text_rom:9001529C                 sw      $a0, 0x10+arg_0($fp)
  5. .text_rom:900152A0                 sw      $a1, 0x10+arg_4($fp)
  6. .text_rom:900152A4                 lw      $v0, 0x10+arg_0($fp)
  7. .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

汇编回应的源码是

  1. int strcmp(const char *cs, const char *ct)
  2. {
  3.         if(!cs) return -1;
  4.         if(!ct) return  1;

  5.         while (*cs || *ct)
  6.             if (*cs++ != *ct++)
  7.                 return (*--cs - *--ct);

  8.         return 0;
  9. }

复制代码

[ 本帖最后由 mjdcl 于 2007-7-10 14:47 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-08-08 13:13 |只看该作者

回复 #1 mjdcl 的帖子

-mtune=r4600
R4K有互锁机制,不用填充nop。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP