aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Math_Ext.jai14
1 files changed, 7 insertions, 7 deletions
diff --git a/Math_Ext.jai b/Math_Ext.jai
index c3111d8..c4f5c47 100644
--- a/Math_Ext.jai
+++ b/Math_Ext.jai
@@ -6,10 +6,10 @@
// TODO Comparing implementaitons using dump
-#run test_math_ext();
+// #run test_math_ext();
-test_math_ext :: () { set_build_options_dc(.{do_output=false});
-// main :: () {
+// test_math_ext :: () { set_build_options_dc(.{do_output=false});
+main :: () {
write_strings("=====================\n", "--- Test Math_Ext ---\n");
@@ -545,7 +545,7 @@ div :: (x: $Tx, y: $Ty) -> result: $Tr, remainder: Tr, saturated: bool #modify {
mov result, x;
cmovz result, limit; // If ZF: limit dividend to MIN-1.
setz saturated;
- cqo remainder, result; // Prepare dividend high bits.
+ SIGN_EXT remainder, result; // Prepare dividend high bits.
idiv.SIZE remainder, result, y;
// If saturated: remainder = 0 - 1; otherwise: remainder = x - 0.
@@ -583,11 +583,11 @@ div :: (x: $Tx, y: $Ty) -> result: $Tr, remainder: Tr, saturated: bool #modify {
#if Tr == s8
#insert #run replace(replace(replace(S_DIV_ASM_8BITS, ".SIZE", ".b"), "MIN", "-128"), "LIMIT", "-127");
#if Tr == s16
- #insert #run replace(replace(replace(S_DIV_ASM, ".SIZE", ".w"), "MIN", "-32768"), "LIMIT", "-32767");
+ #insert #run replace(replace(replace(replace(S_DIV_ASM, ".SIZE", ".w"), "MIN", "-32768"), "LIMIT", "-32767"), "SIGN_EXT", "cwd");
#if Tr == s32
- #insert #run replace(replace(replace(S_DIV_ASM, ".SIZE", ".d"), "MIN", "-2147483648"), "LIMIT", "-2147483647");
+ #insert #run replace(replace(replace(replace(S_DIV_ASM, ".SIZE", ".d"), "MIN", "-2147483648"), "LIMIT", "-2147483647"), "SIGN_EXT", "cdq");
#if Tr == s64
- #insert #run replace(replace(replace(S_DIV_ASM, ".SIZE", ".q"), "MIN", "-9223372036854775808"), "LIMIT", "-9223372036854775807");
+ #insert #run replace(replace(replace(replace(S_DIV_ASM, ".SIZE", ".q"), "MIN", "-9223372036854775808"), "LIMIT", "-9223372036854775807"), "SIGN_EXT", "cqo");
U_DIV_ASM :: #string DONE