summaryrefslogtreecommitdiff
path: root/testsuite/tests/cmm/should_run/ByteSwitch.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/cmm/should_run/ByteSwitch.hs')
-rw-r--r--testsuite/tests/cmm/should_run/ByteSwitch.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/testsuite/tests/cmm/should_run/ByteSwitch.hs b/testsuite/tests/cmm/should_run/ByteSwitch.hs
new file mode 100644
index 0000000000..40b1db7a2b
--- /dev/null
+++ b/testsuite/tests/cmm/should_run/ByteSwitch.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE UnliftedFFITypes #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GHCForeignImportPrim #-}
+
+import GHC.Int
+import GHC.Exts
+
+foreign import prim "byte_switch" byteSwitch:: Int8# -> Int8#
+
+main = traverse (\(I8# x#) -> print $ I8# (byteSwitch x#)) [-4..4]