From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6097] target-ppc: use float_flag_divbyzero instead of checking the operands
Date: Thu, 18 Dec 2008 22:44:21 +0000 [thread overview]
Message-ID: <E1LDRbR-0002V2-Ln@cvs.savannah.gnu.org> (raw)
Revision: 6097
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6097
Author: aurel32
Date: 2008-12-18 22:44:21 +0000 (Thu, 18 Dec 2008)
Log Message:
-----------
target-ppc: use float_flag_divbyzero instead of checking the operands
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Modified Paths:
--------------
trunk/target-ppc/op_helper.c
Modified: trunk/target-ppc/op_helper.c
===================================================================
--- trunk/target-ppc/op_helper.c 2008-12-18 22:44:13 UTC (rev 6096)
+++ trunk/target-ppc/op_helper.c 2008-12-18 22:44:21 UTC (rev 6097)
@@ -697,7 +697,7 @@
return ret;
}
-static always_inline uint64_t float_zero_divide_excp (uint64_t arg1, uint64_t arg2)
+static always_inline void float_zero_divide_excp (void)
{
env->fpscr |= 1 << FPSCR_ZX;
env->fpscr &= ~((1 << FPSCR_FR) | (1 << FPSCR_FI));
@@ -710,12 +710,7 @@
helper_raise_exception_err(POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_FP | POWERPC_EXCP_FP_ZX);
}
- } else {
- /* Set the result to infinity */
- arg1 = ((arg1 ^ arg2) & 0x8000000000000000ULL);
- arg1 |= 0x7FFULL << 52;
}
- return arg1;
}
static always_inline void float_overflow_excp (void)
@@ -969,7 +964,9 @@
helper_raise_exception_err(env->exception_index, env->error_code);
} else {
int status = get_float_exception_flags(&env->fp_status);
- if (status & float_flag_overflow) {
+ if (status & float_flag_divbyzero) {
+ float_zero_divide_excp();
+ } else if (status & float_flag_overflow) {
float_overflow_excp();
} else if (status & float_flag_underflow) {
float_underflow_excp();
@@ -1086,14 +1083,9 @@
} else if (unlikely(float64_is_infinity(farg1.d) && float64_is_infinity(farg2.d))) {
/* Division of infinity by infinity */
farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXIDI);
- } else if (unlikely(!float64_is_nan(farg1.d) && float64_is_zero(farg2.d))) {
- if (float64_is_zero(farg1.d)) {
- /* Division of zero by zero */
- farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXZDZ);
- } else {
- /* Division by zero */
- farg1.ll = float_zero_divide_excp(farg1.d, farg2.d);
- }
+ } else if (unlikely(float64_is_zero(farg1.d) && float64_is_zero(farg2.d))) {
+ /* Division of zero by zero */
+ farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXZDZ);
} else {
farg1.d = float64_div(farg1.d, farg2.d, &env->fp_status);
}
@@ -1513,9 +1505,6 @@
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN reciprocal */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
- } else if (unlikely(float64_is_zero(farg.d))) {
- /* Zero reciprocal */
- farg.ll = float_zero_divide_excp(fone.d, farg.d);
} else {
farg.d = float64_div(fone.d, farg.d, &env->fp_status);
}
@@ -1533,9 +1522,6 @@
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN reciprocal */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
- } else if (unlikely(float64_is_zero(farg.d))) {
- /* Zero reciprocal */
- farg.ll = float_zero_divide_excp(fone.d, farg.d);
} else {
farg.d = float64_div(fone.d, farg.d, &env->fp_status);
f32 = float64_to_float32(farg.d, &env->fp_status);
reply other threads:[~2008-12-18 22:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1LDRbR-0002V2-Ln@cvs.savannah.gnu.org \
--to=aurelien@aurel32.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).