Skip to content

Draft: Deprecate `narrow<N>{Int,Word}#` as regular functions

John Ericson requested to merge wip/no-narrow-n into master

These were used to truncate operations when we were using the native primops for fixed-sized types, to stay in bounds. But now that we used fixed sized unboxed types for those, I don't believe these primops have much motivation. There were, after all, compiled by the NCG as just the aToB# . bToA# round tip anyways.

If we get rid of them and just detect such round trips directly, we can optimize more cases. And similar to @hsyl20's recent fromIntegral changes, once we do handle the "underlying" round tip, there is no point having the combination be atomic because it's just more work for no gain to handle it too.

TODO:

  • Ensure no constant folding regressions.

  • Change happy not to use narrow16Int#.

CC @Bodigrim


Opening (after a rebase) this old branch I had around so the work is not lost.

After !3658 (closed) is done, and all regressions that are my fault are fixed, I really want to extricate myself from primops and get back to the buildsystem/bootstrapping work I think is fore more pressing :). So if someone wants to take this over I will be very appreciative!

Merge request reports