summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/numeric/should_run/T22282.hs3
-rw-r--r--testsuite/tests/numeric/should_run/T22282.stdout2
-rw-r--r--testsuite/tests/numeric/should_run/T22282A.hs18
-rw-r--r--testsuite/tests/numeric/should_run/all.T1
4 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/numeric/should_run/T22282.hs b/testsuite/tests/numeric/should_run/T22282.hs
new file mode 100644
index 0000000000..63b36bb8e6
--- /dev/null
+++ b/testsuite/tests/numeric/should_run/T22282.hs
@@ -0,0 +1,3 @@
+import T22282A
+
+main = print $ testF 217 161
diff --git a/testsuite/tests/numeric/should_run/T22282.stdout b/testsuite/tests/numeric/should_run/T22282.stdout
new file mode 100644
index 0000000000..a62fe1172c
--- /dev/null
+++ b/testsuite/tests/numeric/should_run/T22282.stdout
@@ -0,0 +1,2 @@
+217
+
diff --git a/testsuite/tests/numeric/should_run/T22282A.hs b/testsuite/tests/numeric/should_run/T22282A.hs
new file mode 100644
index 0000000000..087c87c32a
--- /dev/null
+++ b/testsuite/tests/numeric/should_run/T22282A.hs
@@ -0,0 +1,18 @@
+{-# OPTIONS_GHC -O1 #-}
+{-# LANGUAGE MagicHash #-}
+module T22282A where
+
+import Data.Word
+import GHC.Prim
+import GHC.Word
+
+wtestF :: GHC.Prim.Word8# -> GHC.Prim.Word8# -> GHC.Prim.Word8#
+wtestF a b = case word8ToWord# b of
+ 0## -> a
+ _ -> plusWord8# (timesWord8# (quotWord8# a b) b) (remWord8# a b)
+{-# NOINLINE wtestF #-}
+
+testF :: Word8 -> Word8 -> Word8
+testF (W8# a) (W8# b) = W8# (wtestF a b)
+{-# INLINE testF #-}
+
diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T
index 68888545f8..5d5b1f32bf 100644
--- a/testsuite/tests/numeric/should_run/all.T
+++ b/testsuite/tests/numeric/should_run/all.T
@@ -78,3 +78,4 @@ test('T19931', normal, compile_and_run, ['-O2'])
test('IntegerToFloat', normal, compile_and_run, [''])
test('T20291', normal, compile_and_run, [''])
+test('T22282', normal, compile_and_run, [''])