-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use shiftL(Natural/Integer) instead of Bits.shiftL
For some bizarre reason, which I cannot reproduce, the set of optimizations that Clash picks results in a weird specialization of the `natSing2` implementation for `GHC.TypeNats.^`, which is specialized to the `y` in `x ^ y` being a negative number. This then causes the: > shiftL x y = if y <= 0 then shiftLNatural x y else shiftRNatural x (negate y) to pick the else branch, which in turn causes fast power-of-two calculation in `natSing2` to do `1 shiftR y` instead of the intended `1 shiftL y`. Anyhow... I don't know what's going on... This patch ensures we call `shiftLNatural` directly, since we know the exponent never a negative number; and GHC won't be able to specialize. Fixes clash-lang/clash-compiler#1454
- Loading branch information
1 parent
88c8a28
commit 9b15b62
Showing
3 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters