home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.arch      Apparently more than just beeps & boops      131,241 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 130,741 of 131,241   
   EricP to MitchAlsup   
   Re: A typical non-loop use case for SIMD   
   02 Jan 26 18:56:32   
   
   From: ThatWouldBeTelling@thevillage.com   
      
   MitchAlsup wrote:   
   >   
   > However, last week someone suggested a 3-input addition, which I gave   
   > some thought--Exactly what is the overflow condition of a ADD3 when   
   > 2-operands have one sign bit and the other has the opposite sign bit ??   
   >   
   > In the 2-input case:: result<63> != Operand1<63> ^ Operand2<63>   
   > Is there a similar 3-input equation ??   
      
   res1 = a + b   
   ovr1 = (res1<63> ^ a<63>) & (res1<63> ^ b<63>)   
   res2 = res1 + c   
   ovr2 = ((res2<63> ^ res1<63>) & (res2<63> ^ c<63>)) | ovr1   
      
   This detects if either (a+b) or (res1+c) overflows but also   
   signals overflow if (a+b) overflows but then +c wraps it back in range.   
   That is, a = INT_MAX, b = 1, c = -1, then a+b+c == INT_MAX   
   but the above would set ovr1 = 1 because a+b overflowed.   
      
   This unnecessary transitory overflow (one interior to an expression)   
   can be avoided by sign extending a,b,c to 66 bits, doing the add,   
   and checking result<65:63> are all 1 or 0.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca