changeset 216:941177f65d07

*** empty log message ***
author kono
date Sat, 24 Apr 2004 18:45:30 +0900
parents abfad046e6de
children a4d3818f5353
files mc-code-powerpc.c mc.h
diffstat 2 files changed, 185 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/mc-code-powerpc.c	Sat Apr 24 15:31:15 2004 +0900
+++ b/mc-code-powerpc.c	Sat Apr 24 18:45:30 2004 +0900
@@ -1450,6 +1450,12 @@
 }
 
 void
+set_lreg_operand(int oreg,int mode)
+{
+ wefwef wefwef
+}
+
+void
 use_reg(int arg)
 {
 // printf("# use reg %d\n",arg);
@@ -3302,36 +3308,142 @@
 /* ".literal8", */
 "        .align 3",
 "__u2dLC1:",
-"        .long   1127219200",
-"        .long   0",
-".text",
-"        .align 2",
-"u2d_:",
-"        mflr r0",
-"        bcl 20,31,__u2dL2$pb",
-"__u2dL2$pb:",
-"        mflr r10",
-"        mtlr r0",
-"        stw r3,-28(r30)",
-"        lis r0,0x4330",
-"        stw r0,-32(r30)",
-"        lfd f0,-32(r30)",
-"        addis r9,r10,ha16(__u2dLC1-__u2dL2$pb)",
-"        lfd f1,lo16(__u2dLC1-__u2dL2$pb)(r9)",
-"        fsub f1,f0,f1",
 "        blr",
 0
 };
 
-void
-code_asld_lib(int creg0)
+static int asld_lib_used=0;
+static char *asld_lib_lib[] = {
+};
+
+static int lumod_lib_used=0;
+static char *lumod_lib_lib[] = {
+};
+
+static int lmod_lib_used=0;
+static char *lmod_lib_lib[] = {
+};
+
+static int ludiv_lib_used=0;
+static char *ludiv_lib_lib[] = {
+};
+
+static int ldiv_lib_used=0;
+static char *ldiv_lib_lib[] = {
+};
+
+static int lsrd_lib_used=0;
+static char *lsrd_lib_lib[] = {
+};
+
+static int asrd_lib_used=0;
+static char *asrd_lib_lib[] = {
+};
+
+#if FLOAT_CODE
+static int dl2ll_lib_used=0;
+static char *dl2ll_lib_lib[] = {
+};
+
+static int d2ull_lib_used=0;
+static char *d2ull_lib_lib[] = {
+};
+
+static int f2ll_lib_used=0;
+static char *f2ll_lib_lib[] = {
+};
+
+static int f2ull_lib_used=0;
+static char *f2ull_lib_lib[] = {
+};
+
+static int ll2d_lib_used=0;
+static char *ll2d_lib_lib[] = {
+};
+
+static int ll2f_lib_used=0;
+static char *ll2f_lib_lib[] = {
+};
+
+#endif
+
+static void
+code_asld_lib(int oreg)
 { 
     code_save_stacks();
     clear_ptr_cache();
     asld_lib_used = 1;
+    set_lreg(RET_LREGISTER,1);
+    set_lreg_operand(oreg,1);
     printf("\tbl asld_\n");
 }
 
+static void
+code_asrd_lib(int oreg) // ___ashrdi3$stub
+{
+    code_save_stacks();
+    clear_ptr_cache();
+    asrd_lib_used = 1;
+    set_lreg(RET_LREGISTER,1);
+    set_lreg_operand(oreg,1);
+    printf("\tbl asrd_\n");
+}
+
+static void
+code_lsrd_lib(int oreg) // ___lshrdi3$stub
+{
+    code_save_stacks();
+    clear_ptr_cache();
+    lsrd_lib_used = 1;
+    set_lreg(RET_LREGISTER,1);
+    set_lreg_operand(oreg,1);
+    printf("\tbl lsrd_\n");
+}
+
+static void
+code_ldiv_lib(int oreg) // ___divdi3$stub
+{
+    code_save_stacks();
+    clear_ptr_cache();
+    ldiv_lib_used = 1;
+    set_lreg_operand(oreg,1);
+    set_lreg(RET_LREGISTER,1);
+    printf("\tbl ldiv_\n");
+}
+
+static void
+code_ludiv_lib(int oreg) // ___udivdi3$stub
+{
+    code_save_stacks();
+    clear_ptr_cache();
+    ludiv_lib_used = 1;
+    set_lreg_operand(oreg,1);
+    set_lreg(RET_LREGISTER,1);
+    printf("\tbl ludiv_\n");
+}
+
+static void
+code_lmod_lib(int oreg) // ___moddi3$stub
+{
+    code_save_stacks();
+    clear_ptr_cache();
+    lmod_lib_used = 1;
+    set_lreg_operand(oreg,1);
+    set_lreg(RET_LREGISTER,1);
+    printf("\tbl lmod_\n");
+}
+
+static void
+code_lumod_lib(int oreg) // ___umoddi3$stub
+{
+    code_save_stacks();
+    clear_ptr_cache();
+    lumod_lib_used = 1;
+    set_lreg_operand(oreg,1);
+    set_lreg(RET_LREGISTER,1);
+    printf("\tbl lumod_\n");
+}
+
 void
 ltosop(int op,int oreg)
 {
@@ -3427,7 +3539,8 @@
     if(oreg!=creg) free_register(oreg);
 }
 
