@@ -35,247 +35,68 @@ 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) total,
38+ (2, LPlus ITNative) 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) total,
40+ (2, LMinus ITNative) 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) total,
42+ (2, LTimes ITNative) 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, LDiv) partial,
44+ (2, LSDiv ITNative) 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, LMod) partial,
46+ (2, LSRem ITNative) 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) partial,
48+ (2, LAnd ITNative) 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) partial,
50+ (2, LOr ITNative) 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) partial,
52+ (2, LXOr ITNative) 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) partial,
54+ (2, LSHL ITNative) 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, LSHR) partial,
56+ (2, LASHR ITNative) 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) partial,
58+ (1, LCompl ITNative) 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) total,
60+ (2, LEq ITNative) 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) total,
62+ (2, LLt ITNative) 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) total,
64+ (2, LLe ITNative) 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) total,
66+ (2, LGt ITNative) 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) total,
68+ (2, LGe ITNative) 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) total,
70+ (2, LEq ITNative) 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) total,
72+ (2, LLt ITNative) 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) total,
74+ (2, LLe ITNative) 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) total,
76+ (2, LGt ITNative) 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) total,
78+ (2, LGe ITNative) total,
80− Prim (UN "prim__ltB8") (ty [B8Type, B8Type] IType) 2 (b8Cmp (<))
80+ iCoerce IT8 IT16 "zext" zext LZExt,
81− (2, LB8Lt) total,
81+ iCoerce IT8 IT32 "zext" zext LZExt,
82− Prim (UN "prim__lteB8") (ty [B8Type, B8Type] IType) 2 (b8Cmp (<=))
82+ iCoerce IT8 IT64 "zext" zext LZExt,
83− (2, LB8Lte) total,
83+ iCoerce IT16 IT32 "zext" zext LZExt,
84− Prim (UN "prim__eqB8") (ty [B8Type, B8Type] IType) 2 (b8Cmp (==))
84+ iCoerce IT16 IT64 "zext" zext LZExt,
85− (2, LB8Eq) total,
85+ iCoerce IT32 IT64 "zext" zext LZExt,
86− Prim (UN "prim__gteB8") (ty [B8Type, B8Type] IType) 2 (b8Cmp (>))
86+
87− (2, LB8Gte) total,
87+ iCoerce IT8 IT16 "sext" sext LSExt,
88− Prim (UN "prim__gtB8") (ty [B8Type, B8Type] IType) 2 (b8Cmp (>=))
88+ iCoerce IT8 IT32 "sext" sext LSExt,
89− (2, LB8Gt) total,
89+ iCoerce IT8 IT64 "sext" sext LSExt,
90− Prim (UN "prim__addB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (+))
90+ iCoerce IT16 IT32 "sext" sext LSExt,
91− (2, LB8Plus) total,
91+ iCoerce IT16 IT64 "sext" sext LSExt,
92− Prim (UN "prim__subB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (-))
92+ iCoerce IT32 IT64 "sext" sext LSExt,
93− (2, LB8Minus) total,
93+
94− Prim (UN "prim__mulB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin (*))
94+ iCoerce IT16 IT8 "trunc" trunc LTrunc,
95− (2, LB8Times) total,
95+ iCoerce IT32 IT8 "trunc" trunc LTrunc,
96− Prim (UN "prim__udivB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin div)
96+ iCoerce IT64 IT8 "trunc" trunc LTrunc,
97− (2, LB8UDiv) partial,
97+ iCoerce IT32 IT16 "trunc" trunc LTrunc,
98− Prim (UN "prim__sdivB8") (ty [B8Type, B8Type] B8Type) 2 (b8Bin s8div)
98+ iCoerce IT64 IT16 "trunc" trunc LTrunc,
99− (2, LB8SDiv) partial,
99+ iCoerce IT64 IT32 "trunc" trunc LTrunc,
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
280 Prim (UN "prim__intToB8") (ty [IType] B8Type) 1 intToBits8
101 Prim (UN "prim__intToB8") (ty [IType] B8Type) 1 intToBits8
281 (1, LIntB8) total,
102 (1, LIntB8) total,
@@ -402,7 +223,36 @@ primitives =
402 (0, LStdIn) partial,
223 (0, LStdIn) partial,
403 Prim (UN "prim__believe_me") believeTy 3 (p_believeMe)
224 Prim (UN "prim__believe_me") believeTy 3 (p_believeMe)
404 (3, LNoOp) partial -- ahem
225 (3, LNoOp) partial -- ahem
405− ]
226+ ] ++ concatMap intOps [IT8, IT16, IT32, IT64]
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
407p_believeMe [_,_,x] = Just x
257p_believeMe [_,_,x] = Just x
408p_believeMe _ = Nothing
258p_believeMe _ = Nothing
@@ -441,132 +291,96 @@ bsBin _ _ = Nothing
441sBin op [VConstant (Str x), VConstant (Str y)] = Just $ VConstant (Str (op x y))
291sBin op [VConstant (Str x), VConstant (Str y)] = Just $ VConstant (Str (op x y))
442sBin _ _ = Nothing
292sBin _ _ = Nothing
444−s8div :: Word8 -> Word8 -> Word8
294+bsrem IT8 [VConstant (B8 x), VConstant (B8 y)]
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)]
445−s8div x y = fromIntegral (fromIntegral x `div` fromIntegral y :: Int8)
299+ = Just $ VConstant (B32 (fromIntegral (fromIntegral x `rem` fromIntegral y :: Int32)))
446−
300+bsrem IT64 [VConstant (B64 x), VConstant (B64 y)]
447−s16div :: Word16 -> Word16 -> Word16
301+ = Just $ VConstant (B64 (fromIntegral (fromIntegral x `rem` fromIntegral y :: Int64)))
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)]
448−s16div x y = fromIntegral (fromIntegral x `div` fromIntegral y :: Int16)
308+ = Just $ VConstant (B16 (fromIntegral (fromIntegral x `div` fromIntegral y :: Int16)))
449−
309+bsdiv IT32 [VConstant (B32 x), VConstant (B32 y)]
450−s32div :: Word32 -> Word32 -> Word32
310+ = Just $ VConstant (B32 (fromIntegral (fromIntegral x `div` fromIntegral y :: Int32)))
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)]
451−s32div x y = fromIntegral (fromIntegral x `div` fromIntegral y :: Int32)
317+ = Just $ VConstant (B8 (fromIntegral (fromIntegral x `shiftR` fromIntegral y :: Int8)))
452−
318+bashr IT16 [VConstant (B16 x), VConstant (B16 y)]
453−s64div :: Word64 -> Word64 -> Word64
454−s64div x y = fromIntegral (fromIntegral x `div` fromIntegral y :: Int64)
319+ = Just $ VConstant (B16 (fromIntegral (fromIntegral x `shiftR` fromIntegral y :: Int16)))
455−
320+bashr IT32 [VConstant (B32 x), VConstant (B32 y)]
456−s8rem :: Word8 -> Word8 -> Word8
457−s8rem x y = fromIntegral (fromIntegral x `rem` fromIntegral y :: Int8)
321+ = Just $ VConstant (B32 (fromIntegral (fromIntegral x `shiftR` fromIntegral y :: Int32)))
458−
322+bashr IT64 [VConstant (B64 x), VConstant (B64 y)]
459−s16rem :: Word16 -> Word16 -> Word16
460−s16rem x y = fromIntegral (fromIntegral x `rem` fromIntegral y :: Int16)
323+ = Just $ VConstant (B64 (fromIntegral (fromIntegral x `shiftR` fromIntegral y :: Int64)))
461−
324+bashr ITNative [VConstant (I x), VConstant (I y)] = Just $ VConstant (I (x `shiftR` y))
462−s32rem :: Word32 -> Word32 -> Word32
325+bashr _ _ = Nothing
463−s32rem x y = fromIntegral (fromIntegral x `rem` fromIntegral y :: Int32)
326+
464−
327+bUn :: IntTy -> (forall a. Bits a => a -> a) -> [Value] -> Maybe Value
465−s64rem :: Word64 -> Word64 -> Word64
328+bUn IT8 op [VConstant (B8 x)] = Just $ VConstant (B8 (op x))
466−s64rem x y = fromIntegral (fromIntegral x `rem` fromIntegral y :: Int64)
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))
471−b8Un op [VConstant (B8 x)] = Just $ VConstant (B8 (op x))
331+bUn IT64 op [VConstant (B64 x)] = Just $ VConstant (B64 (op x))
472−b8Un _ _ = Nothing
332+bUn _ _ _ = Nothing
474−b16Bin op [VConstant (B16 x), VConstant (B16 y)] = Just $ VConstant (B16 (op x y))
334+bitBin :: IntTy -> (forall a. (Bits a, Integral a) => a -> a -> a) -> [Value] -> Maybe Value
477−b16Un op [VConstant (B16 x)] = Just $ VConstant (B16 (op x))
335+bitBin IT8 op [VConstant (B8 x), VConstant (B8 y)] = Just $ VConstant (B8 (op x y))
480−b32Bin op [VConstant (B32 x), VConstant (B32 y)] = Just $ VConstant (B32 (op x y))
336+bitBin IT16 op [VConstant (B16 x), VConstant (B16 y)] = Just $ VConstant (B16 (op x y))
483−b32Un op [VConstant (B32 x)] = Just $ VConstant (B32 (op x))
337+bitBin IT32 op [VConstant (B32 x), VConstant (B32 y)] = Just $ VConstant (B32 (op x y))
486−b64Bin op [VConstant (B64 x), VConstant (B64 y)] = Just $ VConstant (B64 (op x y))
338+bitBin IT64 op [VConstant (B64 x), VConstant (B64 y)] = Just $ VConstant (B64 (op x y))
487−b64Bin _ _ = Nothing
339+bitBin _ _ _ = Nothing
489−b64Un op [VConstant (B64 x)] = Just $ VConstant (B64 (op x))
341+bCmp :: IntTy -> (forall a. Ord a => a -> a -> Bool) -> [Value] -> Maybe Value
492−b8Cmp op [VConstant (B8 x), VConstant (B8 y)] = Just $ VConstant (I (if (op x y) then 1 else 0))
342+bCmp IT8 op [VConstant (B8 x), VConstant (B8 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))
343+bCmp IT16 op [VConstant (B16 x), VConstant (B16 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))
344+bCmp IT32 op [VConstant (B32 x), VConstant (B32 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))
345+bCmp IT64 op [VConstant (B64 x), VConstant (B64 y)] = Just $ VConstant (I (if (op x y) then 1 else 0))
502−b64Cmp _ _ = Nothing
346+bCmp _ _ _ = Nothing
504−toB8 x = VConstant (B8 (fromIntegral x))
348+toB IT8 x = VConstant (B8 (fromIntegral x))
505−toB16 x = VConstant (B16 (fromIntegral x))
349+toB IT16 x = VConstant (B16 (fromIntegral x))
506−toB32 x = VConstant (B32 (fromIntegral x))
350+toB IT32 x = VConstant (B32 (fromIntegral x))
507−toB64 x = VConstant (B64 (fromIntegral x))
351+toB IT64 x = VConstant (B64 (fromIntegral x))
509−zext8_16 [VConstant (B8 x)] = Just $ toB16 x
353+zext IT8 IT16 [VConstant (B8 x)] = Just $ VConstant (B16 (fromIntegral x))
510−zext8_16 _ = Nothing
354+zext IT8 IT32 [VConstant (B8 x)] = Just $ VConstant (B32 (fromIntegral x))
512−zext8_32 [VConstant (B8 x)] = Just $ toB32 x
355+zext IT8 IT64 [VConstant (B8 x)] = Just $ VConstant (B64 (fromIntegral x))
513−zext8_32 _ = Nothing
356+zext IT16 IT32 [VConstant (B16 x)] = Just $ VConstant (B32 (fromIntegral x))
514−
357+zext IT16 IT64 [VConstant (B16 x)] = Just $ VConstant (B64 (fromIntegral x))
515−zext8_64 [VConstant (B8 x)] = Just $ toB64 x
518−sext8_16 [VConstant (B8 x)] = Just $ toB16 (fromIntegral x :: Int8)
358+zext IT32 IT64 [VConstant (B32 x)] = Just $ VConstant (B64 (fromIntegral x))
519−sext8_16 _ = Nothing
359+zext _ _ _ = Nothing
521−sext8_32 [VConstant (B8 x)] = Just $ toB32 (fromIntegral x :: Int8)
361+sext IT8 IT16 [VConstant (B8 x)] = Just $ VConstant (B16 (fromIntegral (fromIntegral x :: Int8)))
524−sext8_64 [VConstant (B8 x)] = Just $ toB64 (fromIntegral x :: Int8)
362+sext IT8 IT32 [VConstant (B8 x)] = Just $ VConstant (B32 (fromIntegral (fromIntegral x :: Int8)))
525−sext8_64 _ = Nothing
363+sext IT8 IT64 [VConstant (B8 x)] = Just $ VConstant (B64 (fromIntegral (fromIntegral x :: Int8)))
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
533−sext16_32 [VConstant (B16 x)] = Just $ toB32 (fromIntegral x :: Int16)
364+sext IT16 IT32 [VConstant (B16 x)] = Just $ VConstant (B32 (fromIntegral (fromIntegral x :: Int16)))
534−sext16_32 _ = Nothing
536−sext16_64 [VConstant (B16 x)] = Just $ toB64 (fromIntegral x :: Int16)
365+sext IT16 IT64 [VConstant (B16 x)] = Just $ VConstant (B64 (fromIntegral (fromIntegral x :: Int16)))
537−sext16_64 _ = Nothing
366+sext IT32 IT64 [VConstant (B32 x)] = Just $ VConstant (B64 (fromIntegral (fromIntegral x :: Int32)))
539−trunc16_8 [VConstant (B16 x)] = Just $ toB8 x
540−trunc16_8 _ = Nothing
542−zext32_64 [VConstant (B32 x)] = Just $ toB64 x
543−zext32_64 _ = Nothing
367+sext _ _ _ = Nothing
545−sext32_64 [VConstant (B32 x)] = Just $ toB64 (fromIntegral x :: Int32)
369+trunc IT16 IT8 [VConstant (B16 x)] = Just $ VConstant (B8 (fromIntegral x))
546−sext32_64 _ = Nothing
548−trunc32_8 [VConstant (B32 x)] = Just $ toB8 x
370+trunc IT32 IT8 [VConstant (B32 x)] = Just $ VConstant (B8 (fromIntegral x))
549−trunc32_8 _ = Nothing
371+trunc IT64 IT8 [VConstant (B64 x)] = Just $ VConstant (B8 (fromIntegral x))
550−
372+trunc IT32 IT16 [VConstant (B32 x)] = Just $ VConstant (B16 (fromIntegral x))
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
557−trunc64_16 [VConstant (B64 x)] = Just $ toB16 x
373+trunc IT64 IT16 [VConstant (B64 x)] = Just $ VConstant (B16 (fromIntegral x))
558−trunc64_16 _ = Nothing
560−trunc64_32 [VConstant (B64 x)] = Just $ toB32 x
374+trunc IT64 IT32 [VConstant (B64 x)] = Just $ VConstant (B32 (fromIntegral x))
561−trunc64_32 _ = Nothing
375+trunc _ _ _ = Nothing
563−intToBits8 [VConstant (I x)] = Just $ toB8 x
377+intToBits8 [VConstant (I x)] = Just $ toB IT8 x
564intToBits8 _ = Nothing
378intToBits8 _ = Nothing
565−intToBits16 [VConstant (I x)] = Just $ toB16 x
379+intToBits16 [VConstant (I x)] = Just $ toB IT16 x
566intToBits16 _ = Nothing
380intToBits16 _ = Nothing
567−intToBits32 [VConstant (I x)] = Just $ toB32 x
381+intToBits32 [VConstant (I x)] = Just $ toB IT32 x
568intToBits32 _ = Nothing
382intToBits32 _ = Nothing
569−intToBits64 [VConstant (I x)] = Just $ toB64 x
383+intToBits64 [VConstant (I x)] = Just $ toB IT64 x
570intToBits64 _ = Nothing
384intToBits64 _ = Nothing
572bits32ToInt [VConstant (B32 x)] = Just $ VConstant (I (fromIntegral x))
386bits32ToInt [VConstant (B32 x)] = Just $ VConstant (I (fromIntegral x))