Saturday, November 08, 2008

Gcc 4.4 Loongson 2F specific integer multiply/divide instruction patch

http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00273.html
I have put it in my loongson overlay.
BTW, the gcc svn ebuild is from dirtyepic's overlay. Thanks, ;)

zhangle@2f ~ $ cat hello.c
#include<stdio.h>
int mul(){
unsigned long a = 0xffffffff;
unsigned long b = 0xf;
return a * b;
}
zhangle@2f ~ $ gcc -march=loongson2f hello.c -S
zhangle@2f ~ $ gcc -march=mips3 hello.c -S -o hello-mips3.s
zhangle@2f ~ $ diff -u hello.s hello-mips3.s
--- hello.s 2008-11-08 18:16:52.000000000 +0800
+++ hello-mips3.s 2008-11-08 18:16:55.000000000 +0800
@@ -25,7 +25,8 @@
sw $2,8($fp)
lw $3,12($fp)
lw $2,8($fp)
- multu.g $2,$3,$2
+ mult $3,$2
+ mflo $2
move $sp,$fp
lw $fp,20($sp)
addiu $sp,$sp,24

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home