@@ -35,68 +35,247 @@ partial = Partial NotCovering
35primitives =
35primitives =
36 -- operators
36 -- operators
37 [Prim (UN "prim__addInt") (ty [IType, IType] IType) 2 (iBin (+))
37 [Prim (UN "prim__addInt") (ty [IType, IType] IType) 2 (iBin (+))
38− (2, LPlus ITNative) total,
38+ (2, LPlus) total,
39 Prim (UN "prim__subInt") (ty [IType, IType] IType) 2 (iBin (-))
39 Prim (UN "prim__subInt") (ty [IType, IType] IType) 2 (iBin (-))
40− (2, LMinus ITNative) total,
40+ (2, LMinus) total,
41 Prim (UN "prim__mulInt") (ty [IType, IType] IType) 2 (iBin (*))
41 Prim (UN "prim__mulInt") (ty [IType, IType] IType) 2 (iBin (*))
42− (2, LTimes ITNative) total,
42+ (2, LTimes) total,
43 Prim (UN "prim__divInt") (ty [IType, IType] IType) 2 (iBin div)
43 Prim (UN "prim__divInt") (ty [IType, IType] IType) 2 (iBin div)
44− (2, LSDiv ITNative) partial,
44+ (2, LDiv) partial,
45 Prim (UN "prim__modInt") (ty [IType, IType] IType) 2 (iBin mod)
45 Prim (UN "prim__modInt") (ty [IType, IType] IType) 2 (iBin mod)
46− (2, LSRem ITNative) partial,
46+ (2, LMod) partial,
47 Prim (UN "prim__andInt") (ty [IType, IType] IType) 2 (iBin (.&.))
47 Prim (UN "prim__andInt") (ty [IType, IType] IType) 2 (iBin (.&.))
48− (2, LAnd ITNative) partial,
48+ (2, LAnd) partial,
49 Prim (UN "prim__orInt") (ty [IType, IType] IType) 2 (iBin (.|.))
49 Prim (UN "prim__orInt") (ty [IType, IType] IType) 2 (iBin (.|.))
50− (2, LOr ITNative) partial,
50+ (2, LOr) partial,
51 Prim (UN "prim__xorInt") (ty [IType, IType] IType) 2 (iBin xor)
51 Prim (UN "prim__xorInt") (ty [IType, IType] IType) 2 (iBin xor)
52− (2, LXOr ITNative) partial,
52+ (2, LXOr) partial,
53 Prim (UN "prim__shLInt") (ty [IType, IType] IType) 2 (iBin shiftL)
53 Prim (UN "prim__shLInt") (ty [IType, IType] IType) 2 (iBin shiftL)
54− (2, LSHL ITNative) partial,
54+ (2, LSHL) partial,
55 Prim (UN "prim__shRInt") (ty [IType, IType] IType) 2 (iBin shiftR)
55 Prim (UN "prim__shRInt") (ty [IType, IType] IType) 2 (iBin shiftR)
56− (2, LASHR ITNative) partial,
56+ (2, LSHR) partial,
57 Prim (UN "prim__complInt") (ty [IType] IType) 1 (iUn complement)
57 Prim (UN "prim__complInt") (ty [IType] IType) 1 (iUn complement)
58− (1, LCompl ITNative) partial,
58+ (1, LCompl) partial,
59 Prim (UN "prim__eqInt") (ty [IType, IType] IType) 2 (biBin (==))
59 Prim (UN "prim__eqInt") (ty [IType, IType] IType) 2 (biBin (==))
60− (2, LEq ITNative) total,
60+ (2, LEq) total,
61 Prim (UN "prim__ltInt") (ty [IType, IType] IType) 2 (biBin (<))
61 Prim (UN "prim__ltInt") (ty [IType, IType] IType) 2 (biBin (<))
62− (2, LLt ITNative) total,
62+ (2, LLt) total,
63 Prim (UN "prim__lteInt") (ty [IType, IType] IType) 2 (biBin (<=))
63 Prim (UN "prim__lteInt") (ty [IType, IType] IType) 2 (biBin (<=))
64− (2, LLe ITNative) total,
64+ (2, LLe) total,
65 Prim (UN "prim__gtInt") (ty [IType, IType] IType) 2 (biBin (>))
65 Prim (UN "prim__gtInt") (ty [IType, IType] IType) 2 (biBin (>))
66− (2, LGt ITNative) total,
66+ (2, LGt) total,
67 Prim (UN "prim__gteInt") (ty [IType, IType] IType) 2 (biBin (>=))
67 Prim (UN "prim__gteInt") (ty [IType, IType] IType) 2 (biBin (>=))
68− (2, LGe ITNative) total,
68+ (2, LGe) total,
69 Prim (UN "prim__eqChar") (ty [ChType, ChType] IType) 2 (bcBin (==))
69 Prim (UN "prim__eqChar") (ty [ChType, ChType] IType) 2 (bcBin (==))
70− (2, LEq ITNative) total,
70+ (2, LEq) total,
71 Prim (UN "prim__ltChar") (ty [ChType, ChType] IType) 2 (bcBin (<))
71 Prim (UN "prim__ltChar") (ty [ChType, ChType] IType) 2 (bcBin (<))
72− (2, LLt ITNative) total,
72+ (2, LLt) total,
73 Prim (UN "prim__lteChar") (ty [ChType, ChType] IType) 2 (bcBin (<=))
73 Prim (UN "prim__lteChar") (ty [ChType, ChType] IType) 2 (bcBin (<=))
74− (2, LLe ITNative) total,
74+ (2, LLe) total,
75 Prim (UN "prim__gtChar") (ty [ChType, ChType] IType) 2 (bcBin (>))
75 Prim (UN "prim__gtChar") (ty [ChType, ChType] IType) 2 (bcBin (>))
76− (2, LGt ITNative) total,
76+ (2, LGt) total,
77 Prim (UN "prim__gteChar") (ty [ChType, ChType] IType) 2 (bcBin (>=))
77 Prim (UN "prim__gteChar") (ty [ChType, ChType] IType) 2 (bcBin (>=))
78− (2, LGe ITNative) total,
78+ (2, LGe) total,
80− iCoerce IT8 IT16 "zext" zext LZExt,
80+ Prim (UN "prim__ltB8") (ty [B8Type, B8Type] IType) 2 (b8Cmp (<))
81− iCoerce IT8 IT32 "zext" zext LZExt,
81+ (2, LB8Lt) total,
82− iCoerce IT8 IT64 "zext" zext LZExt,
82+ Prim (UN "prim__lteB8") (ty [B8Type, B8Type] IType) 2 (b8Cmp (<=))
83− iCoerce IT16 IT32 "zext" zext LZExt,
83+ (2, LB8Lte) total,
84− iCoerce IT16 IT64 "zext" zext LZExt,
84+ Prim (UN "prim__eqB8") (ty [B8Type, B8Type] IType) 2 (b8Cmp (==))
85− iCoerce IT32 IT64 "zext" zext LZExt,
85+ (2, LB8Eq) total,
86−
86+ Prim (UN "prim__gteB8") (ty [B8Type, B8Type] IType) 2 (b8Cmp (>))
87− iCoerce IT8 IT16 "sext" sext LSExt,
87+ (2, LB8Gte) total,
88− iCoerce IT8 IT32 "sext" sext LSExt,
88+ Prim (UN "prim__gtB8") (ty [B8Type, B8Type] IType) 2 (b8Cmp (>=))
89− iCoerce IT8 IT64 "sext" sext LSExt,
89+ (2, LB8Gt) total,
90− iCoerce IT16 IT32 "sext" sext LSExt,
90+ Prim (UN "prim__addB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (+))
91− iCoerce IT16 IT64 "sext" sext LSExt,
91+ (2, LB8Plus) total,
92− iCoerce IT32 IT64 "sext" sext LSExt,
92+ Prim (UN "prim__subB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (-))
93−
93+ (2, LB8Minus) total,
94− iCoerce IT16 IT8 "trunc" trunc LTrunc,
94+ Prim (UN "prim__mulB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (*))
95− iCoerce IT32 IT8 "trunc" trunc LTrunc,
95+ (2, LB8Times) total,
96− iCoerce IT64 IT8 "trunc" trunc LTrunc,
96+ Prim (UN "prim__udivB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin div)
97− iCoerce IT32 IT16 "trunc" trunc LTrunc,
97+ (2, LB8UDiv) partial,
98− iCoerce IT64 IT16 "trunc" trunc LTrunc,
98+ Prim (UN "prim__sdivB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin s8div)
99− iCoerce IT64 IT32 "trunc" trunc LTrunc,
99+ (2, LB8SDiv) partial,
100+ Prim (UN "prim__uremB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin rem)
101+ (2, LB8URem) partial,
102+ Prim (UN "prim__sremB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin s8rem)
103+ (2, LB8SRem) partial,
104+ Prim (UN "prim__shlB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (\x y -> shiftL x (fromIntegral y)))
106+ Prim (UN "prim__lshrB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (\x y -> shiftR x (fromIntegral y)))
108+ Prim (UN "prim__ashrB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (\x y -> fromIntegral $
109+ shiftR (fromIntegral x :: Int8)
112+ Prim (UN "prim__andB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (.&.))
114+ Prim (UN "prim__orB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (.|.))
116+ Prim (UN "prim__xorB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin xor)
118+ Prim (UN "prim__complB8") (ty [B8Type] B8Type) 1 (b8Un complement)
119+ (1, LB8Compl) total,
120+ Prim (UN "prim__zextB8_16") (ty [B8Type] B16Type) 1 zext8_16
122+ Prim (UN "prim__zextB8_32") (ty [B8Type] B32Type) 1 zext8_32
124+ Prim (UN "prim__zextB8_64") (ty [B8Type] B64Type) 1 zext8_64
126+ Prim (UN "prim__sextB8_16") (ty [B8Type] B16Type) 1 sext8_16
128+ Prim (UN "prim__sextB8_32") (ty [B8Type] B32Type) 1 sext8_32
130+ Prim (UN "prim__sextB8_64") (ty [B8Type] B64Type) 1 sext8_64
133+ Prim (UN "prim__ltB16") (ty [B16Type, B16Type] IType) 2 (b16Cmp (<))
135+ Prim (UN "prim__lteB16") (ty [B16Type, B16Type] IType) 2 (b16Cmp (<=))
137+ Prim (UN "prim__eqB16") (ty [B16Type, B16Type] IType) 2 (b16Cmp (==))
139+ Prim (UN "prim__gteB16") (ty [B16Type, B16Type] IType) 2 (b16Cmp (>))
141+ Prim (UN "prim__gtB16") (ty [B16Type, B16Type] IType) 2 (b16Cmp (>=))
143+ Prim (UN "prim__addB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin (+))
144+ (2, LB16Plus) total,
145+ Prim (UN "prim__subB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin (-))
146+ (2, LB16Minus) total,
147+ Prim (UN "prim__mulB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin (*))
148+ (2, LB16Times) total,
149+ Prim (UN "prim__udivB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin div)
150+ (2, LB16UDiv) partial,
151+ Prim (UN "prim__sdivB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin s16div)
152+ (2, LB16SDiv) partial,
153+ Prim (UN "prim__uremB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin rem)
154+ (2, LB16URem) partial,
155+ Prim (UN "prim__sremB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin s16rem)
156+ (2, LB16SRem) partial,
157+ Prim (UN "prim__shlB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin (\x y -> shiftL x (fromIntegral y)))
159+ Prim (UN "prim__lshrB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin (\x y -> shiftR x (fromIntegral y)))
160+ (2, LB16AShr) total,
161+ Prim (UN "prim__ashrB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin (\x y -> fromIntegral $
162+ shiftR (fromIntegral x :: Int16)
164+ (2, LB16LShr) total,
165+ Prim (UN "prim__andB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin (.&.))
167+ Prim (UN "prim__orB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin (.|.))
169+ Prim (UN "prim__xorB16") (ty [B16Type, B16Type] B16Type) 2 (b16Bin xor)
171+ Prim (UN "prim__complB16") (ty [B16Type] B16Type) 1 (b16Un complement)
172+ (1, LB16Compl) total,
173+ Prim (UN "prim__zextB16_32") (ty [B16Type] B32Type) 1 zext16_32
175+ Prim (UN "prim__zextB16_64") (ty [B16Type] B64Type) 1 zext16_64
177+ Prim (UN "prim__sextB16_32") (ty [B16Type] B32Type) 1 sext16_32
179+ Prim (UN "prim__sextB16_64") (ty [B16Type] B64Type) 1 sext16_64
181+ Prim (UN "prim__truncB16_8") (ty [B16Type] B8Type) 1 trunc16_8
184+ Prim (UN "prim__ltB32") (ty [B32Type, B32Type] IType) 2 (b32Cmp (<))
186+ Prim (UN "prim__lteB32") (ty [B32Type, B32Type] IType) 2 (b32Cmp (<=))
188+ Prim (UN "prim__eqB32") (ty [B32Type, B32Type] IType) 2 (b32Cmp (==))
190+ Prim (UN "prim__gteB32") (ty [B32Type, B32Type] IType) 2 (b32Cmp (>))
192+ Prim (UN "prim__gtB32") (ty [B32Type, B32Type] IType) 2 (b32Cmp (>=))
194+ Prim (UN "prim__addB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin (+))
195+ (2, LB32Plus) total,
196+ Prim (UN "prim__subB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin (-))
197+ (2, LB32Minus) total,
198+ Prim (UN "prim__mulB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin (*))
199+ (2, LB32Times) total,
200+ Prim (UN "prim__udivB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin div)
201+ (2, LB32UDiv) partial,
202+ Prim (UN "prim__sdivB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin s32div)
203+ (2, LB32SDiv) partial,
204+ Prim (UN "prim__uremB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin rem)
205+ (2, LB32URem) partial,
206+ Prim (UN "prim__sremB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin s32rem)
207+ (2, LB32SRem) partial,
208+ Prim (UN "prim__shlB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin (\x y -> shiftL x (fromIntegral y)))
210+ Prim (UN "prim__lshrB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin (\x y -> shiftR x (fromIntegral y)))
211+ (2, LB32AShr) total,
212+ Prim (UN "prim__ashrB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin (\x y -> fromIntegral $
213+ shiftR (fromIntegral x :: Int32)
215+ (2, LB32LShr) total,
216+ Prim (UN "prim__andB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin (.&.))
218+ Prim (UN "prim__orB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin (.|.))
220+ Prim (UN "prim__xorB32") (ty [B32Type, B32Type] B32Type) 2 (b32Bin xor)
222+ Prim (UN "prim__complB32") (ty [B32Type] B32Type) 1 (b32Un complement)
223+ (1, LB32Compl) total,
224+ Prim (UN "prim__zextB32_64") (ty [B32Type] B64Type) 1 zext32_64
226+ Prim (UN "prim__sextB32_64") (ty [B32Type] B64Type) 1 sext32_64
228+ Prim (UN "prim__truncB32_8") (ty [B32Type] B8Type) 1 trunc32_8
230+ Prim (UN "prim__truncB32_16") (ty [B32Type] B16Type) 1 trunc32_16
233+ Prim (UN "prim__ltB64") (ty [B64Type, B64Type] IType) 2 (b64Cmp (<))
235+ Prim (UN "prim__lteB64") (ty [B64Type, B64Type] IType) 2 (b64Cmp (<=))
237+ Prim (UN "prim__eqB64") (ty [B64Type, B64Type] IType) 2 (b64Cmp (==))
239+ Prim (UN "prim__gteB64") (ty [B64Type, B64Type] IType) 2 (b64Cmp (>))
241+ Prim (UN "prim__gtB64") (ty [B64Type, B64Type] IType) 2 (b64Cmp (>=))
243+ Prim (UN "prim__addB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin (+))
244+ (2, LB64Plus) total,
245+ Prim (UN "prim__subB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin (-))
246+ (2, LB64Minus) total,
247+ Prim (UN "prim__mulB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin (*))
248+ (2, LB64Times) total,
249+ Prim (UN "prim__udivB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin div)
250+ (2, LB64UDiv) partial,
251+ Prim (UN "prim__sdivB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin s64div)
252+ (2, LB64SDiv) partial,
253+ Prim (UN "prim__uremB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin rem)
254+ (2, LB64URem) partial,
255+ Prim (UN "prim__sremB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin s64rem)
256+ (2, LB64SRem) partial,
257+ Prim (UN "prim__shlB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin (\x y -> shiftL x (fromIntegral y)))
259+ Prim (UN "prim__lshrB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin (\x y -> shiftR x (fromIntegral y)))
260+ (2, LB64AShr) total,
261+ Prim (UN "prim__ashrB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin (\x y -> fromIntegral $
262+ shiftR (fromIntegral x :: Int64)
264+ (2, LB64LShr) total,
265+ Prim (UN "prim__andB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin (.&.))
267+ Prim (UN "prim__orB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin (.|.))
269+ Prim (UN "prim__xorB64") (ty [B64Type, B64Type] B64Type) 2 (b64Bin xor)
271+ Prim (UN "prim__complB64") (ty [B64Type] B64Type) 1 (b64Un complement)
272+ (1, LB64Compl) total,
273+ Prim (UN "prim__truncB64_8") (ty [B64Type] B8Type) 1 trunc64_8
275+ Prim (UN "prim__truncB64_16") (ty [B64Type] B16Type) 1 trunc64_16
277+ Prim (UN "prim__truncB64_32") (ty [B64Type] B32Type) 1 trunc64_32
101 Prim (UN "prim__intToB8") (ty [IType] B8Type) 1 intToBits8
280 Prim (UN "prim__intToB8") (ty [IType] B8Type) 1 intToBits8
102 (1, LIntB8) total,
281 (1, LIntB8) total,
@@ -223,36 +402,7 @@ primitives =
223 (0, LStdIn) partial,
402 (0, LStdIn) partial,
224 Prim (UN "prim__believe_me") believeTy 3 (p_believeMe)
403 Prim (UN "prim__believe_me") believeTy 3 (p_believeMe)
225 (3, LNoOp) partial -- ahem
404 (3, LNoOp) partial -- ahem
226− ] ++ concatMap intOps [IT8, IT16, IT32, IT64]
405+ ]
229− [ iCmp ity "lt" (bCmp ity (<)) LLt total
230− , iCmp ity "lte" (bCmp ity (<=)) LLe total
231− , iCmp ity "eq" (bCmp ity (==)) LEq total
232− , iCmp ity "gte" (bCmp ity (>=)) LGe total
233− , iCmp ity "gt" (bCmp ity (>)) LGt total
234− , iBinOp ity "add" (bitBin ity (+)) LPlus total
235− , iBinOp ity "sub" (bitBin ity (-)) LMinus total
236− , iBinOp ity "mul" (bitBin ity (*)) LTimes total
237− , iBinOp ity "udiv" (bitBin ity div) LUDiv partial
238− , iBinOp ity "sdiv" (bsdiv ity) LSDiv partial
239− , iBinOp ity "urem" (bitBin ity rem) LURem partial
240− , iBinOp ity "srem" (bsrem ity) LSRem partial
241− , iBinOp ity "shl" (bitBin ity (\x y -> shiftL x (fromIntegral y))) LSHL total
242− , iBinOp ity "lshr" (bitBin ity (\x y -> shiftR x (fromIntegral y))) LLSHR total
243− , iBinOp ity "ashr" (bashr ity) LASHR total
244− , iBinOp ity "and" (bitBin ity (.&.)) LAnd total
245− , iBinOp ity "or" (bitBin ity (.|.)) LOr total
246− , iBinOp ity "xor" (bitBin ity (xor)) LXOr total
247− , iUnOp ity "compl" (bUn ity complement) LCompl total
250−iCmp ity op impl irop totality = Prim (UN $ "prim__" ++ op ++ "B" ++ show (intTyWidth ity)) (ty (replicate 2 $ intTyToConst ity) IType) 2 impl (2, irop ity) totality
251−iBinOp ity op impl irop totality = Prim (UN $ "prim__" ++ op ++ "B" ++ show (intTyWidth ity)) (ty (replicate 2 $ intTyToConst ity) (intTyToConst ity)) 2 impl (2, irop ity) totality
252−iUnOp ity op impl irop totality = Prim (UN $ "prim__" ++ op ++ "B" ++ show (intTyWidth ity)) (ty [intTyToConst ity] (intTyToConst ity)) 1 impl (1, irop ity) totality
253−iCoerce from to op impl irop =
254− Prim (UN $ "prim__" ++ op ++ "B" ++ show (intTyWidth from) ++ "_" ++ show (intTyWidth to))
255− (ty [intTyToConst from] (intTyToConst to)) 1 (impl from to) (1, irop from to) total
257p_believeMe [_,_,x] = Just x
407p_believeMe [_,_,x] = Just x
258p_believeMe _ = Nothing
408p_believeMe _ = Nothing
@@ -291,96 +441,132 @@ bsBin _ _ = Nothing
291sBin op [VConstant (Str x), VConstant (Str y)] = Just $ VConstant (Str (op x y))
441sBin op [VConstant (Str x), VConstant (Str y)] = Just $ VConstant (Str (op x y))
292sBin _ _ = Nothing
442sBin _ _ = Nothing
294−bsrem IT8 [VConstant (B8 x), VConstant (B8 y)]
444+s8div :: Word8 -> Word8 -> Word8
295− = Just $ VConstant (B8 (fromIntegral (fromIntegral x `rem` fromIntegral y :: Int8)))
296−bsrem IT16 [VConstant (B16 x), VConstant (B16 y)]
297− = Just $ VConstant (B16 (fromIntegral (fromIntegral x `rem` fromIntegral y :: Int16)))
298−bsrem IT32 [VConstant (B32 x), VConstant (B32 y)]
299− = Just $ VConstant (B32 (fromIntegral (fromIntegral x `rem` fromIntegral y :: Int32)))
445+s8div x y = fromIntegral (fromIntegral x `div` fromIntegral y :: Int8)
300−bsrem IT64 [VConstant (B64 x), VConstant (B64 y)]
446+
301− = Just $ VConstant (B64 (fromIntegral (fromIntegral x `rem` fromIntegral y :: Int64)))
447+s16div :: Word16 -> Word16 -> Word16
302−bsrem ITNative [VConstant (I x), VConstant (I y)] = Just $ VConstant (I (x `rem` y))
305−bsdiv IT8 [VConstant (B8 x), VConstant (B8 y)]
306− = Just $ VConstant (B8 (fromIntegral (fromIntegral x `div` fromIntegral y :: Int8)))
307−bsdiv IT16 [VConstant (B16 x), VConstant (B16 y)]
308− = Just $ VConstant (B16 (fromIntegral (fromIntegral x `div` fromIntegral y :: Int16)))
448+s16div x y = fromIntegral (fromIntegral x `div` fromIntegral y :: Int16)
309−bsdiv IT32 [VConstant (B32 x), VConstant (B32 y)]
449+
310− = Just $ VConstant (B32 (fromIntegral (fromIntegral x `div` fromIntegral y :: Int32)))
450+s32div :: Word32 -> Word32 -> Word32
311−bsdiv IT64 [VConstant (B64 x), VConstant (B64 y)]
312− = Just $ VConstant (B64 (fromIntegral (fromIntegral x `div` fromIntegral y :: Int64)))
313−bsdiv ITNative [VConstant (I x), VConstant (I y)] = Just $ VConstant (I (x `div` y))
316−bashr IT8 [VConstant (B8 x), VConstant (B8 y)]
317− = Just $ VConstant (B8 (fromIntegral (fromIntegral x `shiftR` fromIntegral y :: Int8)))
451+s32div x y = fromIntegral (fromIntegral x `div` fromIntegral y :: Int32)
318−bashr IT16 [VConstant (B16 x), VConstant (B16 y)]
452+
453+s64div :: Word64 -> Word64 -> Word64
319− = Just $ VConstant (B16 (fromIntegral (fromIntegral x `shiftR` fromIntegral y :: Int16)))
454+s64div x y = fromIntegral (fromIntegral x `div` fromIntegral y :: Int64)
320−bashr IT32 [VConstant (B32 x), VConstant (B32 y)]
455+
456+s8rem :: Word8 -> Word8 -> Word8
321− = Just $ VConstant (B32 (fromIntegral (fromIntegral x `shiftR` fromIntegral y :: Int32)))
457+s8rem x y = fromIntegral (fromIntegral x `rem` fromIntegral y :: Int8)
322−bashr IT64 [VConstant (B64 x), VConstant (B64 y)]
458+
459+s16rem :: Word16 -> Word16 -> Word16
323− = Just $ VConstant (B64 (fromIntegral (fromIntegral x `shiftR` fromIntegral y :: Int64)))
460+s16rem x y = fromIntegral (fromIntegral x `rem` fromIntegral y :: Int16)
324−bashr ITNative [VConstant (I x), VConstant (I y)] = Just $ VConstant (I (x `shiftR` y))
461+
325−bashr _ _ = Nothing
462+s32rem :: Word32 -> Word32 -> Word32
326−
463+s32rem x y = fromIntegral (fromIntegral x `rem` fromIntegral y :: Int32)
327−bUn :: IntTy -> (forall a. Bits a => a -> a) -> [Value] -> Maybe Value
464+
465+s64rem :: Word64 -> Word64 -> Word64
466+s64rem x y = fromIntegral (fromIntegral x `rem` fromIntegral y :: Int64)
328−bUn IT8 op [VConstant (B8 x)] = Just $ VConstant (B8 (op x))
468+b8Bin op [VConstant (B8 x), VConstant (B8 y)] = Just $ VConstant (B8 (op x y))
329−bUn IT16 op [VConstant (B16 x)] = Just $ VConstant (B16 (op x))
469+b8Bin _ _ = Nothing
330−bUn IT32 op [VConstant (B32 x)] = Just $ VConstant (B32 (op x))
470+
331−bUn IT64 op [VConstant (B64 x)] = Just $ VConstant (B64 (op x))
471+b8Un op [VConstant (B8 x)] = Just $ VConstant (B8 (op x))
332−bUn _ _ _ = Nothing
472+b8Un _ _ = Nothing
334−bitBin :: IntTy -> (forall a. (Bits a, Integral a) => a -> a -> a) -> [Value] -> Maybe Value
474+b16Bin op [VConstant (B16 x), VConstant (B16 y)] = Just $ VConstant (B16 (op x y))
335−bitBin IT8 op [VConstant (B8 x), VConstant (B8 y)] = Just $ VConstant (B8 (op x y))
477+b16Un op [VConstant (B16 x)] = Just $ VConstant (B16 (op x))
336−bitBin IT16 op [VConstant (B16 x), VConstant (B16 y)] = Just $ VConstant (B16 (op x y))
480+b32Bin op [VConstant (B32 x), VConstant (B32 y)] = Just $ VConstant (B32 (op x y))
337−bitBin IT32 op [VConstant (B32 x), VConstant (B32 y)] = Just $ VConstant (B32 (op x y))
483+b32Un op [VConstant (B32 x)] = Just $ VConstant (B32 (op x))
338−bitBin IT64 op [VConstant (B64 x), VConstant (B64 y)] = Just $ VConstant (B64 (op x y))
486+b64Bin op [VConstant (B64 x), VConstant (B64 y)] = Just $ VConstant (B64 (op x y))
339−bitBin _ _ _ = Nothing
487+b64Bin _ _ = Nothing
341−bCmp :: IntTy -> (forall a. Ord a => a -> a -> Bool) -> [Value] -> Maybe Value
489+b64Un op [VConstant (B64 x)] = Just $ VConstant (B64 (op x))
342−bCmp IT8 op [VConstant (B8 x), VConstant (B8 y)] = Just $ VConstant (I (if (op x y) then 1 else 0))
492+b8Cmp op [VConstant (B8 x), VConstant (B8 y)] = Just $ VConstant (I (if (op x y) then 1 else 0))
343−bCmp IT16 op [VConstant (B16 x), VConstant (B16 y)] = Just $ VConstant (I (if (op x y) then 1 else 0))
495+b16Cmp op [VConstant (B16 x), VConstant (B16 y)] = Just $ VConstant (I (if (op x y) then 1 else 0))
344−bCmp IT32 op [VConstant (B32 x), VConstant (B32 y)] = Just $ VConstant (I (if (op x y) then 1 else 0))
498+b32Cmp op [VConstant (B32 x), VConstant (B32 y)] = Just $ VConstant (I (if (op x y) then 1 else 0))
345−bCmp IT64 op [VConstant (B64 x), VConstant (B64 y)] = Just $ VConstant (I (if (op x y) then 1 else 0))
501+b64Cmp op [VConstant (B64 x), VConstant (B64 y)] = Just $ VConstant (I (if (op x y) then 1 else 0))
346−bCmp _ _ _ = Nothing
502+b64Cmp _ _ = Nothing
348−toB IT8 x = VConstant (B8 (fromIntegral x))
504+toB8 x = VConstant (B8 (fromIntegral x))
349−toB IT16 x = VConstant (B16 (fromIntegral x))
505+toB16 x = VConstant (B16 (fromIntegral x))
350−toB IT32 x = VConstant (B32 (fromIntegral x))
506+toB32 x = VConstant (B32 (fromIntegral x))
351−toB IT64 x = VConstant (B64 (fromIntegral x))
507+toB64 x = VConstant (B64 (fromIntegral x))
353−zext IT8 IT16 [VConstant (B8 x)] = Just $ VConstant (B16 (fromIntegral x))
509+zext8_16 [VConstant (B8 x)] = Just $ toB16 x
354−zext IT8 IT32 [VConstant (B8 x)] = Just $ VConstant (B32 (fromIntegral x))
510+zext8_16 _ = Nothing
355−zext IT8 IT64 [VConstant (B8 x)] = Just $ VConstant (B64 (fromIntegral x))
512+zext8_32 [VConstant (B8 x)] = Just $ toB32 x
356−zext IT16 IT32 [VConstant (B16 x)] = Just $ VConstant (B32 (fromIntegral x))
513+zext8_32 _ = Nothing
357−zext IT16 IT64 [VConstant (B16 x)] = Just $ VConstant (B64 (fromIntegral x))
514+
515+zext8_64 [VConstant (B8 x)] = Just $ toB64 x
358−zext IT32 IT64 [VConstant (B32 x)] = Just $ VConstant (B64 (fromIntegral x))
518+sext8_16 [VConstant (B8 x)] = Just $ toB16 (fromIntegral x :: Int8)
359−zext _ _ _ = Nothing
519+sext8_16 _ = Nothing
361−sext IT8 IT16 [VConstant (B8 x)] = Just $ VConstant (B16 (fromIntegral (fromIntegral x :: Int8)))
521+sext8_32 [VConstant (B8 x)] = Just $ toB32 (fromIntegral x :: Int8)
362−sext IT8 IT32 [VConstant (B8 x)] = Just $ VConstant (B32 (fromIntegral (fromIntegral x :: Int8)))
524+sext8_64 [VConstant (B8 x)] = Just $ toB64 (fromIntegral x :: Int8)
363−sext IT8 IT64 [VConstant (B8 x)] = Just $ VConstant (B64 (fromIntegral (fromIntegral x :: Int8)))
525+sext8_64 _ = Nothing
527+zext16_32 [VConstant (B16 x)] = Just $ toB32 x
528+zext16_32 _ = Nothing
530+zext16_64 [VConstant (B16 x)] = Just $ toB64 x
531+zext16_64 _ = Nothing
364−sext IT16 IT32 [VConstant (B16 x)] = Just $ VConstant (B32 (fromIntegral (fromIntegral x :: Int16)))
533+sext16_32 [VConstant (B16 x)] = Just $ toB32 (fromIntegral x :: Int16)
534+sext16_32 _ = Nothing
365−sext IT16 IT64 [VConstant (B16 x)] = Just $ VConstant (B64 (fromIntegral (fromIntegral x :: Int16)))
536+sext16_64 [VConstant (B16 x)] = Just $ toB64 (fromIntegral x :: Int16)
366−sext IT32 IT64 [VConstant (B32 x)] = Just $ VConstant (B64 (fromIntegral (fromIntegral x :: Int32)))
537+sext16_64 _ = Nothing
539+trunc16_8 [VConstant (B16 x)] = Just $ toB8 x
540+trunc16_8 _ = Nothing
542+zext32_64 [VConstant (B32 x)] = Just $ toB64 x
367−sext _ _ _ = Nothing
543+zext32_64 _ = Nothing
369−trunc IT16 IT8 [VConstant (B16 x)] = Just $ VConstant (B8 (fromIntegral x))
545+sext32_64 [VConstant (B32 x)] = Just $ toB64 (fromIntegral x :: Int32)
546+sext32_64 _ = Nothing
370−trunc IT32 IT8 [VConstant (B32 x)] = Just $ VConstant (B8 (fromIntegral x))
548+trunc32_8 [VConstant (B32 x)] = Just $ toB8 x
371−trunc IT64 IT8 [VConstant (B64 x)] = Just $ VConstant (B8 (fromIntegral x))
549+trunc32_8 _ = Nothing
372−trunc IT32 IT16 [VConstant (B32 x)] = Just $ VConstant (B16 (fromIntegral x))
550+
551+trunc32_16 [VConstant (B32 x)] = Just $ toB16 x
552+trunc32_16 _ = Nothing
554+trunc64_8 [VConstant (B64 x)] = Just $ toB8 x
555+trunc64_8 _ = Nothing
373−trunc IT64 IT16 [VConstant (B64 x)] = Just $ VConstant (B16 (fromIntegral x))
557+trunc64_16 [VConstant (B64 x)] = Just $ toB16 x
558+trunc64_16 _ = Nothing
374−trunc IT64 IT32 [VConstant (B64 x)] = Just $ VConstant (B32 (fromIntegral x))
560+trunc64_32 [VConstant (B64 x)] = Just $ toB32 x
375−trunc _ _ _ = Nothing
561+trunc64_32 _ = Nothing
377−intToBits8 [VConstant (I x)] = Just $ toB IT8 x
563+intToBits8 [VConstant (I x)] = Just $ toB8 x
378intToBits8 _ = Nothing
564intToBits8 _ = Nothing
379−intToBits16 [VConstant (I x)] = Just $ toB IT16 x
565+intToBits16 [VConstant (I x)] = Just $ toB16 x
380intToBits16 _ = Nothing
566intToBits16 _ = Nothing
381−intToBits32 [VConstant (I x)] = Just $ toB IT32 x
567+intToBits32 [VConstant (I x)] = Just $ toB32 x
382intToBits32 _ = Nothing
568intToBits32 _ = Nothing
383−intToBits64 [VConstant (I x)] = Just $ toB IT64 x
569+intToBits64 [VConstant (I x)] = Just $ toB64 x
384intToBits64 _ = Nothing
570intToBits64 _ = Nothing
386bits32ToInt [VConstant (B32 x)] = Just $ VConstant (I (fromIntegral x))
572bits32ToInt [VConstant (B32 x)] = Just $ VConstant (I (fromIntegral x))