diff options
author | Nikita Karetnikov <nikita@karetnikov.org> | 2015-10-31 12:27:54 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-10-31 16:40:38 +0100 |
commit | 8160f42b8dad33e47b4c73ed3f9bf889462e7bfe (patch) | |
tree | 0752990875cffaac175c28b3a761b1509862af4b /testsuite/tests/numeric | |
parent | 62f0fbc943307d8522e6c8333caf37c6569ee873 (diff) | |
download | haskell-8160f42b8dad33e47b4c73ed3f9bf889462e7bfe.tar.gz |
Add subWordC# on x86ish
This adds a subWordC# primop which implements subtraction with overflow
reporting.
Reviewers: tibbe, goldfire, rwbarton, bgamari, austin, hvr
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1334
GHC Trac Issues: #10962
Diffstat (limited to 'testsuite/tests/numeric')
-rw-r--r-- | testsuite/tests/numeric/should_run/T10962.hs | 16 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/T10962.stdout-ws-32 | 2 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/T10962.stdout-ws-64 | 2 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/all.T | 1 |
4 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/numeric/should_run/T10962.hs b/testsuite/tests/numeric/should_run/T10962.hs new file mode 100644 index 0000000000..896c9e987f --- /dev/null +++ b/testsuite/tests/numeric/should_run/T10962.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} + +module Main where + +import GHC.Base + +main :: IO () +main = do + -- Overflow. + let (# w1, i1 #) = subWordC# 1## 3## + print (W# w1, I# i1) + + -- No overflow. + let (# w2, i2 #) = subWordC# 3## 1## + print (W# w2, I# i2) diff --git a/testsuite/tests/numeric/should_run/T10962.stdout-ws-32 b/testsuite/tests/numeric/should_run/T10962.stdout-ws-32 new file mode 100644 index 0000000000..a1dec8410a --- /dev/null +++ b/testsuite/tests/numeric/should_run/T10962.stdout-ws-32 @@ -0,0 +1,2 @@ +(4294967294,1) +(2,0) diff --git a/testsuite/tests/numeric/should_run/T10962.stdout-ws-64 b/testsuite/tests/numeric/should_run/T10962.stdout-ws-64 new file mode 100644 index 0000000000..853bf94a61 --- /dev/null +++ b/testsuite/tests/numeric/should_run/T10962.stdout-ws-64 @@ -0,0 +1,2 @@ +(18446744073709551614,1) +(2,0) diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T index 27dccc7286..7ebdd44cbd 100644 --- a/testsuite/tests/numeric/should_run/all.T +++ b/testsuite/tests/numeric/should_run/all.T @@ -64,3 +64,4 @@ test('T8726', normal, compile_and_run, ['']) test('CarryOverflow', omit_ways(['ghci']), compile_and_run, ['']) test('T9810', normal, compile_and_run, ['']) test('T10011', normal, compile_and_run, ['']) +test('T10962', omit_ways(['ghci']), compile_and_run, ['']) |