Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
a6a6f55e
Commit
a6a6f55e
authored
Jun 12, 2013
by
Matthias Braun
Browse files
rename mod_honor_signed_zeros() -> mode_has_signed_zero() and fix it
parent
e7c5ccf2
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/libfirm/irmode.h
View file @
a6a6f55e
...
...
@@ -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_h
onor
_signed_zero
s
(
const
ir_mode
*
mode
);
FIRM_API
int
mode_h
as
_signed_zero
(
const
ir_mode
*
mode
);
/**
* Returns non-zero if the given mode might overflow on unary Minus.
...
...
ir/ir/irmode.c
View file @
a6a6f55e
...
...
@@ -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
)
...
...
ir/ir/iropt.c
View file @
a6a6f55e
...
...
@@ -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_h
onor
_signed_zero
s
(
get_irn_mode
(
n
)))
{
if
(
is_Cmp
(
sel
)
&&
!
mode_h
as
_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_h
onor
_signed_zero
s
(
mode
))
if
(
mode_h
as
_signed_zero
(
mode
))
return
0
;
/* must be <, <=, >=, > */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment