diff options
Diffstat (limited to 'gcc/config/cr16')
-rw-r--r-- | gcc/config/cr16/cr16.c | 14 | ||||
-rw-r--r-- | gcc/config/cr16/cr16.h | 8 |
2 files changed, 15 insertions, 7 deletions
diff --git a/gcc/config/cr16/cr16.c b/gcc/config/cr16/cr16.c index 0476065..c410071 100644 --- a/gcc/config/cr16/cr16.c +++ b/gcc/config/cr16/cr16.c @@ -220,6 +220,8 @@ static const struct attribute_spec cr16_attribute_table[] = { #undef TARGET_ASM_UNALIGNED_DI_OP #define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP +#undef TARGET_HARD_REGNO_NREGS +#define TARGET_HARD_REGNO_NREGS cr16_hard_regno_nregs #undef TARGET_HARD_REGNO_MODE_OK #define TARGET_HARD_REGNO_MODE_OK cr16_hard_regno_mode_ok #undef TARGET_MODES_TIEABLE_P @@ -468,6 +470,16 @@ cr16_regno_reg_class (int regno) return NO_REGS; } +/* Implement TARGET_HARD_REGNO_NREGS. */ + +static unsigned int +cr16_hard_regno_nregs (unsigned int regno, machine_mode mode) +{ + if (regno >= CR16_FIRST_DWORD_REGISTER) + return CEIL (GET_MODE_SIZE (mode), CR16_UNITS_PER_DWORD); + return CEIL (GET_MODE_SIZE (mode), UNITS_PER_WORD); +} + /* Implement TARGET_HARD_REGNO_MODE_OK. On the CR16 architecture, all registers can hold all modes, except that double precision floats (and double ints) must fall on even-register boundaries. */ @@ -1371,7 +1383,7 @@ cr16_memory_move_cost (machine_mode mode, { /* One LD or ST takes twice the time of a simple reg-reg move. */ if (reg_classes_intersect_p (rclass, GENERAL_REGS)) - return (4 * HARD_REGNO_NREGS (0, mode)); + return (4 * cr16_hard_regno_nregs (0, mode)); else return (100); } diff --git a/gcc/config/cr16/cr16.h b/gcc/config/cr16/cr16.h index 66886c1..a068b4b 100644 --- a/gcc/config/cr16/cr16.h +++ b/gcc/config/cr16/cr16.h @@ -197,12 +197,8 @@ while (0) /* Returns 1 if the register is longer than word size, 0 otherwise. */ #define LONG_REG_P(REGNO) \ - (HARD_REGNO_NREGS (REGNO, GET_MODE_WIDER_MODE (word_mode).require ()) == 1) - -#define HARD_REGNO_NREGS(REGNO, MODE) \ - ((REGNO >= CR16_FIRST_DWORD_REGISTER) \ - ? ((GET_MODE_SIZE (MODE) + CR16_UNITS_PER_DWORD - 1) / CR16_UNITS_PER_DWORD)\ - : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)) + (targetm.hard_regno_nregs (REGNO, \ + GET_MODE_WIDER_MODE (word_mode).require ()) == 1) #define NOTICE_UPDATE_CC(EXP, INSN) \ notice_update_cc ((EXP)) |