1 ;; Predicate definitions of Andes NDS32 cpu for GNU compiler
2 ;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
3 ;; Contributed by Andes Technology Corporation.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 3, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 (define_predicate "nds32_equality_comparison_operator"
24 (define_predicate "nds32_greater_less_comparison_operator"
25 (match_code "gt,ge,lt,le"))
27 (define_special_predicate "nds32_logical_binary_operator"
28 (match_code "and,ior,xor"))
30 (define_predicate "nds32_symbolic_operand"
31 (match_code "const,symbol_ref,label_ref"))
33 (define_predicate "nds32_reg_constant_operand"
34 (ior (match_operand 0 "register_operand")
35 (match_operand 0 "const_int_operand")))
37 (define_predicate "nds32_rimm15s_operand"
38 (ior (match_operand 0 "register_operand")
39 (and (match_operand 0 "const_int_operand")
40 (match_test "satisfies_constraint_Is15 (op)"))))
42 (define_predicate "nds32_imm5u_operand"
43 (and (match_operand 0 "const_int_operand")
44 (match_test "satisfies_constraint_Iu05 (op)")))
46 (define_predicate "nds32_move_operand"
47 (and (match_operand 0 "general_operand")
48 (not (match_code "high,const,symbol_ref,label_ref")))
50 /* If the constant op does NOT satisfy Is20 nor Ihig,
51 we can not perform move behavior by a single instruction. */
53 && !satisfies_constraint_Is20 (op)
54 && !satisfies_constraint_Ihig (op))
60 (define_predicate "nds32_lmw_smw_base_operand"
61 (and (match_code "mem")
62 (match_test "nds32_valid_smw_lwm_base_p (op)")))
64 (define_special_predicate "nds32_load_multiple_operation"
65 (match_code "parallel")
67 /* To verify 'load' operation, pass 'true' for the second argument.
68 See the implementation in nds32.c for details. */
69 return nds32_valid_multiple_load_store_p (op, true, false);
72 (define_special_predicate "nds32_load_multiple_and_update_address_operation"
73 (match_code "parallel")
75 /* To verify 'load' operation, pass 'true' for the second argument.
76 to verify 'update address' operation, pass 'true' for the third argument
77 See the implementation in nds32.c for details. */
78 return nds32_valid_multiple_load_store_p (op, true, true);
81 (define_special_predicate "nds32_store_multiple_operation"
82 (match_code "parallel")
84 /* To verify 'store' operation, pass 'false' for the second argument.
85 See the implementation in nds32.c for details. */
86 return nds32_valid_multiple_load_store_p (op, false, false);
89 (define_special_predicate "nds32_store_multiple_and_update_address_operation"
90 (match_code "parallel")
92 /* To verify 'store' operation, pass 'false' for the second argument,
93 to verify 'update address' operation, pass 'true' for the third argument
94 See the implementation in nds32.c for details. */
95 return nds32_valid_multiple_load_store_p (op, false, true);
98 (define_special_predicate "nds32_stack_push_operation"
99 (match_code "parallel")
101 /* To verify 'push' operation, pass 'true' for the second argument.
102 See the implementation in nds32-predicates.c for details. */
103 return nds32_valid_stack_push_pop_p (op, true);
106 (define_special_predicate "nds32_stack_pop_operation"
107 (match_code "parallel")
109 /* To verify 'pop' operation, pass 'false' for the second argument.
110 See the implementation in nds32-predicates.c for details. */
111 return nds32_valid_stack_push_pop_p (op, false);
114 ;; ------------------------------------------------------------------------