summaryrefslogtreecommitdiff
path: root/testsuite/tests/primops
diff options
context:
space:
mode:
authorMichal Terepeta <michal.terepeta@gmail.com>2015-07-20 15:43:31 +0200
committerBen Gamari <ben@smart-cactus.org>2015-07-20 16:43:34 +0200
commit82ffc80df573512f788524c4616db3c08fc9f125 (patch)
treebf35684068e0376bb30013d22288a81966427965 /testsuite/tests/primops
parent029367e5894d4ac3ea3845f39f2cc1b5a6a9fac1 (diff)
downloadhaskell-82ffc80df573512f788524c4616db3c08fc9f125.tar.gz
LlvmCodeGen: add support for MO_U_Mul2 CallishMachOp
This adds support MO_U_Mul2 to the LLVM backend by simply using 'mul' instruction but operating at twice the bit width (e.g., for 64 bit words we will generate mul that operates on 128 bits and then extract the two 64 bit values for the result of the CallishMachOp). Test Plan: validate Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1068 GHC Trac Issues: #9430
Diffstat (limited to 'testsuite/tests/primops')
-rw-r--r--testsuite/tests/primops/should_run/T9430.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/primops/should_run/T9430.hs b/testsuite/tests/primops/should_run/T9430.hs
index 571b6db37d..aec2d264a1 100644
--- a/testsuite/tests/primops/should_run/T9430.hs
+++ b/testsuite/tests/primops/should_run/T9430.hs
@@ -73,3 +73,21 @@ main = do
checkW (1, minBound + 1) plusWord2# maxBound 2
check "plusWord2# 2 maxBound" $
checkW (1, minBound + 1) plusWord2# 2 maxBound
+
+ check "timesWord2# maxBound 0" $ checkW (0, 0) timesWord2# maxBound 0
+ check "timesWord2# 0 maxBound" $ checkW (0, 0) timesWord2# 0 maxBound
+ check "timesWord2# maxBound 1" $ checkW (0, maxBound) timesWord2# maxBound 1
+ check "timesWord2# 1 maxBound" $ checkW (0, maxBound) timesWord2# 1 maxBound
+ -- Overflows
+ check "timesWord2# " $ checkW (1, 0) timesWord2# (2 ^ 63) 2
+ check "timesWord2# " $ checkW (2, 0) timesWord2# (2 ^ 63) (2 ^ 2)
+ check "timesWord2# " $ checkW (4, 0) timesWord2# (2 ^ 63) (2 ^ 3)
+ check "timesWord2# " $ checkW (8, 0) timesWord2# (2 ^ 63) (2 ^ 4)
+ check "timesWord2# maxBound 2" $
+ checkW (1, maxBound - 1) timesWord2# maxBound 2
+ check "timesWord2# 2 maxBound" $
+ checkW (1, maxBound - 1) timesWord2# 2 maxBound
+ check "timesWord2# maxBound 3" $
+ checkW (2, maxBound - 2) timesWord2# maxBound 3
+ check "timesWord2# 3 maxBound" $
+ checkW (2, maxBound - 2) timesWord2# 3 maxBound