Mercurial > hg > CbC > old > device
changeset 847:c0ad9d810b6c
i64 overrap check
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 24 Sep 2011 01:57:04 +0900 |
parents | a97cd8b97434 |
children | d9cd16896b4a |
files | mc-code-spu.c mc-codegen.c |
diffstat | 2 files changed, 51 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-code-spu.c Mon Dec 06 16:23:42 2010 +0900 +++ b/mc-code-spu.c Sat Sep 24 01:57:04 2011 +0900 @@ -127,20 +127,20 @@ #define REG_ip 13 -#define REG_fp 0 +#define REG_fp 127 #define REG_sp 1 #define REG_VAR_BASE 3 #define REG_VAR_MIN 3 -#define REG_VAR_USER_MAX 127 /* at leat 6 tmp var */ -#define REG_VAR_MAX 127 +#define REG_VAR_USER_MAX (127-8) /* at leat 6 tmp var */ +#define REG_VAR_MAX (127-8) #define MIN_TMP_REG 3 -#define MAX_TMP_REG 127 +#define MAX_TMP_REG 126 #define FREG_VAR_BASE 3 #define FREG_VAR_MIN 3 -#define FREG_VAR_MAX 127 +#define FREG_VAR_MAX REG_VAR_MAX #define MIN_TMP_FREG 3 -#define MAX_TMP_FREG 127 +#define MAX_TMP_FREG 126 int MAX_REGISTER=127; /* ARMのレジスタを10個まで使う*/ #define REAL_MAX_REGISTER 128 /* ARMのレジスタが32ということ*/ @@ -1026,7 +1026,7 @@ printf("\tand\t%s,%s,%s\n",register_name(reg),register_name(reg),register_name(reg+1)); } -void +static void cext(int sz, int sign, int from, int to) { if (sz==1 && !sign) { @@ -1054,6 +1054,39 @@ } } +static void +shuffle_offset(int sz, int offset, int base, int to) +{ + int tmp = get_register(); + char *bn = register_name(base); + char *tn = register_name(tmp); + + if (sz==1) { + printf(" cbd %s %d(%s)\n",tn,offset, bn); + printf(" shufb %s,%s,%s,%s\n",tn,fn,tn); + } 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); + } + free_register(tmp); +} + + void code_crlvar(int e2,int reg,int sign,int sz) { use_int(reg);
--- a/mc-codegen.c Mon Dec 06 16:23:42 2010 +0900 +++ b/mc-codegen.c Sat Sep 24 01:57:04 2011 +0900 @@ -1042,7 +1042,7 @@ /* source (after) list2(tag,disp) */ /* source list list3(e,cdr,sz) */ -#define DEBUG_PARALLEL_ASSIGN 0 +#define DEBUG_PARALLEL_ASSIGN 1 static int is_writable(int); @@ -1193,7 +1193,7 @@ for(target0=*target;target0; target0=cadr(target0)) { t=car(target0); s=cadddr(target0); sz=size(ty=caddr(target0)); - if(car(t)==car(s) && cadr(t)==cadr(s)) { + if(is_same_type(t,s) && cadr(t)==cadr(s)) { /*書き込み先が自分自身*/ #if DEBUG_PARALLEL_ASSIGN if (lsrc) printf("## remove same %d ty %d+%d sz %d\n",car(t),ty,cadr(t),sz); @@ -1295,8 +1295,10 @@ { int ce1=car(e1); int ce2=car(e2); + if (ce1==ce2) return 1; if (ce1==LVAR) { switch(ce2) { + case LRLVAR: case LURLVAR: return lp64; case RLVAR: case CRLVAR: case FRLVAR: case DRLVAR: case SRLVAR: case SURLVAR: case CURLVAR: case LVAR: case URLVAR: @@ -1304,8 +1306,9 @@ } } else if (ce2==LVAR) { switch(ce1) { + case LRLVAR: case LURLVAR: return lp64; case RLVAR: case CRLVAR: case FRLVAR: case DRLVAR: - case SRLVAR: case SURLVAR: case CURLVAR: case LRLVAR: case LVAR: + case SRLVAR: case SURLVAR: case CURLVAR: case LVAR: case URLVAR: return 1; } @@ -1327,6 +1330,10 @@ return 1; } #endif + } else if (ce1==REGISTER) { + if (lp64 && ce2==LREGISTER) return 1; + } else if (ce2==REGISTER) { + if (lp64 && ce1==LREGISTER) return 1; } return 0; } @@ -1337,7 +1344,7 @@ switch(car(e1)) { case GVAR : case LVAR : - case RLVAR : // this is wrong, but ia32 generates this. + case RLVAR : case LRLVAR: case URLVAR: case LURLVAR: // this is wrong, but ia32 generates this. case REGISTER : return size_of_int; case FREGISTER :