Commit 201a260b authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ia32: Replace repeated code in ia32_create_float_const_entity() by a loop.

parent 84354a35
...@@ -64,15 +64,15 @@ ir_entity *ia32_create_float_const_entity(ia32_isa_t *isa, ir_tarval *tv, ...@@ -64,15 +64,15 @@ ir_entity *ia32_create_float_const_entity(ia32_isa_t *isa, ir_tarval *tv,
ir_mode *mode = get_tarval_mode(tv); ir_mode *mode = get_tarval_mode(tv);
if (!ia32_cg_config.use_sse2) { if (!ia32_cg_config.use_sse2) {
/* try to reduce the mode to produce smaller sized entities */ /* try to reduce the mode to produce smaller sized entities */
if (mode != mode_F) { ir_mode *const modes[] = { mode_F, mode_D, NULL };
if (tarval_ieee754_can_conv_lossless(tv, mode_F)) { for (ir_mode *const *i = modes;; ++i) {
mode = mode_F; ir_mode *const to = *i;
tv = tarval_convert_to(tv, mode); if (!to || to == mode)
} else if (mode != mode_D) { break;
if (tarval_ieee754_can_conv_lossless(tv, mode_D)) { if (tarval_ieee754_can_conv_lossless(tv, to)) {
mode = mode_D; tv = tarval_convert_to(tv, to);
tv = tarval_convert_to(tv, mode); mode = to;
} break;
} }
} }
} }
......
Supports Markdown
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