diff mc-code-powerpc.c @ 289:55e611476cba

*** empty log message ***
author kono
date Thu, 03 Jun 2004 20:41:36 +0900
parents ce7b4d90bc24
children 7b6df595b205
line wrap: on
line diff
--- a/mc-code-powerpc.c	Thu Jun 03 13:15:05 2004 +0900
+++ b/mc-code-powerpc.c	Thu Jun 03 20:41:36 2004 +0900
@@ -1329,13 +1329,17 @@
 #endif
 
     b_expr(e1,1,e2=fwdlabel(),1);  /* including > < ... */
-    use_int(reg);
-    xrn = register_name(reg);
-    printf("\tli %s,0\n",xrn);
-    jmp(e3=fwdlabel());
-    fwddef(e2);
-    printf("\tli %s,1\n",xrn);
-    fwddef(e3);
+    if (use) {
+	use_int(reg);
+	xrn = register_name(reg);
+	printf("\tli %s,0\n",xrn);
+	jmp(e3=fwdlabel());
+	fwddef(e2);
+	printf("\tli %s,1\n",xrn);
+	fwddef(e3);
+    } else {
+	fwddef(e2);
+    }
 }
 
 char *
@@ -2572,19 +2576,22 @@
     case LE:  t=INT; flag = 1; eq=3; break;
     case ULE: t=0;   flag = 1; eq=3; break;
     case EQ:  t=INT; flag = 3; break;
-    case NEQ: t=INT; flag = 3; neg=1; break;
+    case NEQ: t=INT; flag = 3; neg=3; break;
     default: return 0;
     }
     g_expr(list3((t==INT?CMP:UCMP),cadr(e1),caddr(e1)));
     use_int(reg);
     rn = register_name(reg);
+    t = CRBITSIZ*cmpflag;
     if (eq>0) {
-	printf("\tcror %d,%d,%d\n",CRBITSIZ*cmpflag+flag-1,
-	    CRBITSIZ*cmpflag+eq-1,CRBITSIZ*cmpflag+flag-1);
+	printf("\tcror %d,%d,%d\n",t+flag-1,t+eq-1,t+flag-1);
+    }
+    if (neg>0) {
+	neg = t+neg-1,
+	printf("\tcrnor %d,%d,%d\n",neg,neg,neg);
     }
     printf("\tmfcr %s\n",rn);
-    printf("\trlwinm %s,%s,%d,1\n",rn,rn,CRBITSIZ*cmpflag+flag);
-    if (neg>0) code_lnot(reg);
+    printf("\trlwinm %s,%s,%d,1\n",rn,rn,t+flag);
     return 1;
 }
 
@@ -3602,7 +3609,7 @@
 static int
 drexpr_bool(int e1,int reg)
 {
-    int flag=-1,eq=-1,neg=-1;
+    int flag=-1,eq=-1,neg=-1,t;
     char *rn;
     switch(car(e1)) {
     case DOP+GT: case FOP+GT:  flag = 2; break;
@@ -3610,19 +3617,22 @@
     case DOP+LT: case FOP+LT:  flag = 1; break;
     case DOP+LE: case FOP+LE:  flag = 1; eq=3; break;
     case DOP+EQ: case FOP+EQ:  flag = 3; break;
-    case DOP+NEQ: case FOP+NEQ: flag = 3; neg=1; break;
+    case DOP+NEQ: case FOP+NEQ: flag = 3; neg=3; break;
     default: return 0;
     }
     g_expr(list3(DCMP,cadr(e1),caddr(e1)));
     use_int(reg);
     rn = register_name(reg);
+    t = CRBITSIZ*cmpflag;
     if (eq>0) {
-	printf("\tcror %d,%d,%d\n",CRBITSIZ*cmpflag+flag-1,
-	    CRBITSIZ*cmpflag+eq-1,CRBITSIZ*cmpflag+flag-1);
+	printf("\tcror %d,%d,%d\n",t+flag-1,t+eq-1,t+flag-1);
+    }
+    if (neg>0) {
+	neg = t+neg-1,
+	printf("\tcrnor %d,%d,%d\n",neg,neg,neg);
     }
     printf("\tmfcr %s\n",rn);
-    printf("\trlwinm %s,%s,%d,1\n",rn,rn,CRBITSIZ*cmpflag+flag);
-    if (neg>0) code_lnot(reg);
+    printf("\trlwinm %s,%s,%d,1\n",rn,rn,t+flag);
     return 1;
 }