Skip to content

Add constant folding rule and fix `Bits IntN` instances (fix #16402)

Sylvain Henry requested to merge hsyl20/ghc:hsyl20-narrowword into master

Add constant folding rule:

         narrowN (x .&. m)
         m .&. 2^n-1 == 2^n-1
         ==> narrowN x

   e.g.  narrow16 (x .&. 0x12FFFF) ==> narrow16 x

Also fix Bits instances for Int8/16/32/64 which were using Word# primops instead of Int# primops (separate commit).

Edited by Sylvain Henry

Merge request reports