From 69e7672a3bc8b1b40b92277437947f2778c51b96 Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Sun, 20 May 2018 07:31:55 +0000 Subject: [PATCH] [NDS32] Adjust register move cost for graywolf cpu. gcc/ * config/nds32/nds32.c (nds32_register_move_cost): Take garywolf cpu into consideration. Co-Authored-By: Chung-Ju Wu From-SVN: r260412 --- gcc/ChangeLog | 6 ++++++ gcc/config/nds32/nds32.c | 24 ++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63e5c668659..d76ff7d01c5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-05-20 Kito Cheng + Chung-Ju Wu + + * config/nds32/nds32.c (nds32_register_move_cost): Take garywolf cpu + into consideration. + 2018-05-20 Kito Cheng Chung-Ju Wu diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index ac67ba43de3..649e6f4b4db 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -3005,13 +3005,33 @@ nds32_canonicalize_comparison (int *code, /* Describing Relative Costs of Operations. */ static int -nds32_register_move_cost (machine_mode mode ATTRIBUTE_UNUSED, +nds32_register_move_cost (machine_mode mode, reg_class_t from, reg_class_t to) { + /* In garywolf cpu, FPR to GPR is chaper than other cpu. */ + if (TARGET_PIPELINE_GRAYWOLF) + { + if (GET_MODE_SIZE (mode) == 8) + { + /* DPR to GPR. */ + if (from == FP_REGS && to != FP_REGS) + return 3; + /* GPR to DPR. */ + if (from != FP_REGS && to == FP_REGS) + return 2; + } + else + { + if ((from == FP_REGS && to != FP_REGS) + || (from != FP_REGS && to == FP_REGS)) + return 2; + } + } + if ((from == FP_REGS && to != FP_REGS) || (from != FP_REGS && to == FP_REGS)) - return 9; + return 3; else if (from == HIGH_REGS || to == HIGH_REGS) return optimize_size ? 6 : 2; else -- 2.30.2