diff options
author | Luite Stegeman <stegeman@gmail.com> | 2023-01-10 14:48:01 +0900 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-01-18 14:21:42 -0500 |
commit | b4c14c4ba17b3abf3e7b88e1201ac7ba89fd56c9 (patch) | |
tree | 3b215192329190d3aa077fe464930a414da76b39 | |
parent | c45a5fffef2c76efbf5d3a009c3f6d0244a63f0d (diff) | |
download | haskell-b4c14c4ba17b3abf3e7b88e1201ac7ba89fd56c9.tar.gz |
Add PrimCallConv support to GHCi
This adds support for calling Cmm code from bytecode using the native
calling convention, allowing modules that use `foreign import prim`
to be loaded and debugged in GHCi.
This patch introduces a new `PRIMCALL` bytecode instruction and
a helper stack frame `stg_primcall`. The code is based on the
existing functionality for dealing with unboxed tuples in bytecode,
which has been generalised to handle arbitrary calls.
Fixes #22051
21 files changed, 1043 insertions, 145 deletions
diff --git a/compiler/GHC/ByteCode/Asm.hs b/compiler/GHC/ByteCode/Asm.hs index 24e2645052..391949d448 100644 --- a/compiler/GHC/ByteCode/Asm.hs +++ b/compiler/GHC/ByteCode/Asm.hs @@ -12,7 +12,7 @@ module GHC.ByteCode.Asm ( bcoFreeNames, SizedSeq, sizeSS, ssElts, iNTERP_STACK_CHECK_THRESH, - mkTupleInfoLit + mkNativeCallInfoLit ) where import GHC.Prelude @@ -32,7 +32,6 @@ import GHC.Types.Unique.DSet import GHC.Utils.Outputable import GHC.Utils.Panic -import GHC.Utils.Panic.Plain import GHC.Core.TyCon import GHC.Data.FastString @@ -40,7 +39,7 @@ import GHC.Data.SizedSeq import GHC.StgToCmm.Layout ( ArgRep(..) ) import GHC.Cmm.Expr -import GHC.Cmm.CallConv ( tupleRegsCover ) +import GHC.Cmm.CallConv ( allArgRegsCover ) import GHC.Platform import GHC.Platform.Profile @@ -202,7 +201,8 @@ assembleBCO platform (ProtoBCO { protoBCOName = nm (final_insns, final_lits, final_ptrs) <- flip execStateT initial_state $ runAsm platform long_jumps env asm -- precomputed size should be equal to final size - massert (n_insns == sizeSS final_insns) + massertPpr (n_insns == sizeSS final_insns) + (text "bytecode instruction count mismatch") let asm_insns = ssElts final_insns insns_arr = Array.listArray (0, fromIntegral n_insns - 1) asm_insns @@ -351,7 +351,8 @@ largeArg platform w = case platformWordSize platform of fromIntegral (w `shiftR` 32), fromIntegral (w `shiftR` 16), fromIntegral w] - PW4 -> assert (w < fromIntegral (maxBound :: Word32)) $ + PW4 -> assertPpr (w < fromIntegral (maxBound :: Word32)) + (text "largeArg too big:" <+> ppr w) $ [fromIntegral (w `shiftR` 16), fromIntegral w] @@ -388,14 +389,14 @@ assembleI platform i = case i of -> do let ul_bco = assembleBCO platform proto p <- ioptr (liftM BCOPtrBCO ul_bco) emit (push_alts pk) [Op p] - PUSH_ALTS_TUPLE proto tuple_info tuple_proto + PUSH_ALTS_TUPLE proto call_info tuple_proto -> do let ul_bco = assembleBCO platform proto ul_tuple_bco = assembleBCO platform tuple_proto p <- ioptr (liftM BCOPtrBCO ul_bco) p_tup <- ioptr (liftM BCOPtrBCO ul_tuple_bco) info <- int (fromIntegral $ - mkTupleInfoSig platform tuple_info) + mkNativeCallInfoSig platform call_info) emit bci_PUSH_ALTS_T [Op p, Op info, Op p_tup] PUSH_PAD8 -> emit bci_PUSH_PAD8 [] @@ -491,6 +492,7 @@ assembleI platform i = case i of RETURN_TUPLE -> emit bci_RETURN_T [] CCALL off m_addr i -> do np <- addr m_addr emit bci_CCALL [SmallOp off, Op np, SmallOp i] + PRIMCALL -> emit bci_PRIMCALL [] BRK_FUN index uniq cc -> do p1 <- ptr BCOPtrBreakArray q <- int (getKey uniq) np <- addr cc @@ -580,41 +582,44 @@ return_unlifted V64 = error "return_unlifted: vector" maximum number of tuple elements may be larger. Elements can also take multiple words on the stack (for example Double# on a 32 bit platform). - -} -maxTupleNativeStackSize :: WordOff -maxTupleNativeStackSize = 62 +maxTupleReturnNativeStackSize :: WordOff +maxTupleReturnNativeStackSize = 62 {- - Construct the tuple_info word that stg_ctoi_t and stg_ret_t use - to convert a tuple between the native calling convention and the + Construct the call_info word that stg_ctoi_t, stg_ret_t and stg_primcall + use to convert arguments between the native calling convention and the interpreter. - See Note [GHCi tuple layout] for more information. + See Note [GHCi and native call registers] for more information. -} -mkTupleInfoSig :: Platform -> TupleInfo -> Word32 -mkTupleInfoSig platform TupleInfo{..} - | tupleNativeStackSize > maxTupleNativeStackSize - = pprPanic "mkTupleInfoSig: tuple too big for the bytecode compiler" - (ppr tupleNativeStackSize <+> text "stack words." <+> +mkNativeCallInfoSig :: Platform -> NativeCallInfo -> Word32 +mkNativeCallInfoSig platform NativeCallInfo{..} + | nativeCallType == NativeTupleReturn && nativeCallStackSpillSize > maxTupleReturnNativeStackSize + = pprPanic "mkNativeCallInfoSig: tuple too big for the bytecode compiler" + (ppr nativeCallStackSpillSize <+> text "stack words." <+> text "Use -fobject-code to get around this limit" ) | otherwise - = assert (length regs <= 24) {- 24 bits for bitmap -} - assert (tupleNativeStackSize < 255) {- 8 bits for stack size -} - assert (all (`elem` regs) (regSetToList tupleRegs)) {- all regs accounted for -} - foldl' reg_bit 0 (zip regs [0..]) .|. - (fromIntegral tupleNativeStackSize `shiftL` 24) + = assertPpr (length regs <= 24) (text "too many registers for bitmap:" <+> ppr (length regs)) {- 24 bits for register bitmap -} + assertPpr (cont_offset < 255) (text "continuation offset too large:" <+> ppr cont_offset) {- 8 bits for continuation offset (only for NativeTupleReturn) -} + assertPpr (all (`elem` regs) (regSetToList nativeCallRegs)) (text "not all registers accounted for") {- all regs accounted for -} + foldl' reg_bit 0 (zip regs [0..]) .|. (cont_offset `shiftL` 24) where + cont_offset :: Word32 + cont_offset + | nativeCallType == NativeTupleReturn = fromIntegral nativeCallStackSpillSize + | otherwise = 0 -- there is no continuation for primcalls + reg_bit :: Word32 -> (GlobalReg, Int) -> Word32 reg_bit x (r, n) - | r `elemRegSet` tupleRegs = x .|. 1 `shiftL` n - | otherwise = x - regs = tupleRegsCover platform + | r `elemRegSet` nativeCallRegs = x .|. 1 `shiftL` n + | otherwise = x + regs = allArgRegsCover platform -mkTupleInfoLit :: Platform -> TupleInfo -> Literal -mkTupleInfoLit platform tuple_info = - mkLitWord platform . fromIntegral $ mkTupleInfoSig platform tuple_info +mkNativeCallInfoLit :: Platform -> NativeCallInfo -> Literal +mkNativeCallInfoLit platform call_info = + mkLitWord platform . fromIntegral $ mkNativeCallInfoSig platform call_info -- Make lists of host-sized words for literals, so that when the -- words are placed in memory at increasing addresses, the diff --git a/compiler/GHC/ByteCode/Instr.hs b/compiler/GHC/ByteCode/Instr.hs index 498152c471..34baa57d40 100644 --- a/compiler/GHC/ByteCode/Instr.hs +++ b/compiler/GHC/ByteCode/Instr.hs @@ -90,7 +90,7 @@ data BCInstr | PUSH_ALTS (ProtoBCO Name) | PUSH_ALTS_UNLIFTED (ProtoBCO Name) ArgRep | PUSH_ALTS_TUPLE (ProtoBCO Name) -- continuation - !TupleInfo + !NativeCallInfo (ProtoBCO Name) -- tuple return BCO -- Pushing 8, 16 and 32 bits of padding (for constructors). @@ -184,6 +184,8 @@ data BCInstr -- (XXX: inefficient, but I don't know -- what the alignment constraints are.) + | PRIMCALL + -- For doing magic ByteArray passing to foreign calls | SWIZZLE Word16 -- to the ptr N words down the stack, Word16 -- add M (interpreted as a signed 16-bit entity) @@ -269,8 +271,8 @@ instance Outputable BCInstr where ppr (PUSH_ALTS bco) = hang (text "PUSH_ALTS") 2 (ppr bco) ppr (PUSH_ALTS_UNLIFTED bco pk) = hang (text "PUSH_ALTS_UNLIFTED" <+> ppr pk) 2 (ppr bco) - ppr (PUSH_ALTS_TUPLE bco tuple_info tuple_bco) = - hang (text "PUSH_ALTS_TUPLE" <+> ppr tuple_info) + ppr (PUSH_ALTS_TUPLE bco call_info tuple_bco) = + hang (text "PUSH_ALTS_TUPLE" <+> ppr call_info) 2 (ppr tuple_bco $+$ ppr bco) @@ -340,6 +342,7 @@ instance Outputable BCInstr where 0x1 -> text "(interruptible)" 0x2 -> text "(unsafe)" _ -> empty) + ppr PRIMCALL = text "PRIMCALL" ppr (SWIZZLE stkoff n) = text "SWIZZLE " <+> text "stkoff" <+> ppr stkoff <+> text "by" <+> ppr n ppr ENTER = text "ENTER" @@ -382,11 +385,11 @@ bciStackUse (PUSH_ALTS bco) = 2 {- profiling only, restore CCCS -} + bciStackUse (PUSH_ALTS_UNLIFTED bco _) = 2 {- profiling only, restore CCCS -} + 4 + protoBCOStackUse bco bciStackUse (PUSH_ALTS_TUPLE bco info _) = - -- (tuple_bco, tuple_info word, cont_bco, stg_ctoi_t) + -- (tuple_bco, call_info word, cont_bco, stg_ctoi_t) -- tuple - -- (tuple_info, tuple_bco, stg_ret_t) + -- (call_info, tuple_bco, stg_ret_t) 1 {- profiling only -} + - 7 + fromIntegral (tupleSize info) + protoBCOStackUse bco + 7 + fromIntegral (nativeCallSize info) + protoBCOStackUse bco bciStackUse (PUSH_PAD8) = 1 -- overapproximation bciStackUse (PUSH_PAD16) = 1 -- overapproximation bciStackUse (PUSH_PAD32) = 1 -- overapproximation on 64bit arch @@ -443,6 +446,7 @@ bciStackUse RETURN{} = 0 bciStackUse RETURN_UNLIFTED{} = 1 -- pushes stg_ret_X for some X bciStackUse RETURN_TUPLE{} = 1 -- pushes stg_ret_t header bciStackUse CCALL{} = 0 +bciStackUse PRIMCALL{} = 1 -- pushes stg_primcall bciStackUse SWIZZLE{} = 0 bciStackUse BRK_FUN{} = 0 diff --git a/compiler/GHC/ByteCode/Types.hs b/compiler/GHC/ByteCode/Types.hs index 830b60a4ca..a4b025ce92 100644 --- a/compiler/GHC/ByteCode/Types.hs +++ b/compiler/GHC/ByteCode/Types.hs @@ -10,7 +10,7 @@ module GHC.ByteCode.Types ( CompiledByteCode(..), seqCompiledByteCode , FFIInfo(..) , RegBitmap(..) - , TupleInfo(..), voidTupleInfo + , NativeCallType(..), NativeCallInfo(..), voidTupleReturnInfo, voidPrimCallInfo , ByteOff(..), WordOff(..) , UnlinkedBCO(..), BCOPtr(..), BCONPtr(..) , ItblEnv, ItblPtr(..) @@ -105,22 +105,32 @@ newtype RegBitmap = RegBitmap { unRegBitmap :: Word32 } See GHC.StgToByteCode.layoutTuple for more details. -} -data TupleInfo = TupleInfo - { tupleSize :: !WordOff -- total size of tuple in words - , tupleRegs :: !GlobalRegSet - , tupleNativeStackSize :: !WordOff {- words spilled on the stack by - GHCs native calling convention -} - } deriving (Show) - -instance Outputable TupleInfo where - ppr TupleInfo{..} = text "<size" <+> ppr tupleSize <+> - text "stack" <+> ppr tupleNativeStackSize <+> - text "regs" <+> - ppr (map (text @SDoc . show) $ regSetToList tupleRegs) <> - char '>' - -voidTupleInfo :: TupleInfo -voidTupleInfo = TupleInfo 0 emptyRegSet 0 + +data NativeCallType = NativePrimCall + | NativeTupleReturn + deriving (Eq) + +data NativeCallInfo = NativeCallInfo + { nativeCallType :: !NativeCallType + , nativeCallSize :: !WordOff -- total size of arguments in words + , nativeCallRegs :: !GlobalRegSet + , nativeCallStackSpillSize :: !WordOff {- words spilled on the stack by + GHCs native calling convention -} + } + +instance Outputable NativeCallInfo where + ppr NativeCallInfo{..} = text "<arg_size" <+> ppr nativeCallSize <+> + text "stack" <+> ppr nativeCallStackSpillSize <+> + text "regs" <+> + ppr (map (text @SDoc . show) $ regSetToList nativeCallRegs) <> + char '>' + + +voidTupleReturnInfo :: NativeCallInfo +voidTupleReturnInfo = NativeCallInfo NativeTupleReturn 0 emptyRegSet 0 + +voidPrimCallInfo :: NativeCallInfo +voidPrimCallInfo = NativeCallInfo NativePrimCall 0 emptyRegSet 0 type ItblEnv = NameEnv (Name, ItblPtr) -- We need the Name in the range so we know which diff --git a/compiler/GHC/Cmm/CallConv.hs b/compiler/GHC/Cmm/CallConv.hs index a0fee0e5c6..97cebf99e6 100644 --- a/compiler/GHC/Cmm/CallConv.hs +++ b/compiler/GHC/Cmm/CallConv.hs @@ -3,7 +3,7 @@ module GHC.Cmm.CallConv ( assignArgumentsPos, assignStack, realArgRegsCover, - tupleRegsCover + allArgRegsCover ) where import GHC.Prelude @@ -220,12 +220,109 @@ realArgRegsCover platform realLongRegs platform -- we don't save XMM registers if they are not used for parameter passing --- Like realArgRegsCover but always includes the node. This covers the real --- and virtual registers used for unboxed tuples. --- --- Note: if anything changes in how registers for unboxed tuples overlap, --- make sure to also update GHC.StgToByteCode.layoutTuple. -tupleRegsCover :: Platform -> [GlobalReg] -tupleRegsCover platform = +{- + + Note [GHCi and native call registers] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The GHCi bytecode interpreter does not have access to the STG registers + that the native calling convention uses for passing arguments. It uses + helper stack frames to move values between the stack and registers. + + If only a single register needs to be moved, GHCi uses a specific stack + frame. For example stg_ctoi_R1p saves a heap pointer value from STG register + R1 and stg_ctoi_D1 saves a double precision floating point value from D1. + In the other direction, helpers stg_ret_p and stg_ret_d move a value from + the stack to the R1 and D1 registers, respectively. + + When GHCi needs to move more than one register it cannot use a specific + helper frame. It would simply be impossible to create a helper for all + possible combinations of register values. Instead, there are generic helper + stack frames that use a call_info word that describes the active registers + and the number of stack words used by the arguments of a call. + + These helper stack frames are currently: + + - stg_ret_t: return a tuple to the continuation at the top of + the stack + - stg_ctoi_t: convert a tuple return value to be used in + bytecode + - stg_primcall: call a function + + + The call_info word contains a bitmap of the active registers + for the call and and a stack offset. The layout is as follows: + + - bit 0-23: Bitmap of active registers for the call, the + order corresponds to the list returned by + allArgRegsCover. For example if bit 0 (the least + significant bit) is set, the first register in the + allArgRegsCover list is active. Bit 1 for the + second register in the list and so on. + + - bit 24-31: Unsigned byte indicating the stack offset + of the continuation in words. For tuple returns + this is the number of words returned on the + stack. For primcalls this field is unused, since + we don't jump to a continuation. + + The upper 32 bits on 64 bit platforms are currently unused. + + If a register is smaller than a word on the stack (for example a + single precision float on a 64 bit system), then the stack slot + is padded to a whole word. + + Example: + + If a tuple is returned in three registers and an additional two + words on the stack, then three bits in the register bitmap + (bits 0-23) would be set. And bit 24-31 would be + 00000010 (two in binary). + + The values on the stack before a call to POP_ARG_REGS would + be as follows: + + ... + continuation + stack_arg_1 + stack_arg_2 + register_arg_3 + register_arg_2 + register_arg_1 <- Sp + + A call to POP_ARG_REGS(call_info) would move register_arg_1 + to the register corresponding to the lowest set bit in the + call_info word. register_arg_2 would be moved to the register + corresponding to the second lowest set bit, and so on. + + After POP_ARG_REGS(call_info), the stack pointer Sp points + to the topmost stack argument, so the stack looks as follows: + + ... + continuation + stack_arg_1 + stack_arg_2 <- Sp + + At this point all the arguments are in place and we are ready + to jump to the continuation, the location (offset from Sp) of + which is found by inspecting the value of bits 24-31. In this + case the offset is two words. + + On x86_64, the double precision (Dn) and single precision + floating (Fn) point registers overlap, e.g. D1 uses the same + physical register as F1. On this platform, the list returned + by allArgRegsCover contains only entries for the double + precision registers. If an argument is passed in register + Fn, the bit corresponding to Dn should be set. + + Note: if anything changes in how registers for native calls overlap, + make sure to also update GHC.StgToByteCode.layoutNativeCall + -} + +-- Like realArgRegsCover but always includes the node. This covers all real +-- and virtual registers actually used for passing arguments. + +allArgRegsCover :: Platform -> [GlobalReg] +allArgRegsCover platform = nub (VanillaReg 1 VGcPtr : realArgRegsCover platform) diff --git a/compiler/GHC/Cmm/Parser.y b/compiler/GHC/Cmm/Parser.y index dbb2e47030..35d8e4c40f 100644 --- a/compiler/GHC/Cmm/Parser.y +++ b/compiler/GHC/Cmm/Parser.y @@ -1233,8 +1233,8 @@ stmtMacros = listToUFM [ ( fsLit "SAVE_REGS", \[] -> emitSaveRegs ), ( fsLit "RESTORE_REGS", \[] -> emitRestoreRegs ), - ( fsLit "PUSH_TUPLE_REGS", \[live_regs] -> emitPushTupleRegs live_regs ), - ( fsLit "POP_TUPLE_REGS", \[live_regs] -> emitPopTupleRegs live_regs ), + ( fsLit "PUSH_ARG_REGS", \[live_regs] -> emitPushArgRegs live_regs ), + ( fsLit "POP_ARG_REGS", \[live_regs] -> emitPopArgRegs live_regs ), ( fsLit "LDV_ENTER", \[e] -> ldvEnter e ), ( fsLit "LDV_RECORD_CREATE", \[e] -> ldvRecordCreate e ), diff --git a/compiler/GHC/Cmm/Reg.hs b/compiler/GHC/Cmm/Reg.hs index a9b3fce101..104702f312 100644 --- a/compiler/GHC/Cmm/Reg.hs +++ b/compiler/GHC/Cmm/Reg.hs @@ -223,7 +223,7 @@ instance Eq GlobalReg where _r1 == _r2 = False -- NOTE: this Ord instance affects the tuple layout in GHCi, see --- Note [GHCi tuple layout] +-- Note [GHCi and native call registers] instance Ord GlobalReg where compare (VanillaReg i _) (VanillaReg j _) = compare i j -- Ignore type when seeking clashes diff --git a/compiler/GHC/StgToByteCode.hs b/compiler/GHC/StgToByteCode.hs index b59cbfe779..de37d987cb 100644 --- a/compiler/GHC/StgToByteCode.hs +++ b/compiler/GHC/StgToByteCode.hs @@ -58,7 +58,7 @@ import GHC.Data.FastString import GHC.Utils.Panic import GHC.Utils.Panic.Plain import GHC.Utils.Exception (evaluate) -import GHC.StgToCmm.Closure ( NonVoid(..), fromNonVoid, nonVoidIds ) +import GHC.StgToCmm.Closure ( NonVoid(..), fromNonVoid, nonVoidIds, argPrimRep ) import GHC.StgToCmm.Layout import GHC.Runtime.Heap.Layout hiding (WordOff, ByteOff, wordsToBytes) import GHC.Data.Bitmap @@ -464,10 +464,10 @@ returnUnliftedReps d s szb reps = do [rep] -> return (unitOL $ RETURN_UNLIFTED (toArgRep platform rep)) -- otherwise use RETURN_TUPLE with a tuple descriptor nv_reps -> do - let (tuple_info, args_offsets) = layoutTuple profile 0 (primRepCmmType platform) nv_reps + let (call_info, args_offsets) = layoutNativeCall profile NativeTupleReturn 0 (primRepCmmType platform) nv_reps args_ptrs = map (\(rep, off) -> (isFollowableArg (toArgRep platform rep), off)) args_offsets - tuple_bco <- emitBc (tupleBCO platform tuple_info args_ptrs) - return $ PUSH_UBX (mkTupleInfoLit platform tuple_info) 1 `consOL` + tuple_bco <- emitBc (tupleBCO platform call_info args_ptrs) + return $ PUSH_UBX (mkNativeCallInfoLit platform call_info) 1 `consOL` PUSH_BCO tuple_bco `consOL` unitOL RETURN_TUPLE return ( mkSlideB platform szb (d - s) -- clear to sequel @@ -484,7 +484,11 @@ returnUnboxedTuple d s p es = do profile <- getProfile let platform = profilePlatform profile arg_ty e = primRepCmmType platform (atomPrimRep e) - (tuple_info, tuple_components) = layoutTuple profile d arg_ty es + (call_info, tuple_components) = layoutNativeCall profile + NativeTupleReturn + d + arg_ty + es go _ pushes [] = return (reverse pushes) go !dd pushes ((a, off):cs) = do (push, szb) <- pushAtom dd p a massert (off == dd + szb) @@ -492,7 +496,7 @@ returnUnboxedTuple d s p es = do pushes <- go d [] tuple_components ret <- returnUnliftedReps d s - (wordsToBytes platform $ tupleSize tuple_info) + (wordsToBytes platform $ nativeCallSize call_info) (map atomPrimRep es) return (mconcat pushes `appOL` ret) @@ -648,14 +652,14 @@ schemeT d s p app -- Case 1 schemeT d s p (StgOpApp (StgFCallOp (CCall ccall_spec) _ty) args result_ty) = if isSupportedCConv ccall_spec - then generateCCall d s p ccall_spec result_ty (reverse args) + then generateCCall d s p ccall_spec result_ty args else unsupportedCConvException schemeT d s p (StgOpApp (StgPrimOp op) args _ty) = doTailCall d s p (primOpId op) (reverse args) -schemeT _d _s _p (StgOpApp StgPrimCallOp{} _args _ty) - = unsupportedCConvException +schemeT d s p (StgOpApp (StgPrimCallOp (PrimCall label unit)) args result_ty) + = generatePrimCall d s p label (Just unit) result_ty args -- Case 2: Unboxed tuple schemeT d s p (StgConApp con _cn args _tys) @@ -840,18 +844,18 @@ doCase d s p scrut bndr alts | ubx_frame = wordSize platform | otherwise = 0 - (bndr_size, tuple_info, args_offsets) + (bndr_size, call_info, args_offsets) | ubx_tuple_frame = let bndr_ty = primRepCmmType platform bndr_reps = filter (not.isVoidRep) (bcIdPrimReps bndr) - (tuple_info, args_offsets) = - layoutTuple profile 0 bndr_ty bndr_reps - in ( wordsToBytes platform (tupleSize tuple_info) - , tuple_info + (call_info, args_offsets) = + layoutNativeCall profile NativeTupleReturn 0 bndr_ty bndr_reps + in ( wordsToBytes platform (nativeCallSize call_info) + , call_info , args_offsets ) | otherwise = ( wordsToBytes platform (idSizeW platform bndr) - , voidTupleInfo + , voidTupleReturnInfo , [] ) @@ -885,17 +889,18 @@ doCase d s p scrut bndr alts | isUnboxedTupleType bndr_ty || isUnboxedSumType bndr_ty = let bndr_ty = primRepCmmType platform . bcIdPrimRep tuple_start = d_bndr - (tuple_info, args_offsets) = - layoutTuple profile - 0 - bndr_ty - bndrs + (call_info, args_offsets) = + layoutNativeCall profile + NativeTupleReturn + 0 + bndr_ty + bndrs stack_bot = d_alts p' = Map.insertList [ (arg, tuple_start - - wordsToBytes platform (tupleSize tuple_info) + + wordsToBytes platform (nativeCallSize call_info) + offset) | (arg, offset) <- args_offsets , not (isVoidRep $ bcIdPrimRep arg)] @@ -981,8 +986,8 @@ doCase d s p scrut bndr alts -- unboxed tuples get two more words, the second is a pointer (tuple_bco) (extra_pointers, extra_slots) - | ubx_tuple_frame && profiling = ([1], 3) -- tuple_info, tuple_BCO, CCCS - | ubx_tuple_frame = ([1], 2) -- tuple_info, tuple_BCO + | ubx_tuple_frame && profiling = ([1], 3) -- call_info, tuple_BCO, CCCS + | ubx_tuple_frame = ([1], 2) -- call_info, tuple_BCO | otherwise = ([], 0) bitmap_size = trunc16W $ fromIntegral extra_slots + @@ -1028,8 +1033,8 @@ doCase d s p scrut bndr alts let args_ptrs = map (\(rep, off) -> (isFollowableArg (toArgRep platform rep), off)) args_offsets - tuple_bco <- emitBc (tupleBCO platform tuple_info args_ptrs) - return (PUSH_ALTS_TUPLE alt_bco' tuple_info tuple_bco + tuple_bco <- emitBc (tupleBCO platform call_info args_ptrs) + return (PUSH_ALTS_TUPLE alt_bco' call_info tuple_bco `consOL` scrut_code) else let push_alts | not ubx_frame @@ -1050,14 +1055,15 @@ doCase d s p scrut bndr alts -- The native calling convention uses registers for tuples, but in the -- bytecode interpreter, all values live on the stack. -layoutTuple :: Profile - -> ByteOff - -> (a -> CmmType) - -> [a] - -> ( TupleInfo -- See Note [GHCi TupleInfo] - , [(a, ByteOff)] -- argument, offset on stack - ) -layoutTuple profile start_off arg_ty reps = +layoutNativeCall :: Profile + -> NativeCallType + -> ByteOff + -> (a -> CmmType) + -> [a] + -> ( NativeCallInfo -- See Note [GHCi TupleInfo] + , [(a, ByteOff)] -- argument, offset on stack + ) +layoutNativeCall profile call_type start_off arg_ty reps = let platform = profilePlatform profile (orig_stk_bytes, pos) = assignArgumentsPos profile 0 @@ -1070,7 +1076,7 @@ layoutTuple profile start_off arg_ty reps = -- sort the register parameters by register and add them to the stack regs_order :: Map.Map GlobalReg Int - regs_order = Map.fromList $ zip (tupleRegsCover platform) [0..] + regs_order = Map.fromList $ zip (allArgRegsCover platform) [0..] reg_order :: GlobalReg -> (Int, GlobalReg) reg_order reg | Just n <- Map.lookup reg regs_order = (n, reg) @@ -1099,10 +1105,11 @@ layoutTuple profile start_off arg_ty reps = get_byte_off _ = panic "GHC.StgToByteCode.layoutTuple get_byte_off" - in ( TupleInfo - { tupleSize = bytesToWords platform (ByteOff new_stk_bytes) - , tupleRegs = regs_set - , tupleNativeStackSize = bytesToWords platform + in ( NativeCallInfo + { nativeCallType = call_type + , nativeCallSize = bytesToWords platform (ByteOff new_stk_bytes) + , nativeCallRegs = regs_set + , nativeCallStackSpillSize = bytesToWords platform (ByteOff orig_stk_bytes) } , sortBy (comparing snd) $ @@ -1127,7 +1134,7 @@ usePlainReturn t ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We have the bytecode instructions RETURN_TUPLE and PUSH_ALTS_TUPLE to return and receive arbitrary unboxed tuples, respectively. These - instructions use the helper data tuple_BCO and tuple_info. + instructions use the helper data tuple_BCO and call_info. The helper data is used to convert tuples between GHCs native calling convention (object code), which uses stack and registers, and the bytecode @@ -1139,7 +1146,7 @@ usePlainReturn t ================= Bytecode that returns a tuple first pushes all the tuple fields followed - by the appropriate tuple_info and tuple_BCO onto the stack. It then + by the appropriate call_info and tuple_BCO onto the stack. It then executes the RETURN_TUPLE instruction, which causes the interpreter to push stg_ret_t_info to the top of the stack. The stack (growing down) then looks as follows: @@ -1150,14 +1157,14 @@ usePlainReturn t tuple_field_2 ... tuple_field_n - tuple_info + call_info tuple_BCO stg_ret_t_info <- Sp If next_frame is bytecode, the interpreter will start executing it. If it's object code, the interpreter jumps back to the scheduler, which in turn jumps to stg_ret_t. stg_ret_t converts the tuple to the native - calling convention using the description in tuple_info, and then jumps + calling convention using the description in call_info, and then jumps to next_frame. @@ -1169,13 +1176,13 @@ usePlainReturn t tuple. The PUSH_ALTS_TUPLE instuction contains three pieces of data: * cont_BCO: the continuation that receives the tuple - * tuple_info: see below + * call_info: see below * tuple_BCO: see below The interpreter pushes these onto the stack when the PUSH_ALTS_TUPLE instruction is executed, followed by stg_ctoi_tN_info, with N depending on the number of stack words used by the tuple in the GHC native calling - convention. N is derived from tuple_info. + convention. N is derived from call_info. For example if we expect a tuple with three words on the stack, the stack looks as follows after PUSH_ALTS_TUPLE: @@ -1186,7 +1193,7 @@ usePlainReturn t cont_free_var_2 ... cont_free_var_n - tuple_info + call_info tuple_BCO cont_BCO stg_ctoi_t3_info <- Sp @@ -1206,20 +1213,20 @@ usePlainReturn t that is already on the stack. - The tuple_info word + The call_info word =================== - The tuple_info word describes the stack and STG register (e.g. R1..R6, - D1..D6) usage for the tuple. tuple_info contains enough information to + The call_info word describes the stack and STG register (e.g. R1..R6, + D1..D6) usage for the tuple. call_info contains enough information to convert the tuple between the stack-only bytecode and stack+registers GHC native calling conventions. - See Note [GHCi tuple layout] for more details of how the data is packed - in a single word. + See Note [GHCi and native call registers] for more details of how the + data is packed in a single word. -} -tupleBCO :: Platform -> TupleInfo -> [(Bool, ByteOff)] -> [FFIInfo] -> ProtoBCO Name +tupleBCO :: Platform -> NativeCallInfo -> [(Bool, ByteOff)] -> [FFIInfo] -> ProtoBCO Name tupleBCO platform info pointers = mkProtoBCO platform invented_name body_code (Left []) 0{-no arity-} bitmap_size bitmap False{-is alts-} @@ -1233,15 +1240,103 @@ tupleBCO platform info pointers = -} invented_name = mkSystemVarName (mkPseudoUniqueE 0) (fsLit "tuple") - -- the first word in the frame is the tuple_info word, + -- the first word in the frame is the call_info word, -- which is not a pointer - bitmap_size = trunc16W $ 1 + tupleSize info + bitmap_size = trunc16W $ 1 + nativeCallSize info bitmap = intsToReverseBitmap platform (fromIntegral bitmap_size) $ map ((+1) . fromIntegral . bytesToWords platform . snd) (filter fst pointers) body_code = mkSlideW 0 1 -- pop frame header `snocOL` RETURN_TUPLE -- and add it again +primCallBCO :: Platform -> NativeCallInfo -> [(Bool, ByteOff)] -> [FFIInfo] -> ProtoBCO Name +primCallBCO platform args_info pointers = + mkProtoBCO platform invented_name body_code (Left []) + 0{-no arity-} bitmap_size bitmap False{-is alts-} + + where + {- + The primcall BCO is never referred to by name, so we can get away + with using a fake name here. We will need to change this if we want + to save some memory by sharing the BCO between places that have + the same tuple shape + -} + invented_name = mkSystemVarName (mkPseudoUniqueE 0) (fsLit "primcall") + + -- the first three words in the frame are the BCO describing the + -- pointers in the frame, the call_info word and the pointer + -- to the Cmm function being called. None of these is a pointer that + -- should be followed by the garbage collector + bitmap_size = trunc16W $ 2 + nativeCallSize args_info + bitmap = intsToReverseBitmap platform (fromIntegral bitmap_size) $ + map ((+2) . fromIntegral . bytesToWords platform . snd) + (filter fst pointers) + -- if the primcall BCO is ever run it's a bug, since the BCO should only + -- be pushed immediately before running the PRIMCALL bytecode instruction, + -- which immediately leaves the interpreter to jump to the stg_primcall_info + -- Cmm function + body_code = unitOL CASEFAIL + +-- ----------------------------------------------------------------------------- +-- Deal with a primitive call to native code. + +generatePrimCall + :: StackDepth + -> Sequel + -> BCEnv + -> CLabelString -- where to call + -> Maybe Unit + -> Type + -> [StgArg] -- args (atoms) + -> BcM BCInstrList +generatePrimCall d s p target _mb_unit _result_ty args + = do + profile <- getProfile + let + platform = profilePlatform profile + + non_void VoidRep = False + non_void _ = True + + nv_args :: [StgArg] + nv_args = filter (non_void . argPrimRep) args + + (args_info, args_offsets) = + layoutNativeCall profile + NativePrimCall + d + (primRepCmmType platform . argPrimRep) + nv_args + + args_ptrs :: [(Bool, ByteOff)] + args_ptrs = + map (\(r, off) -> + (isFollowableArg (toArgRep platform . argPrimRep $ r), off)) + args_offsets + + push_target = PUSH_UBX (LitLabel target Nothing IsFunction) 1 + push_info = PUSH_UBX (mkNativeCallInfoLit platform args_info) 1 + {- + compute size to move payload (without stg_primcall_info header) + + size of arguments plus three words for: + - function pointer to the target + - call_info word + - BCO to describe the stack frame + -} + szb = wordsToBytes platform (nativeCallSize args_info + 3) + go _ pushes [] = return (reverse pushes) + go !dd pushes ((a, off):cs) = do (push, szb) <- pushAtom dd p a + massert (off == dd + szb) + go (dd + szb) (push:pushes) cs + push_args <- go d [] args_offsets + args_bco <- emitBc (primCallBCO platform args_info args_ptrs) + return $ mconcat push_args `appOL` + (push_target `consOL` + push_info `consOL` + PUSH_BCO args_bco `consOL` + (mkSlideB platform szb (d - s) `appOL` unitOL PRIMCALL)) + -- ----------------------------------------------------------------------------- -- Deal with a CCall. @@ -1259,11 +1354,17 @@ generateCCall -> Type -> [StgArg] -- args (atoms) -> BcM BCInstrList -generateCCall d0 s p (CCallSpec target cconv safety) result_ty args_r_to_l +generateCCall d0 s p (CCallSpec target PrimCallConv _) result_ty args + | (StaticTarget _ label mb_unit _) <- target + = generatePrimCall d0 s p label mb_unit result_ty args + | otherwise + = panic "GHC.StgToByteCode.generateCCall: primcall convention only supports static targets" +generateCCall d0 s p (CCallSpec target cconv safety) result_ty args = do profile <- getProfile let + args_r_to_l = reverse args platform = profilePlatform profile -- useful constants addr_size_b :: ByteOff @@ -2007,7 +2108,7 @@ isSupportedCConv :: CCallSpec -> Bool isSupportedCConv (CCallSpec _ cconv _) = case cconv of CCallConv -> True -- we explicitly pattern match on every StdCallConv -> True -- convention to ensure that a warning - PrimCallConv -> False -- is triggered when a new one is added + PrimCallConv -> True -- is triggered when a new one is added JavaScriptCallConv -> False CApiConv -> True diff --git a/compiler/GHC/StgToCmm/Foreign.hs b/compiler/GHC/StgToCmm/Foreign.hs index e71c418530..95b7d1c5fd 100644 --- a/compiler/GHC/StgToCmm/Foreign.hs +++ b/compiler/GHC/StgToCmm/Foreign.hs @@ -15,8 +15,8 @@ module GHC.StgToCmm.Foreign ( emitLoadThreadState, emitSaveRegs, emitRestoreRegs, - emitPushTupleRegs, - emitPopTupleRegs, + emitPushArgRegs, + emitPopArgRegs, loadThreadState, emitOpenNursery, emitCloseNursery, @@ -349,7 +349,7 @@ emitRestoreRegs = do -- bytecode interpreter. -- -- The "live registers" bitmap corresponds to the list of registers given by --- 'tupleRegsCover', with the least significant bit indicating liveness of +-- 'allArgRegsCover', with the least significant bit indicating liveness of -- the first register in the list. -- -- Each register is saved to a stack slot of one or more machine words, even @@ -362,12 +362,12 @@ emitRestoreRegs = do -- if((mask & 2) != 0) { Sp_adj(-1); Sp(0) = R2; } -- if((mask & 1) != 0) { Sp_adj(-1); Sp(0) = R1; } -- --- See Note [GHCi tuple layout] +-- See Note [GHCi and native call registers] -emitPushTupleRegs :: CmmExpr -> FCode () -emitPushTupleRegs regs_live = do +emitPushArgRegs :: CmmExpr -> FCode () +emitPushArgRegs regs_live = do platform <- getPlatform - let regs = zip (tupleRegsCover platform) [0..] + let regs = zip (allArgRegsCover platform) [0..] save_arg (reg, n) = let mask = CmmLit (CmmInt (1 `shiftL` n) (wordWidth platform)) live = cmmAndWord platform regs_live mask @@ -381,11 +381,11 @@ emitPushTupleRegs regs_live = do in mkCmmIfThen cond $ catAGraphs [adj_sp, save_reg] emit . catAGraphs =<< mapM save_arg (reverse regs) --- | Pop a subset of STG registers from the stack (see 'emitPushTupleRegs') -emitPopTupleRegs :: CmmExpr -> FCode () -emitPopTupleRegs regs_live = do +-- | Pop a subset of STG registers from the stack (see 'emitPushArgRegs') +emitPopArgRegs :: CmmExpr -> FCode () +emitPopArgRegs regs_live = do platform <- getPlatform - let regs = zip (tupleRegsCover platform) [0..] + let regs = zip (allArgRegsCover platform) [0..] save_arg (reg, n) = let mask = CmmLit (CmmInt (1 `shiftL` n) (wordWidth platform)) live = cmmAndWord platform regs_live mask diff --git a/rts/Disassembler.c b/rts/Disassembler.c index ae6d7ac9f7..f8b270fa28 100644 --- a/rts/Disassembler.c +++ b/rts/Disassembler.c @@ -83,6 +83,9 @@ disInstr ( StgBCO *bco, int pc ) debugBelch("CCALL marshaller at 0x%" FMT_HexWord "\n", literals[instrs[pc]] ); pc += 1; break; + case bci_PRIMCALL: + debugBelch("PRIMCALL\n"); + break; case bci_STKCHECK: { StgWord stk_words_reqd = BCO_GET_LARGE_ARG + 1; debugBelch("STKCHECK %" FMT_Word "\n", (W_)stk_words_reqd ); diff --git a/rts/Interpreter.c b/rts/Interpreter.c index 1108ca8ed0..f8885cdbce 100644 --- a/rts/Interpreter.c +++ b/rts/Interpreter.c @@ -2038,6 +2038,12 @@ run_BCO: goto nextInsn; } + case bci_PRIMCALL: { + Sp_subW(1); + SpW(0) = (W_)&stg_primcall_info; + RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding); + } + case bci_CCALL: { void *tok; int stk_offset = BCO_NEXT; diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index 15c612751c..8e986f8d12 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -602,6 +602,7 @@ extern char **environ; SymI_HasDataProto(stg_ret_l_info) \ SymI_HasDataProto(stg_ret_t_info) \ SymI_HasDataProto(stg_ctoi_t) \ + SymI_HasDataProto(stg_primcall_info) \ SymI_HasDataProto(stg_gc_prim_p) \ SymI_HasDataProto(stg_gc_prim_pp) \ SymI_HasDataProto(stg_gc_prim_n) \ diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm index 66d86643b3..625bfd472a 100644 --- a/rts/StgMiscClosures.cmm +++ b/rts/StgMiscClosures.cmm @@ -366,20 +366,10 @@ MK_STG_CTOI_T(61) MK_STG_CTOI_T(62) /* - Note [GHCi tuple layout] - ~~~~~~~~~~~~~~~~~~~~~~~~ - the tuple_info word describes the register and stack usage of the tuple: + Convert a tuple return value to be used in bytecode. - [ ssss ssss rrrr rrrr rrrr rrrr rrrr rrrr ] - - - r: bitmap of live registers, corresponding to the list of registers - returned by GHC.Cmm.CallConv.tupleRegsCover (the least significant - bit corresponds to the first element in the list) - - s: number of words on stack (in addition to registers) - - The order of the live registers in the bitmap is the same as the list - given by GHC.Cmm.CallConv.tupleRegsCover, with the least significant - bit corresponding to the first register in the list. + See Note [GHCi and native call registers] for information on how + values are moved between the stack and registers. */ stg_ctoi_t @@ -402,7 +392,7 @@ stg_ctoi_t Sp = Sp - WDS(tuple_stack); - PUSH_TUPLE_REGS(tuple_info); + PUSH_ARG_REGS(tuple_info); /* jump to the BCO that will finish the return of the tuple */ Sp_adj(-3); @@ -423,13 +413,57 @@ INFO_TABLE_RET( stg_ret_t, RET_BCO ) /* number of words spilled on stack */ tuple_stack = (tuple_info >> 24) & 0xff; - POP_TUPLE_REGS(tuple_info); + POP_ARG_REGS(tuple_info); /* Sp points to the topmost argument now */ jump %ENTRY_CODE(Sp(tuple_stack)) [*]; // NB. all registers live! } + /* + + The stg_primcall frame is used by the bytecode interpreter to call + a Cmm function. The frame contains a call_info word that contains + a bitmap describing the register arguments. + + When the target function is called, Sp points to the topmost stack + argument. + + ... + next_stack_frame + arg_1 + arg_2 + ... + arg_n + target_funptr (pointer to the function we're calling) + call_info (describes the registers containing the arguments) + primcall_BCO (contains bitmap describing pointers in args) + stg_primcall_info <- Sp + + See Note [GHCi and native call registers] for information on the call_info + word and how registers are moved between the stack and registers. + + */ + +INFO_TABLE_RET ( stg_primcall, RET_BCO ) +{ + W_ args_info, prim_fun; + + /* Sp(1) would be the BCO containing the stack description bitmap */ + args_info = Sp(2); + prim_fun = Sp(3); + + Sp_adj(4); + + /* Sp points to the top of the register arguments now, + load them into actual registers */ + POP_ARG_REGS(args_info); + + /* Sp points to the topmost stack argument now */ + + jump prim_fun [*]; // NB. all registers live! +} + /* * Dummy info table pushed on the top of the stack when the interpreter * should apply the BCO on the stack to its arguments, also on the diff --git a/rts/include/rts/Bytecodes.h b/rts/include/rts/Bytecodes.h index 960fc454ee..e05ab26d99 100644 --- a/rts/include/rts/Bytecodes.h +++ b/rts/include/rts/Bytecodes.h @@ -112,6 +112,8 @@ #define bci_TESTLT_W8 85 #define bci_TESTEQ_W8 86 +#define bci_PRIMCALL 87 + /* If you need to go past 255 then you will run into the flags */ /* If you need to go below 0x0100 then you will run into the instructions */ diff --git a/rts/include/stg/MiscClosures.h b/rts/include/stg/MiscClosures.h index 257d59a607..8e50336e4a 100644 --- a/rts/include/stg/MiscClosures.h +++ b/rts/include/stg/MiscClosures.h @@ -160,6 +160,7 @@ RTS_RET(stg_ctoi_t60); RTS_RET(stg_ctoi_t61); RTS_RET(stg_ctoi_t62); +RTS_RET(stg_primcall); RTS_RET(stg_apply_interp); RTS_RET(stg_dead_thread); diff --git a/testsuite/tests/ghci/prog014/prog014.T b/testsuite/tests/ghci/prog014/prog014.T index 1b583e8c19..d9dee7eac7 100644 --- a/testsuite/tests/ghci/prog014/prog014.T +++ b/testsuite/tests/ghci/prog014/prog014.T @@ -1,6 +1,5 @@ test('prog014', [extra_files(['Primop.hs', 'dummy.c']), - expect_fail, # bytecode compiler doesn't support foreign import prim extra_run_opts('dummy.o'), pre_cmd('$MAKE -s --no-print-directory prog014')], ghci_script, ['prog014.script']) diff --git a/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall.hs b/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall.hs new file mode 100644 index 0000000000..807db7c077 --- /dev/null +++ b/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall.hs @@ -0,0 +1,279 @@ +{-# LANGUAGE ForeignFunctionInterface, GHCForeignImportPrim, UnliftedFFITypes, MagicHash, UnboxedTuples #-} + +module Main where + +import GHC.Int +import GHC.Word +import GHC.Prim +import GHC.Exts +import GHC.Types +import Unsafe.Coerce +import GHC.IO + +data Box (a :: UnliftedType) = MkBox a + +i2a :: Int -> Any +i2a = unsafeCoerce + +a2i :: Any -> Int +a2i = unsafeCoerce + +main :: IO () +main = do + + let i8s :: [Int8] + i8s = [0, -1, 1, minBound, maxBound] + + i16s :: [Int16] + i16s = [0, -1, 1, minBound, maxBound] + + i32s :: [Int32] + i32s = [0, -1, 1, minBound, maxBound] + + i64s :: [Int64] + i64s = [0, -1, 1, minBound, maxBound] + + ws :: [Word] + ws = [0, 1, 2, maxBound] + + fs :: [Float] + fs = [-0, 0, -1, 1, -2, 2, 1/0, 1e37, -1e-37] + + ds :: [Double] + ds = [-0, 0, -1, 1, -2, 2, 1/0, 1e307, -1e-307] + + ls :: [Word64] + ls = [0, 1, 2, 4294967296, maxBound] + + mi2a :: Maybe Integer -> Any + mi2a = unsafeCoerce + + a2mi :: Any -> Maybe Integer + a2mi = unsafeCoerce + + a0, a1, a2, a3 :: Any + a0 = mi2a Nothing + a1 = mi2a (Just 1) + a2 = mi2a (Just 18446744073709551617) + a3 = mi2a (Just (-18446744073709551617)) + + as :: [Any] + as = [a0, a1, a2, a3] + + + putStrLn "zero arguments" + IO (\st -> case cmm_zero st of (# st' #) -> (# st', () #)) + print =<< IO (\st -> case cmm_zero_w st of (# st', w #) -> (# st', W# w #)) + print =<< IO (\st -> case cmm_zero_d st of (# st', w #) -> (# st', D# w #)) + print =<< IO (\st -> case cmm_zero_f st of (# st', w #) -> (# st', F# w #)) + + -- XXX zero argument functions + + putStrLn "one argument functions" + print [ I8# (cmm_one1_i8 x) | (I8# x) <- i8s ] + print [ I16# (cmm_one1_i16 x) | (I16# x) <- i16s ] + print [ I32# (cmm_one1_i32 x) | (I32# x) <- i32s ] + print [ I64# (cmm_one1_i64 x) | (I64# x) <- i64s ] + print [ case cmm_one1_p x of (# y #) -> a2mi y | x <- as ] + print [ W# (cmm_one1_w x) | (W# x) <- ws ] + print [ F# (cmm_one1_f x) | (F# x) <- fs ] + print [ D# (cmm_one1_d x) | (D# x) <- ds ] + print [ W64# (cmm_one1_l x) | (W64# x) <- ls ] + + print [ case cmm_one2_i8 x of (# y1, y2 #) -> (I8# y1, I8# y2) | (I8# x) <- i8s ] + print [ case cmm_one2_i16 x of (# y1, y2 #) -> (I16# y1, I16# y2) | (I16# x) <- i16s ] + print [ case cmm_one2_i32 x of (# y1, y2 #) -> (I32# y1, I32# y2) | (I32# x) <- i32s ] + print [ case cmm_one2_i64 x of (# y1, y2 #) -> (I64# y1, I64# y2) | (I64# x) <- i64s ] + print [ case cmm_one2_p x of (# y1, y2 #) -> (a2mi y1, a2mi y2) | x <- as ] + print [ case cmm_one2_w x of (# y1, y2 #) -> (W# y1, W# y2) | (W# x) <- ws ] + print [ case cmm_one2_f x of (# y1, y2 #) -> (F# y1, F# y2) | (F# x) <- fs ] + print [ case cmm_one2_d x of (# y1, y2 #) -> (D# y1, D# y2) | (D# x) <- ds ] + print [ case cmm_one2_l x of (# y1, y2 #) -> (W64# y1, W64# y2) | (W64# x) <- ls ] + + putStrLn "two argument functions" + print [ I8# (cmm_two1_i8 x1 x2) | (I8# x1) <- i8s, (I8# x2) <- i8s ] + print [ I16# (cmm_two1_i16 x1 x2) | (I16# x1) <- i16s, (I16# x2) <- i16s ] + print [ I32# (cmm_two1_i32 x1 x2) | (I32# x1) <- i32s, (I32# x2) <- i32s ] + print [ I64# (cmm_two1_i64 x1 x2) | (I64# x1) <- i64s, (I64# x2) <- i64s ] + print [ case cmm_two1_p x1 x2 of (# y #) -> a2mi y | x1 <- as, x2 <- as ] + print [ W# (cmm_two1_w x1 x2) | (W# x1) <- ws, (W# x2) <- ws ] + print [ F# (cmm_two1_f x1 x2) | (F# x1) <- fs, (F# x2) <- fs ] + print [ D# (cmm_two1_d x1 x2) | (D# x1) <- ds, (D# x2) <- ds ] + print [ W64# (cmm_two1_l x1 x2) | (W64# x1) <- ls, (W64# x2) <- ls ] + + print [ I8# (cmm_two2_i8 x1 x2) | (I8# x1) <- i8s, (I8# x2) <- i8s ] + print [ I16# (cmm_two2_i16 x1 x2) | (I16# x1) <- i16s, (I16# x2) <- i16s ] + print [ I32# (cmm_two2_i32 x1 x2) | (I32# x1) <- i32s, (I32# x2) <- i32s ] + print [ I64# (cmm_two2_i64 x1 x2) | (I64# x1) <- i64s, (I64# x2) <- i64s ] + print [ case cmm_two2_p x1 x2 of (# y #) -> a2mi y | x1 <- as, x2 <- as ] + print [ W# (cmm_two2_w x1 x2) | (W# x1) <- ws, (W# x2) <- ws ] + print [ F# (cmm_two2_f x1 x2) | (F# x1) <- fs, (F# x2) <- fs ] + print [ D# (cmm_two2_d x1 x2) | (D# x1) <- ds, (D# x2) <- ds ] + print [ W64# (cmm_two2_l x1 x2) | (W64# x1) <- ls, (W64# x2) <- ls ] + + putStrLn "additional floating point tests" + print [ F# (cmm_floating_1 x1 x2) | (F# x1) <- fs, (F# x2) <- fs ] + print [ D# (cmm_floating_2 x1 x2) | (D# x1) <- ds, (D# x2) <- ds ] + print [ F# (cmm_floating_3 x1 x2) | (F# x1) <- fs, (D# x2) <- ds ] + print [ D# (cmm_floating_4 x1 x2) | (F# x1) <- fs, (D# x2) <- ds ] + print [ case cmm_floating_5 x1 x2 3.0e1# 4.0e2## 5.0e3# 6.0e4## 7.0e5# 8.0e6## of (# y1, y2 #) -> (F# y1, D# y2) + | (F# x1) <- fs, (D# x2) <- ds ] + print [ case cmm_floating_6 x1 x2 3.0e1## 4.0e2# 5.0e3## 6.0e4# 7.0e5## 8.0e6# of (# y1, y2 #) -> (D# y1, F# y2) + | (D# x1) <- ds, (F# x2) <- fs ] + print [ case cmm_floating_7 w1 x1 x2 + 4## 5.0e1# 6.0e2## + 7## 8.0e3# 9.0e4## + 10## 11.0e5# 12.0e6## + 13## 14.0e7# 15.0e8## + 16## 17.0e9# 18.0e10## + 19## 20.0e11# 21.0e12## of (# y1, y2, y3 #) -> (W# y1, F# y2, D# y3) + | (W# w1) <- ws, (F# x1) <- fs, (D# x2) <- ds ] + + putStrLn "various sized tuple returns" + print [ case cmm_tuple_1 x1 x2 3## of (# y1, y2, y3 #) -> (W# y1, W# y2, W# y3) | (W# x1) <- ws, (W# x2) <- ws] + print [ case cmm_tuple_2 x1 x2 3## 4## a0 a1 7.0## 8.0## a2 a3 11.0# 12.0# + of (# y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12 #) -> + (F# y1, F# y2, a2mi y3, a2mi y4, D# y5, D# y6, a2mi y7, a2mi y8, W# y9, W# y10, a2mi y11, a2mi y12) + | x1 <- as, x2 <- as ] + print [ case cmm_tuple_3 x1 x2 a0 3.0## a1 5.0# + of (# y1, y2, y3, y4, y5, y6 #) -> (F# y1, a2mi y2, D# y3, a2mi y4, W# y5, a2mi y6) + | x1 <- as, (W# x2) <- ws ] + print [ case cmm_tuple_4 x1 x2 of (# y1, y2 #) -> (a2mi y1, a2mi y2) | x1 <- as, x2 <- as ] + + putStrLn "arrays" + MkBox marr0 <- IO (\s -> case newArray# 10# a0 s of (# s', a #) -> (# s', MkBox a #)) + MkBox marr1 <- IO (\s -> case newArray# 12# a1 s of (# s', a #) -> (# s', MkBox a #)) + MkBox arr0 <- IO (\s -> case unsafeFreezeArray# marr0 s of (# s', a #) -> (# s', MkBox a #)) + MkBox arr1 <- IO (\s -> case unsafeFreezeArray# marr1 s of (# s', a #) -> (# s', MkBox a #)) + print (I# (cmm_array_1 arr0), I# (cmm_array_1 arr1)) + case cmm_array_2 arr0 arr1 of (# arr2, arr3 #) -> print (I# (cmm_array_1 arr2), I# (cmm_array_1 arr3)) + + putStrLn "many arguments" + print (W# (cmm_many_arguments 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## 29## 30## 31## 32## 33## 34## 35## 36## 37## 38## 39## 40## 41## 42## 43## 44## 45## 46## 47## 48## 49## 50## 51## 52## 53## 54## 55## 56## 57## 58## 59## 60## 61## 62## 63## 64## 65## 66## 67## 68## 69## 70## 71## 72## 73## 74## 75## 76## 77## 78## 79## 80## 81## 82## 83## 84## 85## 86## 87## 88## 89## 90## 91## 92## 93## 94## 95## 96## 97## 98## 99## 100## 101## 102## 103## 104## 105## 106## 107## 108## 109## 110## 111## 112## 113## 114## 115## 116## 117## 118## 119## 120## 121## 122## 123## 124## 125## 126## 127## 128## 129## 130## 131## 132## 133## 134## 135## 136## 137## 138## 139## 140## 141## 142## 143## 144## 145## 146## 147## 148## 149## 150## 151## 152## 153## 154## 155## 156## 157## 158## 159## 160## 161## 162## 163## 164## 165## 166## 167## 168## 169## 170## 171## 172## 173## 174## 175## 176## 177## 178## 179## 180## 181## 182## 183## 184## 185## 186## 187## 188## 189## 190## 191## 192## 193## 194## 195## 196## 197## 198## 199## 200## 201## 202## 203## 204## 205## 206## 207## 208## 209## 210## 211## 212## 213## 214## 215## 216## 217## 218## 219## 220## 221## 222## 223## 224## 225## 226## 227## 228## 229## 230## 231## 232## 233## 234## 235## 236## 237## 238## 239## 240## 241## 242## 243## 244## 245## 246## 247## 248## 249## 250## 251## 252## 253## 254## 255## 256## 257## 258## 259## 260## 261## 262## 263## 264## 265## 266## 267## 268## 269## 270## 271## 272## 273## 274## 275## 276## 277## 278## 279## 280## 281## 282## 283## 284## 285## 286## 287## 288## 289## 290## 291## 292## 293## 294## 295## 296## 297## 298## 299## 300## 301## 302## 303## 304## 305## 306## 307## 308## 309## 310## 311## 312## 313## 314## 315## 316## 317## 318## 319## 320## 321## 322## 323## 324## 325## 326## 327## 328## 329## 330## 331## 332## 333## 334## 335## 336## 337## 338## 339## 340## 341## 342## 343## 344## 345## 346## 347## 348## 349## 350## 351## 352## 353## 354## 355## 356## 357## 358## 359## 360## 361## 362## 363## 364## 365## 366## 367## 368## 369## 370## 371## 372## 373## 374## 375## 376## 377## 378## 379## 380## 381## 382## 383## 384## 385## 386## 387## 388## 389## 390## 391## 392## 393## 394## 395## 396## 397## 398## 399## 400##)) + +-- XXX why don't we accept State# RealWorld -> State# RealWorld ? +foreign import prim cmm_zero :: State# RealWorld -> (# State# RealWorld #) +foreign import prim cmm_zero_w :: State# RealWorld -> (# State# RealWorld, Word# #) +foreign import prim cmm_zero_d :: State# RealWorld -> (# State# RealWorld, Double# #) +foreign import prim cmm_zero_f :: State# RealWorld -> (# State# RealWorld, Float# #) + +-- one argument functions +foreign import prim cmm_one1_i8 :: Int8# -> Int8# +foreign import prim cmm_one1_i16 :: Int16# -> Int16# +foreign import prim cmm_one1_i32 :: Int32# -> Int32# +foreign import prim cmm_one1_i64 :: Int64# -> Int64# +foreign import prim cmm_one1_p :: Any -> (# Any #) +foreign import prim cmm_one1_w :: Word# -> Word# +foreign import prim cmm_one1_f :: Float# -> Float# +foreign import prim cmm_one1_d :: Double# -> Double# +foreign import prim cmm_one1_l :: Word64# -> Word64# + +foreign import prim cmm_one2_i8 :: Int8# -> (# Int8#, Int8# #) +foreign import prim cmm_one2_i16 :: Int16# -> (# Int16#, Int16# #) +foreign import prim cmm_one2_i32 :: Int32# -> (# Int32#, Int32# #) +foreign import prim cmm_one2_i64 :: Int64# -> (# Int64#, Int64# #) +foreign import prim cmm_one2_p :: Any -> (# Any, Any #) +foreign import prim cmm_one2_w :: Word# -> (# Word#, Word# #) +foreign import prim cmm_one2_f :: Float# -> (# Float#, Float# #) +foreign import prim cmm_one2_d :: Double# -> (# Double#, Double# #) +foreign import prim cmm_one2_l :: Word64# -> (# Word64#, Word64# #) + +-- two argument functions +foreign import prim cmm_two1_i8 :: Int8# -> Int8# -> Int8# +foreign import prim cmm_two1_i16 :: Int16# -> Int16# -> Int16# +foreign import prim cmm_two1_i32 :: Int32# -> Int32# -> Int32# +foreign import prim cmm_two1_i64 :: Int64# -> Int64# -> Int64# +foreign import prim cmm_two1_p :: Any -> Any -> (# Any #) +foreign import prim cmm_two1_w :: Word# -> Word# -> Word# +foreign import prim cmm_two1_f :: Float# -> Float# -> Float# +foreign import prim cmm_two1_d :: Double# -> Double# -> Double# +foreign import prim cmm_two1_l :: Word64# -> Word64# -> Word64# + +foreign import prim cmm_two2_i8 :: Int8# -> Int8# -> Int8# +foreign import prim cmm_two2_i16 :: Int16# -> Int16# -> Int16# +foreign import prim cmm_two2_i32 :: Int32# -> Int32# -> Int32# +foreign import prim cmm_two2_i64 :: Int64# -> Int64# -> Int64# +foreign import prim cmm_two2_p :: Any -> Any -> (# Any #) +foreign import prim cmm_two2_w :: Word# -> Word# -> Word# +foreign import prim cmm_two2_f :: Float# -> Float# -> Float# +foreign import prim cmm_two2_d :: Double# -> Double# -> Double# +foreign import prim cmm_two2_l :: Word64# -> Word64# -> Word64# + +{- additional tests for floating point, since D_ and F_ registers + overlap on some platforms -} + +foreign import prim cmm_floating_1 :: Float# -> Float# -> Float# +foreign import prim cmm_floating_2 :: Double# -> Double# -> Double# +foreign import prim cmm_floating_3 :: Float# -> Double# -> Float# +foreign import prim cmm_floating_4 :: Float# -> Double# -> Double# +foreign import prim cmm_floating_5 :: Float# -> Double# -> Float# -> Double# -> Float# -> Double# -> Float# -> Double# -> (# Float#, Double# #) +foreign import prim cmm_floating_6 :: Double# -> Float# -> Double# -> Float# -> Double# -> Float# -> Double# -> Float# -> (# Double#, Float# #) +foreign import prim cmm_floating_7 :: Word# -> Float# -> Double# -> Word# -> Float# -> Double# -> Word# -> Float# -> Double# -> Word# -> Float# -> Double# -> Word# -> Float# -> Double# -> Word# -> Float# -> Double# -> Word# -> Float# -> Double# -> (# Word#, Float#, Double# #) +-- various sized tuple returns + +foreign import prim cmm_tuple_1 :: Word# -> Word# -> Word# -> (# Word# , Word#, Word# #) +foreign import prim cmm_tuple_2 :: Any -> Any -> Word# -> Word# -> Any -> Any -> Double# -> Double# -> Any -> Any -> Float# -> Float# -> + (# Float#, Float#, Any, Any, Double#, Double#, Any, Any, Word#, Word#, Any, Any #) +foreign import prim cmm_tuple_3 :: Any -> Word# -> Any -> Double# -> Any -> Float# -> + (# Float#, Any, Double#, Any, Word#, Any #) +foreign import prim cmm_tuple_4 :: Any -> Any -> (# Any, Any #) + +-- boxed primitive types + +-- get the length of an array +foreign import prim cmm_array_1 :: Array# Any -> Int# +-- return some arrays +foreign import prim cmm_array_2 :: Array# Any -> Array# Any -> (# Array# Any, Array# Any #) + +foreign import prim cmm_many_arguments :: + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> Word# -> + Word# diff --git a/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall.stdout b/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall.stdout new file mode 100644 index 0000000000..dc511f173f --- /dev/null +++ b/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall.stdout @@ -0,0 +1,60 @@ +zero arguments +123 +1.0 +1.0 +one argument functions +[0,-1,1,-128,127] +[0,-1,1,-32768,32767] +[0,-1,1,-2147483648,2147483647] +[0,-1,1,-9223372036854775808,9223372036854775807] +[Nothing,Just 1,Just 18446744073709551617,Just (-18446744073709551617)] +[0,1,2,18446744073709551615] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307] +[0,1,2,4294967296,18446744073709551615] +[(0,0),(-1,-1),(1,1),(-128,-128),(127,127)] +[(0,0),(-1,-1),(1,1),(-32768,-32768),(32767,32767)] +[(0,0),(-1,-1),(1,1),(-2147483648,-2147483648),(2147483647,2147483647)] +[(0,0),(-1,-1),(1,1),(-9223372036854775808,-9223372036854775808),(9223372036854775807,9223372036854775807)] +[(Nothing,Nothing),(Just 1,Just 1),(Just 18446744073709551617,Just 18446744073709551617),(Just (-18446744073709551617),Just (-18446744073709551617))] +[(0,0),(1,1),(2,2),(18446744073709551615,18446744073709551615)] +[(-0.0,-0.0),(0.0,0.0),(-1.0,-1.0),(1.0,1.0),(-2.0,-2.0),(2.0,2.0),(Infinity,Infinity),(1.0e37,1.0e37),(-1.0e-37,-1.0e-37)] +[(-0.0,-0.0),(0.0,0.0),(-1.0,-1.0),(1.0,1.0),(-2.0,-2.0),(2.0,2.0),(Infinity,Infinity),(1.0e307,1.0e307),(-1.0e-307,-1.0e-307)] +[(0,0),(1,1),(2,2),(4294967296,4294967296),(18446744073709551615,18446744073709551615)] +two argument functions +[0,0,0,0,0,-1,-1,-1,-1,-1,1,1,1,1,1,-128,-128,-128,-128,-128,127,127,127,127,127] +[0,0,0,0,0,-1,-1,-1,-1,-1,1,1,1,1,1,-32768,-32768,-32768,-32768,-32768,32767,32767,32767,32767,32767] +[0,0,0,0,0,-1,-1,-1,-1,-1,1,1,1,1,1,-2147483648,-2147483648,-2147483648,-2147483648,-2147483648,2147483647,2147483647,2147483647,2147483647,2147483647] +[0,0,0,0,0,-1,-1,-1,-1,-1,1,1,1,1,1,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807] +[Nothing,Nothing,Nothing,Nothing,Just 1,Just 1,Just 1,Just 1,Just 18446744073709551617,Just 18446744073709551617,Just 18446744073709551617,Just 18446744073709551617,Just (-18446744073709551617),Just (-18446744073709551617),Just (-18446744073709551617),Just (-18446744073709551617)] +[0,0,0,0,1,1,1,1,2,2,2,2,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615] +[-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37] +[-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307] +[0,0,0,0,0,1,1,1,1,1,2,2,2,2,2,4294967296,4294967296,4294967296,4294967296,4294967296,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615] +[0,-1,1,-128,127,0,-1,1,-128,127,0,-1,1,-128,127,0,-1,1,-128,127,0,-1,1,-128,127] +[0,-1,1,-32768,32767,0,-1,1,-32768,32767,0,-1,1,-32768,32767,0,-1,1,-32768,32767,0,-1,1,-32768,32767] +[0,-1,1,-2147483648,2147483647,0,-1,1,-2147483648,2147483647,0,-1,1,-2147483648,2147483647,0,-1,1,-2147483648,2147483647,0,-1,1,-2147483648,2147483647] +[0,-1,1,-9223372036854775808,9223372036854775807,0,-1,1,-9223372036854775808,9223372036854775807,0,-1,1,-9223372036854775808,9223372036854775807,0,-1,1,-9223372036854775808,9223372036854775807,0,-1,1,-9223372036854775808,9223372036854775807] +[Nothing,Just 1,Just 18446744073709551617,Just (-18446744073709551617),Nothing,Just 1,Just 18446744073709551617,Just (-18446744073709551617),Nothing,Just 1,Just 18446744073709551617,Just (-18446744073709551617),Nothing,Just 1,Just 18446744073709551617,Just (-18446744073709551617)] +[0,1,2,18446744073709551615,0,1,2,18446744073709551615,0,1,2,18446744073709551615,0,1,2,18446744073709551615] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307] +[0,1,2,4294967296,18446744073709551615,0,1,2,4294967296,18446744073709551615,0,1,2,4294967296,18446744073709551615,0,1,2,4294967296,18446744073709551615,0,1,2,4294967296,18446744073709551615] +additional floating point tests +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-1.0,-1.0,-2.0,0.0,-3.0,1.0,Infinity,1.0e37,-1.0,1.0,1.0,0.0,2.0,-1.0,3.0,Infinity,1.0e37,1.0,-2.0,-2.0,-3.0,-1.0,-4.0,0.0,Infinity,1.0e37,-2.0,2.0,2.0,1.0,3.0,0.0,4.0,Infinity,1.0e37,2.0,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,Infinity,2.0e37,1.0e37,-1.0e-37,-1.0e-37,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-2.0e-37] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-1.0,-1.0,-2.0,0.0,-3.0,1.0,Infinity,1.0e307,-1.0,1.0,1.0,0.0,2.0,-1.0,3.0,Infinity,1.0e307,1.0,-2.0,-2.0,-3.0,-1.0,-4.0,0.0,Infinity,1.0e307,-2.0,2.0,2.0,1.0,3.0,0.0,4.0,Infinity,1.0e307,2.0,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,Infinity,2.0e307,1.0e307,-1.0e-307,-1.0e-307,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-2.0e-307] +[-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307] +[(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e307),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e307),(705030.0,8060400.0),(705029.0,8060400.0),(705029.0,8060400.0),(705029.0,8060399.0),(705029.0,8060401.0),(705029.0,8060398.0),(705029.0,8060402.0),(705029.0,Infinity),(705029.0,1.0e307),(705029.0,8060400.0),(705031.0,8060400.0),(705031.0,8060400.0),(705031.0,8060399.0),(705031.0,8060401.0),(705031.0,8060398.0),(705031.0,8060402.0),(705031.0,Infinity),(705031.0,1.0e307),(705031.0,8060400.0),(705028.0,8060400.0),(705028.0,8060400.0),(705028.0,8060399.0),(705028.0,8060401.0),(705028.0,8060398.0),(705028.0,8060402.0),(705028.0,Infinity),(705028.0,1.0e307),(705028.0,8060400.0),(705032.0,8060400.0),(705032.0,8060400.0),(705032.0,8060399.0),(705032.0,8060401.0),(705032.0,8060398.0),(705032.0,8060402.0),(705032.0,Infinity),(705032.0,1.0e307),(705032.0,8060400.0),(Infinity,8060400.0),(Infinity,8060400.0),(Infinity,8060399.0),(Infinity,8060401.0),(Infinity,8060398.0),(Infinity,8060402.0),(Infinity,Infinity),(Infinity,1.0e307),(Infinity,8060400.0),(1.0e37,8060400.0),(1.0e37,8060400.0),(1.0e37,8060399.0),(1.0e37,8060401.0),(1.0e37,8060398.0),(1.0e37,8060402.0),(1.0e37,Infinity),(1.0e37,1.0e307),(1.0e37,8060400.0),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e307),(705030.0,8060400.0)] +[(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e37),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e37),(705030.0,8060400.0),(705029.0,8060400.0),(705029.0,8060400.0),(705029.0,8060399.0),(705029.0,8060401.0),(705029.0,8060398.0),(705029.0,8060402.0),(705029.0,Infinity),(705029.0,1.0e37),(705029.0,8060400.0),(705031.0,8060400.0),(705031.0,8060400.0),(705031.0,8060399.0),(705031.0,8060401.0),(705031.0,8060398.0),(705031.0,8060402.0),(705031.0,Infinity),(705031.0,1.0e37),(705031.0,8060400.0),(705028.0,8060400.0),(705028.0,8060400.0),(705028.0,8060399.0),(705028.0,8060401.0),(705028.0,8060398.0),(705028.0,8060402.0),(705028.0,Infinity),(705028.0,1.0e37),(705028.0,8060400.0),(705032.0,8060400.0),(705032.0,8060400.0),(705032.0,8060399.0),(705032.0,8060401.0),(705032.0,8060398.0),(705032.0,8060402.0),(705032.0,Infinity),(705032.0,1.0e37),(705032.0,8060400.0),(Infinity,8060400.0),(Infinity,8060400.0),(Infinity,8060399.0),(Infinity,8060401.0),(Infinity,8060398.0),(Infinity,8060402.0),(Infinity,Infinity),(Infinity,1.0e37),(Infinity,8060400.0),(1.0e307,8060400.0),(1.0e307,8060400.0),(1.0e307,8060399.0),(1.0e307,8060401.0),(1.0e307,8060398.0),(1.0e307,8060402.0),(1.0e307,Infinity),(1.0e307,1.0e37),(1.0e307,8060400.0),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e37),(705030.0,8060400.0)] +[(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,Infinity,2.11815120906e13),(69,Infinity,2.11815120906e13),(69,Infinity,2.1181512090599e13),(69,Infinity,2.1181512090601e13),(69,Infinity,2.1181512090598e13),(69,Infinity,2.1181512090602e13),(69,Infinity,Infinity),(69,Infinity,1.0e307),(69,Infinity,2.11815120906e13),(69,1.0e37,2.11815120906e13),(69,1.0e37,2.11815120906e13),(69,1.0e37,2.1181512090599e13),(69,1.0e37,2.1181512090601e13),(69,1.0e37,2.1181512090598e13),(69,1.0e37,2.1181512090602e13),(69,1.0e37,Infinity),(69,1.0e37,1.0e307),(69,1.0e37,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,Infinity,2.11815120906e13),(70,Infinity,2.11815120906e13),(70,Infinity,2.1181512090599e13),(70,Infinity,2.1181512090601e13),(70,Infinity,2.1181512090598e13),(70,Infinity,2.1181512090602e13),(70,Infinity,Infinity),(70,Infinity,1.0e307),(70,Infinity,2.11815120906e13),(70,1.0e37,2.11815120906e13),(70,1.0e37,2.11815120906e13),(70,1.0e37,2.1181512090599e13),(70,1.0e37,2.1181512090601e13),(70,1.0e37,2.1181512090598e13),(70,1.0e37,2.1181512090602e13),(70,1.0e37,Infinity),(70,1.0e37,1.0e307),(70,1.0e37,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,Infinity,2.11815120906e13),(71,Infinity,2.11815120906e13),(71,Infinity,2.1181512090599e13),(71,Infinity,2.1181512090601e13),(71,Infinity,2.1181512090598e13),(71,Infinity,2.1181512090602e13),(71,Infinity,Infinity),(71,Infinity,1.0e307),(71,Infinity,2.11815120906e13),(71,1.0e37,2.11815120906e13),(71,1.0e37,2.11815120906e13),(71,1.0e37,2.1181512090599e13),(71,1.0e37,2.1181512090601e13),(71,1.0e37,2.1181512090598e13),(71,1.0e37,2.1181512090602e13),(71,1.0e37,Infinity),(71,1.0e37,1.0e307),(71,1.0e37,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,Infinity,2.11815120906e13),(68,Infinity,2.11815120906e13),(68,Infinity,2.1181512090599e13),(68,Infinity,2.1181512090601e13),(68,Infinity,2.1181512090598e13),(68,Infinity,2.1181512090602e13),(68,Infinity,Infinity),(68,Infinity,1.0e307),(68,Infinity,2.11815120906e13),(68,1.0e37,2.11815120906e13),(68,1.0e37,2.11815120906e13),(68,1.0e37,2.1181512090599e13),(68,1.0e37,2.1181512090601e13),(68,1.0e37,2.1181512090598e13),(68,1.0e37,2.1181512090602e13),(68,1.0e37,Infinity),(68,1.0e37,1.0e307),(68,1.0e37,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13)] +various sized tuple returns +[(3,0,0),(3,1,0),(3,2,0),(3,18446744073709551615,0),(3,0,1),(3,1,1),(3,2,1),(3,18446744073709551615,1),(3,0,2),(3,1,2),(3,2,2),(3,18446744073709551615,2),(3,0,18446744073709551615),(3,1,18446744073709551615),(3,2,18446744073709551615),(3,18446744073709551615,18446744073709551615)] +[(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Nothing,Nothing),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 1,Nothing),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 18446744073709551617,Nothing),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just (-18446744073709551617),Nothing),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Nothing,Just 1),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 1,Just 1),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 18446744073709551617,Just 1),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just (-18446744073709551617),Just 1),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Nothing,Just 18446744073709551617),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 1,Just 18446744073709551617),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 18446744073709551617,Just 18446744073709551617),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just (-18446744073709551617),Just 18446744073709551617),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Nothing,Just (-18446744073709551617)),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 1,Just (-18446744073709551617)),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 18446744073709551617,Just (-18446744073709551617)),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just (-18446744073709551617),Just (-18446744073709551617))] +[(5.0,Just 1,3.0,Nothing,0,Nothing),(5.0,Just 1,3.0,Nothing,1,Nothing),(5.0,Just 1,3.0,Nothing,2,Nothing),(5.0,Just 1,3.0,Nothing,18446744073709551615,Nothing),(5.0,Just 1,3.0,Nothing,0,Just 1),(5.0,Just 1,3.0,Nothing,1,Just 1),(5.0,Just 1,3.0,Nothing,2,Just 1),(5.0,Just 1,3.0,Nothing,18446744073709551615,Just 1),(5.0,Just 1,3.0,Nothing,0,Just 18446744073709551617),(5.0,Just 1,3.0,Nothing,1,Just 18446744073709551617),(5.0,Just 1,3.0,Nothing,2,Just 18446744073709551617),(5.0,Just 1,3.0,Nothing,18446744073709551615,Just 18446744073709551617),(5.0,Just 1,3.0,Nothing,0,Just (-18446744073709551617)),(5.0,Just 1,3.0,Nothing,1,Just (-18446744073709551617)),(5.0,Just 1,3.0,Nothing,2,Just (-18446744073709551617)),(5.0,Just 1,3.0,Nothing,18446744073709551615,Just (-18446744073709551617))] +[(Nothing,Nothing),(Just 1,Nothing),(Just 18446744073709551617,Nothing),(Just (-18446744073709551617),Nothing),(Nothing,Just 1),(Just 1,Just 1),(Just 18446744073709551617,Just 1),(Just (-18446744073709551617),Just 1),(Nothing,Just 18446744073709551617),(Just 1,Just 18446744073709551617),(Just 18446744073709551617,Just 18446744073709551617),(Just (-18446744073709551617),Just 18446744073709551617),(Nothing,Just (-18446744073709551617)),(Just 1,Just (-18446744073709551617)),(Just 18446744073709551617,Just (-18446744073709551617)),(Just (-18446744073709551617),Just (-18446744073709551617))] +arrays +(11,13) +(13,11) +many arguments +80200 diff --git a/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall.stdout-ws-32 b/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall.stdout-ws-32 new file mode 100644 index 0000000000..8b72d4f17a --- /dev/null +++ b/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall.stdout-ws-32 @@ -0,0 +1,60 @@ +zero arguments +123 +1.0 +1.0 +one argument functions +[0,-1,1,-128,127] +[0,-1,1,-32768,32767] +[0,-1,1,-2147483648,2147483647] +[0,-1,1,-9223372036854775808,9223372036854775807] +[Nothing,Just 1,Just 18446744073709551617,Just (-18446744073709551617)] +[0,1,2,4294967295] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307] +[0,1,2,4294967296,18446744073709551615] +[(0,0),(-1,-1),(1,1),(-128,-128),(127,127)] +[(0,0),(-1,-1),(1,1),(-32768,-32768),(32767,32767)] +[(0,0),(-1,-1),(1,1),(-2147483648,-2147483648),(2147483647,2147483647)] +[(0,0),(-1,-1),(1,1),(-9223372036854775808,-9223372036854775808),(9223372036854775807,9223372036854775807)] +[(Nothing,Nothing),(Just 1,Just 1),(Just 18446744073709551617,Just 18446744073709551617),(Just (-18446744073709551617),Just (-18446744073709551617))] +[(0,0),(1,1),(2,2),(4294967295,4294967295)] +[(-0.0,-0.0),(0.0,0.0),(-1.0,-1.0),(1.0,1.0),(-2.0,-2.0),(2.0,2.0),(Infinity,Infinity),(1.0e37,1.0e37),(-1.0e-37,-1.0e-37)] +[(-0.0,-0.0),(0.0,0.0),(-1.0,-1.0),(1.0,1.0),(-2.0,-2.0),(2.0,2.0),(Infinity,Infinity),(1.0e307,1.0e307),(-1.0e-307,-1.0e-307)] +[(0,0),(1,1),(2,2),(4294967296,4294967296),(18446744073709551615,18446744073709551615)] +two argument functions +[0,0,0,0,0,-1,-1,-1,-1,-1,1,1,1,1,1,-128,-128,-128,-128,-128,127,127,127,127,127] +[0,0,0,0,0,-1,-1,-1,-1,-1,1,1,1,1,1,-32768,-32768,-32768,-32768,-32768,32767,32767,32767,32767,32767] +[0,0,0,0,0,-1,-1,-1,-1,-1,1,1,1,1,1,-2147483648,-2147483648,-2147483648,-2147483648,-2147483648,2147483647,2147483647,2147483647,2147483647,2147483647] +[0,0,0,0,0,-1,-1,-1,-1,-1,1,1,1,1,1,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807] +[Nothing,Nothing,Nothing,Nothing,Just 1,Just 1,Just 1,Just 1,Just 18446744073709551617,Just 18446744073709551617,Just 18446744073709551617,Just 18446744073709551617,Just (-18446744073709551617),Just (-18446744073709551617),Just (-18446744073709551617),Just (-18446744073709551617)] +[0,0,0,0,1,1,1,1,2,2,2,2,4294967295,4294967295,4294967295,4294967295] +[-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37] +[-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307,-1.0e-307] +[0,0,0,0,0,1,1,1,1,1,2,2,2,2,2,4294967296,4294967296,4294967296,4294967296,4294967296,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615] +[0,-1,1,-128,127,0,-1,1,-128,127,0,-1,1,-128,127,0,-1,1,-128,127,0,-1,1,-128,127] +[0,-1,1,-32768,32767,0,-1,1,-32768,32767,0,-1,1,-32768,32767,0,-1,1,-32768,32767,0,-1,1,-32768,32767] +[0,-1,1,-2147483648,2147483647,0,-1,1,-2147483648,2147483647,0,-1,1,-2147483648,2147483647,0,-1,1,-2147483648,2147483647,0,-1,1,-2147483648,2147483647] +[0,-1,1,-9223372036854775808,9223372036854775807,0,-1,1,-9223372036854775808,9223372036854775807,0,-1,1,-9223372036854775808,9223372036854775807,0,-1,1,-9223372036854775808,9223372036854775807,0,-1,1,-9223372036854775808,9223372036854775807] +[Nothing,Just 1,Just 18446744073709551617,Just (-18446744073709551617),Nothing,Just 1,Just 18446744073709551617,Just (-18446744073709551617),Nothing,Just 1,Just 18446744073709551617,Just (-18446744073709551617),Nothing,Just 1,Just 18446744073709551617,Just (-18446744073709551617)] +[0,1,2,4294967295,0,1,2,4294967295,0,1,2,4294967295,0,1,2,4294967295] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307] +[0,1,2,4294967296,18446744073709551615,0,1,2,4294967296,18446744073709551615,0,1,2,4294967296,18446744073709551615,0,1,2,4294967296,18446744073709551615,0,1,2,4294967296,18446744073709551615] +additional floating point tests +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-1.0e-37,-1.0,-1.0,-2.0,0.0,-3.0,1.0,Infinity,1.0e37,-1.0,1.0,1.0,0.0,2.0,-1.0,3.0,Infinity,1.0e37,1.0,-2.0,-2.0,-3.0,-1.0,-4.0,0.0,Infinity,1.0e37,-2.0,2.0,2.0,1.0,3.0,0.0,4.0,Infinity,1.0e37,2.0,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,Infinity,2.0e37,1.0e37,-1.0e-37,-1.0e-37,-1.0,1.0,-2.0,2.0,Infinity,1.0e37,-2.0e-37] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-1.0,-1.0,-2.0,0.0,-3.0,1.0,Infinity,1.0e307,-1.0,1.0,1.0,0.0,2.0,-1.0,3.0,Infinity,1.0e307,1.0,-2.0,-2.0,-3.0,-1.0,-4.0,0.0,Infinity,1.0e307,-2.0,2.0,2.0,1.0,3.0,0.0,4.0,Infinity,1.0e307,2.0,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,1.0e307,Infinity,2.0e307,1.0e307,-1.0e-307,-1.0e-307,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-2.0e-307] +[-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,-0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,-2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,Infinity,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,1.0e37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37,-1.0e-37] +[-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307,-0.0,0.0,-1.0,1.0,-2.0,2.0,Infinity,1.0e307,-1.0e-307] +[(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e307),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e307),(705030.0,8060400.0),(705029.0,8060400.0),(705029.0,8060400.0),(705029.0,8060399.0),(705029.0,8060401.0),(705029.0,8060398.0),(705029.0,8060402.0),(705029.0,Infinity),(705029.0,1.0e307),(705029.0,8060400.0),(705031.0,8060400.0),(705031.0,8060400.0),(705031.0,8060399.0),(705031.0,8060401.0),(705031.0,8060398.0),(705031.0,8060402.0),(705031.0,Infinity),(705031.0,1.0e307),(705031.0,8060400.0),(705028.0,8060400.0),(705028.0,8060400.0),(705028.0,8060399.0),(705028.0,8060401.0),(705028.0,8060398.0),(705028.0,8060402.0),(705028.0,Infinity),(705028.0,1.0e307),(705028.0,8060400.0),(705032.0,8060400.0),(705032.0,8060400.0),(705032.0,8060399.0),(705032.0,8060401.0),(705032.0,8060398.0),(705032.0,8060402.0),(705032.0,Infinity),(705032.0,1.0e307),(705032.0,8060400.0),(Infinity,8060400.0),(Infinity,8060400.0),(Infinity,8060399.0),(Infinity,8060401.0),(Infinity,8060398.0),(Infinity,8060402.0),(Infinity,Infinity),(Infinity,1.0e307),(Infinity,8060400.0),(1.0e37,8060400.0),(1.0e37,8060400.0),(1.0e37,8060399.0),(1.0e37,8060401.0),(1.0e37,8060398.0),(1.0e37,8060402.0),(1.0e37,Infinity),(1.0e37,1.0e307),(1.0e37,8060400.0),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e307),(705030.0,8060400.0)] +[(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e37),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e37),(705030.0,8060400.0),(705029.0,8060400.0),(705029.0,8060400.0),(705029.0,8060399.0),(705029.0,8060401.0),(705029.0,8060398.0),(705029.0,8060402.0),(705029.0,Infinity),(705029.0,1.0e37),(705029.0,8060400.0),(705031.0,8060400.0),(705031.0,8060400.0),(705031.0,8060399.0),(705031.0,8060401.0),(705031.0,8060398.0),(705031.0,8060402.0),(705031.0,Infinity),(705031.0,1.0e37),(705031.0,8060400.0),(705028.0,8060400.0),(705028.0,8060400.0),(705028.0,8060399.0),(705028.0,8060401.0),(705028.0,8060398.0),(705028.0,8060402.0),(705028.0,Infinity),(705028.0,1.0e37),(705028.0,8060400.0),(705032.0,8060400.0),(705032.0,8060400.0),(705032.0,8060399.0),(705032.0,8060401.0),(705032.0,8060398.0),(705032.0,8060402.0),(705032.0,Infinity),(705032.0,1.0e37),(705032.0,8060400.0),(Infinity,8060400.0),(Infinity,8060400.0),(Infinity,8060399.0),(Infinity,8060401.0),(Infinity,8060398.0),(Infinity,8060402.0),(Infinity,Infinity),(Infinity,1.0e37),(Infinity,8060400.0),(1.0e307,8060400.0),(1.0e307,8060400.0),(1.0e307,8060399.0),(1.0e307,8060401.0),(1.0e307,8060398.0),(1.0e307,8060402.0),(1.0e307,Infinity),(1.0e307,1.0e37),(1.0e307,8060400.0),(705030.0,8060400.0),(705030.0,8060400.0),(705030.0,8060399.0),(705030.0,8060401.0),(705030.0,8060398.0),(705030.0,8060402.0),(705030.0,Infinity),(705030.0,1.0e37),(705030.0,8060400.0)] +[(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(69,Infinity,2.11815120906e13),(69,Infinity,2.11815120906e13),(69,Infinity,2.1181512090599e13),(69,Infinity,2.1181512090601e13),(69,Infinity,2.1181512090598e13),(69,Infinity,2.1181512090602e13),(69,Infinity,Infinity),(69,Infinity,1.0e307),(69,Infinity,2.11815120906e13),(69,1.0e37,2.11815120906e13),(69,1.0e37,2.11815120906e13),(69,1.0e37,2.1181512090599e13),(69,1.0e37,2.1181512090601e13),(69,1.0e37,2.1181512090598e13),(69,1.0e37,2.1181512090602e13),(69,1.0e37,Infinity),(69,1.0e37,1.0e307),(69,1.0e37,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.11815120906e13),(69,2.017141e12,2.1181512090599e13),(69,2.017141e12,2.1181512090601e13),(69,2.017141e12,2.1181512090598e13),(69,2.017141e12,2.1181512090602e13),(69,2.017141e12,Infinity),(69,2.017141e12,1.0e307),(69,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(70,Infinity,2.11815120906e13),(70,Infinity,2.11815120906e13),(70,Infinity,2.1181512090599e13),(70,Infinity,2.1181512090601e13),(70,Infinity,2.1181512090598e13),(70,Infinity,2.1181512090602e13),(70,Infinity,Infinity),(70,Infinity,1.0e307),(70,Infinity,2.11815120906e13),(70,1.0e37,2.11815120906e13),(70,1.0e37,2.11815120906e13),(70,1.0e37,2.1181512090599e13),(70,1.0e37,2.1181512090601e13),(70,1.0e37,2.1181512090598e13),(70,1.0e37,2.1181512090602e13),(70,1.0e37,Infinity),(70,1.0e37,1.0e307),(70,1.0e37,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.11815120906e13),(70,2.017141e12,2.1181512090599e13),(70,2.017141e12,2.1181512090601e13),(70,2.017141e12,2.1181512090598e13),(70,2.017141e12,2.1181512090602e13),(70,2.017141e12,Infinity),(70,2.017141e12,1.0e307),(70,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(71,Infinity,2.11815120906e13),(71,Infinity,2.11815120906e13),(71,Infinity,2.1181512090599e13),(71,Infinity,2.1181512090601e13),(71,Infinity,2.1181512090598e13),(71,Infinity,2.1181512090602e13),(71,Infinity,Infinity),(71,Infinity,1.0e307),(71,Infinity,2.11815120906e13),(71,1.0e37,2.11815120906e13),(71,1.0e37,2.11815120906e13),(71,1.0e37,2.1181512090599e13),(71,1.0e37,2.1181512090601e13),(71,1.0e37,2.1181512090598e13),(71,1.0e37,2.1181512090602e13),(71,1.0e37,Infinity),(71,1.0e37,1.0e307),(71,1.0e37,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.11815120906e13),(71,2.017141e12,2.1181512090599e13),(71,2.017141e12,2.1181512090601e13),(71,2.017141e12,2.1181512090598e13),(71,2.017141e12,2.1181512090602e13),(71,2.017141e12,Infinity),(71,2.017141e12,1.0e307),(71,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13),(68,Infinity,2.11815120906e13),(68,Infinity,2.11815120906e13),(68,Infinity,2.1181512090599e13),(68,Infinity,2.1181512090601e13),(68,Infinity,2.1181512090598e13),(68,Infinity,2.1181512090602e13),(68,Infinity,Infinity),(68,Infinity,1.0e307),(68,Infinity,2.11815120906e13),(68,1.0e37,2.11815120906e13),(68,1.0e37,2.11815120906e13),(68,1.0e37,2.1181512090599e13),(68,1.0e37,2.1181512090601e13),(68,1.0e37,2.1181512090598e13),(68,1.0e37,2.1181512090602e13),(68,1.0e37,Infinity),(68,1.0e37,1.0e307),(68,1.0e37,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.11815120906e13),(68,2.017141e12,2.1181512090599e13),(68,2.017141e12,2.1181512090601e13),(68,2.017141e12,2.1181512090598e13),(68,2.017141e12,2.1181512090602e13),(68,2.017141e12,Infinity),(68,2.017141e12,1.0e307),(68,2.017141e12,2.11815120906e13)] +various sized tuple returns +[(3,0,0),(3,1,0),(3,2,0),(3,4294967295,0),(3,0,1),(3,1,1),(3,2,1),(3,4294967295,1),(3,0,2),(3,1,2),(3,2,2),(3,4294967295,2),(3,0,4294967295),(3,1,4294967295),(3,2,4294967295),(3,4294967295,4294967295)] +[(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Nothing,Nothing),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 1,Nothing),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 18446744073709551617,Nothing),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just (-18446744073709551617),Nothing),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Nothing,Just 1),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 1,Just 1),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 18446744073709551617,Just 1),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just (-18446744073709551617),Just 1),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Nothing,Just 18446744073709551617),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 1,Just 18446744073709551617),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 18446744073709551617,Just 18446744073709551617),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just (-18446744073709551617),Just 18446744073709551617),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Nothing,Just (-18446744073709551617)),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 1,Just (-18446744073709551617)),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just 18446744073709551617,Just (-18446744073709551617)),(12.0,11.0,Just (-18446744073709551617),Just 18446744073709551617,8.0,7.0,Just 1,Nothing,4,3,Just (-18446744073709551617),Just (-18446744073709551617))] +[(5.0,Just 1,3.0,Nothing,0,Nothing),(5.0,Just 1,3.0,Nothing,1,Nothing),(5.0,Just 1,3.0,Nothing,2,Nothing),(5.0,Just 1,3.0,Nothing,4294967295,Nothing),(5.0,Just 1,3.0,Nothing,0,Just 1),(5.0,Just 1,3.0,Nothing,1,Just 1),(5.0,Just 1,3.0,Nothing,2,Just 1),(5.0,Just 1,3.0,Nothing,4294967295,Just 1),(5.0,Just 1,3.0,Nothing,0,Just 18446744073709551617),(5.0,Just 1,3.0,Nothing,1,Just 18446744073709551617),(5.0,Just 1,3.0,Nothing,2,Just 18446744073709551617),(5.0,Just 1,3.0,Nothing,4294967295,Just 18446744073709551617),(5.0,Just 1,3.0,Nothing,0,Just (-18446744073709551617)),(5.0,Just 1,3.0,Nothing,1,Just (-18446744073709551617)),(5.0,Just 1,3.0,Nothing,2,Just (-18446744073709551617)),(5.0,Just 1,3.0,Nothing,4294967295,Just (-18446744073709551617))] +[(Nothing,Nothing),(Just 1,Nothing),(Just 18446744073709551617,Nothing),(Just (-18446744073709551617),Nothing),(Nothing,Just 1),(Just 1,Just 1),(Just 18446744073709551617,Just 1),(Just (-18446744073709551617),Just 1),(Nothing,Just 18446744073709551617),(Just 1,Just 18446744073709551617),(Just 18446744073709551617,Just 18446744073709551617),(Just (-18446744073709551617),Just 18446744073709551617),(Nothing,Just (-18446744073709551617)),(Just 1,Just (-18446744073709551617)),(Just 18446744073709551617,Just (-18446744073709551617)),(Just (-18446744073709551617),Just (-18446744073709551617))] +arrays +(11,13) +(13,11) +many arguments +80200 diff --git a/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall_cmm.cmm b/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall_cmm.cmm new file mode 100644 index 0000000000..d9005d1619 --- /dev/null +++ b/testsuite/tests/ghci/should_run/GHCiPrimCall/GHCiPrimCall_cmm.cmm @@ -0,0 +1,230 @@ +#include "Cmm.h" + +/* zero arguments */ +cmm_zero() { /* ccall puts("cmm_zero"); buffering gets in the way */ return (); } +cmm_zero_w() { return (123::W_); } +cmm_zero_d() { return (1.0::D_); } +cmm_zero_f() { return (1.0::F_); } +cmm_zero_l() { return (123::L_); } + +/* one argument functions */ +cmm_one1_i8(I8 x) { return (x); } +cmm_one1_i16(I16 x) { return (x); } +cmm_one1_i32(I32 x) { return (x); } +cmm_one1_i64(I64 x) { return (x); } +cmm_one1_p(P_ x) { return (x); } +cmm_one1_w(W_ x) { return (x); } +cmm_one1_f(F_ x) { return (x); } +cmm_one1_d(D_ x) { return (x); } +cmm_one1_l(L_ x) { return (x); } + +cmm_one2_i8(I8 x) { return (x,x); } +cmm_one2_i16(I16 x) { return (x,x); } +cmm_one2_i32(I32 x) { return (x,x); } +cmm_one2_i64(I64 x) { return (x,x); } +cmm_one2_p(P_ x) { return (x,x); } +cmm_one2_w(W_ x) { return (x,x); } +cmm_one2_f(F_ x) { return (x,x); } +cmm_one2_d(D_ x) { return (x,x); } +cmm_one2_l(L_ x) { return (x,x); } + + +/* two argument functions */ +cmm_two1_i8(I8 x, I8 y) { return (x); } +cmm_two1_i16(I16 x, I16 y) { return (x); } +cmm_two1_i32(I32 x, I32 y) { return (x); } +cmm_two1_i64(I64 x, I64 y) { return (x); } +cmm_two1_p(P_ x, P_ y) { return (x); } +cmm_two1_w(W_ x, W_ y) { return (x); } +cmm_two1_f(F_ x, F_ y) { return (x); } +cmm_two1_d(D_ x, D_ y) { return (x); } +cmm_two1_l(L_ x, L_ y) { return (x); } + +cmm_two2_i8(I8 x, I8 y) { return (y); } +cmm_two2_i16(I16 x, I16 y) { return (y); } +cmm_two2_i32(I32 x, I32 y) { return (y); } +cmm_two2_i64(I64 x, I64 y) { return (y); } +cmm_two2_p(P_ x, P_ y) { return (y); } +cmm_two2_w(W_ x, W_ y) { return (y); } +cmm_two2_f(F_ x, F_ y) { return (y); } +cmm_two2_d(D_ x, D_ y) { return (y); } +cmm_two2_l(L_ x, L_ y) { return (y); } + +/* additional tests for floating point, since D_ and F_ registers + overlap on some platforms */ +cmm_floating_1(F_ x, F_ y) { F_ z; z = %fadd(x, y); return (z); } +cmm_floating_2(D_ x, D_ y) { D_ z; z = %fadd(x, y); return (z); } +cmm_floating_3(F_ x, D_ y) { return (x); } +cmm_floating_4(F_ x, D_ y) { return (y); } + + +cmm_floating_5(F_ x1, D_ x2, F_ x3, D_ x4, F_ x5, D_ x6, F_ x7, D_ x8) { + F_ y1; + D_ y2; + + y1 = %fadd(x1,x3); + y1 = %fadd(y1,x5); + y1 = %fadd(y1,x7); + + y2 = %fadd(x2,x4); + y2 = %fadd(y2,x6); + y2 = %fadd(y2,x8); + + return (y1, y2); +} + + +cmm_floating_6(D_ x1, F_ x2, D_ x3, F_ x4, D_ x5, F_ x6, D_ x7, F_ x8) { + D_ y1; + F_ y2; + + y1 = %fadd(x1,x3); + y1 = %fadd(y1,x5); + y1 = %fadd(y1,x7); + + y2 = %fadd(x2,x4); + y2 = %fadd(y2,x6); + y2 = %fadd(y2,x8); + + return (y1, y2); +} + + +cmm_floating_7( W_ x1, F_ x2, D_ x3 + , W_ x4, F_ x5, D_ x6 + , W_ x7, F_ x8, D_ x9 + , W_ x10, F_ x11, D_ x12 + , W_ x13, F_ x14, D_ x15 + , W_ x16, F_ x17, D_ x18 + , W_ x19, F_ x20, D_ x21 + ) { + W_ y1; + F_ y2; + D_ y3; + y1 = x1+x4+x7+x10+x13+x16+x19; + + y2 = %fadd(x2,x5); + y2 = %fadd(y2,x8); + y2 = %fadd(y2,x11); + y2 = %fadd(y2,x14); + y2 = %fadd(y2,x17); + y2 = %fadd(y2,x20); + + y3 = %fadd(x3,x6); + y3 = %fadd(y3,x9); + y3 = %fadd(y3,x12); + y3 = %fadd(y3,x15); + y3 = %fadd(y3,x18); + y3 = %fadd(y3,x21); + + return ( y1, y2, y3 ); +} + + +/* various sized tuple returns */ + +cmm_tuple_1(W_ x, W_ y, W_ z) { return (z, y, x); } +cmm_tuple_2(P_ p1, P_ p2, W_ w1, W_ w2, P_ p3, P_ p4, D_ d1, D_ d2, P_ p5, P_ p6, F_ f1, F_ f2) { + return (f2, f1, p6, p5, d2, d1, p4, p3, w2, w1, p2, p1); +} +cmm_tuple_3(P_ p1, W_ w1, P_ p2, D_ d1, P_ p3, F_ f1) { + return (f1, p3, d1, p2, w1, p1); +} +cmm_tuple_4(P_ p1, P_ p2) { return (p2, p1); } + +/* working with arrays */ +cmm_array_1(P_ x) { + W_ size; + size = StgMutArrPtrs_size(x); + return (size); +} + +/* return two arrays */ +cmm_array_2(P_ x, P_ y) { + return (y, x); +} + +/* many arguments */ +cmm_many_arguments(W_ x1, W_ x2, W_ x3, W_ x4, W_ x5, W_ x6, W_ x7, W_ x8, W_ x9, W_ x10, + W_ x11, W_ x12, W_ x13, W_ x14, W_ x15, W_ x16, W_ x17, W_ x18, W_ x19, W_ x20, + W_ x21, W_ x22, W_ x23, W_ x24, W_ x25, W_ x26, W_ x27, W_ x28, W_ x29, W_ x30, + W_ x31, W_ x32, W_ x33, W_ x34, W_ x35, W_ x36, W_ x37, W_ x38, W_ x39, W_ x40, + W_ x41, W_ x42, W_ x43, W_ x44, W_ x45, W_ x46, W_ x47, W_ x48, W_ x49, W_ x50, + W_ x51, W_ x52, W_ x53, W_ x54, W_ x55, W_ x56, W_ x57, W_ x58, W_ x59, W_ x60, + W_ x61, W_ x62, W_ x63, W_ x64, W_ x65, W_ x66, W_ x67, W_ x68, W_ x69, W_ x70, + W_ x71, W_ x72, W_ x73, W_ x74, W_ x75, W_ x76, W_ x77, W_ x78, W_ x79, W_ x80, + W_ x81, W_ x82, W_ x83, W_ x84, W_ x85, W_ x86, W_ x87, W_ x88, W_ x89, W_ x90, + W_ x91, W_ x92, W_ x93, W_ x94, W_ x95, W_ x96, W_ x97, W_ x98, W_ x99, W_ x100, + W_ x101, W_ x102, W_ x103, W_ x104, W_ x105, W_ x106, W_ x107, W_ x108, W_ x109, W_ x110, + W_ x111, W_ x112, W_ x113, W_ x114, W_ x115, W_ x116, W_ x117, W_ x118, W_ x119, W_ x120, + W_ x121, W_ x122, W_ x123, W_ x124, W_ x125, W_ x126, W_ x127, W_ x128, W_ x129, W_ x130, + W_ x131, W_ x132, W_ x133, W_ x134, W_ x135, W_ x136, W_ x137, W_ x138, W_ x139, W_ x140, + W_ x141, W_ x142, W_ x143, W_ x144, W_ x145, W_ x146, W_ x147, W_ x148, W_ x149, W_ x150, + W_ x151, W_ x152, W_ x153, W_ x154, W_ x155, W_ x156, W_ x157, W_ x158, W_ x159, W_ x160, + W_ x161, W_ x162, W_ x163, W_ x164, W_ x165, W_ x166, W_ x167, W_ x168, W_ x169, W_ x170, + W_ x171, W_ x172, W_ x173, W_ x174, W_ x175, W_ x176, W_ x177, W_ x178, W_ x179, W_ x180, + W_ x181, W_ x182, W_ x183, W_ x184, W_ x185, W_ x186, W_ x187, W_ x188, W_ x189, W_ x190, + W_ x191, W_ x192, W_ x193, W_ x194, W_ x195, W_ x196, W_ x197, W_ x198, W_ x199, W_ x200, + W_ x201, W_ x202, W_ x203, W_ x204, W_ x205, W_ x206, W_ x207, W_ x208, W_ x209, W_ x210, + W_ x211, W_ x212, W_ x213, W_ x214, W_ x215, W_ x216, W_ x217, W_ x218, W_ x219, W_ x220, + W_ x221, W_ x222, W_ x223, W_ x224, W_ x225, W_ x226, W_ x227, W_ x228, W_ x229, W_ x230, + W_ x231, W_ x232, W_ x233, W_ x234, W_ x235, W_ x236, W_ x237, W_ x238, W_ x239, W_ x240, + W_ x241, W_ x242, W_ x243, W_ x244, W_ x245, W_ x246, W_ x247, W_ x248, W_ x249, W_ x250, + W_ x251, W_ x252, W_ x253, W_ x254, W_ x255, W_ x256, W_ x257, W_ x258, W_ x259, W_ x260, + W_ x261, W_ x262, W_ x263, W_ x264, W_ x265, W_ x266, W_ x267, W_ x268, W_ x269, W_ x270, + W_ x271, W_ x272, W_ x273, W_ x274, W_ x275, W_ x276, W_ x277, W_ x278, W_ x279, W_ x280, + W_ x281, W_ x282, W_ x283, W_ x284, W_ x285, W_ x286, W_ x287, W_ x288, W_ x289, W_ x290, + W_ x291, W_ x292, W_ x293, W_ x294, W_ x295, W_ x296, W_ x297, W_ x298, W_ x299, W_ x300, + W_ x301, W_ x302, W_ x303, W_ x304, W_ x305, W_ x306, W_ x307, W_ x308, W_ x309, W_ x310, + W_ x311, W_ x312, W_ x313, W_ x314, W_ x315, W_ x316, W_ x317, W_ x318, W_ x319, W_ x320, + W_ x321, W_ x322, W_ x323, W_ x324, W_ x325, W_ x326, W_ x327, W_ x328, W_ x329, W_ x330, + W_ x331, W_ x332, W_ x333, W_ x334, W_ x335, W_ x336, W_ x337, W_ x338, W_ x339, W_ x340, + W_ x341, W_ x342, W_ x343, W_ x344, W_ x345, W_ x346, W_ x347, W_ x348, W_ x349, W_ x350, + W_ x351, W_ x352, W_ x353, W_ x354, W_ x355, W_ x356, W_ x357, W_ x358, W_ x359, W_ x360, + W_ x361, W_ x362, W_ x363, W_ x364, W_ x365, W_ x366, W_ x367, W_ x368, W_ x369, W_ x370, + W_ x371, W_ x372, W_ x373, W_ x374, W_ x375, W_ x376, W_ x377, W_ x378, W_ x379, W_ x380, + W_ x381, W_ x382, W_ x383, W_ x384, W_ x385, W_ x386, W_ x387, W_ x388, W_ x389, W_ x390, + W_ x391, W_ x392, W_ x393, W_ x394, W_ x395, W_ x396, W_ x397, W_ x398, W_ x399, W_ x400) { + W_ y; + y = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20 + + x21 + x22 + x23 + x24 + x25 + x26 + x27 + x28 + x29 + x30 + + x31 + x32 + x33 + x34 + x35 + x36 + x37 + x38 + x39 + x40 + + x41 + x42 + x43 + x44 + x45 + x46 + x47 + x48 + x49 + x50 + + x51 + x52 + x53 + x54 + x55 + x56 + x57 + x58 + x59 + x60 + + x61 + x62 + x63 + x64 + x65 + x66 + x67 + x68 + x69 + x70 + + x71 + x72 + x73 + x74 + x75 + x76 + x77 + x78 + x79 + x80 + + x81 + x82 + x83 + x84 + x85 + x86 + x87 + x88 + x89 + x90 + + x91 + x92 + x93 + x94 + x95 + x96 + x97 + x98 + x99 + x100 + + x101 + x102 + x103 + x104 + x105 + x106 + x107 + x108 + x109 + x110 + + x111 + x112 + x113 + x114 + x115 + x116 + x117 + x118 + x119 + x120 + + x121 + x122 + x123 + x124 + x125 + x126 + x127 + x128 + x129 + x130 + + x131 + x132 + x133 + x134 + x135 + x136 + x137 + x138 + x139 + x140 + + x141 + x142 + x143 + x144 + x145 + x146 + x147 + x148 + x149 + x150 + + x151 + x152 + x153 + x154 + x155 + x156 + x157 + x158 + x159 + x160 + + x161 + x162 + x163 + x164 + x165 + x166 + x167 + x168 + x169 + x170 + + x171 + x172 + x173 + x174 + x175 + x176 + x177 + x178 + x179 + x180 + + x181 + x182 + x183 + x184 + x185 + x186 + x187 + x188 + x189 + x190 + + x191 + x192 + x193 + x194 + x195 + x196 + x197 + x198 + x199 + x200 + + x201 + x202 + x203 + x204 + x205 + x206 + x207 + x208 + x209 + x210 + + x211 + x212 + x213 + x214 + x215 + x216 + x217 + x218 + x219 + x220 + + x221 + x222 + x223 + x224 + x225 + x226 + x227 + x228 + x229 + x230 + + x231 + x232 + x233 + x234 + x235 + x236 + x237 + x238 + x239 + x240 + + x241 + x242 + x243 + x244 + x245 + x246 + x247 + x248 + x249 + x250 + + x251 + x252 + x253 + x254 + x255 + x256 + x257 + x258 + x259 + x260 + + x261 + x262 + x263 + x264 + x265 + x266 + x267 + x268 + x269 + x270 + + x271 + x272 + x273 + x274 + x275 + x276 + x277 + x278 + x279 + x280 + + x281 + x282 + x283 + x284 + x285 + x286 + x287 + x288 + x289 + x290 + + x291 + x292 + x293 + x294 + x295 + x296 + x297 + x298 + x299 + x300 + + x301 + x302 + x303 + x304 + x305 + x306 + x307 + x308 + x309 + x310 + + x311 + x312 + x313 + x314 + x315 + x316 + x317 + x318 + x319 + x320 + + x321 + x322 + x323 + x324 + x325 + x326 + x327 + x328 + x329 + x330 + + x331 + x332 + x333 + x334 + x335 + x336 + x337 + x338 + x339 + x340 + + x341 + x342 + x343 + x344 + x345 + x346 + x347 + x348 + x349 + x350 + + x351 + x352 + x353 + x354 + x355 + x356 + x357 + x358 + x359 + x360 + + x361 + x362 + x363 + x364 + x365 + x366 + x367 + x368 + x369 + x370 + + x371 + x372 + x373 + x374 + x375 + x376 + x377 + x378 + x379 + x380 + + x381 + x382 + x383 + x384 + x385 + x386 + x387 + x388 + x389 + x390 + + x391 + x392 + x393 + x394 + x395 + x396 + x397 + x398 + x399 + x400; + return (y); +} diff --git a/testsuite/tests/ghci/should_run/GHCiPrimCall/Makefile b/testsuite/tests/ghci/should_run/GHCiPrimCall/Makefile new file mode 100644 index 0000000000..fd64d23f6f --- /dev/null +++ b/testsuite/tests/ghci/should_run/GHCiPrimCall/Makefile @@ -0,0 +1,4 @@ +.PHONY: GHCiPrimCall +GHCiPrimCall: + '$(TEST_HC)' $(TEST_HC_OPTS) -fPIC -v0 -c GHCiPrimCall_cmm.cmm + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e main GHCiPrimCall.hs GHCiPrimCall_cmm.o || echo $$? >&2 diff --git a/testsuite/tests/ghci/should_run/GHCiPrimCall/all.T b/testsuite/tests/ghci/should_run/GHCiPrimCall/all.T new file mode 100644 index 0000000000..701c89cafd --- /dev/null +++ b/testsuite/tests/ghci/should_run/GHCiPrimCall/all.T @@ -0,0 +1,2 @@ +test('GHCiPrimCall', [req_interp], makefile_test, ['GHCiPrimCall']) + |