Mercurial > hg > CbC > old > device
changeset 214:4f459364c334
*** empty log message ***
author | kono |
---|---|
date | Sat, 24 Apr 2004 14:42:11 +0900 |
parents | 8581c314e31a |
children | abfad046e6de |
files | Changes Makefile mc-code-powerpc.c test/code-gen.c |
diffstat | 4 files changed, 153 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Sat Apr 24 00:18:35 2004 +0900 +++ b/Changes Sat Apr 24 14:42:11 2004 +0900 @@ -3965,3 +3965,11 @@ a?a,b:a,b って許されるの? "" の中のマクロが展開されてしまうんですけど。(ま、そうなんだけど) + +#hoge は無視するか、そのままにするか... + +Sat Apr 24 14:39:14 JST 2004 + +long long op int, unsigned long long op int/unsigned + +ってのがあるのか.... うーん...
--- a/Makefile Sat Apr 24 00:18:35 2004 +0900 +++ b/Makefile Sat Apr 24 14:42:11 2004 +0900 @@ -68,6 +68,7 @@ # make check TARGET=test/tmp8 make check TARGET=test/tmp9 make check TARGET=test/enum + make check TARGET=test/obsf #MK =-make MK= check-all-code:
--- a/mc-code-powerpc.c Sat Apr 24 00:18:35 2004 +0900 +++ b/mc-code-powerpc.c Sat Apr 24 14:42:11 2004 +0900 @@ -1981,7 +1981,7 @@ code_const_op_p(int op,int v) { if (op==BAND||op==DIV||op==UDIV||op==MOD||op==UMOD) return 0; - return (-127<v&&v<128); + return (-32766<v&&v<32767); } void @@ -3350,13 +3350,13 @@ switch(op) { case LLSHIFT: case LULSHIFT: - code_asld_lib(oreg); + code_asld_lib(oreg); // ___ashldi3$stub return; case LRSHIFT: - shift("sraw",oreg); + code_asrd_lib(oreg); // ___ashrdi3$stub return; case LURSHIFT: - shift("srw",oreg); + code_lsrd_lib(oreg); // ___lshrdi3$stub return; } orn_h = lregister_name_high(oreg); @@ -3410,26 +3410,16 @@ printf("\tmr %s,%s\n",crn_l,drn_l); break; case DIV: - printf("\tdivw %s,%s,%s\n",crn,crn,orn); + code_ldiv_lib(oreg); // ___divdi3$stub break; case UDIV: - printf("\tdivwu %s,%s,%s\n",crn,crn,orn); + code_ludiv_lib(oreg); // ___udivdi3$stub break; case MOD: - dx=get_register(); - drn = register_name(dx); - printf("\tdivw %s,%s,%s\n",drn,crn,orn); - printf("\tmullw %s,%s,%s\n",drn,drn,orn); - printf("\tsubf %s,%s,%s\n",crn,drn,crn); - free_register(dx); + code_lmod_lib(oreg); // ___moddi3$stub break; case UMOD: - dx=get_register(); - drn = register_name(dx); - printf("\tdivwu %s,%s,%s\n",drn,crn,orn); - printf("\tmullw %s,%s,%s\n",drn,drn,orn); - printf("\tsubf %s,%s,%s\n",crn,drn,crn); - free_register(dx); + code_lumod_lib(oreg); // ___umoddi3$stub break; default: error(-1); @@ -3437,11 +3427,33 @@ if(oreg!=creg) free_register(oreg); } -int code_lconst_op_p(int op,int e) {return 0;} - -loprtc(int op,int v) +int code_lconst_op_p(int op,int e) +{ + switch(op) { + case LSHIFT: + case ULSHIFT: + case RSHIFT: + case URSHIFT: + return (<lcaddr(e)&&lcaddr(e)<32767); + case ADD: + case SUB: + case EOR: + case BOR: + if (car(e)==LCONST) + return (-32766<lcaddr(e)&&lcaddr(e)<32767); + if (car(e)==CONST) + return (-32766<caddr(e)&&caddr(e)<32767); + default: + return 0; + } +} + +loprtc(int op,int e) { char *crn = register_name(creg); + int v; + if (car(e)==LCONST) v = lcaddr(e); + else if (car(e)==CONST) v = caddr(e); switch(op) { case LSHIFT: @@ -3460,21 +3472,12 @@ case SUB: printf("\tsubi %s,%s,lo16(%d)\n",crn,crn,v); break; - case CMP: - printf("\tcmpwi cr0,%s,lo16(%d)\n",crn,v); - break; case EOR: printf("\txori %s,%s,lo16(%d)\n",crn,crn,v); break; case BOR: printf("\tori %s,%s,lo16(%d)\n",crn,crn,v); break; - case MUL: - printf("\tmulli %s,%s,lo16(%d)\n",crn,crn,v); - break; - case UMUL: - printf("\tmulli %s,%s,lo16(%d)\n",crn,crn,v); - break; default: error(-1); }
--- a/test/code-gen.c Sat Apr 24 00:18:35 2004 +0900 +++ b/test/code-gen.c Sat Apr 24 14:42:11 2004 +0900 @@ -645,6 +645,8 @@ printf("tosop 8 %d\n",i); i = i1 >> i2; printf("tosop 9 %d\n",i); + i = i1 % i2; + printf("tosop 10 %d\n",i); u = u1 + u2; printf("tosop 1 %u\n",u); @@ -664,6 +666,8 @@ printf("tosop 8 %u\n",u); u = u1 >> u2; printf("tosop 9 %u\n",u); + u = u1 % u2; + printf("tosop 10 %u\n",u); } // oprtc(int op,int v) @@ -693,6 +697,8 @@ printf("oprtc 8 %d\n",i); i = i1 >> 5; printf("oprtc 9 %d\n",i); + i = i1 % 5; + printf("oprtc 10 %d\n",i); u = u1 + 3; printf("oprtc 1 %u\n",u); @@ -712,6 +718,8 @@ printf("oprtc 8 %u\n",u); u = u1 >> 5; printf("oprtc 9 %u\n",u); + u = u1 % 5; + printf("oprtc 10 %u\n",u); } @@ -1187,8 +1195,12 @@ { long long i1,i2,i; unsigned long long u1,u2,u; + int ii2; + unsigned int uu2; i1 = -555; i2= 555; u1 = 632423423; u2= 32394234; + ii2 = -33; + uu2 = 33; i = i1 + i2; printf("ltosop 1 %lld\n",i); @@ -1208,6 +1220,8 @@ printf("ltosop 8 %lld\n",i); i = i1 >> i2; printf("ltosop 9 %lld\n",i); + i = i1 % i2; + printf("ltosop 10 %lld\n",i); u = u1 + u2; printf("ltosop 1 %llu\n",u); @@ -1227,8 +1241,105 @@ printf("ltosop 8 %llu\n",u); u = u1 >> u2; printf("ltosop 9 %llu\n",u); + u = u1 % u2; + printf("ltosop 10 %llu\n",u); + + i = i1 + ii2; + printf("litosop 1 %lld\n",i); + i = i1 - ii2; + printf("litosop 2 %lld\n",i); + i = i1 / ii2; + printf("litosop 3 %lld\n",i); + i = i1 * ii2; + printf("litosop 4 %lld\n",i); + i = i1 | ii2; + printf("litosop 5 %lld\n",i); + i = i1 & ii2; + printf("litosop 6 %lld\n",i); + i = i1 ^ ii2; + printf("litosop 7 %lld\n",i); + i = i1 << ii2; + printf("litosop 8 %lld\n",i); + i = i1 >> ii2; + printf("litosop 9 %lld\n",i); + i = i1 % ii2; + printf("litosop 10 %lld\n",i); + + u = u1 + uu2; + printf("litosop 1 %llu\n",u); + u = u1 - uu2; + printf("litosop 2 %llu\n",u); + u = u1 / uu2; + printf("litosop 3 %llu\n",u); + u = u1 * uu2; + printf("litosop 4 %llu\n",u); + u = u1 | uu2; + printf("litosop 5 %llu\n",u); + u = u1 & uu2; + printf("litosop 6 %llu\n",u); + u = u1 ^ uu2; + printf("litosop 7 %llu\n",u); + u = u1 << uu2; + printf("litosop 8 %llu\n",u); + u = u1 >> uu2; + printf("litosop 9 %llu\n",u); + u = u1 % uu2; + printf("litosop 10 %llu\n",u); } +// loprtc(int op,int v) +void +loprtc() +{ + long long i1,i; + unsigned long long u1,u; + i1 = -555; + u1 = 632423423; + + i = i1 + 3; + printf("loprtc 1 %lld\n",i); + i = i1 - 3; + printf("loprtc 2 %lld\n",i); + i = i1 / 32323423423LL; + printf("loprtc 3 %lld\n",i); + i = i1 * 323423423423LL; + printf("loprtc 4 %lld\n",i); + i = i1 | 234234234; + printf("loprtc 5 %lld\n",i); + i = i1 & 23234234; + printf("loprtc 6 %lld\n",i); + i = i1 ^ 23234234; + printf("loprtc 7 %lld\n",i); + i = i1 << 5; + printf("loprtc 8 %lld\n",i); + i = i1 >> 5; + printf("loprtc 9 %lld\n",i); + i = i1 % 5; + printf("loprtc 10 %lld\n",i); + + u = u1 + 3; + printf("loprtc 1 %llu\n",u); + u = u1 - 3; + printf("loprtc 2 %llu\n",u); + u = u1 / 32342342344234LL; + printf("loprtc 3 %llu\n",u); + u = u1 * 243234234232324LL; + printf("loprtc 4 %llu\n",u); + u = u1 | 234234234; + printf("loprtc 5 %llu\n",u); + u = u1 & 234234234; + printf("loprtc 6 %llu\n",u); + u = u1 ^ 234234234; + printf("loprtc 7 %llu\n",u); + u = u1 << 5; + printf("loprtc 8 %llu\n",u); + u = u1 >> 5; + printf("loprtc 9 %llu\n",u); + u = u1 % 5; + printf("loprtc 10 %llu\n",u); +} + + // code_i2ll(int creg) void code_i2ll() {