diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vm_ppc.dasc | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc index 4eef1eab..d7809f1f 100644 --- a/src/vm_ppc.dasc +++ b/src/vm_ppc.dasc | |||
@@ -75,6 +75,29 @@ | |||
75 | |.endif | 75 | |.endif |
76 | |.endmacro | 76 | |.endmacro |
77 | | | 77 | | |
78 | |.macro clrso, reg | ||
79 | |.if PPE | ||
80 | | li reg, 0 | ||
81 | | mtxer reg | ||
82 | |.else | ||
83 | | mcrxr cr0 | ||
84 | |.endif | ||
85 | |.endmacro | ||
86 | | | ||
87 | |.macro checkov, reg, noov | ||
88 | |.if PPE | ||
89 | | mfxer reg | ||
90 | | add reg, reg, reg | ||
91 | | cmpwi reg, 0 | ||
92 | | li reg, 0 | ||
93 | | mtxer reg | ||
94 | | bgey noov | ||
95 | |.else | ||
96 | | mcrxr cr0 | ||
97 | | bley noov | ||
98 | |.endif | ||
99 | |.endmacro | ||
100 | | | ||
78 | |//----------------------------------------------------------------------- | 101 | |//----------------------------------------------------------------------- |
79 | | | 102 | | |
80 | |// Fixed register assignments for the interpreter. | 103 | |// Fixed register assignments for the interpreter. |
@@ -2590,7 +2613,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2590 | | stw CARG2, DISPATCH_GL(vmstate)(DISPATCH) | 2613 | | stw CARG2, DISPATCH_GL(vmstate)(DISPATCH) |
2591 | | savex_ 0,1,2,3 | 2614 | | savex_ 0,1,2,3 |
2592 | | stw CARG1, 0(sp) // Store extended stack chain. | 2615 | | stw CARG1, 0(sp) // Store extended stack chain. |
2593 | | mcrxr cr0 // Clear SO flag. | 2616 | | clrso TMP1 |
2594 | | savex_ 4,5,6,7 | 2617 | | savex_ 4,5,6,7 |
2595 | | addi CARG2, sp, 16+32*8+32*4 // Recompute original value of sp. | 2618 | | addi CARG2, sp, 16+32*8+32*4 // Recompute original value of sp. |
2596 | | savex_ 8,9,10,11 | 2619 | | savex_ 8,9,10,11 |
@@ -2724,7 +2747,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2724 | | cmpwi CARG2, 0 | 2747 | | cmpwi CARG2, 0 |
2725 | | li CARG1, 0 | 2748 | | li CARG1, 0 |
2726 | | beqlr | 2749 | | beqlr |
2727 | | mcrxr cr0 // Clear SO for -2147483648 % -1 and return 0. | 2750 | | clrso TMP0 // Clear SO for -2147483648 % -1 and return 0. |
2728 | | blr | 2751 | | blr |
2729 | | | 2752 | | |
2730 | |//----------------------------------------------------------------------- | 2753 | |//----------------------------------------------------------------------- |
@@ -3350,7 +3373,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3350 | |4: | 3373 | |4: |
3351 | |.if not GPR64 | 3374 | |.if not GPR64 |
3352 | | // Potential overflow. | 3375 | | // Potential overflow. |
3353 | | mcrxr cr0; bley <1 // Ignore unrelated overflow. | 3376 | | checkov TMP1, <1 // Ignore unrelated overflow. |
3354 | |.endif | 3377 | |.endif |
3355 | | lus TMP1, 0x41e0 // 2^31. | 3378 | | lus TMP1, 0x41e0 // 2^31. |
3356 | | li TMP0, 0 | 3379 | | li TMP0, 0 |
@@ -3535,7 +3558,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3535 | |2: | 3558 | |2: |
3536 | | ins_next2 | 3559 | | ins_next2 |
3537 | |4: // Overflow. | 3560 | |4: // Overflow. |
3538 | | mcrxr cr0; bley <1 // Ignore unrelated overflow. | 3561 | | checkov TMP0, <1 // Ignore unrelated overflow. |
3539 | | ins_arithfallback b | 3562 | | ins_arithfallback b |
3540 | |5: // FP variant. | 3563 | |5: // FP variant. |
3541 | ||if (vk == 1) { | 3564 | ||if (vk == 1) { |
@@ -4790,7 +4813,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
4790 | | b <1 | 4813 | | b <1 |
4791 | if (vk) { | 4814 | if (vk) { |
4792 | |6: // Potential overflow. | 4815 | |6: // Potential overflow. |
4793 | | mcrxr cr0; bley <4 // Ignore unrelated overflow. | 4816 | | checkov TMP0, <4 // Ignore unrelated overflow. |
4794 | | b <2 | 4817 | | b <2 |
4795 | } | 4818 | } |
4796 | |.endif | 4819 | |.endif |
@@ -4930,7 +4953,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
4930 | | // Traces on PPC don't store the trace number, so use 0. | 4953 | | // Traces on PPC don't store the trace number, so use 0. |
4931 | | stw ZERO, DISPATCH_GL(vmstate)(DISPATCH) | 4954 | | stw ZERO, DISPATCH_GL(vmstate)(DISPATCH) |
4932 | | lwzx TRACE:TMP2, TMP1, RD | 4955 | | lwzx TRACE:TMP2, TMP1, RD |
4933 | | mcrxr cr0 // Clear SO flag. | 4956 | | clrso TMP1 |
4934 | | lp TMP2, TRACE:TMP2->mcode | 4957 | | lp TMP2, TRACE:TMP2->mcode |
4935 | | stw BASE, DISPATCH_GL(jit_base)(DISPATCH) | 4958 | | stw BASE, DISPATCH_GL(jit_base)(DISPATCH) |
4936 | | mtctr TMP2 | 4959 | | mtctr TMP2 |