-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
14,062 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{-# LANGUAGE ForeignFunctionInterface #-} | ||
{-# LANGUAGE MagicHash #-} | ||
{-# LANGUAGE UnliftedFFITypes #-} | ||
|
||
module Main where | ||
|
||
import GHC.Exts | ||
|
||
foreign import ccall "add_all_int64" | ||
add_all_int64 | ||
:: Int64# -> Int64# -> Int64# -> Int64# -> Int64# | ||
-> Int64# -> Int64# -> Int64# -> Int64# -> Int64# | ||
-> Int64# | ||
|
||
main :: IO () | ||
main = do | ||
let a = narrowInt64# 0# | ||
b = narrowInt64# 1# | ||
c = narrowInt64# 2# | ||
d = narrowInt64# 3# | ||
e = narrowInt64# 4# | ||
f = narrowInt64# 5# | ||
g = narrowInt64# 6# | ||
h = narrowInt64# 7# | ||
i = narrowInt64# 8# | ||
j = narrowInt64# 9# | ||
x = I# (extendInt64# (add_all_int64 a b c d e f g h i j)) | ||
print x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdint.h> | ||
|
||
int64_t add_all_int64( | ||
int64_t a, int64_t b, int64_t c, int64_t d, int64_t e, | ||
int64_t f, int64_t g, int64_t h, int64_t i, int64_t j) { | ||
return a + b + c + d + e + f + g + h + i + j; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{-# LANGUAGE ForeignFunctionInterface #-} | ||
{-# LANGUAGE MagicHash #-} | ||
{-# LANGUAGE UnliftedFFITypes #-} | ||
|
||
module Main where | ||
|
||
import GHC.Exts | ||
|
||
foreign import ccall "add_all_word64" | ||
add_all_word64 | ||
:: Word64# -> Word64# -> Word64# -> Word64# -> Word64# | ||
-> Word64# -> Word64# -> Word64# -> Word64# -> Word64# | ||
-> Word64# | ||
|
||
main :: IO () | ||
main = do | ||
let a = narrowWord64# 0## | ||
b = narrowWord64# 1## | ||
c = narrowWord64# 2## | ||
d = narrowWord64# 3## | ||
e = narrowWord64# 4## | ||
f = narrowWord64# 5## | ||
g = narrowWord64# 6## | ||
h = narrowWord64# 7## | ||
i = narrowWord64# 8## | ||
j = narrowWord64# 9## | ||
x = W# (extendWord64# (add_all_word64 a b c d e f g h i j)) | ||
print x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdint.h> | ||
|
||
uint64_t add_all_word64( | ||
uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, | ||
uint64_t f, uint64_t g, uint64_t h, uint64_t i, uint64_t j) { | ||
return a + b + c + d + e + f + g + h + i + j; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.