Menu

error in emulating SUBS F31,fx,fx instruction

scruty
2008-09-01
2013-04-03
  • scruty

    scruty - 2008-09-01

    running under w2k with es40 latest snapshot build, there is an error in emulating the SUBS F31,fx,fx instruction, which should negate the value of fx. (The equivalent f, d, g, t_floating instr seems to work in this respect.)

    DBG> e/hex @r28+48
    ...LIB32+5D9D0: 000000007F7FFFFF ; memory format of an ieee s_floating value, happens to be largest s_float number, but SUBS F31,... goes wrong with other values too
    DBG> step
    stepped to ....%LINE 190+4:      LDS             F9,#X0030(R28)
    DBG> step
    stepped to ...%LINE 190+8:       SUBS            F31,F9,F9
    DBG> e/s_f f9
    ...%F9:  0.3402823E+39
    DBG> e/hex F9
    ...%F9:  47EFFFFFE0000000
    DBG> step
    stepped to ...%LINE 190+12:      LDA             SP,#XFFF8(SP)
    DBG> e/s_f f9
    ...%F9:  0.3402823E+39
    DBG> e/hex f9
    ...%F9:  4FEFFFFFE0000000
    DBG> e/s_f f31
    ...%F31: 0.0000000E+00
    DBG> e/hex f31
    ...%F31: 0000000000000000

    DBG shows the same s_float value before and after the SUBS instr, although the hex values are different. this behaviour is reproducible.

    I looked at CAlphaCPU::ieee_fadd and FPR_GETEXP, but can't track down the error due to my "c illiteracy," except maybe that e.g., the follwing statement in CAlphaCPU::ieee_fadd

    if(ftpa == UFT_ZERO)
        a = b;      /* s1 = 0? */

    seems to be wrong in case of a subtraction, - but why does CAlphaCPU::ieee_fadd work with t_float's SUBT?

     
    • scruty

      scruty - 2008-09-01

      forgot to add, the different hex values (under es40) are different when interpreted as s_ or t_floating value:

      DBG> set radix hex
      DBG> dep/quadword f9=047EFFFFFE0000000
      DBG> e/s_flo f9
      %F9:  0.3402823E+39
      DBG> e/t_flo f9
      %F9:  0.340282346638529E+039
      DBG> dep/quadword f9=04FEFFFFFE0000000
      DBG> e/t_flo f9
      %F9:  0.115792082335570E+078
      DBG> e/s_flo f9
      %F9:  0.3402823E+39

      maybe there is an error in the ieee_norm routine?
      (s_ and t_floating to be normalized the same way?)

      so back to the SUBS F31,F9,F9; it should produce this value:

      DBG> dep/quadword f9=0C7EFFFFFE0000000
      DBG> e/s_flo f9
      %F9:  -0.3402823E+39
      DBG> e/hex f9
      %F9:  0C7EFFFFFE0000000

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.