on master help sign in
Merge pull request #387 from Ralith/restored-itnative-codegen

Restored missing Int to Integer conversion codegens

commit5606f7fde62a0bdd3262aa828c05a413d15bcd4c authorEdwin Brady <edwin.brady@gmail.com> dateThu 11 Jul 2013, 13:03 (13 years ago) parent8e0f138a098c2a
2 files changed+16
src/IRTS/CodegenC.hs+2 src/IRTS/CodegenLLVM.hs+14
src/IRTS/CodegenC.hs+2
@@ -384,6 +384,8 @@ doOp v (LZExt (ITFixed from) ITChar) [x]
384384 = doOp v (LZExt (ITFixed from) ITNative) [x]
385385doOp v (LZExt (ITFixed from) ITBig) [x]
386386 = v ++ "MKBIGUI(vm, " ++ creg x ++ "->info.bits" ++ show (nativeTyWidth from) ++ ")"
387+doOp v (LZExt ITNative ITBig) [x]
388+ = v ++ "MKBIGUI(vm, (uintptr_t)GETINT(" ++ creg x ++ "))"
387389doOp v (LZExt (ITFixed from) (ITFixed to)) [x]
388390 | nativeTyWidth from < nativeTyWidth to = bitCoerce v "Z" from to x
389391doOp v (LTrunc ITNative (ITFixed to)) [x]
src/IRTS/CodegenLLVM.hs+14
@@ -857,6 +857,20 @@ cgOp (LOr ITBig) [x,y] = mpzBin "ior" x y
857857cgOp (LXOr ITBig) [x,y] = mpzBin "xor" x y
858858cgOp (LCompl ITBig) [x] = mpzUn "com" x
859859
860+cgOp (LTrunc ITNative (ITFixed to)) [x]
861+ | 32 >= nativeTyWidth to = iCoerce Trunc IT32 to x
862+cgOp (LZExt ITNative (ITFixed to)) [x]
863+ | 32 <= nativeTyWidth to = iCoerce ZExt IT32 to x
864+cgOp (LSExt ITNative (ITFixed to)) [x]
865+ | 32 <= nativeTyWidth to = iCoerce SExt IT32 to x
866+
867+cgOp (LTrunc (ITFixed from) ITNative) [x]
868+ | nativeTyWidth from >= 32 = iCoerce Trunc from IT32 x
869+cgOp (LZExt (ITFixed from) ITNative) [x]
870+ | nativeTyWidth from <= 32 = iCoerce ZExt from IT32 x
871+cgOp (LSExt (ITFixed from) ITNative) [x]
872+ | nativeTyWidth from <= 32 = iCoerce SExt from IT32 x
873+
860874cgOp (LTrunc (ITFixed from) (ITFixed to)) [x]
861875 | nativeTyWidth from > nativeTyWidth to = iCoerce Trunc from to x
862876cgOp (LZExt (ITFixed from) (ITFixed to)) [x]