summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2020-08-21 00:39:20 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-08-24 00:32:31 -0400
commit364258e0ad25bc95e69745554f5ca831ce80baf8 (patch)
tree98a2acff606fdc2fe644b2a6302f1b0f7aac0bc0 /testsuite
parentd8f61182c3bdd1b6121c83be632b4941b907de88 (diff)
downloadhaskell-364258e0ad25bc95e69745554f5ca831ce80baf8.tar.gz
Fix types in silly shifts (#18589)
Patch written by Simon. I have only added a testcase.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/simplCore/should_compile/T18589.hs12
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
2 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T18589.hs b/testsuite/tests/simplCore/should_compile/T18589.hs
new file mode 100644
index 0000000000..c892bc844e
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T18589.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE MagicHash #-}
+module T18589 where
+
+import GHC.Prim
+
+-- See Note [Guarding against silly shifts]
+-- Make sure that a silly shift is optimized correctly
+f1 x = uncheckedIShiftL# x -1#
+f2 x = uncheckedIShiftRA# x -1#
+f3 x = uncheckedIShiftRL# x -1#
+f4 x = uncheckedShiftL# x -1#
+f5 x = uncheckedShiftRL# x -1#
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index c033150957..771798ee18 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -332,3 +332,4 @@ test('T18328', [ only_ways(['optasm']), grep_errmsg(r'Arity=') ], compile, ['-dd
test('T18347', normal, compile, ['-dcore-lint -O'])
test('T18355', [ grep_errmsg(r'OneShot') ], compile, ['-O -ddump-simpl -dsuppress-uniques'])
test('T18399', normal, compile, ['-dcore-lint -O'])
+test('T18589', normal, compile, ['-dcore-lint -O'])