RtsFlags: Make `mallocFailHook` const correct
[ghc.git] / includes / stg / Prim.h
1 /* ----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 2014-2014
4 *
5 * Declarations for C fallback primitives implemented by 'ghc-prim' package.
6 *
7 * Do not #include this file directly: #include "Rts.h" instead.
8 *
9 * To understand the structure of the RTS headers, see the wiki:
10 * http://ghc.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
11 *
12 * -------------------------------------------------------------------------- */
13
14 #ifndef PRIM_H
15 #define PRIM_H
16
17 /* libraries/ghc-prim/cbits/atomic.c */
18 StgWord hs_atomic_add8(StgWord x, StgWord val);
19 StgWord hs_atomic_add16(StgWord x, StgWord val);
20 StgWord hs_atomic_add32(StgWord x, StgWord val);
21 StgWord64 hs_atomic_add64(StgWord x, StgWord64 val);
22 StgWord hs_atomic_sub8(StgWord x, StgWord val);
23 StgWord hs_atomic_sub16(StgWord x, StgWord val);
24 StgWord hs_atomic_sub32(StgWord x, StgWord val);
25 StgWord64 hs_atomic_sub64(StgWord x, StgWord64 val);
26 StgWord hs_atomic_and8(StgWord x, StgWord val);
27 StgWord hs_atomic_and16(StgWord x, StgWord val);
28 StgWord hs_atomic_and32(StgWord x, StgWord val);
29 StgWord64 hs_atomic_and64(StgWord x, StgWord64 val);
30 StgWord hs_atomic_nand8(StgWord x, StgWord val);
31 StgWord hs_atomic_nand16(StgWord x, StgWord val);
32 StgWord hs_atomic_nand32(StgWord x, StgWord val);
33 StgWord64 hs_atomic_nand64(StgWord x, StgWord64 val);
34 StgWord hs_atomic_or8(StgWord x, StgWord val);
35 StgWord hs_atomic_or16(StgWord x, StgWord val);
36 StgWord hs_atomic_or32(StgWord x, StgWord val);
37 StgWord64 hs_atomic_or64(StgWord x, StgWord64 val);
38 StgWord hs_atomic_xor8(StgWord x, StgWord val);
39 StgWord hs_atomic_xor16(StgWord x, StgWord val);
40 StgWord hs_atomic_xor32(StgWord x, StgWord val);
41 StgWord64 hs_atomic_xor64(StgWord x, StgWord64 val);
42 StgWord hs_cmpxchg8(StgWord x, StgWord old, StgWord new_);
43 StgWord hs_cmpxchg16(StgWord x, StgWord old, StgWord new_);
44 StgWord hs_cmpxchg32(StgWord x, StgWord old, StgWord new_);
45 StgWord hs_cmpxchg64(StgWord x, StgWord64 old, StgWord64 new_);
46 StgWord hs_atomicread8(StgWord x);
47 StgWord hs_atomicread16(StgWord x);
48 StgWord hs_atomicread32(StgWord x);
49 StgWord64 hs_atomicread64(StgWord x);
50 void hs_atomicwrite8(StgWord x, StgWord val);
51 void hs_atomicwrite16(StgWord x, StgWord val);
52 void hs_atomicwrite32(StgWord x, StgWord val);
53 void hs_atomicwrite64(StgWord x, StgWord64 val);
54
55 /* libraries/ghc-prim/cbits/bswap.c */
56 StgWord16 hs_bswap16(StgWord16 x);
57 StgWord32 hs_bswap32(StgWord32 x);
58 StgWord64 hs_bswap64(StgWord64 x);
59
60 /* TODO: longlong.c */
61
62 /* libraries/ghc-prim/cbits/popcnt.c */
63 StgWord hs_popcnt8(StgWord x);
64 StgWord hs_popcnt16(StgWord x);
65 StgWord hs_popcnt32(StgWord x);
66 StgWord hs_popcnt64(StgWord64 x);
67 StgWord hs_popcnt(StgWord x);
68
69 /* libraries/ghc-prim/cbits/word2float.c */
70 StgFloat hs_word2float32(StgWord x);
71 StgDouble hs_word2float64(StgWord x);
72
73 /* libraries/ghc-prim/cbits/clz.c */
74 StgWord hs_clz8(StgWord x);
75 StgWord hs_clz16(StgWord x);
76 StgWord hs_clz32(StgWord x);
77 StgWord hs_clz64(StgWord64 x);
78
79 /* libraries/ghc-prim/cbits/ctz.c */
80 StgWord hs_ctz8(StgWord x);
81 StgWord hs_ctz16(StgWord x);
82 StgWord hs_ctz32(StgWord x);
83 StgWord hs_ctz64(StgWord64 x);
84
85 #endif /* PRIM_H */