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 3,323 of 4,675   
   wolfgang kern to Terje   
   Re: Hex 2 Bin   
   01 Apr 18 10:12:05   
   
   From: nowhere@never.at   
      
   Terje wrote:   
      
   > What about a new easy challenge in the SIMD era:   
      
   > a) Take a large binary data array and print it out as hex, with   
   > user-specified block and line length.   
      
   > I.e. every 10 bytes (20 hex digits) insert a space, every 3 blocks insert   
   > CRLF.   
      
   > b) Given a file of hex data with arbitrary white space, convert to binary.   
      
   > The second one is the most interesting, i.e. how do we transparently skip   
   > all the white space?   
      
   good idea, I checked on usable/available SIMD instructions but skipped all   
   packet float yet.   
      
   a) the nibble to byte expand seem to be the main problem and need at least   
   SSSE3 (Pshufb) and perhaps also AVX for more than 16 digit results.   
   for the byte to ASCII conversion I could use somthing like my old PM32:   
      
                ;assume all bytes are already Zext nibbles here   
   ADD 0606..06 ;on temp copy   
   SHR 4        ;= AND 0101..01   
   IMUL 7       :FMULADD could help here   
   ADD orig,temp   
   OR  3030..30   
      
   b) will need certain tricks ...haven't checked on it so far.   
      
   I have some issues with SIMD instructions because they need to load or use   
   constants from memory. My LM-debugger is still 'work in progress', so I cannot   
   direct compare register- vs. SIMD-solution benchmarks now. But I'd expect the   
   variant with the much lesser memory accesses to be faster even   
   the job may become doubled for >64 bit.   
   __   
   wolfgang   
      
   --- 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