diff options
author | Ian Lynagh <ian@well-typed.com> | 2013-07-30 22:11:31 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2013-07-30 22:11:31 +0100 |
commit | c93e866869fba09c119ea5e99724fddaf335ed01 (patch) | |
tree | 1fc98df704f8539d350e2ae3b72c5fd8d815130f | |
parent | 5970bafbc8f0afc161b7afdd3a19e597769f16af (diff) | |
download | haskell-c93e866869fba09c119ea5e99724fddaf335ed01.tar.gz |
Add a test for #7835
-rw-r--r-- | testsuite/tests/driver/T7835/Makefile | 9 | ||||
-rw-r--r-- | testsuite/tests/driver/T7835/T7835.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/driver/T7835/Test.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/driver/T7835/TestPrim.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/driver/T7835/all.T | 7 | ||||
-rw-r--r-- | testsuite/tests/driver/T7835/test-prims.cmm | 10 |
6 files changed, 48 insertions, 0 deletions
diff --git a/testsuite/tests/driver/T7835/Makefile b/testsuite/tests/driver/T7835/Makefile new file mode 100644 index 0000000000..0248556ac3 --- /dev/null +++ b/testsuite/tests/driver/T7835/Makefile @@ -0,0 +1,9 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +T7835: + $(RM) Test Test.exe Test.hi Test.o TestPrim.hi TestPrim.o test-prims.o + "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make Test test-prims.cmm + ./Test + diff --git a/testsuite/tests/driver/T7835/T7835.stdout b/testsuite/tests/driver/T7835/T7835.stdout new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/testsuite/tests/driver/T7835/T7835.stdout @@ -0,0 +1 @@ +17 diff --git a/testsuite/tests/driver/T7835/Test.hs b/testsuite/tests/driver/T7835/Test.hs new file mode 100644 index 0000000000..8b7f1419ac --- /dev/null +++ b/testsuite/tests/driver/T7835/Test.hs @@ -0,0 +1,4 @@ +import qualified TestPrim + +main = print $ TestPrim.tpo 8 9 + diff --git a/testsuite/tests/driver/T7835/TestPrim.hs b/testsuite/tests/driver/T7835/TestPrim.hs new file mode 100644 index 0000000000..f32e7bc78e --- /dev/null +++ b/testsuite/tests/driver/T7835/TestPrim.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE GHCForeignImportPrim #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnliftedFFITypes #-} +{-# LANGUAGE NoImplicitPrelude #-} + +module TestPrim + ( + tpo# + , tpo + ) where + +import GHC.Base -- Int and I# + +foreign import prim "test_prim_op" tpo# :: Int# -> Int# -> Int# + +tpo :: Int -> Int -> Int +tpo (I# a) (I# b) = I# (tpo# a b) diff --git a/testsuite/tests/driver/T7835/all.T b/testsuite/tests/driver/T7835/all.T new file mode 100644 index 0000000000..3722f3a55d --- /dev/null +++ b/testsuite/tests/driver/T7835/all.T @@ -0,0 +1,7 @@ + +test('T7835', + extra_clean(['Test', 'Test.exe', 'Test.hi', 'Test.o', + 'TestPrim.hi', 'TestPrim.o', 'test-prims.o']), + run_command, + ['$MAKE -s --no-print-directory T7835']) + diff --git a/testsuite/tests/driver/T7835/test-prims.cmm b/testsuite/tests/driver/T7835/test-prims.cmm new file mode 100644 index 0000000000..fb0a4005d3 --- /dev/null +++ b/testsuite/tests/driver/T7835/test-prims.cmm @@ -0,0 +1,10 @@ +#include "Cmm.h" + +test_prim_op (W_ int1, W_ int2) +{ + W_ r; + + r = int1 + int2; + + return (r); +} |