From 53685896151d0ec0685ad73ab447c16cf5fd7f03 Mon Sep 17 00:00:00 2001 From: Bin Cheng Date: Tue, 2 May 2017 15:57:45 +0000 Subject: [PATCH] * rtlanal.c (rtx_cost): Handle TRUNCATE between tieable modes. From-SVN: r247509 --- gcc/ChangeLog | 5 ++++- gcc/rtlanal.c | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 07814eb6bb3..c7c1e86ba01 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,9 +1,12 @@ +2017-05-02 Bin Cheng + + * rtlanal.c (rtx_cost): Handle TRUNCATE between tieable modes. + 2017-05-02 Xi Ruoyao * tree.h (EXPR_CILK_SPAWN): Use macro TREE_CHECK2 instead of function tree_check2. - 2017-05-02 Martin Liska * doc/gcov.texi: Add missing preposition. diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 321363f9746..f18245fb557 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -4164,6 +4164,14 @@ rtx_cost (rtx x, machine_mode mode, enum rtx_code outer_code, return COSTS_N_INSNS (2 + factor); break; + case TRUNCATE: + /* If we can tie these modes, make this cheap. */ + if (MODES_TIEABLE_P (mode, GET_MODE (SUBREG_REG (x)))) + { + total = 0; + break; + } + /* FALLTHRU */ default: if (targetm.rtx_costs (x, mode, outer_code, opno, &total, speed)) return total; -- 2.30.2