1 ;; Predicate definitions for Altera Nios II.
2 ;; Copyright (C) 2012-2015 Free Software Foundation, Inc.
3 ;; Contributed by Chung-Lin Tang <cltang@codesourcery.com>
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
12 ;; GCC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public 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 "const_0_operand"
22 (and (match_code "const_int,const_double,const_vector")
23 (match_test "op == CONST0_RTX (GET_MODE (op))")))
25 (define_predicate "reg_or_0_operand"
26 (ior (match_operand 0 "const_0_operand")
27 (match_operand 0 "register_operand")))
29 (define_predicate "const_uns_arith_operand"
30 (and (match_code "const_int")
31 (match_test "SMALL_INT_UNSIGNED (INTVAL (op))")))
33 (define_predicate "uns_arith_operand"
34 (ior (match_operand 0 "const_uns_arith_operand")
35 (match_operand 0 "register_operand")))
37 (define_predicate "const_arith_operand"
38 (and (match_code "const_int")
39 (match_test "SMALL_INT (INTVAL (op))")))
41 (define_predicate "arith_operand"
42 (ior (match_operand 0 "const_arith_operand")
43 (match_operand 0 "register_operand")))
45 (define_predicate "add_regimm_operand"
46 (ior (match_operand 0 "arith_operand")
47 (match_test "nios2_unspec_reloc_p (op)")))
49 (define_predicate "const_logical_operand"
50 (and (match_code "const_int")
51 (match_test "(INTVAL (op) & 0xffff) == 0
52 || (INTVAL (op) & 0xffff0000) == 0")))
54 (define_predicate "logical_operand"
55 (ior (match_operand 0 "const_logical_operand")
56 (match_operand 0 "register_operand")))
58 (define_predicate "const_shift_operand"
59 (and (match_code "const_int")
60 (match_test "SHIFT_INT (INTVAL (op))")))
62 (define_predicate "shift_operand"
63 (ior (match_operand 0 "const_shift_operand")
64 (match_operand 0 "register_operand")))
66 (define_predicate "call_operand"
67 (ior (match_operand 0 "immediate_operand")
68 (match_operand 0 "register_operand")))
70 (define_predicate "rdwrctl_operand"
71 (and (match_code "const_int")
72 (match_test "RDWRCTL_INT (INTVAL (op))")))
74 (define_predicate "custom_insn_opcode"
75 (and (match_code "const_int")
76 (match_test "CUSTOM_INSN_OPCODE (INTVAL (op))")))
78 (define_special_predicate "expandable_comparison_operator"
79 (match_operand 0 "ordered_comparison_operator")
81 return (GET_MODE_CLASS (GET_MODE (XEXP (op, 0))) != MODE_FLOAT
82 || nios2_validate_fpu_compare (GET_MODE (XEXP (op, 0)), &op,
83 &XEXP (op, 0), &XEXP (op, 1),