Mercurial > hg > CbC > old > device
changeset 745:a396b346308a
i64 continue... code-gen-all.s is generated.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Nov 2010 16:38:42 +0900 |
parents | c9d4390b2b4e |
children | f8ea174944f2 |
files | mc-code-i64.c |
diffstat | 1 files changed, 27 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-code-i64.c Fri Nov 12 15:06:42 2010 +0900 +++ b/mc-code-i64.c Fri Nov 12 16:38:42 2010 +0900 @@ -370,7 +370,7 @@ #define REG_ECX 5 // for strange reason (code_assop) #define REG_EAX 6 #define REG_EBX 7 -#define is_int_reg(reg) (1<=reg&®<MAX_REGISTER) +#define is_int_reg(reg) (1<=reg&®<=MAX_REGISTER) #define is_float_reg(reg) (RET_FREGISTER<=reg&®<FREG_OFFSET+REAL_MAX_DREGISTER) // return value register @@ -438,8 +438,8 @@ "%r15d", "%r16d"}; -#define REG_VAR_BASE (RET_FREGISTER-1) -#define REG_VAR_MIN (RET_FREGISTER-1-MAX_REGISTER_VAR) +#define REG_VAR_BASE (MAX_REGISTER) +#define REG_VAR_MIN (MAX_REGISTER-MAX_REGISTER_VAR) #define FREG_VAR_BASE (RET_FREGISTER+16) #define FREG_VAR_MIN (RET_FREGISTER+16-MAX_DREGISTER_VAR) @@ -3412,13 +3412,14 @@ void code_dneg(int freg,int d) { + use_float(d,freg); int reg = get_dregister(d); if (d) { - printf("\txorpd %s,%s\n",register_name(freg,0),register_name(reg,0)); - printf("\tmovapd %s,%s\n",register_name(reg,0),register_name(freg,0)); + printf("\txorpd %s,%s\n",fregister_name(freg),fregister_name(reg)); + printf("\tmovapd %s,%s\n",fregister_name(reg),fregister_name(freg)); } else { - printf("\txorps %s,%s\n",register_name(freg,0),register_name(reg,0)); - printf("\tcvtss2sd %s,%s\n",register_name(reg,0),register_name(reg,0)); + printf("\txorps %s,%s\n",fregister_name(freg),fregister_name(reg)); + printf("\tcvtss2sd %s,%s\n",fregister_name(reg),fregister_name(reg)); } free_register(reg); } @@ -3427,21 +3428,22 @@ { int f = reg; use_int(reg); - printf("\tcvttsd2si %s,%s\n",register_name(f,0),register_name(creg,0)); + printf("\tcvttsd2si %s,%s\n",fregister_name(f),register_name(creg,0)); } void code_i2d(int reg) { + use_int(reg); int c = reg; use_float(1,reg); - printf("\tcvtsi2sd %s,%s\n",register_name(c,0),register_name(creg,0)); + printf("\tcvtsi2sd %s,%s\n",register_name(c,0),fregister_name(reg)); } void code_d2u(int reg) { int f = reg; use_int(reg); - printf("\tcvttsd2siq %s,%s\n",register_name(f,0),register_name(reg,0)); + printf("\tcvttsd2siq %s,%s\n",fregister_name(f),register_name(reg,0)); } void code_u2d1(int reg,int d) @@ -3467,6 +3469,7 @@ printf(" movap%s %s, %s\n",dbs,dn,register_name(td,0)); printf(" adds%s %s, %s\n",dbs,dn,register_name(td,0)); printf("2:\n"); + set_freg(reg,d); free_register(tmp); free_register(td); } @@ -3478,21 +3481,24 @@ void code_d2f(int reg) { } void code_f2d(int reg) { } void code_f2i(int reg) { + use_float(0,reg); int f = reg; - use_int(reg); - printf("\tcvttss2si %s,%s\n",register_name(f,0),register_name(creg,0)); + set_ireg(get_register(),0); + printf("\tcvttss2si %s,%s\n",fregister_name(f),register_name(creg,0)); } void code_f2u(int reg) { + use_float(0,reg); int f = reg; - use_int(reg); - printf("\tcvttss2siq %s,%s\n",register_name(f,0),register_name(reg,0)); + set_ireg(get_register(),0); + printf("\tcvttss2siq %s,%s\n",fregister_name(f),register_name(creg,0)); } void code_i2f(int reg) { + use_int(reg); int c = reg; - use_float(0,reg); - printf("\tcvtsi2ss %s,%s\n",register_name(c,0),register_name(creg,0)); + set_freg(get_dregister(0),0); + printf("\tcvtsi2ss %s,%s\n",register_name(c,0),fregister_name(creg)); } void code_u2f(int reg) { code_u2d1(reg,0); @@ -3500,6 +3506,7 @@ void code_drgvar(int e2,int d,int freg) { + use_float(d,freg); #ifdef __APPLE__ int r = get_ptr_cache(ncaddr(e2)); if (cadr(e2)) @@ -3517,6 +3524,7 @@ void code_drlvar(int e2,int d,int freg) { + use_float(d,freg); printf("\t%s ",fload(d)); lvar(e2); printf(",%s\n", fregister_name(freg)); } @@ -4149,9 +4157,10 @@ void code_ll2d(int reg) { - char *f = fregister_name(reg); + use_longlong(reg); + char *f = register_name(reg,0); use_float(1,reg); - printf("\tcvtsi2sdq %s,%s\n",f,register_name(reg,0)); + printf("\tcvtsi2sdq %s,%s\n",f,fregister_name(reg)); } void code_ll2f(int reg)