From: Chris Schlumberger-Socha Date: Thu, 23 May 2013 14:09:39 +0000 (+0000) Subject: [AArch64] Refactor aarch64_mov_operand predicate. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=83f8c41484c57a38a8749128ecdceb8dd963a69c;p=gcc.git [AArch64] Refactor aarch64_mov_operand predicate. Co-Authored-By: Marcus Shawcroft From-SVN: r199259 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 02335f0a45e..3ba9d4eae3e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-05-23 Chris Schlumberger-Socha + Marcus Shawcroft + + * config/aarch64/aarch64-protos.h (aarch64_mov_operand_p): Define. + * config/aarch64/aarch64.c (aarch64_mov_operand_p): Define. + * config/aarch64/predicates.md (aarch64_const_address): Remove. + (aarch64_mov_operand): Use aarch64_mov_operand_p. + 2013-05-23 Vidya Praveen * config/aarch64/aarch64-simd.md (clzv4si2): Support for CLZ diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 001842e43b4..91fcde80cf6 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -146,6 +146,8 @@ bool aarch64_is_long_call_p (rtx); bool aarch64_label_mentioned_p (rtx); bool aarch64_legitimate_pic_operand_p (rtx); bool aarch64_move_imm (HOST_WIDE_INT, enum machine_mode); +bool aarch64_mov_operand_p (rtx, enum aarch64_symbol_context, + enum machine_mode); bool aarch64_pad_arg_upward (enum machine_mode, const_tree); bool aarch64_pad_reg_upward (enum machine_mode, const_tree, bool); bool aarch64_regno_ok_for_base_p (int, bool); diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index a0aff58668b..12a70558782 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -6455,6 +6455,25 @@ aarch64_simd_imm_scalar_p (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED) return true; } +bool +aarch64_mov_operand_p (rtx x, + enum aarch64_symbol_context context ATTRIBUTE_UNUSED, + enum machine_mode mode) +{ + + if (GET_CODE (x) == HIGH + && aarch64_valid_symref (XEXP (x, 0), GET_MODE (XEXP (x, 0)))) + return true; + + if (CONST_INT_P (x) && aarch64_move_imm (INTVAL (x), mode)) + return true; + + if (GET_CODE (x) == SYMBOL_REF && mode == DImode && CONSTANT_ADDRESS_P (x)) + return true; + + return false; +} + /* Return a const_int vector of VAL. */ rtx aarch64_simd_gen_const_vector_dup (enum machine_mode mode, int val) diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md index 8514e8f8fbd..16c4385e845 100644 --- a/gcc/config/aarch64/predicates.md +++ b/gcc/config/aarch64/predicates.md @@ -115,10 +115,6 @@ (match_test "aarch64_legitimate_address_p (mode, XEXP (op, 0), PARALLEL, 0)"))) -(define_predicate "aarch64_const_address" - (and (match_code "symbol_ref") - (match_test "mode == DImode && CONSTANT_ADDRESS_P (op)"))) - (define_predicate "aarch64_valid_symref" (match_code "const, symbol_ref, label_ref") { @@ -173,12 +169,7 @@ (and (match_code "reg,subreg,mem,const_int,symbol_ref,high") (ior (match_operand 0 "register_operand") (ior (match_operand 0 "memory_operand") - (ior (match_test "GET_CODE (op) == HIGH - && aarch64_valid_symref (XEXP (op, 0), - GET_MODE (XEXP (op, 0)))") - (ior (match_test "CONST_INT_P (op) - && aarch64_move_imm (INTVAL (op), mode)") - (match_test "aarch64_const_address (op, mode)"))))))) + (match_test "aarch64_mov_operand_p (op, SYMBOL_CONTEXT_ADR, mode)"))))) (define_predicate "aarch64_movti_operand" (and (match_code "reg,subreg,mem,const_int")