home bbs files messages ]

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

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

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

   Message 4,188 of 4,675   
   Terje Mathisen to Rick C. Hodgin   
   Re: Assembly contest idea   
   15 Oct 20 08:22:31   
   
   From: terje.mathisen@nospicedham.tmsw.no   
      
   Rick C. Hodgin wrote:   
   > On 10/14/20 10:00 PM, Melzzzzz wrote:   
   >> On 2020-10-13, Rick C. Hodgin    
   >> wrote:   
   >>> I have two rectangles r1 and r2.  I need to determine if r1 is 1) fully   
   >>> inside, 2) partially inside, or 3) not inside r2.   
   >>> The coordinates are all signed integers ranging from -32768 to +32767.   
   >>   
   >> Too old for this ;)   
   >>   
   >> I think that I solved this problem some 30 years ago :P   
   >   
   > I spent some time searching online for branchless compares to see if I   
   > could find some optimizations that would be useful.   
   >   
   > I remember coming across a page that showed all kinds of optimizations   
   > for adding certain values, subtracting certain values, etc.   
   >   
   > I'm thinking there is a way to take the values and perform only ADD,   
   > SUB, INC, DEC, OR, and XOR to get a result.  If it could be done for a   
   > type of between() function, the rest becomes academic.   
   >   
   You can obviously do a bunch of parallel compares, using SIMD opcodes:   
      
   Each AVX-512 register would hold 32 16-bit ints, so you can splat the   
   ll/ur corners (4 values) of both rectangles (8 total) across up to 8   
   locations:   
      
   --   
   -    
   "almost all programming can be viewed as an exercise in caching"   
      
   --- 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