diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-15 04:56:06 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-15 04:56:06 +0000 |
commit | 8da637123e80be2156e84d0f2f1be564132996c1 (patch) | |
tree | 3ff18ff7fc94a7ca0a414c165e33d5a33108b3f3 /gcc/config/spu | |
parent | 8eafe656d06910682748b4f19ea12cd8bbabd4ba (diff) | |
download | gcc-8da637123e80be2156e84d0f2f1be564132996c1.tar.gz |
2009-05-15 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r147550
2009-05-15 Basile Starynkevitch <basile@starynkevitch.net>
merged with trunk rev147539
* gcc/melt/warmelt-normal.melt (normexp_defcmatcher): use obj_hash
instead of hashcode!
* gcc/Makefile.in: TEXI_GCCINT_FILES has both plugins.texi & melt.texi
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@147552 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/spu')
-rw-r--r-- | gcc/config/spu/spu-c.c | 4 | ||||
-rw-r--r-- | gcc/config/spu/spu-protos.h | 5 | ||||
-rw-r--r-- | gcc/config/spu/spu.c | 69 | ||||
-rw-r--r-- | gcc/config/spu/spu.h | 16 | ||||
-rw-r--r-- | gcc/config/spu/spu.md | 187 |
5 files changed, 90 insertions, 191 deletions
diff --git a/gcc/config/spu/spu-c.c b/gcc/config/spu/spu-c.c index e1352b14a8a..a946b037cb7 100644 --- a/gcc/config/spu/spu-c.c +++ b/gcc/config/spu/spu-c.c @@ -42,7 +42,7 @@ spu_categorize_keyword (const cpp_token *tok) { if (tok->type == CPP_NAME) { - cpp_hashnode *ident = tok->val.node; + cpp_hashnode *ident = tok->val.node.node; if (ident == C_CPP_HASHNODE (vector_keyword) || ident == C_CPP_HASHNODE (__vector_keyword)) @@ -60,7 +60,7 @@ spu_categorize_keyword (const cpp_token *tok) static cpp_hashnode * spu_macro_to_expand (cpp_reader *pfile, const cpp_token *tok) { - cpp_hashnode *expand_this = tok->val.node; + cpp_hashnode *expand_this = tok->val.node.node; cpp_hashnode *ident; ident = spu_categorize_keyword (tok); diff --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h index 06e02ba0b48..33951d77ea9 100644 --- a/gcc/config/spu/spu-protos.h +++ b/gcc/config/spu/spu-protos.h @@ -28,8 +28,7 @@ extern int valid_subreg (rtx op); extern void spu_expand_extv (rtx * ops, int unsignedp); extern void spu_expand_insv (rtx * ops); extern int spu_expand_block_move (rtx * ops); -extern void spu_emit_branch_or_set (int is_set, enum rtx_code code, - rtx * operands); +extern void spu_emit_branch_or_set (int is_set, rtx cmp, rtx * operands); extern int spu_emit_vector_cond_expr (rtx, rtx, rtx, rtx, rtx, rtx); extern HOST_WIDE_INT const_double_to_hwint (rtx x); extern rtx hwint_to_const_double (enum machine_mode mode, HOST_WIDE_INT v); @@ -55,8 +54,6 @@ extern bool exp2_immediate_p (rtx op, enum machine_mode mode, int low, int high); extern int spu_constant_address_p (rtx x); extern int spu_legitimate_constant_p (rtx x); -extern int spu_legitimate_address (enum machine_mode mode, rtx x, - int reg_ok_strict); extern int spu_initial_elimination_offset (int from, int to); extern rtx spu_function_value (const_tree type, const_tree func); extern rtx spu_function_arg (int cum, enum machine_mode mode, tree type, diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index bb73622f9d5..b8e08c83ea6 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -152,6 +152,7 @@ char regs_ever_allocated[FIRST_PSEUDO_REGISTER]; static void spu_init_builtins (void); static unsigned char spu_scalar_mode_supported_p (enum machine_mode mode); static unsigned char spu_vector_mode_supported_p (enum machine_mode mode); +static bool spu_legitimate_address_p (enum machine_mode, rtx, bool); static rtx adjust_operand (rtx op, HOST_WIDE_INT * start); static rtx get_pic_reg (void); static int need_to_save_reg (int regno, int saving); @@ -212,7 +213,6 @@ static void asm_file_start (void); static unsigned int spu_section_type_flags (tree, const char *, int); extern const char *reg_names[]; -rtx spu_compare_op0, spu_compare_op1; /* Which instruction set architecture to use. */ int spu_arch; @@ -400,6 +400,9 @@ const struct attribute_spec spu_attribute_table[]; #undef TARGET_SECTION_TYPE_FLAGS #define TARGET_SECTION_TYPE_FLAGS spu_section_type_flags +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P spu_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; void @@ -844,42 +847,44 @@ int spu_comp_icode[12][3] = { WORD_MODE, we can generate better code in most cases if we do it ourselves. */ void -spu_emit_branch_or_set (int is_set, enum rtx_code code, rtx operands[]) +spu_emit_branch_or_set (int is_set, rtx cmp, rtx operands[]) { int reverse_compare = 0; int reverse_test = 0; rtx compare_result, eq_result; rtx comp_rtx, eq_rtx; - rtx target = operands[0]; enum machine_mode comp_mode; enum machine_mode op_mode; enum spu_comp_code scode, eq_code; enum insn_code ior_code; + enum rtx_code code = GET_CODE (cmp); + rtx op0 = XEXP (cmp, 0); + rtx op1 = XEXP (cmp, 1); int index; int eq_test = 0; - /* When spu_compare_op1 is a CONST_INT change (X >= C) to (X > C-1), + /* When op1 is a CONST_INT change (X >= C) to (X > C-1), and so on, to keep the constant in operand 1. */ - if (GET_CODE (spu_compare_op1) == CONST_INT) + if (GET_CODE (op1) == CONST_INT) { - HOST_WIDE_INT val = INTVAL (spu_compare_op1) - 1; - if (trunc_int_for_mode (val, GET_MODE (spu_compare_op0)) == val) + HOST_WIDE_INT val = INTVAL (op1) - 1; + if (trunc_int_for_mode (val, GET_MODE (op0)) == val) switch (code) { case GE: - spu_compare_op1 = GEN_INT (val); + op1 = GEN_INT (val); code = GT; break; case LT: - spu_compare_op1 = GEN_INT (val); + op1 = GEN_INT (val); code = LE; break; case GEU: - spu_compare_op1 = GEN_INT (val); + op1 = GEN_INT (val); code = GTU; break; case LTU: - spu_compare_op1 = GEN_INT (val); + op1 = GEN_INT (val); code = LEU; break; default: @@ -888,7 +893,7 @@ spu_emit_branch_or_set (int is_set, enum rtx_code code, rtx operands[]) } comp_mode = SImode; - op_mode = GET_MODE (spu_compare_op0); + op_mode = GET_MODE (op0); switch (code) { @@ -1012,18 +1017,18 @@ spu_emit_branch_or_set (int is_set, enum rtx_code code, rtx operands[]) abort (); } - if (GET_MODE (spu_compare_op1) == DFmode + if (GET_MODE (op1) == DFmode && (scode != SPU_GT && scode != SPU_EQ)) abort (); - if (is_set == 0 && spu_compare_op1 == const0_rtx - && (GET_MODE (spu_compare_op0) == SImode - || GET_MODE (spu_compare_op0) == HImode) && scode == SPU_EQ) + if (is_set == 0 && op1 == const0_rtx + && (GET_MODE (op0) == SImode + || GET_MODE (op0) == HImode) && scode == SPU_EQ) { /* Don't need to set a register with the result when we are comparing against zero and branching. */ reverse_test = !reverse_test; - compare_result = spu_compare_op0; + compare_result = op0; } else { @@ -1031,23 +1036,22 @@ spu_emit_branch_or_set (int is_set, enum rtx_code code, rtx operands[]) if (reverse_compare) { - rtx t = spu_compare_op1; - spu_compare_op1 = spu_compare_op0; - spu_compare_op0 = t; + rtx t = op1; + op1 = op0; + op0 = t; } if (spu_comp_icode[index][scode] == 0) abort (); if (!(*insn_data[spu_comp_icode[index][scode]].operand[1].predicate) - (spu_compare_op0, op_mode)) - spu_compare_op0 = force_reg (op_mode, spu_compare_op0); + (op0, op_mode)) + op0 = force_reg (op_mode, op0); if (!(*insn_data[spu_comp_icode[index][scode]].operand[2].predicate) - (spu_compare_op1, op_mode)) - spu_compare_op1 = force_reg (op_mode, spu_compare_op1); + (op1, op_mode)) + op1 = force_reg (op_mode, op1); comp_rtx = GEN_FCN (spu_comp_icode[index][scode]) (compare_result, - spu_compare_op0, - spu_compare_op1); + op0, op1); if (comp_rtx == 0) abort (); emit_insn (comp_rtx); @@ -1056,8 +1060,7 @@ spu_emit_branch_or_set (int is_set, enum rtx_code code, rtx operands[]) { eq_result = gen_reg_rtx (comp_mode); eq_rtx = GEN_FCN (spu_comp_icode[index][eq_code]) (eq_result, - spu_compare_op0, - spu_compare_op1); + op0, op1); if (eq_rtx == 0) abort (); emit_insn (eq_rtx); @@ -1088,13 +1091,14 @@ spu_emit_branch_or_set (int is_set, enum rtx_code code, rtx operands[]) else bcomp = gen_rtx_NE (comp_mode, compare_result, const0_rtx); - loc_ref = gen_rtx_LABEL_REF (VOIDmode, target); + loc_ref = gen_rtx_LABEL_REF (VOIDmode, operands[3]); emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, gen_rtx_IF_THEN_ELSE (VOIDmode, bcomp, loc_ref, pc_rtx))); } else if (is_set == 2) { + rtx target = operands[0]; int compare_size = GET_MODE_BITSIZE (comp_mode); int target_size = GET_MODE_BITSIZE (GET_MODE (target)); enum machine_mode mode = mode_for_size (target_size, MODE_INT, 0); @@ -1129,6 +1133,7 @@ spu_emit_branch_or_set (int is_set, enum rtx_code code, rtx operands[]) } else { + rtx target = operands[0]; if (reverse_test) emit_insn (gen_rtx_SET (VOIDmode, compare_result, gen_rtx_NOT (comp_mode, compare_result))); @@ -3611,9 +3616,9 @@ spu_legitimate_constant_p (rtx x) The alignment matters in the reg+const case because lqd and stqd ignore the 4 least significant bits of the const. (TODO: It might be preferable to allow any alignment and fix it up when splitting.) */ -int -spu_legitimate_address (enum machine_mode mode ATTRIBUTE_UNUSED, - rtx x, int reg_ok_strict) +bool +spu_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, + rtx x, bool reg_ok_strict) { if (mode == TImode && GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h index ed92715cd01..f994f3709c1 100644 --- a/gcc/config/spu/spu.h +++ b/gcc/config/spu/spu.h @@ -416,17 +416,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \ #define MAX_REGS_PER_ADDRESS 2 -#ifdef REG_OK_STRICT -# define REG_OK_STRICT_FLAG 1 -#else -# define REG_OK_STRICT_FLAG 0 -#endif - -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ - { if (spu_legitimate_address (MODE, X, REG_OK_STRICT_FLAG)) \ - goto ADDR; \ - } - #define LEGITIMATE_CONSTANT_P(X) spu_legitimate_constant_p(X) @@ -606,11 +595,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \ } \ } while (0) -/* These are set by the cmp patterns and used while expanding - conditional branches. */ -extern GTY(()) rtx spu_compare_op0; -extern GTY(()) rtx spu_compare_op1; - /* Builtins. */ diff --git a/gcc/config/spu/spu.md b/gcc/config/spu/spu.md index bd6936fd9e3..db42db16111 100644 --- a/gcc/config/spu/spu.md +++ b/gcc/config/spu/spu.md @@ -3657,57 +3657,6 @@ selb\t%0,%4,%0,%3" [(set_attr "type" "br")]) -;; Compare insns are next. Note that the spu has two types of compares, -;; signed & unsigned, and one type of branch. -;; -;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc -;; insns, and branches. We store the operands of compares until we see -;; how it is used. - -(define_expand "cmp<mode>" - [(set (cc0) - (compare (match_operand:VQHSI 0 "spu_reg_operand" "") - (match_operand:VQHSI 1 "spu_nonmem_operand" "")))] - "" - { - spu_compare_op0 = operands[0]; - spu_compare_op1 = operands[1]; - DONE; - }) - -(define_expand "cmp<mode>" - [(set (cc0) - (compare (match_operand:DTI 0 "spu_reg_operand" "") - (match_operand:DTI 1 "spu_reg_operand" "")))] - "" - { - spu_compare_op0 = operands[0]; - spu_compare_op1 = operands[1]; - DONE; - }) - -(define_expand "cmp<mode>" - [(set (cc0) - (compare (match_operand:VSF 0 "spu_reg_operand" "") - (match_operand:VSF 1 "spu_reg_operand" "")))] - "" - { - spu_compare_op0 = operands[0]; - spu_compare_op1 = operands[1]; - DONE; - }) - -(define_expand "cmpdf" - [(set (cc0) - (compare (match_operand:DF 0 "register_operand" "") - (match_operand:DF 1 "register_operand" "")))] - "" - "{ - spu_compare_op0 = operands[0]; - spu_compare_op1 = operands[1]; - DONE; -}") - ;; vector conditional compare patterns (define_expand "vcond<mode>" [(set (match_operand:VCMP 0 "spu_reg_operand" "=r") @@ -3746,108 +3695,72 @@ selb\t%0,%4,%0,%3" ;; branch on condition -(define_expand "beq" - [(use (match_operand 0 "" ""))] - "" - { spu_emit_branch_or_set (0, EQ, operands); DONE; }) - -(define_expand "bne" - [(use (match_operand 0 "" ""))] - "" - { spu_emit_branch_or_set (0, NE, operands); DONE; }) - -(define_expand "bge" - [(use (match_operand 0 "" ""))] - "" - { spu_emit_branch_or_set (0, GE, operands); DONE; }) - -(define_expand "bgt" - [(use (match_operand 0 "" ""))] - "" - { spu_emit_branch_or_set (0, GT, operands); DONE; }) - -(define_expand "ble" - [(use (match_operand 0 "" ""))] - "" - { spu_emit_branch_or_set (0, LE, operands); DONE; }) - -(define_expand "blt" - [(use (match_operand 0 "" ""))] +(define_expand "cbranch<mode>4" + [(use (match_operator 0 "ordered_comparison_operator" + [(match_operand:VQHSI 1 "spu_reg_operand" "") + (match_operand:VQHSI 2 "spu_nonmem_operand" "")])) + (use (match_operand 3 ""))] "" - { spu_emit_branch_or_set (0, LT, operands); DONE; }) + { spu_emit_branch_or_set (0, operands[0], operands); DONE; }) -(define_expand "bgeu" - [(use (match_operand 0 "" ""))] +(define_expand "cbranch<mode>4" + [(use (match_operator 0 "ordered_comparison_operator" + [(match_operand:DTI 1 "spu_reg_operand" "") + (match_operand:DTI 2 "spu_reg_operand" "")])) + (use (match_operand 3 ""))] "" - { spu_emit_branch_or_set (0, GEU, operands); DONE; }) + { spu_emit_branch_or_set (0, operands[0], operands); DONE; }) -(define_expand "bgtu" - [(use (match_operand 0 "" ""))] +(define_expand "cbranch<mode>4" + [(use (match_operator 0 "ordered_comparison_operator" + [(match_operand:VSF 1 "spu_reg_operand" "") + (match_operand:VSF 2 "spu_reg_operand" "")])) + (use (match_operand 3 ""))] "" - { spu_emit_branch_or_set (0, GTU, operands); DONE; }) + { spu_emit_branch_or_set (0, operands[0], operands); DONE; }) -(define_expand "bleu" - [(use (match_operand 0 "" ""))] +(define_expand "cbranchdf4" + [(use (match_operator 0 "ordered_comparison_operator" + [(match_operand:DF 1 "spu_reg_operand" "") + (match_operand:DF 2 "spu_reg_operand" "")])) + (use (match_operand 3 ""))] "" - { spu_emit_branch_or_set (0, LEU, operands); DONE; }) - -(define_expand "bltu" - [(use (match_operand 0 "" ""))] - "" - { spu_emit_branch_or_set (0, LTU, operands); DONE; }) + { spu_emit_branch_or_set (0, operands[0], operands); DONE; }) ;; set on condition -(define_expand "seq" - [(clobber (match_operand:SI 0 "spu_reg_operand" ""))] - "" - { spu_emit_branch_or_set (1, EQ, operands); DONE; }) - -(define_expand "sne" - [(clobber (match_operand:SI 0 "spu_reg_operand" ""))] - "" - { spu_emit_branch_or_set (1, NE, operands); DONE; }) - -(define_expand "sgt" - [(clobber (match_operand:SI 0 "spu_reg_operand" ""))] - "" - { spu_emit_branch_or_set (1, GT, operands); DONE; }) - -(define_expand "slt" - [(clobber (match_operand:SI 0 "spu_reg_operand" ""))] - "" - { spu_emit_branch_or_set (1, LT, operands); DONE; }) - -(define_expand "sge" - [(clobber (match_operand:SI 0 "spu_reg_operand" ""))] - "" - { spu_emit_branch_or_set (1, GE, operands); DONE; }) - -(define_expand "sle" - [(clobber (match_operand:SI 0 "spu_reg_operand" ""))] - "" - { spu_emit_branch_or_set (1, LE, operands); DONE; }) - -(define_expand "sgtu" - [(clobber (match_operand:SI 0 "spu_reg_operand" ""))] +(define_expand "cstore<mode>4" + [(use (match_operator 1 "ordered_comparison_operator" + [(match_operand:VQHSI 2 "spu_reg_operand" "") + (match_operand:VQHSI 3 "spu_nonmem_operand" "")])) + (clobber (match_operand:SI 0 "spu_reg_operand"))] "" - { spu_emit_branch_or_set (1, GTU, operands); DONE; }) + { spu_emit_branch_or_set (1, operands[1], operands); DONE; }) -(define_expand "sltu" - [(clobber (match_operand:SI 0 "spu_reg_operand" ""))] +(define_expand "cstore<mode>4" + [(use (match_operator 1 "ordered_comparison_operator" + [(match_operand:DTI 2 "spu_reg_operand" "") + (match_operand:DTI 3 "spu_reg_operand" "")])) + (clobber (match_operand:SI 0 "spu_reg_operand"))] "" - { spu_emit_branch_or_set (1, LTU, operands); DONE; }) + { spu_emit_branch_or_set (1, operands[1], operands); DONE; }) -(define_expand "sgeu" - [(clobber (match_operand:SI 0 "spu_reg_operand" ""))] +(define_expand "cstore<mode>4" + [(use (match_operator 1 "ordered_comparison_operator" + [(match_operand:VSF 2 "spu_reg_operand" "") + (match_operand:VSF 3 "spu_reg_operand" "")])) + (clobber (match_operand:SI 0 "spu_reg_operand"))] "" - { spu_emit_branch_or_set (1, GEU, operands); DONE; }) + { spu_emit_branch_or_set (1, operands[1], operands); DONE; }) -(define_expand "sleu" - [(clobber (match_operand:SI 0 "spu_reg_operand" ""))] +(define_expand "cstoredf4" + [(use (match_operator 1 "ordered_comparison_operator" + [(match_operand:DF 2 "spu_reg_operand" "") + (match_operand:DF 3 "spu_reg_operand" "")])) + (clobber (match_operand:SI 0 "spu_reg_operand"))] "" - { spu_emit_branch_or_set (1, LEU, operands); DONE; }) + { spu_emit_branch_or_set (1, operands[1], operands); DONE; }) ;; conditional move @@ -3863,12 +3776,12 @@ selb\t%0,%4,%0,%3" (define_expand "mov<mode>cc" [(set (match_operand:ALL 0 "spu_reg_operand" "") - (if_then_else:ALL (match_operand 1 "comparison_operator" "") + (if_then_else:ALL (match_operand 1 "ordered_comparison_operator" "") (match_operand:ALL 2 "spu_reg_operand" "") (match_operand:ALL 3 "spu_reg_operand" "")))] "" { - spu_emit_branch_or_set(2, GET_CODE(operands[1]), operands); + spu_emit_branch_or_set(2, operands[1], operands); DONE; }) |