Commit a6a6f55e authored by Matthias Braun's avatar Matthias Braun
Browse files

rename mod_honor_signed_zeros() -> mode_has_signed_zero() and fix it

parent e7c5ccf2
......@@ -359,10 +359,11 @@ FIRM_API ir_mode *find_signed_mode(const ir_mode *mode);
FIRM_API ir_mode *find_double_bits_int_mode(const ir_mode *mode);
/**
* Returns non-zero if the given mode honors signed zero's, i.e.,
* a +0 and a -0 exists and handled differently.
* Returns non-zero if the given mode has negative zeros, i.e. +0 and -0 exist.
* Note that for comparisons +0 and -0 are considered equal, the sign only
* shows in expressions like 1/x which results in +inf/-inf.
*/
FIRM_API int mode_honor_signed_zeros(const ir_mode *mode);
FIRM_API int mode_has_signed_zero(const ir_mode *mode);
/**
* Returns non-zero if the given mode might overflow on unary Minus.
......
......@@ -620,14 +620,17 @@ ir_mode *find_double_bits_int_mode(const ir_mode *mode)
return find_mode(&n);
}
int mode_honor_signed_zeros(const ir_mode *mode)
{
/* for floating point, we know that IEEE 754 has +0 and -0,
* but always handles it identical.
*/
return
mode->sort == irms_float_number &&
mode->arithmetic != irma_ieee754;
int mode_has_signed_zero(const ir_mode *mode)
{
switch (mode->arithmetic) {
case irma_ieee754:
case irma_x86_extended_float:
return 1;
case irma_none:
case irma_twos_complement:
return 0;
}
panic("invalid mode arithmetic");
}
int mode_overflow_on_unary_Minus(const ir_mode *mode)
......
......@@ -1258,7 +1258,7 @@ static ir_node *equivalent_node_Mux(ir_node *n)
DBG_OPT_ALGSIM0(oldn, n, FS_OPT_MUX_EQ);
return n;
}
if (is_Cmp(sel) && !mode_honor_signed_zeros(get_irn_mode(n))) {
if (is_Cmp(sel) && !mode_has_signed_zero(get_irn_mode(n))) {
ir_relation relation = get_Cmp_relation(sel);
ir_node *f = get_Mux_false(n);
ir_node *t = get_Mux_true(n);
......@@ -5412,7 +5412,7 @@ int ir_mux_is_abs(const ir_node *sel, const ir_node *mux_false,
* transformations.
*/
mode = get_irn_mode(mux_true);
if (mode_honor_signed_zeros(mode))
if (mode_has_signed_zero(mode))
return 0;
/* must be <, <=, >=, > */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment