summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi/should_run/PrimFFIInt8.hs
blob: 4124e074aa4d34a3781a3f5d7432bb44d66d8398 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnliftedFFITypes #-}

module Main where

import GHC.Exts

foreign import ccall "add_all_int8"
    add_all_int8
        :: Int8# -> Int8# -> Int8# -> Int8# -> Int8#
        -> Int8# -> Int8# -> Int8# -> Int8# -> Int8#
        -> Int8#

main :: IO ()
main = do
    let a = narrowInt8# 0#
        b = narrowInt8# 1#
        c = narrowInt8# 2#
        d = narrowInt8# 3#
        e = narrowInt8# 4#
        f = narrowInt8# 5#
        g = narrowInt8# 6#
        h = narrowInt8# 7#
        i = narrowInt8# 8#
        j = narrowInt8# 9#
        x = I# (extendInt8# (add_all_int8 a b c d e f g h i j))
    print x