summaryrefslogtreecommitdiff
path: root/testsuite/tests/cmm/should_run/ByteSwitch.hs
blob: 40b1db7a2b960953cc7b547a24724465f09f9223 (plain)
1
2
3
4
5
6
7
8
9
10
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]