From 66408f6c3954fa6d91972bffecfaf49287cbfe55 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Tue, 17 Jul 2018 01:02:11 +0200 Subject: [PATCH] rs6000: Improve truncifsf2 The current implementation leaves an unnecessary register move. It is easier to just expand things in the expander already. This patch does that. * config/rs6000/rs6000.md (truncsf2): Expand truncates of double-double modes to SFmode directly directly. (truncsf2_fprs): Delete. From-SVN: r262754 --- gcc/ChangeLog | 6 ++++++ gcc/config/rs6000/rs6000.md | 23 +++++------------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 598598445c0..6bdf930d06f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-07-16 Segher Boessenkool + + * config/rs6000/rs6000.md (truncsf2): Expand truncates of + double-double modes to SFmode directly directly. + (truncsf2_fprs): Delete. + 2018-07-16 Segher Boessenkool * config/rs6000/rs6000.c (init_float128_ibm): Use the correct names diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 44d32d9edc8..94a0f7d9a66 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -7702,28 +7702,15 @@ { if (FLOAT128_IEEE_P (mode)) rs6000_expand_float128_convert (operands[0], operands[1], false); - else if (mode == TFmode) - emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1])); - else if (mode == IFmode) - emit_insn (gen_truncifsf2_fprs (operands[0], operands[1])); else - gcc_unreachable (); + { + rtx tmp = gen_reg_rtx (DFmode); + emit_insn (gen_truncdf2 (tmp, operands[1])); + emit_insn (gen_truncdfsf2 (operands[0], tmp)); + } DONE; }) -(define_insn_and_split "truncsf2_fprs" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (float_truncate:SF (match_operand:IBM128 1 "gpc_reg_operand" "d"))) - (clobber (match_scratch:DF 2 "=d"))] - "TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128 && FLOAT128_IBM_P (mode)" - "#" - "&& reload_completed" - [(set (match_dup 2) - (float_truncate:DF (match_dup 1))) - (set (match_dup 0) - (float_truncate:SF (match_dup 2)))] - "") - (define_expand "floatsi2" [(parallel [(set (match_operand:FLOAT128 0 "gpc_reg_operand") (float:FLOAT128 (match_operand:SI 1 "gpc_reg_operand"))) -- 2.30.2