@@ -252,6 +252,9 @@ bitOp v op ty args = v ++ "idris_b" ++ show (intTyWidth ty) ++ op ++ "(vm, " ++
252bitCoerce v op input output arg
252bitCoerce v op input output arg
253 = v ++ "idris_b" ++ show (intTyWidth input) ++ op ++ show (intTyWidth output) ++ "(vm, " ++ creg arg ++ ")"
253 = v ++ "idris_b" ++ show (intTyWidth input) ++ op ++ show (intTyWidth output) ++ "(vm, " ++ creg arg ++ ")"
255+signedTy :: IntTy -> String
256+signedTy t = "int" ++ show (intTyWidth t) ++ "_t"
255doOp v (LPlus ITNative) [l, r] = v ++ "ADD(" ++ creg l ++ ", " ++ creg r ++ ")"
258doOp v (LPlus ITNative) [l, r] = v ++ "ADD(" ++ creg l ++ ", " ++ creg r ++ ")"
256doOp v (LMinus ITNative) [l, r] = v ++ "INTOP(-," ++ creg l ++ ", " ++ creg r ++ ")"
259doOp v (LMinus ITNative) [l, r] = v ++ "INTOP(-," ++ creg l ++ ", " ++ creg r ++ ")"
257doOp v (LTimes ITNative) [l, r] = v ++ "MULT(" ++ creg l ++ ", " ++ creg r ++ ")"
260doOp v (LTimes ITNative) [l, r] = v ++ "MULT(" ++ creg l ++ ", " ++ creg r ++ ")"
@@ -335,14 +338,19 @@ doOp v (LSDiv ty) [x, y] = bitOp v "SDiv" ty [x, y]
335doOp v (LURem ty) [x, y] = bitOp v "URem" ty [x, y]
338doOp v (LURem ty) [x, y] = bitOp v "URem" ty [x, y]
336doOp v (LSRem ty) [x, y] = bitOp v "SRem" ty [x, y]
339doOp v (LSRem ty) [x, y] = bitOp v "SRem" ty [x, y]
341+doOp v (LSExt from ITBig) [x] = v ++ "MKBIGSI(vm, (" ++ signedTy from ++ ")" ++ creg x ++ "->info.bits" ++ show (intTyWidth from) ++ ")"
342+doOp v (LSExt ITNative to) [x] = v ++ "idris_b" ++ show (intTyWidth to) ++ "const(vm, GETINT(" ++ creg x ++ "))"
343+doOp v (LSExt from ITNative) [x] = v ++ "MKINT((i_int)((" ++ signedTy from ++ ")" ++ creg x ++ "->info.bits" ++ show (intTyWidth from) ++ "))"
338doOp v (LSExt from to) [x]
344doOp v (LSExt from to) [x]
339 | intTyWidth from < intTyWidth to = bitCoerce v "S" from to x
345 | intTyWidth from < intTyWidth to = bitCoerce v "S" from to x
340−doOp v (LZExt ITNative to) [x] = v ++ "idris_b" ++ show (intTyWidth to) ++ "(vm, " ++ creg x ++ ")"
346+doOp v (LZExt ITNative to) [x] = v ++ "idris_b" ++ show (intTyWidth to) ++ "const(vm, (uintptr_t)GETINT(" ++ creg x ++ ")"
341−doOp v (LZExt IT32 ITNative) [x] = v ++ "idris_castB32Int(vm, " ++ creg x ++ ")"
347+doOp v (LZExt from ITNative) [x] = v ++ "MKINT((i_int)" ++ creg x ++ "->info.bits" ++ show (intTyWidth from) ++ ")"
348+doOp v (LZExt from ITBig) [x] = v ++ "MKBIGUI(vm, " ++ creg x ++ "->info.bits" ++ show (intTyWidth from) ++ ")"
342doOp v (LZExt from to) [x]
349doOp v (LZExt from to) [x]
343 | intTyWidth from < intTyWidth to = bitCoerce v "Z" from to x
350 | intTyWidth from < intTyWidth to = bitCoerce v "Z" from to x
344−doOp v (LTrunc ITNative to) [x] = v ++ "idris_b" ++ show (intTyWidth to) ++ "(vm, " ++ creg x ++ ")"
351+doOp v (LTrunc ITNative to) [x] = v ++ "idris_b" ++ show (intTyWidth to) ++ "const(vm, GETINT(" ++ creg x ++ "))"
345−doOp v (LTrunc IT32 ITNative) [x] = v ++ "idris_castB32Int(vm, " ++ creg x ++ ")"
352+doOp v (LTrunc from ITNative) [x] = v ++ "MKINT((i_int)" ++ creg x ++ "->info.bits" ++ show (intTyWidth from) ++ ")"
353+doOp v (LTrunc ITBig to) [x] = v ++ "idris_b" ++ show (intTyWidth to) ++ "const(vm, mpz_get_ui(GETMPZ(" ++ creg x ++ "))"
346doOp v (LTrunc from to) [x]
354doOp v (LTrunc from to) [x]
347 | intTyWidth from > intTyWidth to = bitCoerce v "T" from to x
355 | intTyWidth from > intTyWidth to = bitCoerce v "T" from to x