# HG changeset patch # User Shinji KONO # Date 1290579245 -32400 # Node ID 44c276fa9ec6432782d3236d08af09dad46926d7 # Parent 8a042b6ffd6888c694c69acd1572923604cf8a9e Cell SPU restart diff -r 8a042b6ffd68 -r 44c276fa9ec6 .gdbinit --- a/.gdbinit Thu Nov 25 13:21:18 2010 +0900 +++ b/.gdbinit Wed Nov 24 15:14:05 2010 +0900 @@ -1,37 +1,34 @@ tb main +r -s test/basic.c define regs -call (void)printf("rax=%08lx rbx=%08lx rcx=%08lx rdx=%08lx\nrsi=%08lx rdi=%08lx rbp=%08lx rsp=%08lx rip=%08lx\n",$rax,$rbx,$rcx,$rdx,$rsi,$rdi,$rbp,$rsp,$rip) +printf "pc =%08x lr =%08x r0 =%08x r1 =%08x r3= %08x r4= %08x\n",$pc,$lr,$r0,$r1,$r3,$r4 +printf "r10=%08x r11=%08x r12=%08x r13=%08x r14=%08x r15=%08x\n",$r10,$r11,$r12,$r13,$r14,$r15 +end +define fregs +printf "f1=%g f2=%g f3=%g f4=%g f5=%g f6=%g\n",$f1,$f2,$f3,$f4,$f5,$f6 +printf "f10=%g f11=%g f12=%g f13=%g f14=%g f15=%g\n",$f10,$f11,$f12,$f13,$f14,$f15 +end +define allreg +printf "pc =%08x lr =%08x r0 =%08x r1 =%08x r3= %08x r4= %08x\n",$pc,$lr,$r0,$r1,$r3,$r4 +printf "r5=%08x r6=%08x r7=%08x r8=%08x r9=%08x\n",$r5,$r6,$r7,$r8,$r9 +printf "r10=%08x r11=%08x r12=%08x r13=%08x r14=%08x r15=%08x\n",$r10,$r11,$r12,$r13,$r14,$r15 +printf "r16=%08x r17=%08x r18=%08x r19=%08x r20=%08x r21=%08x\n",$r10,$r11,$r12,$r13,$r14,$r15 +printf "f1=%g f2=%g f3=%g f4=%g f5=%g f6=%g\n",$f1,$f2,$f3,$f4,$f5,$f6 +printf "f10=%g f11=%g f12=%g f13=%g f14=%g f15=%g\n",$f10,$f11,$f12,$f13,$f14,$f15 +printf "f20=%g f21=%g f22=%g f23=%g f24=%g f25=%g\n",$f20,$f21,$f22,$f23,$f24,$f25 +end +define sh +regs +x/20i $pc-36 end define si stepi regs -x/1i $rip +x/1i $pc end define ni nexti regs -x/1i $rip +x/1i $pc end b errmsg -# r -s test/tmp7.c -# r -s -DINLINE=inline test/tmp7.c -# r -s test/int.c -# r -s test/tmp6.c -# r -s test/call.c -# r -s test/static.c -# r -s test/tmpa.c -# r -s test/code-gen-all.c -# r -s mc-code-powerpc.c -# r -s test/macro.c -# r -s test/basic.c -# r -s test/float.c -# r -s test/strinit.c -# r -s test/bitfield.c -# r -s test/tstdarg.c -r -s test/ps2.c -# r -s test/arg.c -# r -s test/obsf2.c -# r -s test/putenemy.c -# r -s -DINLINE=inline test/code-gen-all.c -# r -s -DINLINE=inline test/strinit.c -# r -s test/fact-a.c diff -r 8a042b6ffd68 -r 44c276fa9ec6 mc-code-spu.c --- a/mc-code-spu.c Thu Nov 25 13:21:18 2010 +0900 +++ b/mc-code-spu.c Wed Nov 24 15:14:05 2010 +0900 @@ -1038,7 +1038,7 @@ { char *crn = register_name(reg); char *rrn = register_name(r); - char *rn2 = register_name(r+1); + // char *rn2 = register_name(r+1); char *drn; int dreg; if (offset==0) { @@ -1097,14 +1097,6 @@ -#define cext(sign,sz,reg) - -static char * -cext_at(int sz,int sign) -{ - return ((sz==1&&!sign)?" @ zero_extendqisi2":""); -} - void code_label(int labelno) { @@ -1181,12 +1173,44 @@ } void +cext(int sz, int sign, int from, into to) +{ + if (sz==1 && !sign) { +// unsigned char + printf(" rotqbyi %s,%s,13\n",fn,fn); + printf(" andi %s,%s,0x00ff\n",tn,fn); + } else if (sz==1 && sign) { +// signed char + printf(" rotqbyi %s,%s,13\n",fn,fn); + printf(" xsbh %s,%s\n",fn,fn); + printf(" xshw %s,%s\n",tn,fn); + } else if (sz==2 && !sign) { +// unsigned short + int t = get_register(); + char *tmp = register_name(t); + printf(" rotqbyi %s,%s,14\n",fn,fn); + printf(" ori %s,%s,0\n",tmp,fn); + printf(" ila %s,65535\n",fn,fn); + printf(" and %s,%s,%s\n",tn,tmp,fn); + free_register(t); + } else if (sz==2 && !sign) { +// singed short + printf(" rotqbyi %s,%s,14\n",fn,fn); + printf(" xshw %s,%s\n",tn,fn); + } +} + +void code_crlvar(int e2,int reg,int sign,int sz) { use_int(reg); + int tmp = 0; + if (size<4) + tmp = get_register(); lvar_intro(e2); - printf("\t%s\t%s, ",cload(sz,sign),register_name(reg)); - lvar(e2,cext_at(sz,sign)); - cext(sign,sz,reg); + printf("\tlqd\t%s,",register_name(size<4?tmp:reg)); + lvar(e2); + cext(sign,sz,reg,tmp); + if (tmp) free_register(tmp); } void diff -r 8a042b6ffd68 -r 44c276fa9ec6 test/code-gen.c --- a/test/code-gen.c Thu Nov 25 13:21:18 2010 +0900 +++ b/test/code-gen.c Wed Nov 24 15:14:05 2010 +0900 @@ -54,7 +54,7 @@ INLINE void code_lvar() { - char c1,c2; + signed char c1,c2; unsigned char uc1,uc2; int i1,i2; short s1,s2; @@ -75,7 +75,7 @@ INLINE void code_lvar_address() { - char c1,c2,*p; + signed char c1,c2,*p; unsigned char uc1,uc2,*up; int i1,i2,*ip; short s1,s2,*sp; @@ -116,9 +116,9 @@ // code_rgvar(int e1,int creg) // code_crgvar(int e1,int creg,int sign,int sz) -char c1,c2; +signed char c1,c2; unsigned char uc1,uc2; -static char s_c1,s_c2; +static signed char s_c1,s_c2; static unsigned char s_uc1,s_uc2; int i1,i2; unsigned int ui1,ui2; @@ -162,7 +162,7 @@ INLINE void code_register() { - register char c1,c2; + register signed char c1,c2; register unsigned char uc1,uc2; register int i1,i2; register short s1,s2; @@ -362,7 +362,7 @@ #endif -struct aa { char a[100]; } a0; +struct aa { signed char a[100]; } a0; INLINE struct aa code_return_struct0(/*int j*/) { @@ -742,7 +742,7 @@ INLINE void code_cmp() { - char c1,c2; + signed char c1,c2; unsigned char uc1,uc2; int i1,i2; short s1,s2; @@ -774,7 +774,7 @@ INLINE void code_cmp_register() { - register char c1,c2; + register signed char c1,c2; register unsigned char uc1,uc2; register int i1,i2; register short s1,s2; @@ -844,9 +844,9 @@ INLINE void code_crindirect() { - char i1,i2; + signed char i1,i2; unsigned char ui1,ui2; - char *pi1,*pi2; + signed char *pi1,*pi2; unsigned char *pui1,*pui2; long l1,l2; unsigned long ul1,ul2;