diff options
author | Richard Henderson <rth@twiddle.net> | 2010-01-12 19:59:33 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-01-12 19:59:33 +0000 |
commit | 583d121520a81d07bacee7ebe9366d107c8b18b6 (patch) | |
tree | edaa4e9824a7b3e99886da07c3fe1a6bb0c61b25 /tcg/sparc/tcg-target.h | |
parent | 5e143c43a686d5563b3a8c9d46b338967cc8d09c (diff) |
tcg-sparc: Implement division properly.
The {div,divu}2 opcodes are intended for systems for which the
division instruction produces both quotient and remainder. Sparc
is not such a system. Indeed, the remainder must be computed as
quot = a / b
rem = a - (quot * b)
Split out a tcg_out_div32 function that properly initializes Y
with the extension of the input to 64-bits. Discard the code
that used the 64-bit DIVX on sparc9/sparcv8plus without extending
the inputs to 64-bits. Implement remainders in terms of division
followed by multiplication.
Signed-off-by: Richard Henderson <rth@twiddle.net>
[blauwirbel@gmail.com: applied rth's typo fix in tcg_out_div32]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'tcg/sparc/tcg-target.h')
-rw-r--r-- | tcg/sparc/tcg-target.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h index e8f8f65ee1..e00707b273 100644 --- a/tcg/sparc/tcg-target.h +++ b/tcg/sparc/tcg-target.h @@ -88,6 +88,9 @@ enum { #endif /* optional instructions */ +#define TCG_TARGET_HAS_div_i32 +#define TCG_TARGET_HAS_div_i64 + //#define TCG_TARGET_HAS_bswap32_i32 //#define TCG_TARGET_HAS_bswap64_i64 //#define TCG_TARGET_HAS_neg_i32 |