1 ;; Code and mode itertator and attribute definitions
2 ;; of Andes NDS32 cpu for GNU compiler
3 ;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
4 ;; Contributed by Andes Technology Corporation.
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 3, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 ;;----------------------------------------------------------------------------
24 ;;----------------------------------------------------------------------------
26 ;; A list of integer modes that are up to one word long.
27 (define_mode_iterator QIHISI [QI HI SI])
29 ;; A list of integer modes for one word and double word.
30 (define_mode_iterator SIDI [SI DI])
32 ;; A list of integer modes that are up to one half-word long.
33 (define_mode_iterator QIHI [QI HI])
35 ;; A list of the modes that are up to double-word long.
36 (define_mode_iterator DIDF [DI DF])
38 ;; A list of the modes that are up to one word long vector.
39 (define_mode_iterator VQIHI [V4QI V2HI])
41 ;; A list of the modes that are up to one word long vector
42 ;; and scalar for varies mode.
43 (define_mode_iterator VSHI [V2HI HI])
44 (define_mode_iterator VSQIHI [V4QI V2HI QI HI])
45 (define_mode_iterator VSQIHIDI [V4QI V2HI QI HI DI])
46 (define_mode_iterator VQIHIDI [V4QI V2HI DI])
48 ;; A list of the modes that are up to double-word long.
49 (define_mode_iterator ANYF [(SF "TARGET_FPU_SINGLE")
50 (DF "TARGET_FPU_DOUBLE")])
52 ;;----------------------------------------------------------------------------
54 ;;----------------------------------------------------------------------------
56 (define_mode_attr size [(QI "b") (HI "h") (SI "w") (SF "s") (DF "d")])
58 (define_mode_attr byte [(QI "1") (HI "2") (SI "4") (V4QI "4") (V2HI "4")])
60 (define_mode_attr bits [(V4QI "8") (QI "8") (V2HI "16") (HI "16") (DI "64")])
62 (define_mode_attr VELT [(V4QI "QI") (V2HI "HI")])
64 ;;----------------------------------------------------------------------------
66 ;;----------------------------------------------------------------------------
69 (define_code_iterator shift_rotate [ashift ashiftrt lshiftrt rotatert])
71 (define_code_iterator shifts [ashift ashiftrt lshiftrt])
73 (define_code_iterator shiftrt [ashiftrt lshiftrt])
75 (define_code_iterator sat_plus [ss_plus us_plus])
77 (define_code_iterator all_plus [plus ss_plus us_plus])
79 (define_code_iterator sat_minus [ss_minus us_minus])
81 (define_code_iterator all_minus [minus ss_minus us_minus])
83 (define_code_iterator plus_minus [plus minus])
85 (define_code_iterator extend [sign_extend zero_extend])
87 (define_code_iterator sumax [smax umax])
89 (define_code_iterator sumin [smin umin])
91 (define_code_iterator sumin_max [smax umax smin umin])
93 ;;----------------------------------------------------------------------------
95 ;;----------------------------------------------------------------------------
98 (define_code_attr shift
99 [(ashift "ashl") (ashiftrt "ashr") (lshiftrt "lshr") (rotatert "rotr")])
102 [(ashiftrt "") (lshiftrt "u") (sign_extend "s") (zero_extend "u")])
105 [(sign_extend "s") (zero_extend "z")])
108 [(plus "") (ss_plus "k") (us_plus "uk")
109 (minus "") (ss_minus "k") (us_minus "uk")])
111 (define_code_attr opcode
112 [(plus "add") (minus "sub") (smax "smax") (umax "umax") (smin "smin") (umin "umin")])
114 (define_code_attr add_rsub
115 [(plus "a") (minus "rs")])
117 (define_code_attr add_sub
118 [(plus "a") (minus "s")])
120 ;;----------------------------------------------------------------------------