comparison mc-code-ia32.c @ 84:1a723130a2c7

condtional
author kono
date Wed, 05 Mar 2003 10:54:33 +0900
parents f3f75911d62c
children 3789aef7331d
comparison
equal deleted inserted replaced
83:f3f75911d62c 84:1a723130a2c7
1027 { 1027 {
1028 g_expr(list3(SUB,cadr(e1),caddr(e1))); 1028 g_expr(list3(SUB,cadr(e1),caddr(e1)));
1029 printf("\tj%s\t_%d\n",s,l1); 1029 printf("\tj%s\t_%d\n",s,l1);
1030 } 1030 }
1031 1031
1032 void
1033 drexpr(int e1, int e2,int l1, int op)
1034 {
1035 g_expr(list3(DCOMP,e1,e2));
1036 switch(op) {
1037 case DOP+GT:
1038 printf("\ttestb\t$69,%%ah\n");
1039 printf("\tje\t_%d\n",l1);
1040 break;
1041 case DOP+GE:
1042 printf("\ttestb\t$5,%%ah\n");
1043 printf("\tje\t_%d\n",l1);
1044 break;
1045 case DOP+EQ:
1046 printf("\tandb\t$69,%%ah\n");
1047 printf("\txorb\t$64,%%ah\n");
1048 printf("\tje\t_%d\n",l1);
1049 break;
1050 case DOP+NEQ:
1051 printf("\tandb\t$69,%%ah\n");
1052 printf("\txorb\t$64,%%ah\n");
1053 printf("\tjne\t_%d\n",l1);
1054 break;
1055 }
1056 }
1057
1058 1032
1059 void 1033 void
1060 jcond(int l, char cond) 1034 jcond(int l, char cond)
1061 { 1035 {
1062 if (chk) return; 1036 if (chk) return;
1473 case DADD: printf("\tfaddp %%st,%%st(1)\n"); break; 1447 case DADD: printf("\tfaddp %%st,%%st(1)\n"); break;
1474 case DSUB: printf("\tfsubrp %%st,%%st(1)\n"); break; 1448 case DSUB: printf("\tfsubrp %%st,%%st(1)\n"); break;
1475 case DDIV: printf("\tfdivrp %%st,%%st(1)\n"); break; 1449 case DDIV: printf("\tfdivrp %%st,%%st(1)\n"); break;
1476 case DMUL: printf("\tfmulp %%st,%%st(1)\n"); break; 1450 case DMUL: printf("\tfmulp %%st,%%st(1)\n"); break;
1477 case DCOMP: 1451 case DCOMP:
1478 printf("\tfxch\t%%st(1)\n"); 1452 /* printf("\tfxch\t%%st(1)\n"); */
1479 printf("\tfucompp\n"); 1453 printf("\tfucompp\n");
1480 printf("\tfnstsw\t%%ax\n"); 1454 printf("\tfnstsw\t%%ax\n");
1481 break; 1455 break;
1482 } 1456 }
1483 } 1457 }
1516 printf("\t%s (%s)\n",fstore_u(d),register_name(creg,0)); 1490 printf("\t%s (%s)\n",fstore_u(d),register_name(creg,0));
1517 if (use) 1491 if (use)
1518 /* pop */; 1492 /* pop */;
1519 } 1493 }
1520 1494
1495 void
1496 drexpr(int e1, int e2,int l1, int op)
1497 {
1498 g_expr(list3(DCOMP,e1,e2));
1499 switch(op) {
1500 case DOP+GE:
1501 printf("\ttestb\t$5,%%ah\n");
1502 printf("\tjne\t_%d\n",l1);
1503 break;
1504 case DOP+GT:
1505 printf("\ttestb\t$69,%%ah\n");
1506 printf("\tjne\t_%d\n",l1);
1507 break;
1508 case DOP+EQ:
1509 printf("\tandb\t$69,%%ah\n");
1510 printf("\txorb\t$64,%%ah\n");
1511 printf("\tjne\t_%d\n",l1);
1512 break;
1513 case DOP+NEQ:
1514 printf("\tandb\t$69,%%ah\n");
1515 printf("\txorb\t$64,%%ah\n");
1516 printf("\tje\t_%d\n",l1);
1517 break;
1518 }
1519 }
1520
1521 int dpop_register() 1521 int dpop_register()
1522 { 1522 {
1523 return 1; 1523 return 1;
1524 } 1524 }
1525 1525