summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi/should_run/PrimFFIInt16.hs
blob: 6d4eae328f8d7da5b655616ef77484e01365158b (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_int16"
    add_all_int16
        :: Int16# -> Int16# -> Int16# -> Int16# -> Int16#
        -> Int16# -> Int16# -> Int16# -> Int16# -> Int16#
        -> Int16#

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