aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/i386/i386-expand.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2020-12-28 16:52:45 +0100
committerUros Bizjak <ubizjak@gmail.com>2020-12-28 16:53:56 +0100
commit97d3ddcfc9c67d26e3869a261a506ef70e7f092e (patch)
tree08ca52bdc1fc0f4c3f0c9a6a7d2f871edc1f46bc /gcc/config/i386/i386-expand.c
parent12ae2bc70846a2be8255eaa41322cd1a5a7b7350 (diff)
i386: Use existing temporary register in rounding functions
It is possible to avoid the call to force_reg and use existing temporary register in ix86_expand_trunc, ix86_expand_round and ix86_expand_rounddf_32 expanders. 2020-12-28 Uroš Bizjak <ubizjak@gmail.com> gcc/ * config/i386/i386-expand.c (ix86_expand_trunc): Use existing temporary register to avoid a call to force_reg.
Diffstat (limited to 'gcc/config/i386/i386-expand.c')
-rw-r--r--gcc/config/i386/i386-expand.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index c856489c046..5fe38052056 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -16513,13 +16513,15 @@ ix86_expand_trunc (rtx operand0, rtx operand1)
/* if (!isless (xa, TWO52)) goto label; */
label = ix86_expand_sse_compare_and_jump (UNLE, TWO52, xa, false);
- /* x = (double)(long)x */
+ /* xa = (double)(long)x */
xi = gen_reg_rtx (mode == DFmode ? DImode : SImode);
expand_fix (xi, res, 0);
- expand_float (res, xi, 0);
+ expand_float (xa, xi, 0);
if (HONOR_SIGNED_ZEROS (mode))
- ix86_sse_copysign_to_positive (res, res, force_reg (mode, operand1), mask);
+ ix86_sse_copysign_to_positive (xa, xa, res, mask);
+
+ emit_move_insn (res, xa);
emit_label (label);
LABEL_NUSES (label) = 1;
@@ -16629,7 +16631,7 @@ ix86_expand_round (rtx operand0, rtx operand1)
expand_float (xa, xi, 0);
/* res = copysign (xa, operand1) */
- ix86_sse_copysign_to_positive (res, xa, force_reg (mode, operand1), mask);
+ ix86_sse_copysign_to_positive (res, xa, res, mask);
emit_label (label);
LABEL_NUSES (label) = 1;
@@ -16700,7 +16702,7 @@ ix86_expand_rounddf_32 (rtx operand0, rtx operand1)
xa2 = expand_simple_binop (mode, PLUS, xa2, tmp, NULL_RTX, 0, OPTAB_DIRECT);
/* res = copysign (xa2, operand1) */
- ix86_sse_copysign_to_positive (res, xa2, force_reg (mode, operand1), mask);
+ ix86_sse_copysign_to_positive (res, xa2, res, mask);
emit_label (label);
LABEL_NUSES (label) = 1;