Commit 73dac59b by Claudiu Zissulescu Committed by Claudiu Zissulescu

[ARC] Cleanup, fix and set LRA default.

LP_COUNT register cannot be freely allocated by the compiler as it
size, and/or content may change depending on the ARC hardware
configuration. Thus, make this register fixed.

Remove register classes and unused constraint letters.

Cleanup the implementation of conditional_register_usage hook by using
macros instead of magic constants and removing all references to
reg_class_contents which are bringing so much grief when lra is enabled.

gcc/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.h (reg_class): Reorder registers classes, remove
	unused register classes.
	(REG_CLASS_NAMES): Likewise.
	(REG_CLASS_CONTENTS): Likewise.
	(FIXED_REGISTERS): Make lp_count fixed.
	(BASE_REG_CLASS): Remove ACC16_BASE_REGS reference.
	(PROGRAM_COUNTER_REGNO): Remove.
	* config/arc/arc.c (arc_conditional_register_usage): Remove unused
	register classes, use constants for register numbers, remove
	reg_class_contents references.
	(arc_process_double_reg_moves): Add asserts.
	(arc_secondary_reload): Remove LPCOUNT_REG reference, use
	lra_in_progress predicate.
	(arc_init_reg_tables): Remove unused register classes.
	(arc_register_move_cost): Likewise.
	(arc_preferred_reload_class): Likewise.
	(hwloop_optimize): Update rtx patterns involving lp_count
	register.
	(arc_return_address_register): Rename ILINK1, INLINK2 regnums
	macros.
	* config/arc/constraints.md ("c"): Choose between GENERAL_REGS and
	CHEAP_CORE_REGS.  Former one will be used for LRA.
	("Rac"): Choose between GENERAL_REGS and ALL_CORE_REGS.  Former
	one will be used for LRA.
	("w"): Choose between GENERAL_REGS and WRITABLE_CORE_REGS.  Former
	one will be used for LRA.
	("W"): Choose between GENERAL_REGS and MPY_WRITABLE_CORE_REGS.
	Former one will be used for LRA.
	("f"): Delete constraint.
	("k"): Likewise.
	("e"): Likewise.
	("l"): Change it from register constraint to constraint.
	* config/arc/arc.md (movqi_insn): Remove unsed lp_count constraints.
	(movhi_insn): Likewise.
	(movsi_insn): Update pattern.
	(arc_lp): Likewise.
	(dbnz): Likewise.
	(stack_tie): Remove 'b' constraint letter.
	(R4_REG): Define.
	(R9_REG, R15_REG, R16_REG, R25_REG): Likewise.
	(R32_REG, R40_REG, R41_REG, R42_REG, R43_REG, R44_REG): Likewise.
	(R57_REG, R59_REG, PCL_REG): Likewise.
	(ILINK1_REGNUM): Renamed to ILINK1_REG.
	(ILINK2_REGNUM): Renamed to ILINK2_REG.
	(Rgp): Remove.
	(SP_REGS): Likewise.
	(Rcw): Remove unused reg classes.
	* config/arc/predicates.md (dest_reg_operand): Just default on
	register_operand predicate.
	(mpy_dest_reg_operand): Likewise.
	(move_dest_operand): Use macros instead of constants.

