changeset 768:ec9fdbb27351

i64 unsigned
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 18 Nov 2010 01:08:52 +0900
parents c14a1426cfed
children 74701505c42d
files .gdbinit mc-codegen.c
diffstat 2 files changed, 24 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Thu Nov 18 00:12:12 2010 +0900
+++ b/.gdbinit	Thu Nov 18 01:08:52 2010 +0900
@@ -13,7 +13,8 @@
 x/1i $rip
 end
 b errmsg
-r -s test/tmp7.c
+# r -s test/tmp7.c
+r -s test/int.c
 # r -s test/tmp6.c
 # r -s test/call.c
 # r -s test/static.c
--- a/mc-codegen.c	Thu Nov 18 00:12:12 2010 +0900
+++ b/mc-codegen.c	Thu Nov 18 01:08:52 2010 +0900
@@ -212,9 +212,11 @@
 	return LONGLONG;
 #endif
     case RLVAR:
-	code_rlvar(e2,USE_CREG);
+	if (lp64) code_crlvar(e2,USE_CREG,1,size_of_int);
+	else code_rlvar(e2,USE_CREG);
 	return INT;
     case URLVAR:
+	if (lp64) code_crlvar(e2,USE_CREG,0,size_of_int);
 	code_rlvar(e2,USE_CREG);
 	return UNSIGNED;
     case CRLVAR:
@@ -2259,11 +2261,18 @@
     int t = type_value(type);
     if (t>0&&car(t)==BIT_FIELD) e2=rvalue(e2);
     if (0);
-    else if (car(e2)==CONST)  e2 = llist2(LCONST,(unsigned long long)cadr(e2));
+    else if (car(e2)==CONST)  {
+	if (cadr(e2)<0)
+	    e2 = llist2(LCONST,0);
+	e2 = llist2(LCONST,(unsigned long long)cadr(e2));
+    }
     else if (car(e2)==LCONST)  ;
 #if FLOAT_CODE
-    else if (car(e2)==DCONST||car(e2)==FCONST)
+    else if (car(e2)==DCONST||car(e2)==FCONST) {
+	if (dcadr(e2)<0) 
+	    e2 = llist2(LCONST,0);
         e2 = llist2(LCONST,(unsigned long long)dcadr(e2));
+    }
 #endif
     else {
 	switch(type_value(type)) {
@@ -2342,10 +2351,18 @@
     if (0);
     else if(scalar(t)) { type = set_type_with_attr(UNSIGNED,type); return e2; }
 #if FLOAT_CODE
-    else if (car(e2)==DCONST||car(e2)==FCONST)  e2 = list2(CONST,(int)dcadr(e2));
+    else if (car(e2)==DCONST||car(e2)==FCONST)  {
+	if (dcadr(e2)<0)
+	    return e2 = list2(CONST,0);
+	e2 = list2(CONST,(int)dcadr(e2));
+    }
 #endif
 #if LONGLONG_CODE
-    else if (car(e2)==LCONST)  e2 = list2(CONST,(unsigned)lcadr(e2));
+    else if (car(e2)==LCONST)  {
+	if (lcadr(e2)<0)
+	    e2 = list2(CONST,0);
+	e2 = list2(CONST,(unsigned)lcadr(e2));
+    }
 #endif
     else {
 	switch(t) {