Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.24
 
1.25
 
MAIN:ragge:20101026203000
 
local2.c
_>319319                 printf("\tmovsb\n");
 320320 }
 321321 
<> 322+#define E(x)    expand(p, 0, x)
322323 /*
 323324  * Generate code to convert an unsigned long to xmm float/double.
 324325  */
 325326 static void
 326327 ultofd(NODE *p)
 327328 {
 328329 
<>329 -#define E(x)    expand(p, 0, x)
330330         E("     movq AL,A1\n");
 331331         E("     testq A1,A1\n");
 332332         E("     js 2f\n");
     
 !
340340         E("     cvtsi2sZfq A2,A3\n");
 341341         E("     addsZf A3,A3\n");
 342342         E("3:\n");
<>343 -#undef E
344343 }
 345344 
<> 345+/*
  346+ * Generate code to convert an x87 long double to an unsigned long.
  347+ * This is ugly :-/
  348+ */
  349+static void
  350+ldtoul(NODE *p)
  351+{
  352+        int r;
  353+
  354+        r = getlr(p, '1')->n_rval;
  355+
  356+        E("     subq $16,%rsp\n");
  357+        E("     movl $0x5f000000,(%rsp)\n"); /* More than long can have */
  358+        E("     flds (%rsp)\n");
  359+        if (p->n_left->n_op == REG) {
  360+                E("     movq AL,(%rsp)\n");
  361+                E("     fldt (%rsp)\n");
  362+        } else
  363+                E("     fldt AL\n");
  364+        E("     fucomi %st(1), %st\n");
  365+        E("     jae 2f\n");
  366+
  367+        E("     fstp %st(1)\n");         /* Pop huge val from stack */
  368+        E("     fnstcw (%rsp)\n");       /* store cw */
  369+        E("     movw $0x0f3f,4(%rsp)\n");/* round towards 0 */
  370+        E("     fldcw 4(%rsp)\n");       /* new cw */
  371+        E("     fistpll 8(%rsp)\n");     /* save val */
  372+        E("     fldcw (%rsp)\n");        /* fetch old cw */
  373+        E("     movq 8(%rsp),A1\n");
  374+
  375+        E("     jmp 3f\n");
  376+
  377+        E("2:\n");
  378+
  379+        E("     fsubp %st, %st(1)\n");
  380+        E("     fnstcw (%rsp)\n");      
  381+        E("     movw $0x0f3f,4(%rsp)\n");
  382+        E("     fldcw 4(%rsp)\n");
  383+        E("     fistpll 8(%rsp)\n");
  384+        E("     fldcw (%rsp)\n");
  385+        E("     movabsq $0x8000000000000000,A1\n");
  386+        E("     xorq 8(%rsp),A1\n");
  387+
  388+        E("3:   addq $16,%rsp\n");
  389+}
  390+#undef E
  391+
346392 void
 347393 zzzcode(NODE *p, int c)
 348394 {
     
 !
360406                 }
 361407                 break;
 362408 
<> 409+        case 'B': /* ldouble to unsigned long cast */
  410+                ldtoul(p);
  411+                break;
  412+
<_363413         case 'C'/* remove from stack after subroutine call */
 364414                 pr = p->n_qual;
 365415                 if (p->n_op == UCALL)
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-08-23 03:37 +0200