From-SVN: r266100
parent f711908b
2018-11-14 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.h (reg_class): Reorder registers classes, remove
unused register classes.
(REG_CLASS_NAMES): Likewise.
(REG_CLASS_CONTENTS): Likewise.
(FIXED_REGISTERS): Make lp_count fixed.
(BASE_REG_CLASS): Remove ACC16_BASE_REGS reference.
(PROGRAM_COUNTER_REGNO): Remove.
* config/arc/arc.c (arc_conditional_register_usage): Remove unused
register classes, use constants for register numbers, remove
reg_class_contents references.
(arc_process_double_reg_moves): Add asserts.
(arc_secondary_reload): Remove LPCOUNT_REG reference, use
lra_in_progress predicate.
(arc_init_reg_tables): Remove unused register classes.
(arc_register_move_cost): Likewise.
(arc_preferred_reload_class): Likewise.
(hwloop_optimize): Update rtx patterns involving lp_count
register.
(arc_return_address_register): Rename ILINK1, INLINK2 regnums
macros.
* config/arc/constraints.md ("c"): Choose between GENERAL_REGS and
CHEAP_CORE_REGS. Former one will be used for LRA.
("Rac"): Choose between GENERAL_REGS and ALL_CORE_REGS. Former
one will be used for LRA.
("w"): Choose between GENERAL_REGS and WRITABLE_CORE_REGS. Former
one will be used for LRA.
("W"): Choose between GENERAL_REGS and MPY_WRITABLE_CORE_REGS.
Former one will be used for LRA.
("f"): Delete constraint.
("k"): Likewise.
("e"): Likewise.
("l"): Change it from register constraint to constraint.
* config/arc/arc.md (movqi_insn): Remove unsed lp_count constraints.
(movhi_insn): Likewise.
(movsi_insn): Update pattern.
(arc_lp): Likewise.
(dbnz): Likewise.
(stack_tie): Remove 'b' constraint letter.
(R4_REG): Define.
(R9_REG, R15_REG, R16_REG, R25_REG): Likewise.
(R32_REG, R40_REG, R41_REG, R42_REG, R43_REG, R44_REG): Likewise.
(R57_REG, R59_REG, PCL_REG): Likewise.
(ILINK1_REGNUM): Renamed to ILINK1_REG.
(ILINK2_REGNUM): Renamed to ILINK2_REG.
(Rgp): Remove.
(SP_REGS): Likewise.
(Rcw): Remove unused reg classes.
* config/arc/predicates.md (dest_reg_operand): Just default on
register_operand predicate.
(mpy_dest_reg_operand): Likewise.
(move_dest_operand): Use macros instead of constants.
* config/arc/arc.opt (mlra): Switch to lra as default.
2018-11-14 Richard Biener <rguenther@suse.de> 2018-11-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/87974 PR tree-optimization/87974
...@@ -312,8 +312,6 @@ if (GET_MODE_CLASS (MODE) == MODE_INT \ ...@@ -312,8 +312,6 @@ if (GET_MODE_CLASS (MODE) == MODE_INT \
#undef WCHAR_TYPE_SIZE #undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32 #define WCHAR_TYPE_SIZE 32
#define PROGRAM_COUNTER_REGNO 63
/* Standard register usage. */ /* Standard register usage. */
/* Number of actual hardware registers. /* Number of actual hardware registers.
...@@ -373,7 +371,7 @@ if (GET_MODE_CLASS (MODE) == MODE_INT \ ...@@ -373,7 +371,7 @@ if (GET_MODE_CLASS (MODE) == MODE_INT \
1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \
0, 0, 0, 0, 1, 1, 1, 1, \ 0, 0, 0, 0, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 0, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \
\ \
0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \
...@@ -470,25 +468,15 @@ enum reg_class ...@@ -470,25 +468,15 @@ enum reg_class
{ {
NO_REGS, NO_REGS,
R0_REGS, /* 'x' */ R0_REGS, /* 'x' */
GP_REG, /* 'Rgp' */ R0R1_CD_REGS, /* 'Rsd' */
FP_REG, /* 'f' */ R0R3_CD_REGS, /* 'Rcd' */
SP_REGS, /* 'b' */
LPCOUNT_REG, /* 'l' */
LINK_REGS, /* 'k' */
DOUBLE_REGS, /* D0, D1 */
SIMD_VR_REGS, /* VR00-VR63 */
SIMD_DMA_CONFIG_REGS, /* DI0-DI7,DO0-DO7 */
ARCOMPACT16_REGS, /* 'q' */ ARCOMPACT16_REGS, /* 'q' */
AC16_BASE_REGS, /* 'e' */
SIBCALL_REGS, /* "Rsc" */ SIBCALL_REGS, /* "Rsc" */
GENERAL_REGS, /* 'r' */
MPY_WRITABLE_CORE_REGS, /* 'W' */
WRITABLE_CORE_REGS, /* 'w' */
CHEAP_CORE_REGS, /* 'c' */
ALL_CORE_REGS, /* 'Rac' */
R0R3_CD_REGS, /* 'Rcd' */
R0R1_CD_REGS, /* 'Rsd' */
AC16_H_REGS, /* 'h' */ AC16_H_REGS, /* 'h' */
DOUBLE_REGS, /* 'D' */
GENERAL_REGS, /* 'r' */
SIMD_VR_REGS, /* 'v' */
SIMD_DMA_CONFIG_REGS, /* 'd' */
ALL_REGS, ALL_REGS,
LIM_REG_CLASSES LIM_REG_CLASSES
}; };
...@@ -497,29 +485,18 @@ enum reg_class ...@@ -497,29 +485,18 @@ enum reg_class
/* Give names of register classes as strings for dump file. */ /* Give names of register classes as strings for dump file. */
#define REG_CLASS_NAMES \ #define REG_CLASS_NAMES \
{ \ { \
"NO_REGS", \ "NO_REGS", \
"R0_REGS", \ "R0_REGS", \
"GP_REG", \ "R0R1_CD_REGS", \
"FP_REG", \ "R0R3_CD_REGS", \
"SP_REGS", \ "ARCOMPACT16_REGS", \
"LPCOUNT_REG", \ "AC16_H_REGS", \
"LINK_REGS", \ "DOUBLE_REGS", \
"DOUBLE_REGS", \ "GENERAL_REGS", \
"SIMD_VR_REGS", \ "SIMD_VR_REGS", \
"SIMD_DMA_CONFIG_REGS", \ "SIMD_DMA_CONFIG_REGS", \
"ARCOMPACT16_REGS", \ "ALL_REGS" \
"AC16_BASE_REGS", \
"SIBCALL_REGS", \
"GENERAL_REGS", \
"MPY_WRITABLE_CORE_REGS", \
"WRITABLE_CORE_REGS", \
"CHEAP_CORE_REGS", \
"R0R3_CD_REGS", \
"R0R1_CD_REGS", \
"AC16_H_REGS", \
"ALL_CORE_REGS", \
"ALL_REGS" \
} }
/* Define which registers fit in which classes. /* Define which registers fit in which classes.
...@@ -527,33 +504,19 @@ enum reg_class ...@@ -527,33 +504,19 @@ enum reg_class
of length N_REG_CLASSES. */ of length N_REG_CLASSES. */
#define REG_CLASS_CONTENTS \ #define REG_CLASS_CONTENTS \
{ \ { \
{0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* No Registers */ \ {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* NO_REGS. */\
{0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'x', r0 register , r0 */ \ {0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'x'. */ \
{0x04000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'Rgp', Global Pointer, r26 */ \ {0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'Rsd'. */ \
{0x08000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'f', Frame Pointer, r27 */ \ {0x0000000f, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'Rcd'. */ \
{0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'b', Stack Pointer, r28 */ \ {0x0000f00f, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'q'. */ \
{0x00000000, 0x10000000, 0x00000000, 0x00000000, 0x00000000}, /* 'l', LPCOUNT Register, r60 */ \ {0x1c001fff, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'Rsc'. */ \
{0xe0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'k', LINK Registers, r29-r31 */ \ {0x9fffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'h'. */ \
{0x00000000, 0x00000f00, 0x00000000, 0x00000000, 0x00000000}, /* 'D', D1, D2 Registers */ \ {0x00000000, 0x00000f00, 0x00000000, 0x00000000, 0x00000000}, /* 'D'. */ \
{0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000}, /* 'V', VR00-VR63 Registers */ \ {0xffffffff, 0x8fffffff, 0x00000000, 0x00000000, 0x00000000}, /* 'r'. */ \
{0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000ffff}, /* 'V', DI0-7,DO0-7 Registers */ \ {0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000}, /* 'v'. */ \
{0x0000f00f, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'q', r0-r3, r12-r15 */ \ {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000ffff}, /* 'd'. */ \
{0x1000f00f, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'e', r0-r3, r12-r15, sp */ \ {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0003ffff} /* ALL_REGS. */\
{0x1c001fff, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* "Rsc", r0-r12 */ \
{0x9fffffff, 0x80000000, 0x00000000, 0x00000000, 0x00000000}, /* 'r', r0-r28, blink, ap and pcl */ \
{0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'W', r0-r31 */ \
/* Include ap / pcl in WRITABLE_CORE_REGS for sake of symmetry. As these \
registers are fixed, it does not affect the literal meaning of the \
constraints, but it makes it a superset of GENERAL_REGS, thus \
enabling some operations that would otherwise not be possible. */ \
{0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'w', r0-r31, r60 */ \
{0xffffffff, 0x9fffffff, 0x00000000, 0x00000000, 0x00000000}, /* 'c', r0-r60, ap, pcl */ \
{0xffffffff, 0x9fffffff, 0x00000000, 0x00000000, 0x00000000}, /* 'Rac', r0-r60, ap, pcl */ \
{0x0000000f, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'Rcd', r0-r3 */ \
{0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'Rsd', r0-r1 */ \
{0x9fffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'h', r0-28, r30 */ \
{0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0003ffff} /* All Registers */ \
} }
/* Local macros to mark the first and last regs of different classes. */ /* Local macros to mark the first and last regs of different classes. */
...@@ -590,7 +553,7 @@ extern enum reg_class arc_regno_reg_class[]; ...@@ -590,7 +553,7 @@ extern enum reg_class arc_regno_reg_class[];
/* The class value for valid base registers. A base register is one used in /* The class value for valid base registers. A base register is one used in
an address which is the register value plus a displacement. */ an address which is the register value plus a displacement. */
#define BASE_REG_CLASS (TARGET_MIXED_CODE ? AC16_BASE_REGS : GENERAL_REGS) #define BASE_REG_CLASS GENERAL_REGS
/* These assume that REGNO is a hard or pseudo reg number. /* These assume that REGNO is a hard or pseudo reg number.
They give nonzero only if REGNO is a hard reg of the suitable class They give nonzero only if REGNO is a hard reg of the suitable class
...@@ -1650,4 +1613,8 @@ enum ...@@ -1650,4 +1613,8 @@ enum
/* The default option for BI/BIH instructions. */ /* The default option for BI/BIH instructions. */
#define DEFAULT_BRANCH_INDEX 0 #define DEFAULT_BRANCH_INDEX 0
#ifndef TARGET_LRA
#define TARGET_LRA arc_lra_p()
#endif
#endif /* GCC_ARC_H */ #endif /* GCC_ARC_H */
...@@ -171,18 +171,37 @@ ...@@ -171,18 +171,37 @@
(R1_REG 1) (R1_REG 1)
(R2_REG 2) (R2_REG 2)
(R3_REG 3) (R3_REG 3)
(R4_REG 4)
(R9_REG 9)
(R10_REG 10) (R10_REG 10)
(R12_REG 12) (R12_REG 12)
(R15_REG 15)
(R16_REG 16)
(R25_REG 25)
(SP_REG 28) (SP_REG 28)
(ILINK1_REGNUM 29) (ILINK1_REG 29)
(ILINK2_REGNUM 30) (ILINK2_REG 30)
(R30_REG 30)
(RETURN_ADDR_REGNUM 31) (RETURN_ADDR_REGNUM 31)
(R32_REG 32)
(R40_REG 40)
(R41_REG 41)
(R42_REG 42)
(R43_REG 43)
(R44_REG 44)
(R57_REG 57)
(MUL64_OUT_REG 58) (MUL64_OUT_REG 58)
(MUL32x16_REG 56) (MUL32x16_REG 56)
(ARCV2_ACC 58) (ARCV2_ACC 58)
(R59_REG 59)
(LP_COUNT 60) (LP_COUNT 60)
(CC_REG 61) (CC_REG 61)
(PCL_REG 63)
(LP_START 144) (LP_START 144)
(LP_END 145) (LP_END 145)
] ]
...@@ -652,8 +671,8 @@ core_3, archs4x, archs4xd, archs4xd_slow" ...@@ -652,8 +671,8 @@ core_3, archs4x, archs4xd, archs4xd_slow"
; The iscompact attribute allows the epilogue expander to know for which ; The iscompact attribute allows the epilogue expander to know for which
; insns it should lengthen the return insn. ; insns it should lengthen the return insn.
(define_insn "*movqi_insn" (define_insn "*movqi_insn"
[(set (match_operand:QI 0 "move_dest_operand" "=Rcq,Rcq#q, w,Rcq#q, h,w*l,w*l,???w,h,w*l,Rcq, S,!*x, r,r, Ucm,m,???m, m,Usc") [(set (match_operand:QI 0 "move_dest_operand" "=Rcq,Rcq#q, w,Rcq#q, h, w, w,???w,h, w,Rcq, S,!*x, r,r, Ucm,m,???m, m,Usc")
(match_operand:QI 1 "move_src_operand" " cL, cP,Rcq#q, P,hCm1, cL, I,?Rac,i, ?i, T,Rcq,Usd,Ucm,m,?Rac,c,?Rac,Cm3,i"))] (match_operand:QI 1 "move_src_operand" " cL, cP,Rcq#q, P,hCm1,cL, I,?Rac,i,?i, T,Rcq,Usd,Ucm,m,?Rac,c,?Rac,Cm3,i"))]
"register_operand (operands[0], QImode) "register_operand (operands[0], QImode)
|| register_operand (operands[1], QImode)" || register_operand (operands[1], QImode)"
"@ "@
...@@ -689,8 +708,8 @@ core_3, archs4x, archs4xd, archs4xd_slow" ...@@ -689,8 +708,8 @@ core_3, archs4x, archs4xd, archs4xd_slow"
"if (prepare_move_operands (operands, HImode)) DONE;") "if (prepare_move_operands (operands, HImode)) DONE;")
(define_insn "*movhi_insn" (define_insn "*movhi_insn"
[(set (match_operand:HI 0 "move_dest_operand" "=Rcq,Rcq#q, w,Rcq#q, h,w*l,w*l,???w,Rcq#q,h,w*l,Rcq, S, r,r, Ucm,m,???m, m,VUsc") [(set (match_operand:HI 0 "move_dest_operand" "=Rcq,Rcq#q, w,Rcq#q, h, w, w,???w,Rcq#q,h, w,Rcq, S, r,r, Ucm,m,???m, m,VUsc")
(match_operand:HI 1 "move_src_operand" " cL, cP,Rcq#q, P,hCm1, cL, I,?Rac, i,i, ?i, T,Rcq,Ucm,m,?Rac,c,?Rac,Cm3,i"))] (match_operand:HI 1 "move_src_operand" " cL, cP,Rcq#q, P,hCm1,cL, I,?Rac, i,i,?i, T,Rcq,Ucm,m,?Rac,c,?Rac,Cm3,i"))]
"register_operand (operands[0], HImode) "register_operand (operands[0], HImode)
|| register_operand (operands[1], HImode) || register_operand (operands[1], HImode)
|| (CONSTANT_P (operands[1]) || (CONSTANT_P (operands[1])
...@@ -740,9 +759,9 @@ core_3, archs4x, archs4xd, archs4xd_slow" ...@@ -740,9 +759,9 @@ core_3, archs4x, archs4xd, archs4xd_slow"
; the iscompact attribute allows the epilogue expander to know for which ; the iscompact attribute allows the epilogue expander to know for which
; insns it should lengthen the return insn. ; insns it should lengthen the return insn.
; N.B. operand 1 of alternative 7 expands into pcl,symbol@gotpc . ; N.B. operand 1 of alternative 7 expands into pcl,symbol@gotpc .
(define_insn "*movsi_insn" ; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 (define_insn "*movsi_insn" ; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
[(set (match_operand:SI 0 "move_dest_operand" "=Rcq,Rcq#q, w,Rcq#q, h,w*l,w*l, w, w, w, w, ???w, ?w, w,Rcq#q, h, w*l,Rcq, S, Us<,RcqRck,!*x, r,!*Rsd,!*Rcd,r,Ucm, Usd,m,???m, m,VUsc") [(set (match_operand:SI 0 "move_dest_operand" "=Rcq,Rcq#q, w,Rcq#q, h,wl, w, w, w, w, w,???w, ?w, w,Rcq#q, h, wl,Rcq, S, Us<,RcqRck,!*x, r,!*Rsd,!*Rcd,r,Ucm, Usd,m,???m, m,VUsc")
(match_operand:SI 1 "move_src_operand" " cL, cP,Rcq#q, P,hCm1, cL, I,Crr,Clo,Chi,Cbi,?Rac*l,Cpc,Clb, ?Cal,Cal,?Cal,Uts,Rcq,RcqRck, Us>,Usd,Ucm, Usd, Ucd,m, w,!*Rzd,c,?Rac,Cm3, C32"))] (match_operand:SI 1 "move_src_operand" " cL, cP,Rcq#q, P,hCm1,cL, I,Crr,Clo,Chi,Cbi,?Rac,Cpc,Clb, ?Cal,Cal,?Cal,Uts,Rcq,RcqRck, Us>,Usd,Ucm, Usd, Ucd,m, w,!*Rzd,c,?Rac,Cm3, C32"))]
"register_operand (operands[0], SImode) "register_operand (operands[0], SImode)
|| register_operand (operands[1], SImode) || register_operand (operands[1], SImode)
|| (CONSTANT_P (operands[1]) || (CONSTANT_P (operands[1])
...@@ -5002,12 +5021,12 @@ core_3, archs4x, archs4xd, archs4xd_slow" ...@@ -5002,12 +5021,12 @@ core_3, archs4x, archs4xd, archs4xd_slow"
}) })
(define_insn "arc_lp" (define_insn "arc_lp"
[(unspec:SI [(match_operand:SI 0 "register_operand" "l")] [(unspec:SI [(reg:SI LP_COUNT)]
UNSPEC_ARC_LP) UNSPEC_ARC_LP)
(use (label_ref (match_operand 1 "" ""))) (use (label_ref (match_operand 0 "" "")))
(use (label_ref (match_operand 2 "" "")))] (use (label_ref (match_operand 1 "" "")))]
"" ""
"lp\\t@%l2\\t; %0:@%l1->@%l2" "lp\\t@%l1\\t; lp_count:@%l0->@%l1"
[(set_attr "type" "loop_setup") [(set_attr "type" "loop_setup")
(set_attr "length" "4")]) (set_attr "length" "4")])
...@@ -5015,16 +5034,16 @@ core_3, archs4x, archs4xd, archs4xd_slow" ...@@ -5015,16 +5034,16 @@ core_3, archs4x, archs4xd, archs4xd_slow"
;; register, instead of going to memory. ;; register, instead of going to memory.
(define_insn "loop_end" (define_insn "loop_end"
[(set (pc) [(set (pc)
(if_then_else (ne (match_operand:SI 2 "nonimmediate_operand" "0,0") (if_then_else (ne (match_operand:SI 2 "nonimmediate_operand" "0,m")
(const_int 1)) (const_int 1))
(label_ref (match_operand 1 "" "")) (label_ref (match_operand 1 "" ""))
(pc))) (pc)))
(set (match_operand:SI 0 "nonimmediate_operand" "=l!r,m") (set (match_operand:SI 0 "nonimmediate_operand" "=r,m")
(plus (match_dup 2) (const_int -1))) (plus (match_dup 2) (const_int -1)))
(unspec [(const_int 0)] UNSPEC_ARC_LP) (unspec [(const_int 0)] UNSPEC_ARC_LP)
(clobber (match_scratch:SI 3 "=X,&r"))] (clobber (match_scratch:SI 3 "=X,&r"))]
"" ""
"\\t;%0 %1 %2" "; ZOL_END, begins @%l1"
[(set_attr "length" "0") [(set_attr "length" "0")
(set_attr "predicable" "no") (set_attr "predicable" "no")
(set_attr "type" "loop_end")]) (set_attr "type" "loop_end")])
...@@ -5069,7 +5088,7 @@ core_3, archs4x, archs4xd, archs4xd_slow" ...@@ -5069,7 +5088,7 @@ core_3, archs4x, archs4xd, archs4xd_slow"
(define_insn_and_split "dbnz" (define_insn_and_split "dbnz"
[(set (pc) [(set (pc)
(if_then_else (if_then_else
(ne (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+r!l,m") (ne (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+rl,m")
(const_int -1)) (const_int -1))
(const_int 0)) (const_int 0))
(label_ref (match_operand 1 "" "")) (label_ref (match_operand 1 "" ""))
...@@ -6283,8 +6302,8 @@ core_3, archs4x, archs4xd, archs4xd_slow" ...@@ -6283,8 +6302,8 @@ core_3, archs4x, archs4xd, archs4xd_slow"
(define_insn "stack_tie" (define_insn "stack_tie"
[(set (mem:BLK (scratch)) [(set (mem:BLK (scratch))
(unspec:BLK [(match_operand:SI 0 "register_operand" "rb") (unspec:BLK [(match_operand:SI 0 "register_operand" "r")
(match_operand:SI 1 "register_operand" "rb")] (match_operand:SI 1 "register_operand" "r")]
UNSPEC_ARC_STKTIE))] UNSPEC_ARC_STKTIE))]
"" ""
"" ""
......
...@@ -401,12 +401,9 @@ Target ...@@ -401,12 +401,9 @@ Target
Pass -marclinux_prof option through to linker. Pass -marclinux_prof option through to linker.
;; lra is still unproven for ARC, so allow to fall back to reload with -mno-lra. ;; lra is still unproven for ARC, so allow to fall back to reload with -mno-lra.
;Target InverseMask(NO_LRA)
; lra still won't allow to configure libgcc; see PR rtl-optimization/55464.
; so don't enable by default.
mlra mlra
Target Mask(LRA) Target Report Var(arc_lra_flag) Init(1) Save
Enable lra. Use LRA instead of reload.
mlra-priority-none mlra-priority-none
Target RejectNegative Var(arc_lra_priority_tag, ARC_LRA_PRIORITY_NONE) Target RejectNegative Var(arc_lra_priority_tag, ARC_LRA_PRIORITY_NONE)
......
...@@ -24,48 +24,35 @@ ...@@ -24,48 +24,35 @@
; result registers of ARC600. ; result registers of ARC600.
; First, define a class for core registers that can be read cheaply. This ; First, define a class for core registers that can be read cheaply. This
; is most or all core registers for ARC600, but only r0-r31 for ARC700 ; is most or all core registers for ARC600, but only r0-r31 for ARC700
(define_register_constraint "c" "CHEAP_CORE_REGS" (define_register_constraint "c" "GENERAL_REGS"
"core register @code{r0}-@code{r31}, @code{ap},@code{pcl}") "Legacy, core register @code{r0}-@code{r31}, @code{ap},@code{pcl}")
; All core regs - e.g. for when we must have a way to reload a register. ; All core regs - e.g. for when we must have a way to reload a register.
(define_register_constraint "Rac" "ALL_CORE_REGS" (define_register_constraint "Rac" "GENERAL_REGS"
"core register @code{r0}-@code{r60}, @code{ap},@code{pcl}") "Legacy, core register @code{r0}-@code{r60}, @code{ap},@code{pcl}")
; Some core registers (.e.g lp_count) aren't general registers because they ; Some core registers (.e.g lp_count) aren't general registers because they
; can't be used as the destination of a multi-cycle operation like ; can't be used as the destination of a multi-cycle operation like
; load and/or multiply, yet they are still writable in the sense that ; load and/or multiply, yet they are still writable in the sense that
; register-register moves and single-cycle arithmetic (e.g "add", "and", ; register-register moves and single-cycle arithmetic (e.g "add", "and",
; but not "mpy") can write to them. ; but not "mpy") can write to them.
(define_register_constraint "w" "WRITABLE_CORE_REGS" (define_register_constraint "w" "GENERAL_REGS"
"writable core register: @code{r0}-@code{r31}, @code{r60}, nonfixed core register") "Legacy, writable core register: @code{r0}-@code{r31}, @code{r60},
nonfixed core register")
(define_register_constraint "W" "MPY_WRITABLE_CORE_REGS" (define_register_constraint "W" "GENERAL_REGS"
"writable core register except @code{LP_COUNT} (@code{r60}): @code{r0}-@code{r31}, nonfixed core register") "Legacy, writable core register except @code{LP_COUNT} (@code{r60}):
@code{r0}-@code{r31}, nonfixed core register")
(define_register_constraint "l" "LPCOUNT_REG" (define_constraint "l"
"@internal "@internal
Loop count register @code{r60}") Loop count register @code{r60}"
(and (match_code "reg")
(match_test "REGNO (op) == LP_COUNT")))
(define_register_constraint "x" "R0_REGS" (define_register_constraint "x" "R0_REGS"
"@code{R0} register.") "@code{R0} register.")
(define_register_constraint "Rgp" "GP_REG"
"@internal
Global Pointer register @code{r26}")
(define_register_constraint "f" "FP_REG"
"@internal
Frame Pointer register @code{r27}")
(define_register_constraint "b" "SP_REGS"
"@internal
Stack Pointer register @code{r28}")
(define_register_constraint "k" "LINK_REGS"
"@internal
Link Registers @code{ilink1}:@code{r29}, @code{ilink2}:@code{r30},
@code{blink}:@code{r31},")
(define_register_constraint "q" "TARGET_Q_CLASS ? ARCOMPACT16_REGS : NO_REGS" (define_register_constraint "q" "TARGET_Q_CLASS ? ARCOMPACT16_REGS : NO_REGS"
"Registers usable in ARCompact 16-bit instructions: @code{r0}-@code{r3}, "Registers usable in ARCompact 16-bit instructions: @code{r0}-@code{r3},
@code{r12}-@code{r15}") @code{r12}-@code{r15}")
...@@ -78,10 +65,6 @@ ...@@ -78,10 +65,6 @@
"Registers usable in NPS400 bitfield instructions: @code{r0}-@code{r3}, "Registers usable in NPS400 bitfield instructions: @code{r0}-@code{r3},
@code{r12}-@code{r15}") @code{r12}-@code{r15}")
(define_register_constraint "e" "AC16_BASE_REGS"
"Registers usable as base-regs of memory addresses in ARCompact 16-bit memory
instructions: @code{r0}-@code{r3}, @code{r12}-@code{r15}, @code{sp}")
(define_register_constraint "D" "DOUBLE_REGS" (define_register_constraint "D" "DOUBLE_REGS"
"ARC FPX (dpfp) 64-bit registers. @code{D0}, @code{D1}") "ARC FPX (dpfp) 64-bit registers. @code{D0}, @code{D1}")
...@@ -472,7 +455,7 @@ ...@@ -472,7 +455,7 @@
(match_test (match_test
"TARGET_Rcw "TARGET_Rcw
&& REGNO (op) < FIRST_PSEUDO_REGISTER && REGNO (op) < FIRST_PSEUDO_REGISTER
&& TEST_HARD_REG_BIT (reg_class_contents[WRITABLE_CORE_REGS], && TEST_HARD_REG_BIT (reg_class_contents[GENERAL_REGS],
REGNO (op))"))) REGNO (op))")))
(define_constraint "Rcr" (define_constraint "Rcr"
......
...@@ -20,33 +20,12 @@ ...@@ -20,33 +20,12 @@
(define_predicate "dest_reg_operand" (define_predicate "dest_reg_operand"
(match_code "reg,subreg") (match_code "reg,subreg")
{ {
rtx op0 = op;
if (GET_CODE (op0) == SUBREG)
op0 = SUBREG_REG (op0);
if (REG_P (op0) && REGNO (op0) < FIRST_PSEUDO_REGISTER
&& TEST_HARD_REG_BIT (reg_class_contents[ALL_CORE_REGS],
REGNO (op0))
&& !TEST_HARD_REG_BIT (reg_class_contents[WRITABLE_CORE_REGS],
REGNO (op0)))
return 0;
return register_operand (op, mode); return register_operand (op, mode);
}) })
(define_predicate "mpy_dest_reg_operand" (define_predicate "mpy_dest_reg_operand"
(match_code "reg,subreg") (match_code "reg,subreg")
{ {
rtx op0 = op;
if (GET_CODE (op0) == SUBREG)
op0 = SUBREG_REG (op0);
if (REG_P (op0) && REGNO (op0) < FIRST_PSEUDO_REGISTER
&& TEST_HARD_REG_BIT (reg_class_contents[ALL_CORE_REGS],
REGNO (op0))
/* Make sure the destination register is not LP_COUNT. */
&& !TEST_HARD_REG_BIT (reg_class_contents[MPY_WRITABLE_CORE_REGS],
REGNO (op0)))
return 0;
return register_operand (op, mode); return register_operand (op, mode);
}) })
...@@ -358,13 +337,14 @@ ...@@ -358,13 +337,14 @@
case REG : case REG :
/* Program Counter register cannot be the target of a move. It is /* Program Counter register cannot be the target of a move. It is
a readonly register. */ a readonly register. */
if (REGNO (op) == PROGRAM_COUNTER_REGNO) if (REGNO (op) == PCL_REG)
return 0; return 0;
else if (TARGET_MULMAC_32BY16_SET else if (TARGET_MULMAC_32BY16_SET
&& (REGNO (op) == 56 || REGNO(op) == 57)) && (REGNO (op) == MUL32x16_REG || REGNO (op) == R57_REG))
return 0; return 0;
else if (TARGET_MUL64_SET else if (TARGET_MUL64_SET
&& (REGNO (op) == 57 || REGNO(op) == 58 || REGNO(op) == 59 )) && (REGNO (op) == R57_REG || REGNO (op) == MUL64_OUT_REG
|| REGNO (op) == R59_REG))
return 0; return 0;
else if (REGNO (op) == LP_COUNT) else if (REGNO (op) == LP_COUNT)
return 1; return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment