annotate gcc/config/microblaze/predicates.md @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents 561a7518be6b
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 ;; Predicate definitions for Xilinx MicroBlaze
111
kono
parents: 68
diff changeset
2 ;; Copyright (C) 2009-2017 Free Software Foundation, Inc.
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 ;;
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 ;; Contributed by Michael Eager <eager@eagercon.com>.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 ;;
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 ;; This file is part of GCC.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 ;;
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 ;; GCC is free software; you can redistribute it and/or modify
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ;; it under the terms of the GNU General Public License as published by
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 ;; the Free Software Foundation; either version 3, or (at your option)
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 ;; any later version.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 ;;
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 ;; GCC is distributed in the hope that it will be useful,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 ;; GNU General Public License for more details.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 ;;
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 ;; You should have received a copy of the GNU General Public License
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 ;; along with GCC; see the file COPYING3. If not see
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 ;; <http://www.gnu.org/licenses/>.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 ;; Return whether OP can be used as an operands in arithmetic.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 (define_predicate "arith_operand"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 (ior (match_code "const_int,const_double")
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 (match_operand 0 "register_operand")))
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 (define_predicate "arith_operand32"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 (ior (match_operand 0 "register_operand")
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 (and (match_code "const_int,const_double")
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 (match_test "LARGE_INT (op)"))))
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
111
kono
parents: 68
diff changeset
33 (define_predicate "arith_plus_operand"
kono
parents: 68
diff changeset
34 (match_operand 0 "general_operand")
kono
parents: 68
diff changeset
35 {
kono
parents: 68
diff changeset
36 switch (GET_CODE (op))
kono
parents: 68
diff changeset
37 {
kono
parents: 68
diff changeset
38 default:
kono
parents: 68
diff changeset
39 return 0;
kono
parents: 68
diff changeset
40 case CONST_INT:
kono
parents: 68
diff changeset
41 case REG:
kono
parents: 68
diff changeset
42 return 1;
kono
parents: 68
diff changeset
43 case SYMBOL_REF:
kono
parents: 68
diff changeset
44 case LABEL_REF:
kono
parents: 68
diff changeset
45 if (flag_pic || microblaze_tls_referenced_p(op))
kono
parents: 68
diff changeset
46 return 0;
kono
parents: 68
diff changeset
47 return 1;
kono
parents: 68
diff changeset
48 case CONST:
kono
parents: 68
diff changeset
49 {
kono
parents: 68
diff changeset
50 rtx const0;
kono
parents: 68
diff changeset
51 const0 = XEXP (op, 0);
kono
parents: 68
diff changeset
52
kono
parents: 68
diff changeset
53 switch (GET_CODE(const0))
kono
parents: 68
diff changeset
54 {
kono
parents: 68
diff changeset
55 default:
kono
parents: 68
diff changeset
56 return 0;
kono
parents: 68
diff changeset
57 case UNSPEC :
kono
parents: 68
diff changeset
58 return 1;
kono
parents: 68
diff changeset
59
kono
parents: 68
diff changeset
60 case PLUS :
kono
parents: 68
diff changeset
61 {
kono
parents: 68
diff changeset
62 rtx p0, p1;
kono
parents: 68
diff changeset
63 p0 = XEXP (const0, 0);
kono
parents: 68
diff changeset
64 p1 = XEXP (const0, 1);
kono
parents: 68
diff changeset
65
kono
parents: 68
diff changeset
66 if ((GET_CODE(p0) == SYMBOL_REF
kono
parents: 68
diff changeset
67 || GET_CODE (p0) == LABEL_REF)
kono
parents: 68
diff changeset
68 && GET_CODE(p1) == CONST_INT)
kono
parents: 68
diff changeset
69 {
kono
parents: 68
diff changeset
70 return arith_plus_operand (p0, GET_MODE(p0));
kono
parents: 68
diff changeset
71 }
kono
parents: 68
diff changeset
72 }
kono
parents: 68
diff changeset
73 }
kono
parents: 68
diff changeset
74 }
kono
parents: 68
diff changeset
75 }
kono
parents: 68
diff changeset
76 return 0;
kono
parents: 68
diff changeset
77 })
kono
parents: 68
diff changeset
78
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 (define_predicate "const_0_operand"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 (and (match_code "const_int,const_double")
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 (match_test "op == CONST0_RTX (GET_MODE (op))")))
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 ;; Return whether OP is a register or the constant 0.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 (define_predicate "reg_or_0_operand"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 (ior (match_operand 0 "const_0_operand")
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 (match_operand 0 "register_operand")))
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
111
kono
parents: 68
diff changeset
88 (define_predicate "reg_or_mem_operand"
kono
parents: 68
diff changeset
89 (ior (match_operand 0 "memory_operand")
kono
parents: 68
diff changeset
90 (match_operand 0 "register_operand")))
kono
parents: 68
diff changeset
91
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 ;; Return if the operand is either the PC or a label_ref.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 (define_special_predicate "pc_or_label_operand"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 (ior (match_code "pc,label_ref")
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 (and (match_code "symbol_ref")
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 (match_test "!(strcmp ((XSTR (op, 0)), \"_stack_overflow_exit\"))"))))
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 ;; Test for valid call operand
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 (define_predicate "call_insn_operand"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 (match_test "CALL_INSN_OP (op)"))
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101
111
kono
parents: 68
diff changeset
102 (define_predicate "call_insn_simple_operand"
kono
parents: 68
diff changeset
103 (and (match_test "CALL_INSN_OP (op)")
kono
parents: 68
diff changeset
104 (match_test "GET_CODE (op) == REG || GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST_INT")))
kono
parents: 68
diff changeset
105
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 ;; Return if OPERAND is valid as a source operand for a move instruction.
111
kono
parents: 68
diff changeset
107 (define_predicate "move_src_operand"
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 (and (
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 not (
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 and (match_code "plus")
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 (not (match_test "(GET_CODE (XEXP (op, 0)) == REG) ^ (GET_CODE (XEXP (op,1)) == REG)"))
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 )
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 )
111
kono
parents: 68
diff changeset
114 (match_operand 0 "general_operand"))
kono
parents: 68
diff changeset
115 {
kono
parents: 68
diff changeset
116 if (microblaze_tls_referenced_p(op)
kono
parents: 68
diff changeset
117 || (flag_pic && (symbol_mentioned_p(op) || label_mentioned_p(op))))
kono
parents: 68
diff changeset
118 return false;
kono
parents: 68
diff changeset
119
kono
parents: 68
diff changeset
120 return true;
kono
parents: 68
diff changeset
121 })
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 ;; Test for valid PIC call operand
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 (define_predicate "call_insn_plt_operand"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 (match_test "PLT_ADDR_P (op)"))
111
kono
parents: 68
diff changeset
126
kono
parents: 68
diff changeset
127 ;; Return if the code of this rtx pattern is a comparison.
kono
parents: 68
diff changeset
128 (define_predicate "cmp_op"
kono
parents: 68
diff changeset
129 (match_code "gt,ge,gtu,geu,lt,le,ltu,leu"))