On Mon, May 23, 2005 at 10:25:26AM +0200, Uros Bizjak wrote:
> Hello!
> 
> It looks that i387 control word register definition is missing from register
> definitions for i386 processor. Inside i386.h, we have:
> 
> #define FIXED_REGISTERS                                               \
> /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/    \
> {  0, 0, 0, 0, 0, 0, 0, 1, 0,  0,  0,  0,  0,  0,  0,  0,     \
> /*arg,flags,fpsr,dir,frame*/                                  \
>     1,    1,   1,  1,    1,                                   \
> /*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/                   \
>      0,   0,   0,   0,   0,   0,   0,   0,                    \
> /*mmx0,mmx1,mmx2,mmx3,mmx4,mmx5,mmx6,mmx7*/                   \
>      0,   0,   0,   0,   0,   0,   0,   0,                    \
> /*  r8,  r9, r10, r11, r12, r13, r14, r15*/                   \
>      2,   2,   2,   2,   2,   2,   2,   2,                    \
> /*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/             \
>      2,   2,    2,    2,    2,    2,    2,    2}
> 
> However, there should be another register defined, i387 control word register,
> 'fpcr' (Please look at chapter 11.2.1.2 and 11.2.1.3 in
> http://webster.cs.ucr.edu/AoA/Windows/HTML/RealArithmetic.html). There are two
> instructions in i386.md that actually use fpcr:

Well you really want both the fpcr and the mxcsr registers, since the fpcr
only controls the x87 and the mxcsr controls the xmm registers.  Note, in
adding these registers, you are going to have to go through all of the floating
point patterns to add (use:HI FPCR_REG) and (use:SI MXCSR_REG) to each and
every pattern so that the optimizer can be told not to move a floating point
operation past the setting of the control word.  Then you need to make sure
nothing got broken by adding these USE instructions.  It is certainly doable,
but it is not a simple fix.  I suspect there is then more information needed to
be able to move redudant mode switching operations out of a loop.  If you are
going to tackle it, be sure to have your paperwork in place so that your code
changes can be used.

-- 
Michael Meissner
email: [EMAIL PROTECTED]
http://www.the-meissners.org

Reply via email to