diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-10-12 14:51:31 -0400 |
---|---|---|
committer | Zubin Duggal <zubin.duggal@gmail.com> | 2022-10-26 15:39:08 +0530 |
commit | 74e329d21af314d3c000364722a0ba6f33e56563 (patch) | |
tree | eb5d64f5f15217b09f334c679449089a194951af | |
parent | 9e2540011d2c1a22e65063bba9fca54c0180f29c (diff) | |
download | haskell-74e329d21af314d3c000364722a0ba6f33e56563.tar.gz |
testsuite: Add test for #22282
This will complement mpickering's more general port of foundation's
numerical testsuite, providing a test for the specific case found
in #22282.
(cherry picked from commit 8eff62a43cebbb21f00aeea138bcc343d8ac8f34)
-rw-r--r-- | testsuite/tests/numeric/should_run/T22282.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/T22282.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/T22282A.hs | 18 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/all.T | 1 |
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 028677e52d..3d206ed084 100644 --- a/testsuite/tests/numeric/should_run/all.T +++ b/testsuite/tests/numeric/should_run/all.T @@ -76,3 +76,4 @@ test('T18515', normal, compile_and_run, ['']) test('T18604', normal, compile_and_run, ['']) test('IntegerToFloat', normal, compile_and_run, ['']) +test('T22282', normal, compile_and_run, ['']) |