1 |
282 |
jeremybenn |
;; GCC machine description for picochip
|
2 |
|
|
;; Copyright (C) 2008 Free Software Foundation, Inc.
|
3 |
|
|
;; Contributed by picoChip Designs Ltd (http://www.picochip.com)
|
4 |
|
|
;; Maintained by Daniel Towner (dant@picochip.com) and Hariharan
|
5 |
|
|
;; Sandanagobalane (hariharan@picochip.com)
|
6 |
|
|
;;
|
7 |
|
|
;; This file is part of GCC.
|
8 |
|
|
;;
|
9 |
|
|
;; GCC is free software; you can redistribute it and/or modify
|
10 |
|
|
;; it under the terms of the GNU General Public License as published by
|
11 |
|
|
;; the Free Software Foundation; either version 3, or (at your option)
|
12 |
|
|
;; any later version.
|
13 |
|
|
;;
|
14 |
|
|
;; GCC is distributed in the hope that it will be useful,
|
15 |
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
|
|
;; GNU General Public License for more details.
|
18 |
|
|
;;
|
19 |
|
|
;; You should have received a copy of the GNU General Public License
|
20 |
|
|
;; along with GCC; see the file COPYING3. If not, see
|
21 |
|
|
;; .
|
22 |
|
|
|
23 |
|
|
(define_predicate "picochip_register_or_immediate_operand"
|
24 |
|
|
(ior (match_operand 0 "register_operand")
|
25 |
|
|
(match_operand 0 "immediate_operand")))
|
26 |
|
|
|
27 |
|
|
(define_predicate "power_of_2_imm_operand"
|
28 |
|
|
(match_code "const_int")
|
29 |
|
|
{
|
30 |
|
|
if (GET_CODE (op) == CONST_INT)
|
31 |
|
|
{
|
32 |
|
|
if (exact_log2 (INTVAL (op)) <= 16 && exact_log2 (INTVAL (op)) > 0)
|
33 |
|
|
return 1;
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
return 0;
|
37 |
|
|
})
|
38 |
|
|
|
39 |
|
|
;; Limit the comparison operators to a selected subset.
|
40 |
|
|
(define_predicate "picochip_supported_comparison_operator"
|
41 |
|
|
(and (match_operand 0 "comparison_operator")
|
42 |
|
|
(match_code "ne,eq,ge,geu,lt,ltu")))
|
43 |
|
|
(define_predicate "picochip_peephole_comparison_operator"
|
44 |
|
|
(and (match_operand 0 "comparison_operator")
|
45 |
|
|
(match_code "ne,eq")))
|
46 |
|
|
|
47 |
|
|
;; Allow selected arithmetic operators to apply a shift to their first
|
48 |
|
|
;; operands
|
49 |
|
|
|
50 |
|
|
(define_predicate "picochip_first_op_shift_operator"
|
51 |
|
|
(match_code "and,plus,minus,ior,xor"))
|
52 |
|
|
|
53 |
|
|
;; The same as the previous predicate, but only allowing those
|
54 |
|
|
;; operators which can accept an immediate.
|
55 |
|
|
(define_predicate "picochip_first_op_shift_operator_imm"
|
56 |
|
|
(match_code "plus,minus"))
|
57 |
|
|
|
58 |
|
|
;; Predicate on a J type integer.
|
59 |
|
|
(define_predicate "picochip_J_operand"
|
60 |
|
|
(match_operand 0 "immediate_operand")
|
61 |
|
|
{
|
62 |
|
|
return (CONST_INT == GET_CODE(op) &&
|
63 |
|
|
picochip_const_ok_for_letter_p (INTVAL(op), 'J'));
|
64 |
|
|
})
|
65 |
|
|
|
66 |
|
|
;; Is the operand suitable for use in a compare?
|
67 |
|
|
|
68 |
|
|
(define_predicate "picochip_comparison_operand"
|
69 |
|
|
(ior (match_operand 0 "register_operand")
|
70 |
|
|
(and (match_operand 0 "immediate_operand")
|
71 |
|
|
(match_test "picochip_const_ok_for_letter_p(INTVAL(op), 'O')"))))
|
72 |
|
|
|