Skip to content

Provide bitreverse primop

We already have nice primops like byteSwap#, it'd be nice to also have bitreverse.

Clang provides __builtin_bitreverse (http://clang.llvm.org/docs/LanguageExtensions.html#builtin-bitreverse) functions which could be the default. GCC currently doesn't have a built-in (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50481).

One prominent place where this primop could be used is Data.IntSet.Internal where it's implemented as a revNat. Many other libraries also define own versions.

Trac metadata
Trac field Value
Version 8.6.3
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by Peter Trommler
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information