
#7902: Add support for byte endianness swapping exposed as a primops -----------------------------+---------------------------------------------- Reporter: tab | Owner: Type: feature request | Status: patch Priority: normal | Component: Compiler Version: 7.7 | Keywords: bswap endianness Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by tab): i've uploaded new versions of the patch. a quick revlog: * i've added a 16 bits bswap. in NCG, i've implemented it as a 32 bits bswap followed by a shr instead of using a xchg, as the higher 8 bits register are not available as a name in the current codebase, and also that limits the number of possible registers to 4. * corrected a bug with bswap's llvm codegen. Use zero extension (zext) instead of signed extension (sext). Technically popcnt got the same problem, but as the number never reach the highest bits, sext is equivalent to zext in this case. (Is there a better way to contribute to ghc than attaching patches here ? Or is this the best thing to do ?) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7902#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler