Re:Optimising Haskell for a tight inner loop
by userbinator on Wednesday January 08, 2014 @08:36PM
(#7028177)
I wonder how a table lookup compares? Something like
I really wish Intel would optimise lodsb, scasb, and the rest of the string instructions, since they're powerful and particularly suited for this sort of scanning.
[ Parent
| on HN ]
Re:Optimising Haskell for a tight inner loop
by zvrba on Thursday January 09, 2014 @02:26AM
(#7029268)
I think it's more likely that they'll eventually re-purpose these opcodes (further ISA extensions), and string operations will be optimized through simple hardware matching of documented instruction sequences. Already today, Intel's optimization manual gives SSE-optimized string search routines, which consume 16 bytes at a time.
Removing and re-purposing instructions is not unprecedented; it has already been done at 32->64 jump. (Prefixes, decimal instructions, etc.)
Re:Optimising Haskell for a tight inner loop
by pbsd on Thursday January 09, 2014 @07:40AM
(#7030099)
I doubt those instructions (especially stos* and movs*, respectively matching memset and memcpy) are going anywhere. Intel has even changed their semantics in recent chips to work on 16-byte or larger chunks, and to have out-of-order memory accesses. Current MOVSB, for instance, should be nearly as fast as SSE/AVX optimized memory transfers.
Re:Optimising Haskell for a tight inner loop
by userbinator on Thursday January 09, 2014 @09:13PM
(#7034660)
I wouldn't say their semantics have changed but certainly their implementation. The fact that Intel used to recommend against using them but now advises the opposite, suggests that scas/cmps (memchr/memset) could be next. In any case, the thought of one machine instruction doing better than lots of carefully hand-written assembly is nice.