-int code_lconst_op_p(int op,int e)
+int
+code_lconst_op_p(int op,int e)
 {
     int v;
     if (car(e)==LCONST) {
@@ -3454,6 +3567,7 @@
     }
 }
 
+void
 loprtc(int op,int e)
 {
     char *crn_h = lregister_name_high(creg);
@@ -3598,47 +3712,77 @@
 }
 
 #if FLOAT_CODE
+
 void
 code_d2ll(int creg)
 {
-    creg = use_longlong(creg0=creg);
     // fixdfdi$stub
+    code_save_stacks();
+    clear_ptr_cache();
+    dl2ll_lib_used = 1;
+    set_freg(RET_DREGISTER,1);
+    printf("\tbl d2ll_\n");
+    set_lreg(RET_LREGISTER,0);
 }
 
 void
 code_d2ull(int creg)
 {
-    creg = use_longlong(creg0=creg);
     // fixunsdfdi$stub
+    code_save_stacks();
+    clear_ptr_cache();
+    d2ull_lib_used = 1;
+    set_freg(RET_DREGISTER,1);
+    printf("\tbl d2ull\n");
+    set_lreg(RET_LREGISTER,0);
 }
 
 void
 code_f2ll(int creg)
 {
-    creg = use_longlong(creg0=creg);
     // fixdfdi$stub
-
+    code_save_stacks();
+    clear_ptr_cache();
+    f2ll_lib_used = 1;
+    set_freg(RET_DREGISTER,1);
+    printf("\tbl f2ll\n");
+    set_lreg(RET_LREGISTER,0);
 }
 
 void
 code_f2ull(int creg)
 {
-    creg = use_longlong(creg0=creg);
     // fixsfdi$stub
+    code_save_stacks();
+    clear_ptr_cache();
+    f2ull_lib_used = 1;
+    set_freg(RET_DREGISTER,1);
+    printf("\tbl f2ull\n");
+    set_lreg(RET_LREGISTER,0);
 }
 
 void
 code_ll2d(int creg)
 {
-    creg = use_double(creg0=creg);
     // floatdidf$stub
+    code_save_stacks();
+    clear_ptr_cache();
+    ll2d_lib_used = 1;
+    set_lreg(RET_LREGISTER,1);
+    printf("\tbl ll2d\n");
+    set_freg(RET_DREGISTER,0);
 }
 
 void
 code_ll2f(int creg)
 {
-    creg = use_float(creg0=creg);
     // floatdisf$stub
+    code_save_stacks();
+    clear_ptr_cache();
+    ll2f_lib_used = 1;
+    set_lreg(RET_LREGISTER,1);
+    printf("\tbl ll2f\n");
+    set_freg(RET_DREGISTER,0);
 }
 
 void
@@ -3806,8 +3950,20 @@
     if (i2d_lib_used) emit_lib(i2d_lib);
 #endif
 #if LONGLONG_CODE
+    if (asld_lib_used) emit_lib(d2u_lib);
+    if (lumod_lib_used) emit_lib(lumod_lib);
+    if (lmod_lib_used) emit_lib(lmod_lib);
+    if (ludiv_lib_used) emit_lib(ludiv_lib);
+    if (ldiv_lib_used) emit_lib(ldiv_lib);
+    if (lsrd_lib_used) emit_lib(lsrd_lib);
+    if (asrd_lib_used) emit_lib(asrd_lib);
 #if FLOAT_CODE
-    if (asld_lib_used) emit_lib(d2u_lib);
+    if (dl2ll_lib_used) emit_lib(dl2ll_lib);
+    if (d2ull_lib_used) emit_lib(d2ull_lib);
+    if (f2ll_lib_used) emit_lib(f2ll_lib);
+    if (f2ull_lib_used) emit_lib(f2ull_lib);
+    if (ll2d_lib_used) emit_lib(ll2d_lib);
+    if (ll2f_lib_used) emit_lib(ll2f_lib);
 #endif
 #endif
     global_table();
--- a/mc.h	Sat Apr 24 15:31:15 2004 +0900
+++ b/mc.h	Sat Apr 24 18:45:30 2004 +0900
@@ -11,7 +11,7 @@
 #endif
 
 #define FLOAT_CODE 1
-#define LONGLONG_CODE 0
+#define LONGLONG_CODE 1
 
 #define SIZE_INT   4