Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
1d378318
Commit
1d378318
authored
Nov 08, 2013
by
Matthias Braun
Browse files
perform float2int bitcast without expensive string conversions
parent
3c98a9d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/lower/lower_softfloat.c
View file @
1d378318
...
...
@@ -571,12 +571,6 @@ static void lower_Cmp(ir_node *n)
exchange
(
n
,
cmp
);
}
static
const
tarval_mode_info
hex_output
=
{
TVO_HEX
,
"0x"
,
NULL
,
};
/**
* Adapts floating point constants.
*/
...
...
@@ -586,16 +580,19 @@ static void lower_Const(ir_node *n)
if
(
!
mode_is_float
(
mode
))
return
;
ir_mode
*
lowered_mode
=
get_lowered_mode
(
mode
);
set_irn_mode
(
n
,
lowered_mode
);
assert
(
get_mode_size_bits
(
mode
)
%
8
==
0
);
unsigned
size
=
get_mode_size_bits
(
mode
)
/
8
;
unsigned
char
*
buf
=
ALLOCAN
(
unsigned
char
,
size
);
set_tarval_mode_output_option
(
mode
,
&
hex_output
);
char
buf
[
100
];
tarval_snprintf
(
buf
,
sizeof
(
buf
),
get_Const_tarval
(
n
));
ir_tarval
*
float_tv
=
get_Const_tarval
(
n
);
for
(
unsigned
i
=
0
;
i
<
size
;
++
i
)
{
buf
[
i
]
=
get_tarval_sub_bits
(
float_tv
,
i
);
}
ir_mode
*
lowered_mode
=
get_lowered_mode
(
mode
);
ir_tarval
*
int_tv
=
new_tarval_from_bytes
(
buf
,
lowered_mode
,
false
);
size_t
len
=
strlen
(
buf
);
ir_tarval
*
tv
=
new_tarval_from_str
(
buf
,
len
,
lowered_mode
);
set_Const_tarval
(
n
,
tv
);
set_irn_mode
(
n
,
lowered_mode
);
set_Const_tarval
(
n
,
int_tv
);
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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