This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, gfortran testsuite]: Do not load denormals in gfortran.fortran_torture/intrinsic_nearest.f90


On 08/21/2009 11:15 PM, Richard Henderson wrote:
On 08/21/2009 01:28 PM, Uros Bizjak wrote:
See what happens when denormals are loaded? Instead of loading
<something>e-44, we just loaded <something_else>e-308. Without _ANY_
exception, that is, and this is silicon bug, plain and simple. Perhaps
some other rocket is waiting to self-destruct... [2]. ;)

Not exactly. You can't interpret the register in this way without issuing a CVTST instruction first. Which *will* trap, and with /S qualifier, will go through the kernel routine that will produce a properly normalized double-precision number.

If you try to use ADDT instead of ADDS on this register value,
without the CVTST, you are in error and will cause rockets to pop.

It looks that perhaps something is wrong with alpha's cmpXX patterns.


From this reduced testcase:

--cut here--
program f2003
implicit none

complex :: z1 = cmplx(b'10101',-4.0, kind=4)

if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort()

z1 = cmplx(b'10101',-4.0, kind=4)

if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort()

end program f2003
--cut here--

following sequence is produced with -O2 -mieee:

   12000040c:   fc ff 5d 24     ldah    t1,-4(gp)
   120000410:   00 00 3d 24     ldah    t0,0(gp)
   120000414:   e8 1d 42 89     lds     $f10,7656(t1)
-> 120000418:   c8 84 61 89     lds     $f11,-31544(t0)
   12000041c:   8c d5 ea 5b     cvtst/s $f10,$f12
   120000420:   ad b4 6c 59     cmpteq/su       $f11,$f12,$f13

alias:

lds $f10,$LC0($2) !gprellow # 86 *movsf_fix/2 [length = 4]
lds $f11,z1.723($1) !gprellow # 18 *movsf_fix/2 [length = 4]
cvtsts $f10,$f12 # 20 *extendsfdf2_ieee [length = 4]
cmpteq/su $f11,$f12,$f13 # 21 *cmpdf_ieee_ext1 [length = 4]
cpys $f12,$f12,$f10 # 89 *movdf_fix/1 [length = 4]


where:

(define_insn "*cmpdf_ieee_ext1"
  [(set (match_operand:DF 0 "register_operand" "=&f")
    (match_operator:DF 1 "alpha_fp_comparison_operator"
               [(float_extend:DF
                 (match_operand:SF 2 "reg_or_0_operand" "fG"))
                (match_operand:DF 3 "reg_or_0_operand" "fG")]))]

It is assumed that the above pattern can inherently extend SFmode operand to DFmode. This is not true for denormals, since lds doesn't load denormals correclty. Also, cmpteq/su doesn't fix its operand.

I wonder, if all alpha.md patterns that inherently extend SFmode to DFmode are wrong for denormal operands?

Uros.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]