OSDN Git Service

Use datarootdir for locales.
[pf3gnuchains/pf3gnuchains4x.git] / include / opcode / tic6x-opcode-table.h
1 /* TI C6X opcode table.
2    Copyright 2010, 2011
3    Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
18    MA 02110-1301, USA.  */
19
20 /* Define the INSN macro before including this file; it takes as
21    arguments the fields from tic6x_opcode (defined in tic6x.h).  The
22    name is given as an identifier; the subsequent four operands should
23    have "tic6x_func_unit_", "tic6x_insn_format_", "tic6x_pipeline_"
24    and "TIC6X_INSN_", respectively, prepended to them by the macro
25    definition.  Also define INSNE, which has a second argument that
26    goes after tic6x_opcode_NAME_ to form the enumeration value for
27    this instruction, where the value otherwise formed from the name,
28    functional unit and format is ambiguous, but otherwise has the same
29    arguments as INSN.  */
30
31 #define TIC6X_INSN_C64X_AND_C67X TIC6X_INSN_C64X|TIC6X_INSN_C67X
32 #define tic6x_insn_format_nfu_s_branch_nop_cst  \
33   tic6x_insn_format_s_branch_nop_cst
34 #define tic6x_insn_format_s_l_1_or_2_src tic6x_insn_format_l_1_or_2_src
35 #define RAN(id, min, max) { CONCAT2(tic6x_field_,id), (min), (max) }
36 #define FIX(id, val) RAN(id, val, val)
37 #define FIX0() 0, { { 0, 0, 0 } }
38 #define FIX1(a) 1, { a }
39 #define FIX2(a, b) 2, { a, b }
40 #define FIX3(a, b, c) 3, { a, b, c }
41 #define FIX4(a, b, c, d) 4, { a, b, c, d }
42 #define OP0() 0, { { 0, 0, FALSE, 0, 0, 0, 0 } }
43 #define OP1(a) 1, { a }
44 #define OP2(a, b) 2, { a, b }
45 #define OP3(a, b, c) 3, { a, b, c }
46 #define OP4(a, b, c, d) 4, { a, b, c, d }
47 #define OACST { tic6x_operand_asm_const, 0, tic6x_rw_none, 0, 0, 0, 0 }
48 #define OLCST { tic6x_operand_link_const, 0, tic6x_rw_none, 0, 0, 0, 0 }
49 #define OFULIST { tic6x_operand_func_unit, 0, tic6x_rw_none, 0, 0, 0, 0 }
50 #define ORIRP1 { tic6x_operand_irp, 4, tic6x_rw_read, 1, 1, 0, 0 }
51 #define ORNRP1 { tic6x_operand_nrp, 4, tic6x_rw_read, 1, 1, 0, 0 }
52 #define OWREG1 { tic6x_operand_reg, 4, tic6x_rw_write, 1, 1, 0, 0 }
53 #define OWRETREG1 { tic6x_operand_retreg, 4, tic6x_rw_write, 1, 1, 0, 0 }
54 #define ORREG1 { tic6x_operand_reg, 4, tic6x_rw_read, 1, 1, 0, 0 }
55 #define ORDREG1 { tic6x_operand_dreg, 4, tic6x_rw_read, 1, 1, 0, 0 }
56 #define ORWREG1 { tic6x_operand_reg, 4, tic6x_rw_read_write, 1, 1, 0, 0 }
57 #define ORAREG1 { tic6x_operand_areg, 4, tic6x_rw_read, 1, 1, 0, 0 }
58 #define ORXREG1 { tic6x_operand_xreg, 4, tic6x_rw_read, 1, 1, 0, 0 }
59 #define ORREG12 { tic6x_operand_reg, 4, tic6x_rw_read, 1, 2, 0, 0 }
60 #define ORREG14 { tic6x_operand_reg, 4, tic6x_rw_read, 1, 4, 0, 0 }
61 #define ORXREG14 { tic6x_operand_xreg, 4, tic6x_rw_read, 1, 4, 0, 0 }
62 #define OWREG2 { tic6x_operand_reg, 4, tic6x_rw_write, 2, 2, 0, 0 }
63 #define OWREG4 { tic6x_operand_reg, 4, tic6x_rw_write, 4, 4, 0, 0 }
64 #define OWREG9 { tic6x_operand_reg, 4, tic6x_rw_write, 9, 9, 0, 0 }
65 #define OWDREG5 { tic6x_operand_dreg, 4, tic6x_rw_write, 5, 5, 0, 0 }
66 #define OWREGL1 { tic6x_operand_regpair, 5, tic6x_rw_write, 1, 1, 1, 1 }
67 #define ORREGL1 { tic6x_operand_regpair, 5, tic6x_rw_read, 1, 1, 1, 1 }
68 #define OWREGD1 { tic6x_operand_regpair, 8, tic6x_rw_write, 1, 1, 1, 1 }
69 #define OWREGD12 { tic6x_operand_regpair, 8, tic6x_rw_write, 1, 1, 2, 2 }
70 #define OWREGD4 { tic6x_operand_regpair, 8, tic6x_rw_write, 4, 4, 4, 4 }
71 #define ORREGD1 { tic6x_operand_regpair, 8, tic6x_rw_read, 1, 1, 1, 1 }
72 #define OWREGD45 { tic6x_operand_regpair, 8, tic6x_rw_write, 4, 4, 5, 5 }
73 #define OWREGD67 { tic6x_operand_regpair, 8, tic6x_rw_write, 6, 6, 7, 7 }
74 #define ORDREGD1 { tic6x_operand_dregpair, 8, tic6x_rw_read, 1, 1, 1, 1 }
75 #define OWDREGD5 { tic6x_operand_dregpair, 8, tic6x_rw_write, 5, 5, 5, 5 }
76 #define ORREGD12 { tic6x_operand_regpair, 8, tic6x_rw_read, 1, 1, 2, 2 }
77 #define ORXREGD12 { tic6x_operand_xregpair, 8, tic6x_rw_read, 1, 1, 2, 2 }
78 #define ORREGD1234 { tic6x_operand_regpair, 8, tic6x_rw_read, 1, 2, 3, 4 }
79 #define ORREGD1324 { tic6x_operand_regpair, 8, tic6x_rw_read, 1, 3, 2, 4 }
80 #define OWREGD910 { tic6x_operand_regpair, 8, tic6x_rw_write, 9, 9, 10, 10 }
81 #define ORCREG1 { tic6x_operand_ctrl, 4, tic6x_rw_read, 1, 1, 0, 0 }
82 #define OWCREG1 { tic6x_operand_ctrl, 4, tic6x_rw_write, 1, 1, 0, 0 }
83 #define ORMEMDW { tic6x_operand_mem_deref, 4, tic6x_rw_read, 3, 3, 0, 0 }
84 #define OWMEMDW { tic6x_operand_mem_deref, 4, tic6x_rw_write, 3, 3, 0, 0 }
85 #define ORMEMSB { tic6x_operand_mem_short, 1, tic6x_rw_read, 3, 3, 0, 0 }
86 #define OWMEMSB { tic6x_operand_mem_short, 1, tic6x_rw_write, 3, 3, 0, 0 }
87 #define ORMEMLB { tic6x_operand_mem_long, 1, tic6x_rw_read, 3, 3, 0, 0 }
88 #define OWMEMLB { tic6x_operand_mem_long, 1, tic6x_rw_write, 3, 3, 0, 0 }
89 #define ORMEMSH { tic6x_operand_mem_short, 2, tic6x_rw_read, 3, 3, 0, 0 }
90 #define OWMEMSH { tic6x_operand_mem_short, 2, tic6x_rw_write, 3, 3, 0, 0 }
91 #define ORMEMLH { tic6x_operand_mem_long, 2, tic6x_rw_read, 3, 3, 0, 0 }
92 #define OWMEMLH { tic6x_operand_mem_long, 2, tic6x_rw_write, 3, 3, 0, 0 }
93 #define ORMEMSW { tic6x_operand_mem_short, 4, tic6x_rw_read, 3, 3, 0, 0 }
94 #define OWMEMSW { tic6x_operand_mem_short, 4, tic6x_rw_write, 3, 3, 0, 0 }
95 #define ORMEMLW { tic6x_operand_mem_long, 4, tic6x_rw_read, 3, 3, 0, 0 }
96 #define OWMEMLW { tic6x_operand_mem_long, 4, tic6x_rw_write, 3, 3, 0, 0 }
97 #define ORMEMSD { tic6x_operand_mem_short, 8, tic6x_rw_read, 3, 3, 0, 0 }
98 #define OWMEMSD { tic6x_operand_mem_short, 8, tic6x_rw_write, 3, 3, 0, 0 }
99 #define ORMEMND { tic6x_operand_mem_ndw, 8, tic6x_rw_read, 3, 3, 0, 0 }
100 #define OWMEMND { tic6x_operand_mem_ndw, 8, tic6x_rw_write, 3, 3, 0, 0 }
101 #define ENC(id, meth, op) {                     \
102     CONCAT2(tic6x_field_,id),                   \
103     CONCAT2(tic6x_coding_,meth),                \
104     op                                          \
105   }
106 #define ENC0() 0, { { 0, 0, 0 } }
107 #define ENC1(a) 1, { a }
108 #define ENC2(a, b) 2, { a, b }
109 #define ENC3(a, b, c) 3, { a, b, c }
110 #define ENC4(a, b, c, d) 4, { a, b, c, d }
111 #define ENC5(a, b, c, d, e) 5, { a, b, c, d, e }
112 #define ENC6(a, b, c, d, e, f) 6, { a, b, c, d, e, f }
113 #define ENC7(a, b, c, d, e, f, g) 7, { a, b, c, d, e, f, g }
114
115 INSN(abs, l, unary, 1cycle, C62X, 0,
116      FIX1(FIX(op, 0)),
117      OP2(ORXREG1, OWREG1),
118      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
119           ENC(dst, reg, 1)))
120 INSN(abs, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
121      FIX3(FIX(op, 0x38), FIX(x, 0), FIX(src1, 0)),
122      OP2(ORREGL1, OWREGL1),
123      ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
124
125 INSN(abs2, l, unary, 1cycle, C64X, 0,
126      FIX1(FIX(op, 0x4)),
127      OP2(ORXREG1, OWREG1),
128      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
129           ENC(dst, reg, 1)))
130
131 INSN(absdp, s, 1_or_2_src, 2cycle_dp, C67X, TIC6X_FLAG_NO_CROSS,
132      FIX3(FIX(op, 0x2c), FIX(x, 0), FIX(src1, 0)),
133      OP2(ORREGD1, OWREGD12),
134      ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
135
136 INSN(abssp, s, unary, 1cycle, C67X, 0,
137      FIX1(FIX(op, 0)),
138      OP2(ORXREG1, OWREG1),
139      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
140           ENC(dst, reg, 1)))
141
142 INSNE(add, l_si_xsi_si, l, 1_or_2_src, 1cycle, C62X, 0,
143       FIX1(FIX(op, 0x3)),
144       OP3(ORREG1, ORXREG1, OWREG1),
145       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
146            ENC(src2, reg, 1), ENC(dst, reg, 2)))
147 INSNE(add, l_si_xsi_sl, l, 1_or_2_src, 1cycle, C62X, 0,
148       FIX1(FIX(op, 0x23)),
149       OP3(ORREG1, ORXREG1, OWREGL1),
150       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
151            ENC(src2, reg, 1), ENC(dst, reg, 2)))
152 INSNE(add, l_xsi_sl_sl, l, 1_or_2_src, 1cycle, C62X, 0,
153       FIX1(FIX(op, 0x21)),
154       OP3(ORXREG1, ORREGL1, OWREGL1),
155       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
156            ENC(src2, reg, 1), ENC(dst, reg, 2)))
157 INSNE(add, l_s5_xsi_si, l, 1_or_2_src, 1cycle, C62X, 0,
158       FIX1(FIX(op, 0x2)),
159       OP3(OACST, ORXREG1, OWREG1),
160       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
161            ENC(src2, reg, 1), ENC(dst, reg, 2)))
162 INSNE(add, l_s5_sl_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
163       FIX2(FIX(op, 0x20), FIX(x, 0)),
164       OP3(OACST, ORREGL1, OWREGL1),
165       ENC4(ENC(s, fu, 0), ENC(src1, scst, 0), ENC(src2, reg, 1),
166            ENC(dst, reg, 2)))
167 INSNE(add, s_si_xsi_si, s, 1_or_2_src, 1cycle, C62X, 0,
168       FIX1(FIX(op, 0x7)),
169       OP3(ORREG1, ORXREG1, OWREG1),
170       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
171            ENC(src2, reg, 1), ENC(dst, reg, 2)))
172 INSNE(add, s_s5_xsi_si, s, 1_or_2_src, 1cycle, C62X, 0,
173       FIX1(FIX(op, 0x6)),
174       OP3(OACST, ORXREG1, OWREG1),
175       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
176            ENC(src2, reg, 1), ENC(dst, reg, 2)))
177 INSNE(add, d_si_si_si, d, 1_or_2_src, 1cycle, C62X,
178       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
179       FIX1(FIX(op, 0x10)),
180       OP3(ORREG1, ORREG1, OWREG1),
181       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
182            ENC(dst, reg, 2)))
183 INSNE(add, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X,
184       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
185       FIX1(FIX(op, 0x12)),
186       OP3(ORREG1, OACST, OWREG1),
187       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
188            ENC(dst, reg, 2)))
189 INSNE(add, d_si_xsi_si, d, ext_1_or_2_src, 1cycle, C64X, TIC6X_FLAG_PREFER(0),
190       FIX1(FIX(op, 0xa)),
191       OP3(ORREG1, ORXREG1, OWREG1),
192       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
193            ENC(src2, reg, 1), ENC(dst, reg, 2)))
194 INSNE(add, d_xsi_s5_si, d, ext_1_or_2_src, 1cycle, C64X, TIC6X_FLAG_PREFER(0),
195       FIX1(FIX(op, 0xb)),
196       OP3(ORXREG1, OACST, OWREG1),
197       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
198            ENC(src1, scst, 1), ENC(dst, reg, 2)))
199
200 INSNE(addab, d_si_si_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
201       FIX1(FIX(op, 0x30)),
202       OP3(ORREG1, ORREG1, OWREG1),
203       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
204            ENC(dst, reg, 2)))
205 INSNE(addab, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X,
206       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
207       FIX1(FIX(op, 0x32)),
208       OP3(ORREG1, OACST, OWREG1),
209       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
210            ENC(dst, reg, 2)))
211 INSN(addab, d, adda_long, 1cycle, C64XP, TIC6X_FLAG_PREFER(0),
212      FIX1(FIX(op, 3)),
213      OP3(ORAREG1, OLCST, OWREG1),
214      ENC4(ENC(s, fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_byte, 1),
215           ENC(dst, reg, 2)))
216
217 INSNE(addad, d_si_si_si, d, 1_or_2_src, 1cycle, C64X_AND_C67X,
218       TIC6X_FLAG_NO_CROSS,
219       FIX1(FIX(op, 0x3c)),
220       OP3(ORREG1, ORREG1, OWREG1),
221       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
222            ENC(dst, reg, 2)))
223 INSNE(addad, d_si_u5_si, d, 1_or_2_src, 1cycle, C64X_AND_C67X,
224       TIC6X_FLAG_NO_CROSS,
225       FIX1(FIX(op, 0x3d)),
226       OP3(ORREG1, OACST, OWREG1),
227       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
228            ENC(dst, reg, 2)))
229
230 INSNE(addah, d_si_si_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
231       FIX1(FIX(op, 0x34)),
232       OP3(ORREG1, ORREG1, OWREG1),
233       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
234            ENC(dst, reg, 2)))
235 INSNE(addah, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X,
236       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
237       FIX1(FIX(op, 0x36)),
238       OP3(ORREG1, OACST, OWREG1),
239       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
240            ENC(dst, reg, 2)))
241 INSN(addah, d, adda_long, 1cycle, C64XP, TIC6X_FLAG_PREFER(0),
242      FIX1(FIX(op, 5)),
243      OP3(ORAREG1, OLCST, OWREG1),
244      ENC4(ENC(s, fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_half, 1),
245           ENC(dst, reg, 2)))
246
247 INSNE(addaw, d_si_si_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
248       FIX1(FIX(op, 0x38)),
249       OP3(ORREG1, ORREG1, OWREG1),
250       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
251            ENC(dst, reg, 2)))
252 INSNE(addaw, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X,
253       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
254       FIX1(FIX(op, 0x3a)),
255       OP3(ORREG1, OACST, OWREG1),
256       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
257            ENC(dst, reg, 2)))
258 INSN(addaw, d, adda_long, 1cycle, C64XP, TIC6X_FLAG_PREFER(0),
259      FIX1(FIX(op, 7)),
260      OP3(ORAREG1, OLCST, OWREG1),
261      ENC4(ENC(s, fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_word, 1),
262           ENC(dst, reg, 2)))
263
264 INSN(adddp, l, 1_or_2_src, addsubdp, C67X, 0,
265      FIX1(FIX(op, 0x18)),
266      OP3(ORREGD12, ORXREGD12, OWREGD67),
267      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
268           ENC(src2, reg, 1), ENC(dst, reg, 2)))
269 INSN(adddp, s, l_1_or_2_src, addsubdp, C67XP, 0,
270      FIX1(FIX(op, 0x72)),
271      OP3(ORREGD12, ORXREGD12, OWREGD67),
272      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
273           ENC(src2, reg, 1), ENC(dst, reg, 2)))
274
275 INSN(addk, s, addk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
276      FIX0(),
277      OP2(OLCST, OWREG1),
278      ENC3(ENC(s, fu, 0), ENC(cst, scst, 0), ENC(dst, reg, 1)))
279
280 INSN(addkpc, s, addkpc, 1cycle, C64X,
281      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MCNOP|TIC6X_FLAG_SIDE_B_ONLY,
282      FIX1(FIX(s, 1)),
283      OP3(OLCST, OWREG1, OACST),
284      ENC3(ENC(src1, pcrel, 0), ENC(dst, reg, 1), ENC(src2, ucst, 2)))
285
286 INSN(addsp, l, 1_or_2_src, 4cycle, C67X, 0,
287      FIX1(FIX(op, 0x10)),
288      OP3(ORREG1, ORXREG1, OWREG4),
289      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
290           ENC(src2, reg, 1), ENC(dst, reg, 2)))
291 INSN(addsp, s, l_1_or_2_src, 4cycle, C67XP, 0,
292      FIX1(FIX(op, 0x70)),
293      OP3(ORREG1, ORXREG1, OWREG4),
294      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
295           ENC(src2, reg, 1), ENC(dst, reg, 2)))
296
297 INSN(addsub, l, 1_or_2_src_noncond, 1cycle, C64XP, 0,
298      FIX1(FIX(op, 0xc)),
299      OP3(ORREG1, ORXREG1, OWREGD1),
300      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
301           ENC(src2, reg, 1), ENC(dst, reg, 2)))
302
303 INSN(addsub2, l, 1_or_2_src_noncond, 1cycle, C64XP, 0,
304      FIX1(FIX(op, 0xd)),
305      OP3(ORREG1, ORXREG1, OWREGD1),
306      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
307           ENC(src2, reg, 1), ENC(dst, reg, 2)))
308
309 INSNE(addu, l_ui_xui_ul, l, 1_or_2_src, 1cycle, C62X, 0,
310       FIX1(FIX(op, 0x2b)),
311       OP3(ORREG1, ORXREG1, OWREGL1),
312       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
313            ENC(src2, reg, 1), ENC(dst, reg, 2)))
314 INSNE(addu, l_xui_ul_ul, l, 1_or_2_src, 1cycle, C62X, 0,
315       FIX1(FIX(op, 0x29)),
316       OP3(ORXREG1, ORREGL1, OWREGL1),
317       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
318            ENC(src2, reg, 1), ENC(dst, reg, 2)))
319
320 INSN(add2, s, 1_or_2_src, 1cycle, C62X, 0,
321      FIX1(FIX(op, 0x1)),
322      OP3(ORREG1, ORXREG1, OWREG1),
323      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
324           ENC(src2, reg, 1), ENC(dst, reg, 2)))
325 INSN(add2, l, 1_or_2_src, 1cycle, C64X, 0,
326      FIX1(FIX(op, 0x5)),
327      OP3(ORREG1, ORXREG1, OWREG1),
328      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
329           ENC(src2, reg, 1), ENC(dst, reg, 2)))
330 INSN(add2, d, ext_1_or_2_src, 1cycle, C64X, 0,
331      FIX1(FIX(op, 0x4)),
332      OP3(ORREG1, ORXREG1, OWREG1),
333      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
334           ENC(src2, reg, 1), ENC(dst, reg, 2)))
335
336 INSN(add4, l, 1_or_2_src, 1cycle, C64X, 0,
337      FIX1(FIX(op, 0x65)),
338      OP3(ORREG1, ORXREG1, OWREG1),
339      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
340           ENC(src2, reg, 1), ENC(dst, reg, 2)))
341
342 INSNE(and, l_ui_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
343       FIX1(FIX(op, 0x7b)),
344       OP3(ORREG1, ORXREG1, OWREG1),
345       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
346            ENC(src2, reg, 1), ENC(dst, reg, 2)))
347 INSNE(and, l_s5_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
348       FIX1(FIX(op, 0x7a)),
349       OP3(OACST, ORXREG1, OWREG1),
350       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
351            ENC(src2, reg, 1), ENC(dst, reg, 2)))
352 INSNE(and, s_ui_xui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
353       FIX1(FIX(op, 0x1f)),
354       OP3(ORREG1, ORXREG1, OWREG1),
355       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
356            ENC(src2, reg, 1), ENC(dst, reg, 2)))
357 INSNE(and, s_s5_xui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
358       FIX1(FIX(op, 0x1e)),
359       OP3(OACST, ORXREG1, OWREG1),
360       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
361            ENC(src2, reg, 1), ENC(dst, reg, 2)))
362 INSNE(and, d_ui_xui_ui, d, ext_1_or_2_src, 1cycle, C64X, 0,
363       FIX1(FIX(op, 0x6)),
364       OP3(ORREG1, ORXREG1, OWREG1),
365       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
366            ENC(src2, reg, 1), ENC(dst, reg, 2)))
367 INSNE(and, d_s5_xui_ui, d, ext_1_or_2_src, 1cycle, C64X, 0,
368       FIX1(FIX(op, 0x7)),
369       OP3(OACST, ORXREG1, OWREG1),
370       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
371            ENC(src2, reg, 1), ENC(dst, reg, 2)))
372
373 INSN(andn, l, 1_or_2_src, 1cycle, C64X, 0,
374      FIX1(FIX(op, 0x7c)),
375      OP3(ORREG1, ORXREG1, OWREG1),
376      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
377           ENC(src2, reg, 1), ENC(dst, reg, 2)))
378 INSN(andn, s, ext_1_or_2_src, 1cycle, C64X, 0,
379      FIX1(FIX(op, 0x6)),
380      OP3(ORREG1, ORXREG1, OWREG1),
381      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
382           ENC(src2, reg, 1), ENC(dst, reg, 2)))
383 INSN(andn, d, ext_1_or_2_src, 1cycle, C64X, 0,
384      FIX1(FIX(op, 0x0)),
385      OP3(ORREG1, ORXREG1, OWREG1),
386      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
387           ENC(src2, reg, 1), ENC(dst, reg, 2)))
388
389 INSN(avg2, m, compound, 1616_m, C64X, 0,
390      FIX1(FIX(op, 0x13)),
391      OP3(ORREG1, ORXREG1, OWREG2),
392      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
393           ENC(src2, reg, 1), ENC(dst, reg, 2)))
394
395 INSN(avgu4, m, compound, 1616_m, C64X, 0,
396      FIX1(FIX(op, 0x12)),
397      OP3(ORREG1, ORXREG1, OWREG2),
398      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
399           ENC(src2, reg, 1), ENC(dst, reg, 2)))
400
401 INSN(b, s, ext_branch_cond_imm, branch, C62X, TIC6X_FLAG_NO_CROSS,
402      FIX0(),
403      OP1(OLCST),
404      ENC2(ENC(s, fu, 0), ENC(cst, pcrel, 0)))
405 INSN(b, s, branch, branch, C62X, TIC6X_FLAG_SIDE_B_ONLY,
406      FIX1(FIX(s, 1)),
407      OP1(ORXREG1),
408      ENC2(ENC(x, xpath, 0), ENC(src2, reg, 0)))
409 INSN(b, s, b_irp, branch, C62X, TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY,
410      FIX3(FIX(s, 1), FIX(x, 0), FIX(dst, 0)),
411      OP1(ORIRP1),
412      ENC0())
413 INSN(b, s, b_nrp, branch, C62X, TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY,
414      FIX3(FIX(s, 1), FIX(x, 0), FIX(dst, 0)),
415      OP1(ORNRP1),
416      ENC0())
417
418 INSN(bdec, s, bdec, branch, C64X, TIC6X_FLAG_NO_CROSS,
419      FIX0(),
420      OP2(OLCST, ORWREG1),
421      ENC3(ENC(s, fu, 0), ENC(src, pcrel, 0), ENC(dst, reg, 1)))
422
423 INSN(bitc4, m, unary, 1616_m, C64X, 0,
424      FIX1(FIX(op, 0x1e)),
425      OP2(ORXREG1, OWREG2),
426      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
427           ENC(dst, reg, 1)))
428
429 INSN(bitr, m, unary, 1616_m, C64X, 0,
430      FIX1(FIX(op, 0x1f)),
431      OP2(ORXREG1, OWREG2),
432      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
433           ENC(dst, reg, 1)))
434
435 INSN(bnop, s, branch_nop_cst, branch, C64X,
436      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MCNOP,
437      FIX0(),
438      OP2(OLCST, OACST),
439      ENC3(ENC(s, fu, 0), ENC(src2, pcrel, 0), ENC(src1, ucst, 1)))
440 INSN(bnop, nfu, s_branch_nop_cst, branch, C64XP,
441      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_MCNOP,
442      FIX1(FIX(s, 0)),
443      OP2(OLCST, OACST),
444      ENC2(ENC(src2, pcrel, 0), ENC(src1, ucst, 1)))
445 INSN(bnop, s, branch_nop_reg, branch, C64X,
446      TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MCNOP,
447      FIX1(FIX(s, 1)),
448      OP2(ORXREG1, OACST),
449      ENC3(ENC(x, xpath, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1)))
450
451 INSN(bpos, s, bpos, branch, C64X, TIC6X_FLAG_NO_CROSS,
452      FIX0(),
453      OP2(OLCST, ORREG1),
454      ENC3(ENC(s, fu, 0), ENC(src, pcrel, 0), ENC(dst, reg, 1)))
455
456 INSN(call, s, ext_branch_cond_imm, branch, C62X,
457      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_CALL,
458      FIX0(),
459      OP1(OLCST),
460      ENC2(ENC(s, fu, 0), ENC(cst, pcrel, 0)))
461 INSN(call, s, branch, branch, C62X,
462      TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_CALL,
463      FIX1(FIX(s, 1)),
464      OP1(ORXREG1),
465      ENC2(ENC(x, xpath, 0), ENC(src2, reg, 0)))
466 INSN(call, s, b_irp, branch, C62X,
467      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_CALL,
468      FIX3(FIX(s, 1), FIX(x, 0), FIX(dst, 0)),
469      OP1(ORIRP1),
470      ENC0())
471 INSN(call, s, b_nrp, branch, C62X,
472      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_CALL,
473      FIX3(FIX(s, 1), FIX(x, 0), FIX(dst, 0)),
474      OP1(ORNRP1),
475      ENC0())
476
477 INSN(callnop, s, branch_nop_cst, branch, C64X,
478      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_MCNOP|TIC6X_FLAG_CALL,
479      FIX0(),
480      OP2(OLCST, OACST),
481      ENC3(ENC(s, fu, 0), ENC(src2, pcrel, 0), ENC(src1, ucst, 1)))
482 INSN(callnop, nfu, s_branch_nop_cst, branch, C64XP,
483      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_MCNOP|TIC6X_FLAG_CALL,
484      FIX1(FIX(s, 0)),
485      OP2(OLCST, OACST),
486      ENC2(ENC(src2, pcrel, 0), ENC(src1, ucst, 1)))
487 INSN(callnop, s, branch_nop_reg, branch, C64X,
488      TIC6X_FLAG_MACRO|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MCNOP|TIC6X_FLAG_CALL,
489      FIX1(FIX(s, 1)),
490      OP2(ORXREG1, OACST),
491      ENC3(ENC(x, xpath, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1)))
492
493 INSN(callp, s, call_imm_nop, branch, C64XP,
494      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MCNOP,
495      FIX1(FIX(z, 1)),
496      OP2(OLCST, OWRETREG1),
497      ENC2(ENC(s, fu, 0), ENC(cst, pcrel, 0)))
498
499 INSN(callret, s, ext_branch_cond_imm, branch, C62X,
500      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_CALL|TIC6X_FLAG_RETURN,
501      FIX0(),
502      OP1(OLCST),
503      ENC2(ENC(s, fu, 0), ENC(cst, pcrel, 0)))
504 INSN(callret, s, branch, branch, C62X,
505      TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_CALL|TIC6X_FLAG_RETURN,
506      FIX1(FIX(s, 1)),
507      OP1(ORXREG1),
508      ENC2(ENC(x, xpath, 0), ENC(src2, reg, 0)))
509 INSN(callret, s, b_irp, branch, C62X,
510      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_CALL|TIC6X_FLAG_RETURN,
511      FIX3(FIX(s, 1), FIX(x, 0), FIX(dst, 0)),
512      OP1(ORIRP1),
513      ENC0())
514 INSN(callret, s, b_nrp, branch, C62X,
515      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_CALL|TIC6X_FLAG_RETURN,
516      FIX3(FIX(s, 1), FIX(x, 0), FIX(dst, 0)),
517      OP1(ORNRP1),
518      ENC0())
519
520 INSN(clr, s, field, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
521      FIX1(FIX(op, 0x3)),
522      OP4(ORREG1, OACST, OACST, OWREG1),
523      ENC5(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(csta, ucst, 1),
524           ENC(cstb, ucst, 2), ENC(dst, reg, 3)))
525 INSN(clr, s, 1_or_2_src, 1cycle, C62X, 0,
526      FIX1(FIX(op, 0x3f)),
527      OP3(ORXREG1, ORREG1, OWREG1),
528      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
529           ENC(src1, reg, 1), ENC(dst, reg, 2)))
530
531 INSNE(cmpeq, l_si_xsi_ui, l, 1_or_2_src, 1cycle, C62X, 0,
532       FIX1(FIX(op, 0x53)),
533       OP3(ORREG1, ORXREG1, OWREG1),
534       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
535            ENC(src2, reg, 1), ENC(dst, reg, 2)))
536 INSNE(cmpeq, l_s5_xsi_ui, l, 1_or_2_src, 1cycle, C62X, 0,
537       FIX1(FIX(op, 0x52)),
538       OP3(OACST, ORXREG1, OWREG1),
539       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
540            ENC(src2, reg, 1), ENC(dst, reg, 2)))
541 INSNE(cmpeq, l_xsi_sl_ui, l, 1_or_2_src, 1cycle, C62X, 0,
542       FIX1(FIX(op, 0x51)),
543       OP3(ORXREG1, ORREGL1, OWREG1),
544       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
545            ENC(src2, reg, 1), ENC(dst, reg, 2)))
546 INSNE(cmpeq, l_s5_sl_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
547       FIX2(FIX(op, 0x50), FIX(x, 0)),
548       OP3(OACST, ORREGL1, OWREG1),
549       ENC4(ENC(s, fu, 0), ENC(src1, scst, 0), ENC(src2, reg, 1),
550            ENC(dst, reg, 2)))
551
552 INSN(cmpeq2, s, 1_or_2_src, 1cycle, C64X, 0,
553      FIX1(FIX(op, 0x1d)),
554      OP3(ORREG1, ORXREG1, OWREG1),
555      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
556           ENC(src2, reg, 1), ENC(dst, reg, 2)))
557
558 INSN(cmpeq4, s, 1_or_2_src, 1cycle, C64X, 0,
559      FIX1(FIX(op, 0x1c)),
560      OP3(ORREG1, ORXREG1, OWREG1),
561      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
562           ENC(src2, reg, 1), ENC(dst, reg, 2)))
563
564 INSN(cmpeqdp, s, 1_or_2_src, dpcmp, C67X, 0,
565      FIX1(FIX(op, 0x28)),
566      OP3(ORREGD12, ORXREGD12, OWREG2),
567      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
568           ENC(src2, reg, 1), ENC(dst, reg, 2)))
569
570 INSN(cmpeqsp, s, 1_or_2_src, 1cycle, C67X, 0,
571      FIX1(FIX(op, 0x38)),
572      OP3(ORREG1, ORXREG1, OWREG1),
573      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
574           ENC(src2, reg, 1), ENC(dst, reg, 2)))
575
576 INSNE(cmpgt, l_si_xsi_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
577       FIX1(FIX(op, 0x47)),
578       OP3(ORREG1, ORXREG1, OWREG1),
579       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
580            ENC(src2, reg, 1), ENC(dst, reg, 2)))
581 INSNE(cmpgt, l_s5_xsi_ui, l, 1_or_2_src, 1cycle, C62X, 0,
582       FIX1(FIX(op, 0x46)),
583       OP3(OACST, ORXREG1, OWREG1),
584       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
585            ENC(src2, reg, 1), ENC(dst, reg, 2)))
586 INSNE(cmpgt, l_xsi_sl_ui, l, 1_or_2_src, 1cycle, C62X, 0,
587       FIX1(FIX(op, 0x45)),
588       OP3(ORXREG1, ORREGL1, OWREG1),
589       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
590            ENC(src2, reg, 1), ENC(dst, reg, 2)))
591 INSNE(cmpgt, l_s5_sl_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
592       FIX2(FIX(op, 0x44), FIX(x, 0)),
593       OP3(OACST, ORREGL1, OWREG1),
594       ENC4(ENC(s, fu, 0), ENC(src1, scst, 0), ENC(src2, reg, 1),
595            ENC(dst, reg, 2)))
596 INSNE(cmpgt, l_xsi_si_ui, l, 1_or_2_src, 1cycle, C62X,
597       TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(0),
598       FIX1(FIX(op, 0x57)),
599       OP3(ORXREG1, ORREG1, OWREG1),
600       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 1),
601            ENC(src2, reg, 0), ENC(dst, reg, 2)))
602 INSNE(cmpgt, l_xsi_s5_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
603       FIX1(FIX(op, 0x56)),
604       OP3(ORXREG1, OACST, OWREG1),
605       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 1),
606            ENC(src2, reg, 0), ENC(dst, reg, 2)))
607 INSNE(cmpgt, l_sl_xsi_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
608       FIX1(FIX(op, 0x55)),
609       OP3(ORREGL1, ORXREG1, OWREG1),
610       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 1),
611            ENC(src2, reg, 0), ENC(dst, reg, 2)))
612 INSNE(cmpgt, l_sl_s5_ui, l, 1_or_2_src, 1cycle, C62X,
613       TIC6X_FLAG_MACRO|TIC6X_FLAG_NO_CROSS,
614       FIX2(FIX(op, 0x54), FIX(x, 0)),
615       OP3(ORREGL1, OACST, OWREG1),
616       ENC4(ENC(s, fu, 0), ENC(src1, scst, 1), ENC(src2, reg, 0),
617            ENC(dst, reg, 2)))
618
619 INSN(cmpgt2, s, 1_or_2_src, 1cycle, C64X, 0,
620      FIX1(FIX(op, 0x14)),
621      OP3(ORREG1, ORXREG1, OWREG1),
622      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
623           ENC(src2, reg, 1), ENC(dst, reg, 2)))
624
625 INSN(cmpgtdp, s, 1_or_2_src, dpcmp, C67X, 0,
626      FIX1(FIX(op, 0x29)),
627      OP3(ORREGD12, ORXREGD12, OWREG2),
628      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
629           ENC(src2, reg, 1), ENC(dst, reg, 2)))
630
631 INSN(cmpgtsp, s, 1_or_2_src, 1cycle, C67X, 0,
632      FIX1(FIX(op, 0x39)),
633      OP3(ORREG1, ORXREG1, OWREG1),
634      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
635           ENC(src2, reg, 1), ENC(dst, reg, 2)))
636
637 INSNE(cmpgtu, l_ui_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
638       FIX1(FIX(op, 0x4f)),
639       OP3(ORREG1, ORXREG1, OWREG1),
640       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
641            ENC(src2, reg, 1), ENC(dst, reg, 2)))
642 INSNE(cmpgtu, l_u4_xui_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
643       FIX2(FIX(op, 0x4e), RAN(src1, 0, 15)),
644       OP3(OACST, ORXREG1, OWREG1),
645       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, ucst, 0),
646            ENC(src2, reg, 1), ENC(dst, reg, 2)))
647 /* Although not mentioned in SPRUFE8, CMPGTU and CMPLTU support a
648    5-bit unsigned constant operand on C64X and above.  */
649 INSNE(cmpgtu, l_u5_xui_ui, l, 1_or_2_src, 1cycle, C64X, 0,
650       FIX2(FIX(op, 0x4e), RAN(src1, 16, 31)),
651       OP3(OACST, ORXREG1, OWREG1),
652       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, ucst, 0),
653            ENC(src2, reg, 1), ENC(dst, reg, 2)))
654 INSNE(cmpgtu, l_xui_ul_ui, l, 1_or_2_src, 1cycle, C62X, 0,
655       FIX1(FIX(op, 0x4d)),
656       OP3(ORXREG1, ORREGL1, OWREG1),
657       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
658            ENC(src2, reg, 1), ENC(dst, reg, 2)))
659 INSNE(cmpgtu, l_u4_ul_ui, l, 1_or_2_src, 1cycle, C62X,
660       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
661       FIX3(FIX(op, 0x4c), FIX(x, 0), RAN(src1, 0, 15)),
662       OP3(OACST, ORREGL1, OWREG1),
663       ENC4(ENC(s, fu, 0), ENC(src1, ucst, 0), ENC(src2, reg, 1),
664            ENC(dst, reg, 2)))
665 INSNE(cmpgtu, l_u5_ul_ui, l, 1_or_2_src, 1cycle, C64X, TIC6X_FLAG_NO_CROSS,
666       FIX3(FIX(op, 0x4c), FIX(x, 0), RAN(src1, 16, 31)),
667       OP3(OACST, ORREGL1, OWREG1),
668       ENC4(ENC(s, fu, 0), ENC(src1, ucst, 0), ENC(src2, reg, 1),
669            ENC(dst, reg, 2)))
670
671 INSN(cmpgtu4, s, 1_or_2_src, 1cycle, C64X, 0,
672      FIX1(FIX(op, 0x15)),
673      OP3(ORREG1, ORXREG1, OWREG1),
674      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
675           ENC(src2, reg, 1), ENC(dst, reg, 2)))
676
677 INSNE(cmplt, l_si_xsi_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
678       FIX1(FIX(op, 0x57)),
679       OP3(ORREG1, ORXREG1, OWREG1),
680       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
681            ENC(src2, reg, 1), ENC(dst, reg, 2)))
682 INSNE(cmplt, l_s5_xsi_ui, l, 1_or_2_src, 1cycle, C62X, 0,
683       FIX1(FIX(op, 0x56)),
684       OP3(OACST, ORXREG1, OWREG1),
685       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
686            ENC(src2, reg, 1), ENC(dst, reg, 2)))
687 INSNE(cmplt, l_xsi_sl_ui, l, 1_or_2_src, 1cycle, C62X, 0,
688       FIX1(FIX(op, 0x55)),
689       OP3(ORXREG1, ORREGL1, OWREG1),
690       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
691            ENC(src2, reg, 1), ENC(dst, reg, 2)))
692 INSNE(cmplt, l_s5_sl_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
693       FIX2(FIX(op, 0x54), FIX(x, 0)),
694       OP3(OACST, ORREGL1, OWREG1),
695       ENC4(ENC(s, fu, 0), ENC(src1, scst, 0), ENC(src2, reg, 1),
696            ENC(dst, reg, 2)))
697 INSNE(cmplt, l_xsi_si_ui, l, 1_or_2_src, 1cycle, C62X,
698       TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(0),
699       FIX1(FIX(op, 0x47)),
700       OP3(ORXREG1, ORREG1, OWREG1),
701       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 1),
702            ENC(src2, reg, 0), ENC(dst, reg, 2)))
703 INSNE(cmplt, l_xsi_s5_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
704       FIX1(FIX(op, 0x46)),
705       OP3(ORXREG1, OACST, OWREG1),
706       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 1),
707            ENC(src2, reg, 0), ENC(dst, reg, 2)))
708 INSNE(cmplt, l_sl_xsi_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
709       FIX1(FIX(op, 0x45)),
710       OP3(ORREGL1, ORXREG1, OWREG1),
711       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 1),
712            ENC(src2, reg, 0), ENC(dst, reg, 2)))
713 INSNE(cmplt, l_sl_s5_ui, l, 1_or_2_src, 1cycle, C62X,
714       TIC6X_FLAG_MACRO|TIC6X_FLAG_NO_CROSS,
715       FIX2(FIX(op, 0x44), FIX(x, 0)),
716       OP3(ORREGL1, OACST, OWREG1),
717       ENC4(ENC(s, fu, 0), ENC(src1, scst, 1), ENC(src2, reg, 0),
718            ENC(dst, reg, 2)))
719
720 INSN(cmplt2, s, 1_or_2_src, 1cycle, C64X, TIC6X_FLAG_MACRO,
721      FIX1(FIX(op, 0x14)),
722      OP3(ORXREG1, ORREG1, OWREG1),
723      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
724           ENC(src1, reg, 1), ENC(dst, reg, 2)))
725
726 INSN(cmpltdp, s, 1_or_2_src, dpcmp, C67X, 0,
727      FIX1(FIX(op, 0x2a)),
728      OP3(ORREGD12, ORXREGD12, OWREG2),
729      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
730           ENC(src2, reg, 1), ENC(dst, reg, 2)))
731
732 INSN(cmpltsp, s, 1_or_2_src, 1cycle, C67X, 0,
733      FIX1(FIX(op, 0x3a)),
734      OP3(ORREG1, ORXREG1, OWREG1),
735      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
736           ENC(src2, reg, 1), ENC(dst, reg, 2)))
737
738 INSNE(cmpltu, l_ui_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
739       FIX1(FIX(op, 0x5f)),
740       OP3(ORREG1, ORXREG1, OWREG1),
741       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
742            ENC(src2, reg, 1), ENC(dst, reg, 2)))
743 INSNE(cmpltu, l_u4_xui_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
744       FIX2(FIX(op, 0x5e), RAN(src1, 0, 15)),
745       OP3(OACST, ORXREG1, OWREG1),
746       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, ucst, 0),
747            ENC(src2, reg, 1), ENC(dst, reg, 2)))
748 INSNE(cmpltu, l_u5_xui_ui, l, 1_or_2_src, 1cycle, C64X, 0,
749       FIX2(FIX(op, 0x5e), RAN(src1, 16, 31)),
750       OP3(OACST, ORXREG1, OWREG1),
751       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, ucst, 0),
752            ENC(src2, reg, 1), ENC(dst, reg, 2)))
753 INSNE(cmpltu, l_xui_ul_ui, l, 1_or_2_src, 1cycle, C62X, 0,
754       FIX1(FIX(op, 0x5d)),
755       OP3(ORXREG1, ORREGL1, OWREG1),
756       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
757            ENC(src2, reg, 1), ENC(dst, reg, 2)))
758 INSNE(cmpltu, l_u4_ul_ui, l, 1_or_2_src, 1cycle, C62X,
759       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
760       FIX3(FIX(op, 0x5c), FIX(x, 0), RAN(src1, 0, 15)),
761       OP3(OACST, ORREGL1, OWREG1),
762       ENC4(ENC(s, fu, 0), ENC(src1, ucst, 0), ENC(src2, reg, 1),
763            ENC(dst, reg, 2)))
764 INSNE(cmpltu, l_u5_ul_ui, l, 1_or_2_src, 1cycle, C64X, TIC6X_FLAG_NO_CROSS,
765       FIX3(FIX(op, 0x5c), FIX(x, 0), RAN(src1, 16, 31)),
766       OP3(OACST, ORREGL1, OWREG1),
767       ENC4(ENC(s, fu, 0), ENC(src1, ucst, 0), ENC(src2, reg, 1),
768            ENC(dst, reg, 2)))
769
770 INSN(cmpltu4, s, 1_or_2_src, 1cycle, C64X, TIC6X_FLAG_MACRO,
771      FIX1(FIX(op, 0x15)),
772      OP3(ORXREG1, ORREG1, OWREG1),
773      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
774           ENC(src1, reg, 1), ENC(dst, reg, 2)))
775
776 INSN(cmpy, m, 1_or_2_src, 4cycle, C64XP, 0,
777      FIX1(FIX(op, 0xa)),
778      OP3(ORREG1, ORXREG1, OWREGD4),
779      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
780           ENC(src2, reg, 1), ENC(dst, reg, 2)))
781
782 INSN(cmpyr, m, 1_or_2_src, 4cycle, C64XP, 0,
783      FIX1(FIX(op, 0xb)),
784      OP3(ORREG1, ORXREG1, OWREG4),
785      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
786           ENC(src2, reg, 1), ENC(dst, reg, 2)))
787
788 INSN(cmpyr1, m, 1_or_2_src, 4cycle, C64XP, 0,
789      FIX1(FIX(op, 0xc)),
790      OP3(ORREG1, ORXREG1, OWREG4),
791      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
792           ENC(src2, reg, 1), ENC(dst, reg, 2)))
793
794 INSN(cmtl, d, 1_or_2_src, load, C64XP,
795      TIC6X_FLAG_LOAD|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_SIDE_T2_ONLY|TIC6X_FLAG_NO_CROSS,
796      FIX3(FIX(s, 1), FIX(op, 0xe), FIX(src1, 0)),
797      OP2(ORMEMDW, OWDREG5),
798      ENC2(ENC(src2, reg, 0), ENC(dst, reg, 1)))
799
800 INSN(ddotp4, m, 1_or_2_src, 4cycle, C64XP, 0,
801      FIX1(FIX(op, 0x18)),
802      OP3(ORREG1, ORXREG1, OWREGD4),
803      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
804           ENC(src2, reg, 1), ENC(dst, reg, 2)))
805
806 INSN(ddotph2, m, 1_or_2_src, 4cycle, C64XP, 0,
807      FIX1(FIX(op, 0x17)),
808      OP3(ORREGD1, ORXREG1, OWREGD4),
809      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
810           ENC(src2, reg, 1), ENC(dst, reg, 2)))
811
812 INSN(ddotph2r, m, 1_or_2_src, 4cycle, C64XP, 0,
813      FIX1(FIX(op, 0x15)),
814      OP3(ORREGD1, ORXREG1, OWREG4),
815      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
816           ENC(src2, reg, 1), ENC(dst, reg, 2)))
817
818 INSN(ddotpl2, m, 1_or_2_src, 4cycle, C64XP, 0,
819      FIX1(FIX(op, 0x16)),
820      OP3(ORREGD1, ORXREG1, OWREGD4),
821      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
822           ENC(src2, reg, 1), ENC(dst, reg, 2)))
823
824 INSN(ddotpl2r, m, 1_or_2_src, 4cycle, C64XP, 0,
825      FIX1(FIX(op, 0x14)),
826      OP3(ORREGD1, ORXREG1, OWREG4),
827      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
828           ENC(src2, reg, 1), ENC(dst, reg, 2)))
829
830 INSN(deal, m, unary, 1616_m, C64X, 0,
831      FIX1(FIX(op, 0x1d)),
832      OP2(ORXREG1, OWREG2),
833      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
834           ENC(dst, reg, 1)))
835
836 INSN(dint, nfu, dint, 1cycle, C64XP, 0,
837      FIX1(FIX(s, 0)),
838      OP0(),
839      ENC0())
840
841 INSN(dmv, s, ext_1_or_2_src, 1cycle, C64XP, 0,
842      FIX1(FIX(op, 0xb)),
843      OP3(ORREG1, ORXREG1, OWREGD1),
844      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
845           ENC(src2, reg, 1), ENC(dst, reg, 2)))
846
847 INSNE(dotp2, m_s2_xs2_si, m, compound, 4cycle, C64X, 0,
848       FIX1(FIX(op, 0xc)),
849       OP3(ORREG1, ORXREG1, OWREG4),
850       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
851            ENC(src2, reg, 1), ENC(dst, reg, 2)))
852 INSNE(dotp2, m_s2_xs2_sll, m, compound, 4cycle, C64X, 0,
853       FIX1(FIX(op, 0xb)),
854       OP3(ORREG1, ORXREG1, OWREGD4),
855       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
856            ENC(src2, reg, 1), ENC(dst, reg, 2)))
857
858 INSN(dotpn2, m, compound, 4cycle, C64X, 0,
859      FIX1(FIX(op, 0x9)),
860      OP3(ORREG1, ORXREG1, OWREG4),
861      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
862           ENC(src2, reg, 1), ENC(dst, reg, 2)))
863
864 INSN(dotpnrsu2, m, compound, 4cycle, C64X, 0,
865      FIX1(FIX(op, 0x7)),
866      OP3(ORREG1, ORXREG1, OWREG4),
867      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
868           ENC(src2, reg, 1), ENC(dst, reg, 2)))
869
870 INSN(dotpnrus2, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
871      FIX1(FIX(op, 0x7)),
872      OP3(ORXREG1, ORREG1, OWREG4),
873      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
874           ENC(src1, reg, 1), ENC(dst, reg, 2)))
875
876 INSN(dotprsu2, m, compound, 4cycle, C64X, 0,
877      FIX1(FIX(op, 0xd)),
878      OP3(ORREG1, ORXREG1, OWREG4),
879      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
880           ENC(src2, reg, 1), ENC(dst, reg, 2)))
881
882 INSN(dotprus2, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
883      FIX1(FIX(op, 0xd)),
884      OP3(ORXREG1, ORREG1, OWREG4),
885      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
886           ENC(src1, reg, 1), ENC(dst, reg, 2)))
887
888 INSN(dotpsu4, m, compound, 4cycle, C64X, 0,
889      FIX1(FIX(op, 0x2)),
890      OP3(ORREG1, ORXREG1, OWREG4),
891      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
892           ENC(src2, reg, 1), ENC(dst, reg, 2)))
893
894 INSN(dotpus4, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
895      FIX1(FIX(op, 0x2)),
896      OP3(ORXREG1, ORREG1, OWREG4),
897      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
898           ENC(src1, reg, 1), ENC(dst, reg, 2)))
899
900 INSN(dotpu4, m, compound, 4cycle, C64X, 0,
901      FIX1(FIX(op, 0x6)),
902      OP3(ORREG1, ORXREG1, OWREG4),
903      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
904           ENC(src2, reg, 1), ENC(dst, reg, 2)))
905
906 INSN(dpack2, l, 1_or_2_src_noncond, 1cycle, C64XP, 0,
907      FIX1(FIX(op, 0x34)),
908      OP3(ORREG1, ORXREG1, OWREGD1),
909      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
910           ENC(src2, reg, 1), ENC(dst, reg, 2)))
911
912 INSN(dpackx2, l, 1_or_2_src_noncond, 1cycle, C64XP, 0,
913      FIX1(FIX(op, 0x33)),
914      OP3(ORREG1, ORXREG1, OWREGD1),
915      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
916           ENC(src2, reg, 1), ENC(dst, reg, 2)))
917
918 INSN(dpint, l, 1_or_2_src, 4cycle, C67X, TIC6X_FLAG_NO_CROSS,
919      FIX3(FIX(op, 0x8), FIX(x, 0), FIX(src1, 0)),
920      OP2(ORREGD1, OWREG4),
921      ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
922
923 INSN(dpsp, l, 1_or_2_src, 4cycle, C67X, TIC6X_FLAG_NO_CROSS,
924      FIX3(FIX(op, 0x9), FIX(x, 0), FIX(src1, 0)),
925      OP2(ORREGD1, OWREG4),
926      ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
927
928 INSN(dptrunc, l, 1_or_2_src, 4cycle, C67X, TIC6X_FLAG_NO_CROSS,
929      FIX3(FIX(op, 0x1), FIX(x, 0), FIX(src1, 0)),
930      OP2(ORREGD1, OWREG4),
931      ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
932
933 INSN(ext, s, field, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
934      FIX1(FIX(op, 0x1)),
935      OP4(ORREG1, OACST, OACST, OWREG1),
936      ENC5(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(csta, ucst, 1),
937           ENC(cstb, ucst, 2), ENC(dst, reg, 3)))
938 INSN(ext, s, 1_or_2_src, 1cycle, C62X, 0,
939      FIX1(FIX(op, 0x2f)),
940      OP3(ORXREG1, ORREG1, OWREG1),
941      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
942           ENC(src1, reg, 1), ENC(dst, reg, 2)))
943
944 INSN(extu, s, field, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
945      FIX1(FIX(op, 0x0)),
946      OP4(ORREG1, OACST, OACST, OWREG1),
947      ENC5(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(csta, ucst, 1),
948           ENC(cstb, ucst, 2), ENC(dst, reg, 3)))
949 INSN(extu, s, 1_or_2_src, 1cycle, C62X, 0,
950      FIX1(FIX(op, 0x2b)),
951      OP3(ORXREG1, ORREG1, OWREG1),
952      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
953           ENC(src1, reg, 1), ENC(dst, reg, 2)))
954
955 INSN(gmpy, m, 1_or_2_src, 4cycle, C64XP, TIC6X_FLAG_NO_CROSS,
956      FIX2(FIX(op, 0x1f), FIX(x, 0)),
957      OP3(ORREG1, ORREG1, OWREG4),
958      ENC4(ENC(s, fu, 0), ENC(src1, reg, 0), ENC(src2, reg, 1),
959           ENC(dst, reg, 2)))
960
961 /* This instruction can be predicated as usual; SPRUFE8 is incorrect
962    where it shows the "z" field as fixed to 1.  */
963 INSN(gmpy4, m, compound, 4cycle, C64X, 0,
964      FIX1(FIX(op, 0x11)),
965      OP3(ORREG1, ORXREG1, OWREG4),
966      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
967           ENC(src2, reg, 1), ENC(dst, reg, 2)))
968
969 INSN(idle, nfu, nop_idle, nop, C62X, TIC6X_FLAG_MCNOP,
970      FIX2(FIX(s, 0), FIX(op, 0xf)),
971      OP0(),
972      ENC0())
973
974 INSN(intdp, l, 1_or_2_src, intdp, C67X, 0,
975      FIX2(FIX(op, 0x39), FIX(src1, 0)),
976      OP2(ORXREG1, OWREGD45),
977      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
978           ENC(dst, reg, 1)))
979
980 INSN(intdpu, l, 1_or_2_src, intdp, C67X, 0,
981      FIX2(FIX(op, 0x3b), FIX(src1, 0)),
982      OP2(ORXREG1, OWREGD45),
983      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
984           ENC(dst, reg, 1)))
985
986 INSN(intsp, l, 1_or_2_src, 4cycle, C67X, 0,
987      FIX2(FIX(op, 0x4a), FIX(src1, 0)),
988      OP2(ORXREG1, OWREG4),
989      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
990           ENC(dst, reg, 1)))
991
992 INSN(intspu, l, 1_or_2_src, 4cycle, C67X, 0,
993      FIX2(FIX(op, 0x49), FIX(src1, 0)),
994      OP2(ORXREG1, OWREG4),
995      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
996           ENC(dst, reg, 1)))
997
998 INSN(ldb, d, load_store, load, C62X,
999      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
1000      FIX2(FIX(op, 2), FIX(r, 0)),
1001      OP2(ORMEMSB, OWDREG5),
1002      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1003           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1004           ENC(srcdst, reg, 1)))
1005 INSN(ldb, d, load_store_long, load, C62X,
1006      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
1007      FIX1(FIX(op, 2)),
1008      OP2(ORMEMLB, OWDREG5),
1009      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_byte, 0),
1010           ENC(dst, reg, 1)))
1011
1012 INSN(ldbu, d, load_store, load, C62X,
1013      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
1014      FIX2(FIX(op, 1), FIX(r, 0)),
1015      OP2(ORMEMSB, OWDREG5),
1016      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1017           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1018           ENC(srcdst, reg, 1)))
1019 INSN(ldbu, d, load_store_long, load, C62X,
1020      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
1021      FIX1(FIX(op, 1)),
1022      OP2(ORMEMLB, OWDREG5),
1023      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_byte, 0),
1024           ENC(dst, reg, 1)))
1025
1026 INSN(lddw, d, load_store, load, C64X_AND_C67X,
1027      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS,
1028      FIX2(FIX(op, 6), FIX(r, 1)),
1029      OP2(ORMEMSD, OWDREGD5),
1030      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1031           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1032           ENC(srcdst, reg, 1)))
1033
1034 INSN(ldh, d, load_store, load, C62X,
1035      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
1036      FIX2(FIX(op, 4), FIX(r, 0)),
1037      OP2(ORMEMSH, OWDREG5),
1038      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1039           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1040           ENC(srcdst, reg, 1)))
1041 INSN(ldh, d, load_store_long, load, C62X,
1042      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
1043      FIX1(FIX(op, 4)),
1044      OP2(ORMEMLH, OWDREG5),
1045      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_half, 0),
1046           ENC(dst, reg, 1)))
1047
1048 INSN(ldhu, d, load_store, load, C62X,
1049      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
1050      FIX2(FIX(op, 0), FIX(r, 0)),
1051      OP2(ORMEMSH, OWDREG5),
1052      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1053           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1054           ENC(srcdst, reg, 1)))
1055 INSN(ldhu, d, load_store_long, load, C62X,
1056      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
1057      FIX1(FIX(op, 0)),
1058      OP2(ORMEMLH, OWDREG5),
1059      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_half, 0),
1060           ENC(dst, reg, 1)))
1061
1062 INSN(ldndw, d, load_nonaligned, load, C64X,
1063      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_UNALIGNED,
1064      FIX0(),
1065      OP2(ORMEMND, OWDREGD5),
1066      ENC7(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1067           ENC(offsetR, mem_offset_noscale, 0), ENC(baseR, reg, 0),
1068           ENC(sc, scaled, 0), ENC(dst, reg_shift, 1)))
1069
1070 INSN(ldnw, d, load_store, load, C64X,
1071      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_UNALIGNED,
1072      FIX2(FIX(op, 3), FIX(r, 1)),
1073      OP2(ORMEMSW, OWDREG5),
1074      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1075           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1076           ENC(srcdst, reg, 1)))
1077
1078 INSN(ldw, d, load_store, load, C62X,
1079      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
1080      FIX2(FIX(op, 6), FIX(r, 0)),
1081      OP2(ORMEMSW, OWDREG5),
1082      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1083           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1084           ENC(srcdst, reg, 1)))
1085 INSN(ldw, d, load_store_long, load, C62X,
1086      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
1087      FIX1(FIX(op, 6)),
1088      OP2(ORMEMLW, OWDREG5),
1089      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_word, 0),
1090           ENC(dst, reg, 1)))
1091
1092 INSN(ll, d, 1_or_2_src, load, C64XP,
1093      TIC6X_FLAG_LOAD|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_SIDE_T2_ONLY|TIC6X_FLAG_NO_CROSS,
1094      FIX3(FIX(s, 1), FIX(op, 0xc), FIX(src1, 0)),
1095      OP2(ORMEMDW, OWDREG5),
1096      ENC2(ENC(src2, reg, 0), ENC(dst, reg, 1)))
1097
1098 INSNE(lmbd, l_ui_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
1099       FIX1(FIX(op, 0x6b)),
1100       OP3(ORREG1, ORXREG1, OWREG1),
1101       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1102            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1103 INSNE(lmbd, l_s5_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
1104       FIX1(FIX(op, 0x6a)),
1105       OP3(OACST, ORXREG1, OWREG1),
1106       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1107            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1108
1109 INSN(max2, l, 1_or_2_src, 1cycle, C64X, 0,
1110      FIX1(FIX(op, 0x42)),
1111      OP3(ORREG1, ORXREG1, OWREG1),
1112      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1113           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1114 INSN(max2, s, ext_1_or_2_src, 1cycle, C64XP, 0,
1115      FIX1(FIX(op, 0xd)),
1116      OP3(ORREG1, ORXREG1, OWREG1),
1117      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1118           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1119
1120 INSN(maxu4, l, 1_or_2_src, 1cycle, C64X, 0,
1121      FIX1(FIX(op, 0x43)),
1122      OP3(ORREG1, ORXREG1, OWREG1),
1123      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1124           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1125
1126 INSN(min2, l, 1_or_2_src, 1cycle, C64X, 0,
1127      FIX1(FIX(op, 0x41)),
1128      OP3(ORREG1, ORXREG1, OWREG1),
1129      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1130           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1131 INSN(min2, s, ext_1_or_2_src, 1cycle, C64XP, 0,
1132      FIX1(FIX(op, 0xc)),
1133      OP3(ORREG1, ORXREG1, OWREG1),
1134      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1135           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1136
1137 INSN(minu4, l, 1_or_2_src, 1cycle, C64X, 0,
1138      FIX1(FIX(op, 0x48)),
1139      OP3(ORREG1, ORXREG1, OWREG1),
1140      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1141           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1142
1143 INSNE(mpy, m_sl16_xsl16_si, m, mpy, 1616_m, C62X, 0,
1144       FIX1(FIX(op, 0x19)),
1145       OP3(ORREG1, ORXREG1, OWREG2),
1146       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1147            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1148 INSNE(mpy, m_s5_xsl16_si, m, mpy, 1616_m, C62X, 0,
1149       FIX1(FIX(op, 0x18)),
1150       OP3(OACST, ORXREG1, OWREG2),
1151       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1152            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1153
1154 INSN(mpydp, m, mpy, mpydp, C67X, TIC6X_FLAG_NO_CROSS,
1155      FIX2(FIX(op, 0x0e), FIX(x, 0)),
1156      OP3(ORREGD1234, ORREGD1324, OWREGD910),
1157      ENC4(ENC(s, fu, 0), ENC(src1, reg, 0), ENC(src2, reg, 1),
1158           ENC(dst, reg, 2)))
1159
1160 INSN(mpyh, m, mpy, 1616_m, C62X, 0,
1161      FIX1(FIX(op, 0x01)),
1162      OP3(ORREG1, ORXREG1, OWREG2),
1163      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1164           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1165
1166 INSN(mpyhi, m, compound, 4cycle, C64X, 0,
1167      FIX1(FIX(op, 0x14)),
1168      OP3(ORREG1, ORXREG1, OWREGD4),
1169      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1170           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1171
1172 INSN(mpyhir, m, compound, 4cycle, C64X, 0,
1173      FIX1(FIX(op, 0x10)),
1174      OP3(ORREG1, ORXREG1, OWREG4),
1175      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1176           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1177
1178 INSN(mpyhl, m, mpy, 1616_m, C62X, 0,
1179      FIX1(FIX(op, 0x09)),
1180      OP3(ORREG1, ORXREG1, OWREG2),
1181      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1182           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1183
1184 INSN(mpyhlu, m, mpy, 1616_m, C62X, 0,
1185      FIX1(FIX(op, 0x0f)),
1186      OP3(ORREG1, ORXREG1, OWREG2),
1187      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1188           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1189
1190 INSN(mpyhslu, m, mpy, 1616_m, C62X, 0,
1191      FIX1(FIX(op, 0x0b)),
1192      OP3(ORREG1, ORXREG1, OWREG2),
1193      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1194           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1195
1196 INSN(mpyhsu, m, mpy, 1616_m, C62X, 0,
1197      FIX1(FIX(op, 0x03)),
1198      OP3(ORREG1, ORXREG1, OWREG2),
1199      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1200           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1201
1202 INSN(mpyhu, m, mpy, 1616_m, C62X, 0,
1203      FIX1(FIX(op, 0x07)),
1204      OP3(ORREG1, ORXREG1, OWREG2),
1205      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1206           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1207
1208 INSN(mpyhuls, m, mpy, 1616_m, C62X, 0,
1209      FIX1(FIX(op, 0x0d)),
1210      OP3(ORREG1, ORXREG1, OWREG2),
1211      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1212           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1213
1214 INSN(mpyhus, m, mpy, 1616_m, C62X, 0,
1215      FIX1(FIX(op, 0x05)),
1216      OP3(ORREG1, ORXREG1, OWREG2),
1217      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1218           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1219
1220 INSNE(mpyi, m_si_xsi_si, m, mpy, mpyi, C67X, 0,
1221       FIX1(FIX(op, 0x04)),
1222       OP3(ORREG14, ORXREG14, OWREG9),
1223       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1224            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1225 INSNE(mpyi, m_s5_xsi_si, m, mpy, mpyi, C67X, 0,
1226       FIX1(FIX(op, 0x06)),
1227       OP3(OACST, ORXREG14, OWREG9),
1228       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1229            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1230
1231 INSNE(mpyid, m_si_xsi_sll, m, mpy, mpyid, C67X, 0,
1232       FIX1(FIX(op, 0x08)),
1233       OP3(ORREG14, ORXREG14, OWREGD910),
1234       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1235            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1236 INSNE(mpyid, m_s5_xsi_sll, m, mpy, mpyid, C67X, 0,
1237       FIX1(FIX(op, 0x0c)),
1238       OP3(OACST, ORXREG14, OWREGD910),
1239       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1240            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1241
1242 INSN(mpyih, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
1243      FIX1(FIX(op, 0x14)),
1244      OP3(ORXREG1, ORREG1, OWREGD4),
1245      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1246           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1247
1248 INSN(mpyihr, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
1249      FIX1(FIX(op, 0x10)),
1250      OP3(ORXREG1, ORREG1, OWREG4),
1251      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1252           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1253
1254 INSN(mpyil, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
1255      FIX1(FIX(op, 0x15)),
1256      OP3(ORXREG1, ORREG1, OWREGD4),
1257      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1258           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1259
1260 INSN(mpyilr, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
1261      FIX1(FIX(op, 0x0e)),
1262      OP3(ORXREG1, ORREG1, OWREG4),
1263      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1264           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1265
1266 INSN(mpylh, m, mpy, 1616_m, C62X, 0,
1267      FIX1(FIX(op, 0x11)),
1268      OP3(ORREG1, ORXREG1, OWREG2),
1269      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1270           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1271
1272 INSN(mpylhu, m, mpy, 1616_m, C62X, 0,
1273      FIX1(FIX(op, 0x17)),
1274      OP3(ORREG1, ORXREG1, OWREG2),
1275      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1276           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1277
1278 INSN(mpyli, m, compound, 4cycle, C64X, 0,
1279      FIX1(FIX(op, 0x15)),
1280      OP3(ORREG1, ORXREG1, OWREGD4),
1281      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1282           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1283
1284 INSN(mpylir, m, compound, 4cycle, C64X, 0,
1285      FIX1(FIX(op, 0x0e)),
1286      OP3(ORREG1, ORXREG1, OWREG4),
1287      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1288           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1289
1290 INSN(mpylshu, m, mpy, 1616_m, C62X, 0,
1291      FIX1(FIX(op, 0x13)),
1292      OP3(ORREG1, ORXREG1, OWREG2),
1293      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1294           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1295
1296 INSN(mpyluhs, m, mpy, 1616_m, C62X, 0,
1297      FIX1(FIX(op, 0x15)),
1298      OP3(ORREG1, ORXREG1, OWREG2),
1299      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1300           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1301
1302 INSN(mpysp, m, mpy, 4cycle, C67X, 0,
1303      FIX1(FIX(op, 0x1c)),
1304      OP3(ORREG1, ORXREG1, OWREG4),
1305      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1306           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1307
1308 /* Contrary to SPRU733A, MPYSPDP and MPYSP2DP are on both C67X and
1309    C67X+.  */
1310 INSN(mpyspdp, m, compound, mpyspdp, C67X, 0,
1311      FIX1(FIX(op, 0x16)),
1312      OP3(ORREG12, ORXREGD12, OWREGD67),
1313      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1314           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1315
1316 INSN(mpysp2dp, m, compound, mpyspdp, C67X, 0,
1317      FIX1(FIX(op, 0x17)),
1318      OP3(ORREG1, ORXREG1, OWREGD45),
1319      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1320           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1321
1322 INSNE(mpysu, m_sl16_xul16_si, m, mpy, 1616_m, C62X, 0,
1323       FIX1(FIX(op, 0x1b)),
1324       OP3(ORREG1, ORXREG1, OWREG2),
1325       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1326            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1327 INSNE(mpysu, m_s5_xul16_si, m, mpy, 1616_m, C62X, 0,
1328       FIX1(FIX(op, 0x1e)),
1329       OP3(OACST, ORXREG1, OWREG2),
1330       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1331            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1332
1333 INSN(mpysu4, m, compound, 4cycle, C64X, 0,
1334      FIX1(FIX(op, 0x05)),
1335      OP3(ORREG1, ORXREG1, OWREGD4),
1336      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1337           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1338
1339 INSN(mpyu, m, mpy, 1616_m, C62X, 0,
1340      FIX1(FIX(op, 0x1f)),
1341      OP3(ORREG1, ORXREG1, OWREG2),
1342      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1343           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1344
1345 INSN(mpyu4, m, compound, 4cycle, C64X, 0,
1346      FIX1(FIX(op, 0x04)),
1347      OP3(ORREG1, ORXREG1, OWREGD4),
1348      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1349           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1350
1351 INSN(mpyus, m, mpy, 1616_m, C62X, 0,
1352      FIX1(FIX(op, 0x1d)),
1353      OP3(ORREG1, ORXREG1, OWREG2),
1354      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1355           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1356
1357 INSN(mpyus4, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
1358      FIX1(FIX(op, 0x05)),
1359      OP3(ORXREG1, ORREG1, OWREGD4),
1360      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1361           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1362
1363 INSN(mpy2, m, compound, 4cycle, C64X, 0,
1364      FIX1(FIX(op, 0x00)),
1365      OP3(ORREG1, ORXREG1, OWREGD4),
1366      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1367           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1368
1369 INSN(mpy2ir, m, 1_or_2_src, 4cycle, C64XP, 0,
1370      FIX1(FIX(op, 0x0f)),
1371      OP3(ORREG1, ORXREG1, OWREGD4),
1372      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1373           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1374
1375 INSNE(mpy32, 32_32_32, m, mpy, 4cycle, C64XP, 0,
1376       FIX1(FIX(op, 0x10)),
1377       OP3(ORREG1, ORXREG1, OWREG4),
1378       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1379            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1380 INSNE(mpy32, 32_32_64, m, mpy, 4cycle, C64XP, 0,
1381       FIX1(FIX(op, 0x14)),
1382       OP3(ORREG1, ORXREG1, OWREGD4),
1383       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1384            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1385
1386 INSN(mpy32su, m, mpy, 4cycle, C64XP, 0,
1387      FIX1(FIX(op, 0x16)),
1388      OP3(ORREG1, ORXREG1, OWREGD4),
1389      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1390           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1391
1392 INSN(mpy32u, m, compound, 4cycle, C64XP, 0,
1393      FIX1(FIX(op, 0x18)),
1394      OP3(ORREG1, ORXREG1, OWREGD4),
1395      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1396           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1397
1398 INSN(mpy32us, m, compound, 4cycle, C64XP, 0,
1399      FIX1(FIX(op, 0x19)),
1400      OP3(ORREG1, ORXREG1, OWREGD4),
1401      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1402           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1403
1404 /* "or" forms of "mv" are preferred over "add" forms when available
1405    because "or" uses less power.  However, 40-bit moves are only
1406    available through "add", and before C64X D-unit moves are only
1407    available through "add" (without cross paths being available).  */
1408 INSNE(mv, l_xui_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1409       FIX2(FIX(op, 0x7e), FIX(src1, 0)),
1410       OP2(ORXREG1, OWREG1),
1411       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1412            ENC(dst, reg, 1)))
1413 INSNE(mv, l_sl_sl, l, 1_or_2_src, 1cycle, C62X,
1414       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
1415       FIX3(FIX(op, 0x20), FIX(x, 0), FIX(src1, 0)),
1416       OP2(ORREGL1, OWREGL1),
1417       ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
1418 INSNE(mv, s_xui_ui, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1419       FIX2(FIX(op, 0x1a), FIX(src1, 0)),
1420       OP2(ORXREG1, OWREG1),
1421       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1422            ENC(dst, reg, 1)))
1423 INSNE(mv, d_si_si, d, 1_or_2_src, 1cycle, C62X,
1424       TIC6X_FLAG_MACRO|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(0),
1425       FIX2(FIX(op, 0x12), FIX(src1, 0)),
1426       OP2(ORREG1, OWREG1),
1427       ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
1428 INSNE(mv, d_xui_ui, d, ext_1_or_2_src, 1cycle, C64X,
1429       TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(1),
1430       FIX2(FIX(op, 0x3), FIX(src1, 0)),
1431       OP2(ORXREG1, OWREG1),
1432       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1433            ENC(dst, reg, 1)))
1434
1435 INSNE(mvc, from_cr, s, 1_or_2_src, 1cycle, C62X,
1436       TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_NO_CROSS,
1437       FIX3(FIX(s, 1), FIX(op, 0x0f), FIX(x, 0)),
1438       OP2(ORCREG1, OWREG1),
1439       ENC3(ENC(src1, crhi, 0), ENC(src2, crlo, 0), ENC(dst, reg, 1)))
1440 INSNE(mvc, to_cr, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_SIDE_B_ONLY,
1441       FIX2(FIX(s, 1), FIX(op, 0x0e)),
1442       OP2(ORXREG1, OWCREG1),
1443       ENC4(ENC(x, xpath, 0), ENC(src2, reg, 0), ENC(src1, crhi, 1),
1444            ENC(dst, crlo, 1)))
1445
1446 INSN(mvd, m, unary, 4cycle, C64X, 0,
1447      FIX1(FIX(op, 0x1a)),
1448      OP2(ORXREG1, OWREG4),
1449      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1450           ENC(dst, reg, 1)))
1451
1452 INSN(mvk, s, mvk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1453      FIX1(FIX(h, 0)),
1454      OP2(OLCST, OWREG1),
1455      ENC3(ENC(s, fu, 0), ENC(cst, scst, 0), ENC(dst, reg, 1)))
1456 INSN(mvk, l, unary, 1cycle, C64X, TIC6X_FLAG_NO_CROSS,
1457      FIX2(FIX(x, 0), FIX(op, 0x05)),
1458      OP2(OACST, OWREG1),
1459      ENC3(ENC(s, fu, 0), ENC(src2, scst, 0), ENC(dst, reg, 1)))
1460 INSN(mvk, d, 1_or_2_src, 1cycle, C64X, TIC6X_FLAG_NO_CROSS,
1461      FIX2(FIX(op, 0x00), FIX(src2, 0)),
1462      OP2(OACST, OWREG1),
1463      ENC3(ENC(s, fu, 0), ENC(src1, scst, 0), ENC(dst, reg, 1)))
1464
1465 INSN(mvkh, s, mvk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1466      FIX1(FIX(h, 1)),
1467      OP2(OLCST, OWREG1),
1468      ENC3(ENC(s, fu, 0), ENC(cst, lcst_high16, 0), ENC(dst, reg, 1)))
1469
1470 INSN(mvklh, s, mvk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
1471      FIX1(FIX(h, 1)),
1472      OP2(OLCST, OWREG1),
1473      ENC3(ENC(s, fu, 0), ENC(cst, lcst_low16, 0), ENC(dst, reg, 1)))
1474
1475 INSN(mvkl, s, mvk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
1476      FIX1(FIX(h, 0)),
1477      OP2(OLCST, OWREG1),
1478      ENC3(ENC(s, fu, 0), ENC(cst, lcst_low16, 0), ENC(dst, reg, 1)))
1479
1480 INSNE(neg, s_xsi_si, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1481       FIX2(FIX(op, 0x16), FIX(src1, 0)),
1482       OP2(ORXREG1, OWREG1),
1483       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1484            ENC(dst, reg, 1)))
1485 INSNE(neg, l_xsi_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1486       FIX2(FIX(op, 0x06), FIX(src1, 0)),
1487       OP2(ORXREG1, OWREG1),
1488       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1489            ENC(dst, reg, 1)))
1490 INSNE(neg, l_sl_sl, l, 1_or_2_src, 1cycle, C62X,
1491       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
1492       FIX2(FIX(op, 0x24), FIX(src1, 0)),
1493       OP2(ORREGL1, OWREGL1),
1494       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1495            ENC(dst, reg, 1)))
1496
1497 INSN(nop, nfu, nop_idle, nop, C62X, 0,
1498      FIX2(FIX(s, 0), RAN(op, 0, 8)),
1499      OP1(OACST),
1500      ENC1(ENC(op, ucst_minus_one, 0)))
1501 INSNE(nop, 1, nfu, nop_idle, nop, C62X, TIC6X_FLAG_MACRO,
1502       FIX2(FIX(s, 0), FIX(op, 0)),
1503       OP0(),
1504       ENC0())
1505
1506 INSNE(norm, l_xsi_ui, l, 1_or_2_src, 1cycle, C62X, 0,
1507       FIX2(FIX(op, 0x63), FIX(src1, 0)),
1508       OP2(ORXREG1, OWREG1),
1509       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1510            ENC(dst, reg, 1)))
1511 INSNE(norm, l_sl_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1512       FIX3(FIX(op, 0x60), FIX(x, 0), FIX(src1, 0)),
1513       OP2(ORREGL1, OWREG1),
1514       ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
1515
1516 INSN(not, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1517      FIX2(FIX(op, 0x6e), FIX(src1, 0x1f)),
1518      OP2(ORXREG1, OWREG1),
1519      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1520           ENC(dst, reg, 1)))
1521 INSN(not, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1522      FIX2(FIX(op, 0x0a), FIX(src1, 0x1f)),
1523      OP2(ORXREG1, OWREG1),
1524      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1525           ENC(dst, reg, 1)))
1526 INSN(not, d, ext_1_or_2_src, 1cycle, C64X, TIC6X_FLAG_MACRO,
1527      FIX2(FIX(op, 0xf), FIX(src1, 0x1f)),
1528      OP2(ORXREG1, OWREG1),
1529      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1530           ENC(dst, reg, 1)))
1531
1532 INSNE(or, d_ui_xui_ui, d, ext_1_or_2_src, 1cycle, C64X, 0,
1533       FIX1(FIX(op, 0x2)),
1534       OP3(ORREG1, ORXREG1, OWREG1),
1535       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1536            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1537 INSNE(or, d_s5_xui_ui, d, ext_1_or_2_src, 1cycle, C64X, 0,
1538       FIX1(FIX(op, 0x3)),
1539       OP3(OACST, ORXREG1, OWREG1),
1540       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1541            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1542 INSNE(or, l_ui_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
1543       FIX1(FIX(op, 0x7f)),
1544       OP3(ORREG1, ORXREG1, OWREG1),
1545       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1546            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1547 INSNE(or, l_s5_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
1548       FIX1(FIX(op, 0x7e)),
1549       OP3(OACST, ORXREG1, OWREG1),
1550       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1551            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1552 INSNE(or, s_ui_xui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
1553       FIX1(FIX(op, 0x1b)),
1554       OP3(ORREG1, ORXREG1, OWREG1),
1555       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1556            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1557 INSNE(or, s_s5_xui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
1558       FIX1(FIX(op, 0x1a)),
1559       OP3(OACST, ORXREG1, OWREG1),
1560       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1561            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1562
1563 INSN(pack2, l, 1_or_2_src, 1cycle, C64X, 0,
1564      FIX1(FIX(op, 0x0)),
1565      OP3(ORREG1, ORXREG1, OWREG1),
1566      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1567           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1568 INSN(pack2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1569      FIX1(FIX(op, 0xf)),
1570      OP3(ORREG1, ORXREG1, OWREG1),
1571      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1572           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1573
1574 INSN(packh2, l, 1_or_2_src, 1cycle, C64X, 0,
1575      FIX1(FIX(op, 0x1e)),
1576      OP3(ORREG1, ORXREG1, OWREG1),
1577      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1578           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1579 INSN(packh2, s, 1_or_2_src, 1cycle, C64X, 0,
1580      FIX1(FIX(op, 0x9)),
1581      OP3(ORREG1, ORXREG1, OWREG1),
1582      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1583           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1584
1585 INSN(packh4, l, 1_or_2_src, 1cycle, C64X, 0,
1586      FIX1(FIX(op, 0x69)),
1587      OP3(ORREG1, ORXREG1, OWREG1),
1588      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1589           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1590
1591 INSN(packhl2, l, 1_or_2_src, 1cycle, C64X, 0,
1592      FIX1(FIX(op, 0x1c)),
1593      OP3(ORREG1, ORXREG1, OWREG1),
1594      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1595           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1596 INSN(packhl2, s, 1_or_2_src, 1cycle, C64X, 0,
1597      FIX1(FIX(op, 0x8)),
1598      OP3(ORREG1, ORXREG1, OWREG1),
1599      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1600           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1601
1602 INSN(packlh2, l, 1_or_2_src, 1cycle, C64X, 0,
1603      FIX1(FIX(op, 0x1b)),
1604      OP3(ORREG1, ORXREG1, OWREG1),
1605      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1606           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1607 INSN(packlh2, s, 1_or_2_src, 1cycle, C64X, 0,
1608      FIX1(FIX(op, 0x10)),
1609      OP3(ORREG1, ORXREG1, OWREG1),
1610      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1611           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1612
1613 INSN(packl4, l, 1_or_2_src, 1cycle, C64X, 0,
1614      FIX1(FIX(op, 0x68)),
1615      OP3(ORREG1, ORXREG1, OWREG1),
1616      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1617           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1618
1619 INSN(rcpdp, s, 1_or_2_src, 2cycle_dp, C67X, TIC6X_FLAG_NO_CROSS,
1620      FIX3(FIX(op, 0x2d), FIX(x, 0), FIX(src1, 0)),
1621      OP2(ORREGD1, OWREGD12),
1622      ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
1623
1624 INSN(rcpsp, s, 1_or_2_src, 1cycle, C67X, 0,
1625      FIX2(FIX(op, 0x3d), FIX(src1, 0)),
1626      OP2(ORXREG1, OWREG1),
1627      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1628           ENC(dst, reg, 1)))
1629
1630 INSN(ret, s, ext_branch_cond_imm, branch, C62X,
1631      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_RETURN,
1632      FIX0(),
1633      OP1(OLCST),
1634      ENC2(ENC(s, fu, 0), ENC(cst, pcrel, 0)))
1635 INSN(ret, s, branch, branch, C62X,
1636      TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_RETURN,
1637      FIX1(FIX(s, 1)),
1638      OP1(ORXREG1),
1639      ENC2(ENC(x, xpath, 0), ENC(src2, reg, 0)))
1640 INSN(ret, s, b_irp, branch, C62X,
1641      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_RETURN,
1642      FIX3(FIX(s, 1), FIX(x, 0), FIX(dst, 0)),
1643      OP1(ORIRP1),
1644      ENC0())
1645 INSN(ret, s, b_nrp, branch, C62X,
1646      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_RETURN,
1647      FIX3(FIX(s, 1), FIX(x, 0), FIX(dst, 0)),
1648      OP1(ORNRP1),
1649      ENC0())
1650
1651 INSN(retp, s, call_imm_nop, branch, C64XP,
1652      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MCNOP|TIC6X_FLAG_MACRO|TIC6X_FLAG_RETURN,
1653      FIX1(FIX(z, 1)),
1654      OP2(OLCST, OWRETREG1),
1655      ENC2(ENC(s, fu, 0), ENC(cst, pcrel, 0)))
1656
1657 INSN(rint, nfu, rint, 1cycle, C64XP, 0,
1658      FIX1(FIX(s, 0)),
1659      OP0(),
1660      ENC0())
1661
1662 INSNE(rotl, m_ui_xui_ui, m, compound, 1616_m, C64X, 0,
1663       FIX1(FIX(op, 0x1d)),
1664       OP3(ORXREG1, ORREG1, OWREG2),
1665       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1666            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1667 INSNE(rotl, m_u5_xui_ui, m, compound, 1616_m, C64X, 0,
1668       FIX1(FIX(op, 0x1e)),
1669       OP3(ORXREG1, OACST, OWREG2),
1670       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1671            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1672
1673 INSN(rpack2, s, ext_1_or_2_src_noncond, 1cycle, C64XP, 0,
1674      FIX2(FIX(op, 0xb), FIX(z, 1)),
1675      OP3(ORREG1, ORXREG1, OWREG1),
1676      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1677           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1678
1679 INSN(rsqrdp, s, 1_or_2_src, 2cycle_dp, C67X, TIC6X_FLAG_NO_CROSS,
1680      FIX3(FIX(op, 0x2e), FIX(x, 0), FIX(src1, 0)),
1681      OP2(ORREGD1, OWREGD12),
1682      ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
1683
1684 INSN(rsqrsp, s, 1_or_2_src, 1cycle, C67X, 0,
1685      FIX2(FIX(op, 0x3e), FIX(src1, 0)),
1686      OP2(ORXREG1, OWREG1),
1687      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1688           ENC(dst, reg, 1)))
1689
1690 INSNE(sadd, l_si_xsi_si, l, 1_or_2_src, 1cycle, C62X, 0,
1691       FIX1(FIX(op, 0x13)),
1692       OP3(ORREG1, ORXREG1, OWREG1),
1693       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1694            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1695 INSNE(sadd, l_xsi_sl_sl, l, 1_or_2_src, 1cycle, C62X, 0,
1696       FIX1(FIX(op, 0x31)),
1697       OP3(ORXREG1, ORREGL1, OWREGL1),
1698       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1699            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1700 INSNE(sadd, l_s5_xsi_si, l, 1_or_2_src, 1cycle, C62X, 0,
1701       FIX1(FIX(op, 0x12)),
1702       OP3(OACST, ORXREG1, OWREG1),
1703       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1704            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1705 INSNE(sadd, l_s5_sl_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1706       FIX1(FIX(op, 0x30)),
1707       OP3(OACST, ORREGL1, OWREGL1),
1708       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1709            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1710 INSNE(sadd, s_si_xsi_si, s, 1_or_2_src, 1cycle, C64X, 0,
1711       FIX1(FIX(op, 0x20)),
1712       OP3(ORREG1, ORXREG1, OWREG1),
1713       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1714            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1715
1716 INSN(sadd2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1717      FIX1(FIX(op, 0x0)),
1718      OP3(ORREG1, ORXREG1, OWREG1),
1719      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1720           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1721
1722 INSN(saddsub, l, 1_or_2_src_noncond, 1cycle, C64XP, 0,
1723      FIX1(FIX(op, 0x0e)),
1724      OP3(ORREG1, ORXREG1, OWREGD1),
1725      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1726           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1727
1728 INSN(saddsub2, l, 1_or_2_src_noncond, 1cycle, C64XP, 0,
1729      FIX1(FIX(op, 0x0f)),
1730      OP3(ORREG1, ORXREG1, OWREGD1),
1731      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1732           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1733
1734 INSN(saddsu2, s, ext_1_or_2_src, 1cycle, C64X, TIC6X_FLAG_MACRO,
1735      FIX1(FIX(op, 0x1)),
1736      OP3(ORXREG1, ORREG1, OWREG1),
1737      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1738           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1739
1740 INSN(saddus2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1741      FIX1(FIX(op, 0x1)),
1742      OP3(ORREG1, ORXREG1, OWREG1),
1743      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1744           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1745
1746 INSN(saddu4, s, ext_1_or_2_src, 1cycle, C64X, 0,
1747      FIX1(FIX(op, 0x3)),
1748      OP3(ORREG1, ORXREG1, OWREG1),
1749      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1750           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1751
1752 INSN(sat, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1753      FIX3(FIX(op, 0x40), FIX(x, 0), FIX(src1, 0)),
1754      OP2(ORREGL1, OWREG1),
1755      ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
1756
1757 INSN(set, s, field, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1758      FIX1(FIX(op, 0x2)),
1759      OP4(ORREG1, OACST, OACST, OWREG1),
1760      ENC5(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(csta, ucst, 1),
1761           ENC(cstb, ucst, 2), ENC(dst, reg, 3)))
1762 INSN(set, s, 1_or_2_src, 1cycle, C62X, 0,
1763      FIX1(FIX(op, 0x3b)),
1764      OP3(ORXREG1, ORREG1, OWREG1),
1765      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1766           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1767
1768 INSN(shfl, m, unary, 1616_m, C64X, 0,
1769      FIX1(FIX(op, 0x1c)),
1770      OP2(ORXREG1, OWREG2),
1771      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1772           ENC(dst, reg, 1)))
1773
1774 INSN(shfl3, l, 1_or_2_src_noncond, 1cycle, C64XP, 0,
1775      FIX1(FIX(op, 0x36)),
1776      OP3(ORREG1, ORXREG1, OWREGD1),
1777      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1778           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1779
1780 INSNE(shl, s_xsi_ui_si, s, 1_or_2_src, 1cycle, C62X, 0,
1781       FIX1(FIX(op, 0x33)),
1782       OP3(ORXREG1, ORREG1, OWREG1),
1783       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1784            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1785 INSNE(shl, s_sl_ui_sl, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1786       FIX2(FIX(op, 0x31), FIX(x, 0)),
1787       OP3(ORREGL1, ORREG1, OWREGL1),
1788       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
1789            ENC(dst, reg, 2)))
1790 INSNE(shl, s_xui_ui_ul, s, 1_or_2_src, 1cycle, C62X, 0,
1791       FIX1(FIX(op, 0x13)),
1792       OP3(ORXREG1, ORREG1, OWREGL1),
1793       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1794            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1795 INSNE(shl, s_xsi_u5_si, s, 1_or_2_src, 1cycle, C62X, 0,
1796       FIX1(FIX(op, 0x32)),
1797       OP3(ORXREG1, OACST, OWREG1),
1798       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1799            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1800 INSNE(shl, s_sl_u5_sl, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1801       FIX2(FIX(op, 0x30), FIX(x, 0)),
1802       OP3(ORREGL1, OACST, OWREGL1),
1803       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
1804            ENC(dst, reg, 2)))
1805 INSNE(shl, s_xui_u5_ul, s, 1_or_2_src, 1cycle, C62X, 0,
1806       FIX1(FIX(op, 0x12)),
1807       OP3(ORXREG1, OACST, OWREGL1),
1808       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1809            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1810
1811 INSN(shlmb, l, 1_or_2_src, 1cycle, C64X, 0,
1812      FIX1(FIX(op, 0x61)),
1813      OP3(ORREG1, ORXREG1, OWREG1),
1814      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1815           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1816 INSN(shlmb, s, ext_1_or_2_src, 1cycle, C64X, 0,
1817      FIX1(FIX(op, 0x9)),
1818      OP3(ORREG1, ORXREG1, OWREG1),
1819      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1820           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1821
1822 INSNE(shr, s_xsi_ui_si, s, 1_or_2_src, 1cycle, C62X, 0,
1823       FIX1(FIX(op, 0x37)),
1824       OP3(ORXREG1, ORREG1, OWREG1),
1825       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1826            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1827 INSNE(shr, s_sl_ui_sl, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1828       FIX2(FIX(op, 0x35), FIX(x, 0)),
1829       OP3(ORREGL1, ORREG1, OWREGL1),
1830       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
1831            ENC(dst, reg, 2)))
1832 INSNE(shr, s_xsi_u5_si, s, 1_or_2_src, 1cycle, C62X, 0,
1833       FIX1(FIX(op, 0x36)),
1834       OP3(ORXREG1, OACST, OWREG1),
1835       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1836            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1837 INSNE(shr, s_sl_u5_sl, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1838       FIX2(FIX(op, 0x34), FIX(x, 0)),
1839       OP3(ORREGL1, OACST, OWREGL1),
1840       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
1841            ENC(dst, reg, 2)))
1842
1843 INSNE(shr2, s_xs2_ui_s2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1844       FIX1(FIX(op, 0x7)),
1845       OP3(ORXREG1, ORREG1, OWREG1),
1846       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1847            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1848 INSNE(shr2, s_xs2_u5_s2, s, 1_or_2_src, 1cycle, C64X, 0,
1849       FIX1(FIX(op, 0x18)),
1850       OP3(ORXREG1, OACST, OWREG1),
1851       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1852            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1853
1854 INSN(shrmb, l, 1_or_2_src, 1cycle, C64X, 0,
1855      FIX1(FIX(op, 0x62)),
1856      OP3(ORREG1, ORXREG1, OWREG1),
1857      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1858           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1859 INSN(shrmb, s, ext_1_or_2_src, 1cycle, C64X, 0,
1860      FIX1(FIX(op, 0xa)),
1861      OP3(ORREG1, ORXREG1, OWREG1),
1862      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1863           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1864
1865 INSNE(shru, s_xui_ui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
1866       FIX1(FIX(op, 0x27)),
1867       OP3(ORXREG1, ORREG1, OWREG1),
1868       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1869            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1870 INSNE(shru, s_ul_ui_ul, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1871       FIX2(FIX(op, 0x25), FIX(x, 0)),
1872       OP3(ORREGL1, ORREG1, OWREGL1),
1873       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
1874            ENC(dst, reg, 2)))
1875 INSNE(shru, s_xui_u5_ui, s, 1_or_2_src, 1cycle, C62X, 0,
1876       FIX1(FIX(op, 0x26)),
1877       OP3(ORXREG1, OACST, OWREG1),
1878       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1879            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1880 INSNE(shru, s_ul_u5_ul, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1881       FIX2(FIX(op, 0x24), FIX(x, 0)),
1882       OP3(ORREGL1, OACST, OWREGL1),
1883       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
1884            ENC(dst, reg, 2)))
1885
1886 INSNE(shru2, s_xu2_ui_u2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1887       FIX1(FIX(op, 0x8)),
1888       OP3(ORXREG1, ORREG1, OWREG1),
1889       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1890            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1891 INSNE(shru2, s_xu2_u5_u2, s, 1_or_2_src, 1cycle, C64X, 0,
1892       FIX1(FIX(op, 0x19)),
1893       OP3(ORXREG1, OACST, OWREG1),
1894       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1895            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1896
1897 INSN(sl, d, 1_or_2_src, store, C64XP,
1898      TIC6X_FLAG_STORE|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_SIDE_T2_ONLY|TIC6X_FLAG_NO_CROSS,
1899      FIX3(FIX(s, 1), FIX(op, 0xd), FIX(src1, 0)),
1900      OP2(ORDREG1, OWMEMDW),
1901      ENC2(ENC(dst, reg, 0), ENC(src2, reg, 1)))
1902
1903 INSN(smpy, m, mpy, 1616_m, C62X, 0,
1904      FIX1(FIX(op, 0x1a)),
1905      OP3(ORREG1, ORXREG1, OWREG2),
1906      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1907           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1908
1909 INSN(smpyh, m, mpy, 1616_m, C62X, 0,
1910      FIX1(FIX(op, 0x02)),
1911      OP3(ORREG1, ORXREG1, OWREG2),
1912      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1913           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1914
1915 INSN(smpyhl, m, mpy, 1616_m, C62X, 0,
1916      FIX1(FIX(op, 0x0a)),
1917      OP3(ORREG1, ORXREG1, OWREG2),
1918      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1919           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1920
1921 INSN(smpylh, m, mpy, 1616_m, C62X, 0,
1922      FIX1(FIX(op, 0x12)),
1923      OP3(ORREG1, ORXREG1, OWREG2),
1924      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1925           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1926
1927 INSN(smpy2, m, compound, 4cycle, C64X, 0,
1928      FIX1(FIX(op, 0x01)),
1929      OP3(ORREG1, ORXREG1, OWREGD4),
1930      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1931           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1932
1933 /* Contrary to SPRUFE8, this is the correct operand order for this
1934    instruction.  */
1935 INSN(smpy32, m, 1_or_2_src, 4cycle, C64XP, 0,
1936      FIX1(FIX(op, 0x19)),
1937      OP3(ORREG1, ORXREG1, OWREG4),
1938      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1939           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1940
1941 INSN(spack2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1942      FIX1(FIX(op, 0x2)),
1943      OP3(ORREG1, ORXREG1, OWREG1),
1944      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1945           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1946
1947 INSN(spacku4, s, ext_1_or_2_src, 1cycle, C64X, 0,
1948      FIX1(FIX(op, 0x4)),
1949      OP3(ORREG1, ORXREG1, OWREG1),
1950      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1951           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1952
1953 INSN(spdp, s, 1_or_2_src, 2cycle_dp, C67X, 0,
1954      FIX2(FIX(op, 0x02), FIX(src1, 0)),
1955      OP2(ORXREG1, OWREGD12),
1956      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1957           ENC(dst, reg, 1)))
1958
1959 INSN(spint, l, 1_or_2_src, 4cycle, C67X, 0,
1960      FIX2(FIX(op, 0x0a), FIX(src1, 0)),
1961      OP2(ORXREG1, OWREG4),
1962      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1963           ENC(dst, reg, 1)))
1964
1965 INSNE(spkernel, nfu_2, nfu, spkernel, 1cycle, C64XP,
1966       TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPKERNEL,
1967       FIX1(FIX(s, 0)),
1968       OP2(OACST, OACST),
1969       ENC2(ENC(fstgfcyc, fstg, 0), ENC(fstgfcyc, fcyc, 1)))
1970 INSNE(spkernel, nfu_0, nfu, spkernel, 1cycle, C64XP,
1971       TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPKERNEL|TIC6X_FLAG_MACRO,
1972       FIX2(FIX(s, 0), FIX(fstgfcyc, 0)),
1973       OP0(),
1974       ENC0())
1975
1976 INSN(spkernelr, nfu, spkernelr, 1cycle, C64XP,
1977      TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPKERNEL,
1978      FIX1(FIX(s, 0)),
1979      OP0(),
1980      ENC0())
1981
1982 INSN(sploop, nfu, loop_buffer, 1cycle, C64XP,
1983      TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPLOOP,
1984      FIX4(FIX(s, 0), FIX(op, 0xc), FIX(csta, 0), RAN(cstb, 0, 13)),
1985      OP1(OACST),
1986      ENC1(ENC(cstb, ucst_minus_one, 0)))
1987
1988 INSN(sploopd, nfu, loop_buffer, 1cycle, C64XP,
1989      TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPLOOP,
1990      FIX4(FIX(s, 0), FIX(op, 0xd), FIX(csta, 0), RAN(cstb, 0, 13)),
1991      OP1(OACST),
1992      ENC1(ENC(cstb, ucst_minus_one, 0)))
1993
1994 INSN(sploopw, nfu, loop_buffer, 1cycle, C64XP,
1995      TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPLOOP,
1996      FIX4(FIX(s, 0), FIX(op, 0xf), FIX(csta, 0), RAN(cstb, 0, 13)),
1997      OP1(OACST),
1998      ENC1(ENC(cstb, ucst_minus_one, 0)))
1999
2000 /* Contrary to SPRUFE8, this is the correct encoding for this
2001    instruction.  */
2002 INSN(spmask, nfu, spmask, 1cycle, C64XP, TIC6X_FLAG_FIRST|TIC6X_FLAG_SPMASK,
2003      FIX2(FIX(s, 0), FIX(op, 0x8)),
2004      OP1(OFULIST),
2005      ENC1(ENC(mask, spmask, 0)))
2006
2007 INSN(spmaskr, nfu, spmask, 1cycle, C64XP, TIC6X_FLAG_FIRST|TIC6X_FLAG_SPMASK,
2008      FIX2(FIX(s, 0), FIX(op, 0x9)),
2009      OP1(OFULIST),
2010      ENC1(ENC(mask, spmask, 0)))
2011
2012 INSN(sptrunc, l, 1_or_2_src, 4cycle, C67X, 0,
2013      FIX2(FIX(op, 0x0b), FIX(src1, 0)),
2014      OP2(ORXREG1, OWREG4),
2015      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2016           ENC(dst, reg, 1)))
2017
2018 INSNE(sshl, s_xsi_ui_si, s, 1_or_2_src, 1cycle, C62X, 0,
2019       FIX1(FIX(op, 0x23)),
2020       OP3(ORXREG1, ORREG1, OWREG1),
2021       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2022            ENC(src1, reg, 1), ENC(dst, reg, 2)))
2023 INSNE(sshl, s_xsi_u5_si, s, 1_or_2_src, 1cycle, C62X, 0,
2024       FIX1(FIX(op, 0x22)),
2025       OP3(ORXREG1, OACST, OWREG1),
2026       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2027            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
2028
2029 INSN(sshvl, m, compound, 1616_m, C64X, 0,
2030      FIX1(FIX(op, 0x1c)),
2031      OP3(ORXREG1, ORREG1, OWREG2),
2032      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2033           ENC(src1, reg, 1), ENC(dst, reg, 2)))
2034
2035 /* Contrary to SPRUFE8, this is the correct encoding for this
2036    instruction.  */
2037 INSN(sshvr, m, compound, 1616_m, C64X, 0,
2038      FIX1(FIX(op, 0x1a)),
2039      OP3(ORXREG1, ORREG1, OWREG2),
2040      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2041           ENC(src1, reg, 1), ENC(dst, reg, 2)))
2042
2043 INSNE(ssub, l_si_xsi_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
2044       FIX1(FIX(op, 0x0f)),
2045       OP3(ORREG1, ORXREG1, OWREG1),
2046       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2047            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2048 INSNE(ssub, l_xsi_si_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(0),
2049       FIX1(FIX(op, 0x1f)),
2050       OP3(ORXREG1, ORREG1, OWREG1),
2051       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2052            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2053 INSNE(ssub, l_s5_xsi_si, l, 1_or_2_src, 1cycle, C62X, 0,
2054       FIX1(FIX(op, 0x0e)),
2055       OP3(OACST, ORXREG1, OWREG1),
2056       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2057            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2058 INSNE(ssub, l_s5_sl_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2059       FIX1(FIX(op, 0x2c)),
2060       OP3(OACST, ORREGL1, OWREGL1),
2061       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2062            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2063
2064 INSN(ssub2, l, 1_or_2_src, 1cycle, C64XP, 0,
2065      FIX1(FIX(op, 0x64)),
2066      OP3(ORREG1, ORXREG1, OWREG1),
2067      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2068           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2069
2070 INSN(stb, d, load_store, store, C62X,
2071      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
2072      FIX2(FIX(op, 3), FIX(r, 0)),
2073      OP2(ORDREG1, OWMEMSB),
2074      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2075           ENC(offsetR, mem_offset, 1), ENC(baseR, reg, 1),
2076           ENC(srcdst, reg, 0)))
2077 INSN(stb, d, load_store_long, store, C62X,
2078      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
2079      FIX1(FIX(op, 3)),
2080      OP2(ORDREG1, OWMEMLB),
2081      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 1), ENC(offsetR, ulcst_dpr_byte, 1),
2082           ENC(dst, reg, 0)))
2083
2084 INSN(stdw, d, load_store, store, C64X, TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS,
2085      FIX2(FIX(op, 4), FIX(r, 1)),
2086      OP2(ORDREGD1, OWMEMSD),
2087      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2088           ENC(offsetR, mem_offset, 1), ENC(baseR, reg, 1),
2089           ENC(srcdst, reg, 0)))
2090
2091 INSN(sth, d, load_store, store, C62X,
2092      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
2093      FIX2(FIX(op, 5), FIX(r, 0)),
2094      OP2(ORDREG1, OWMEMSH),
2095      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2096           ENC(offsetR, mem_offset, 1), ENC(baseR, reg, 1),
2097           ENC(srcdst, reg, 0)))
2098 INSN(sth, d, load_store_long, store, C62X,
2099      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
2100      FIX1(FIX(op, 5)),
2101      OP2(ORDREG1, OWMEMLH),
2102      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 1), ENC(offsetR, ulcst_dpr_half, 1),
2103           ENC(dst, reg, 0)))
2104
2105 INSN(stndw, d, store_nonaligned, store, C64X,
2106      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_UNALIGNED,
2107      FIX0(),
2108      OP2(ORDREGD1, OWMEMND),
2109      ENC7(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2110           ENC(offsetR, mem_offset_noscale, 1), ENC(baseR, reg, 1),
2111           ENC(sc, scaled, 1), ENC(src, reg_shift, 0)))
2112
2113 INSN(stnw, d, load_store, store, C64X,
2114      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_UNALIGNED,
2115      FIX2(FIX(op, 5), FIX(r, 1)),
2116      OP2(ORDREG1, OWMEMSW),
2117      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2118           ENC(offsetR, mem_offset, 1), ENC(baseR, reg, 1),
2119           ENC(srcdst, reg, 0)))
2120
2121 INSN(stw, d, load_store, store, C62X,
2122      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
2123      FIX2(FIX(op, 7), FIX(r, 0)),
2124      OP2(ORDREG1, OWMEMSW),
2125      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2126           ENC(offsetR, mem_offset, 1), ENC(baseR, reg, 1),
2127           ENC(srcdst, reg, 0)))
2128 INSN(stw, d, load_store_long, store, C62X,
2129      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
2130      FIX1(FIX(op, 7)),
2131      OP2(ORDREG1, OWMEMLW),
2132      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 1), ENC(offsetR, ulcst_dpr_word, 1),
2133           ENC(dst, reg, 0)))
2134
2135 INSNE(sub, l_si_xsi_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
2136       FIX1(FIX(op, 0x07)),
2137       OP3(ORREG1, ORXREG1, OWREG1),
2138       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2139            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2140 INSNE(sub, l_xsi_si_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(0),
2141       FIX1(FIX(op, 0x17)),
2142       OP3(ORXREG1, ORREG1, OWREG1),
2143       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2144            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2145 INSNE(sub, l_si_xsi_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
2146       FIX1(FIX(op, 0x27)),
2147       OP3(ORREG1, ORXREG1, OWREGL1),
2148       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2149            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2150 INSNE(sub, l_xsi_si_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(0),
2151       FIX1(FIX(op, 0x37)),
2152       OP3(ORXREG1, ORREG1, OWREGL1),
2153       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2154            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2155 INSNE(sub, l_s5_xsi_si, l, 1_or_2_src, 1cycle, C62X, 0,
2156       FIX1(FIX(op, 0x06)),
2157       OP3(OACST, ORXREG1, OWREG1),
2158       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2159            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2160 INSNE(sub, l_s5_sl_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2161       FIX1(FIX(op, 0x24)),
2162       OP3(OACST, ORREGL1, OWREGL1),
2163       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2164            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2165 INSNE(sub, l_xsi_s5_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
2166       FIX1(FIX(op, 0x2)),
2167       OP3(ORXREG1, OACST, OWREG1),
2168       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst_negate, 1),
2169            ENC(src2, reg, 0), ENC(dst, reg, 2)))
2170 INSNE(sub, l_sl_s5_sl, l, 1_or_2_src, 1cycle, C62X,
2171       TIC6X_FLAG_MACRO|TIC6X_FLAG_NO_CROSS,
2172       FIX2(FIX(op, 0x20), FIX(x, 0)),
2173       OP3(ORREGL1, OACST, OWREGL1),
2174       ENC4(ENC(s, fu, 0), ENC(src1, scst_negate, 1), ENC(src2, reg, 0),
2175            ENC(dst, reg, 2)))
2176 INSNE(sub, s_si_xsi_si, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
2177       FIX1(FIX(op, 0x17)),
2178       OP3(ORREG1, ORXREG1, OWREG1),
2179       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2180            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2181 INSNE(sub, s_s5_xsi_si, s, 1_or_2_src, 1cycle, C62X, 0,
2182       FIX1(FIX(op, 0x16)),
2183       OP3(OACST, ORXREG1, OWREG1),
2184       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2185            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2186 /* Contrary to SPRUFE8, this is the correct encoding for this
2187    instruction; this instruction can be predicated.  */
2188 INSNE(sub, s_xsi_si_si, s, ext_1_or_2_src, 1cycle, C64X, TIC6X_FLAG_PREFER(0),
2189       FIX1(FIX(op, 0x5)),
2190       OP3(ORXREG1, ORREG1, OWREG1),
2191       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2192            ENC(src1, reg, 1), ENC(dst, reg, 2)))
2193 INSNE(sub, s_xsi_s5_si, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
2194       FIX1(FIX(op, 0x6)),
2195       OP3(ORXREG1, OACST, OWREG1),
2196       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst_negate, 1),
2197            ENC(src2, reg, 0), ENC(dst, reg, 2)))
2198 INSNE(sub, d_si_si_si, d, 1_or_2_src, 1cycle, C62X,
2199       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
2200       FIX1(FIX(op, 0x11)),
2201       OP3(ORREG1, ORREG1, OWREG1),
2202       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
2203            ENC(dst, reg, 2)))
2204 INSNE(sub, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2205       FIX1(FIX(op, 0x13)),
2206       OP3(ORREG1, OACST, OWREG1),
2207       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
2208            ENC(dst, reg, 2)))
2209 INSNE(sub, d_si_xsi_si, d, ext_1_or_2_src, 1cycle, C64X, TIC6X_FLAG_PREFER(0),
2210       FIX1(FIX(op, 0xc)),
2211       OP3(ORREG1, ORXREG1, OWREG1),
2212       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2213            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2214
2215 INSNE(subab, d_si_si_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2216       FIX1(FIX(op, 0x31)),
2217       OP3(ORREG1, ORREG1, OWREG1),
2218       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
2219            ENC(dst, reg, 2)))
2220 INSNE(subab, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2221       FIX1(FIX(op, 0x33)),
2222       OP3(ORREG1, OACST, OWREG1),
2223       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
2224            ENC(dst, reg, 2)))
2225
2226 INSN(subabs4, l, 1_or_2_src, 1cycle, C64X, 0,
2227      FIX1(FIX(op, 0x5a)),
2228      OP3(ORREG1, ORXREG1, OWREG1),
2229      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2230           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2231
2232 INSNE(subah, d_si_si_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2233       FIX1(FIX(op, 0x35)),
2234       OP3(ORREG1, ORREG1, OWREG1),
2235       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
2236            ENC(dst, reg, 2)))
2237 INSNE(subah, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2238       FIX1(FIX(op, 0x37)),
2239       OP3(ORREG1, OACST, OWREG1),
2240       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
2241            ENC(dst, reg, 2)))
2242
2243 INSNE(subaw, d_si_si_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2244       FIX1(FIX(op, 0x39)),
2245       OP3(ORREG1, ORREG1, OWREG1),
2246       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
2247            ENC(dst, reg, 2)))
2248 INSNE(subaw, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2249       FIX1(FIX(op, 0x3b)),
2250       OP3(ORREG1, OACST, OWREG1),
2251       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
2252            ENC(dst, reg, 2)))
2253
2254 INSN(subc, l, 1_or_2_src, 1cycle, C62X, 0,
2255      FIX1(FIX(op, 0x4b)),
2256      OP3(ORREG1, ORXREG1, OWREG1),
2257      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2258           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2259
2260 INSNE(subdp, l_dp_xdp_dp, l, 1_or_2_src, addsubdp, C67X, TIC6X_FLAG_PREFER(1),
2261       FIX1(FIX(op, 0x19)),
2262       OP3(ORREGD12, ORXREGD12, OWREGD67),
2263       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2264            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2265 INSNE(subdp, l_xdp_dp_dp, l, 1_or_2_src, addsubdp, C67X, TIC6X_FLAG_PREFER(0),
2266       FIX1(FIX(op, 0x1d)),
2267       OP3(ORXREGD12, ORREGD12, OWREGD67),
2268       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2269            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2270 INSNE(subdp, s_dp_xdp_dp, s, l_1_or_2_src, addsubdp, C67XP,
2271       TIC6X_FLAG_PREFER(1),
2272       FIX1(FIX(op, 0x73)),
2273       OP3(ORREGD12, ORXREGD12, OWREGD67),
2274       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2275            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2276 INSNE(subdp, s_xdp_dp_dp, s, l_1_or_2_src, addsubdp, C67XP,
2277       TIC6X_FLAG_PREFER(0),
2278       FIX1(FIX(op, 0x77)),
2279       OP3(ORXREGD12, ORREGD12, OWREGD67),
2280       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2281            ENC(src1, reg, 1), ENC(dst, reg, 2)))
2282
2283 INSNE(subsp, l_sp_xsp_sp, l, 1_or_2_src, 4cycle, C67X, TIC6X_FLAG_PREFER(1),
2284       FIX1(FIX(op, 0x11)),
2285       OP3(ORREG1, ORXREG1, OWREG4),
2286       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2287            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2288 INSNE(subsp, l_xsp_sp_sp, l, 1_or_2_src, 4cycle, C67X, TIC6X_FLAG_PREFER(0),
2289       FIX1(FIX(op, 0x15)),
2290       OP3(ORXREG1, ORREG1, OWREG4),
2291       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2292            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2293 INSNE(subsp, s_sp_xsp_sp, s, l_1_or_2_src, 4cycle, C67XP,
2294       TIC6X_FLAG_PREFER(1),
2295       FIX1(FIX(op, 0x71)),
2296       OP3(ORREG1, ORXREG1, OWREG4),
2297       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2298            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2299 INSNE(subsp, s_xsp_sp_sp, s, l_1_or_2_src, 4cycle, C67XP,
2300       TIC6X_FLAG_PREFER(0),
2301       FIX1(FIX(op, 0x75)),
2302       OP3(ORXREG1, ORREG1, OWREG4),
2303       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2304            ENC(src1, reg, 1), ENC(dst, reg, 2)))
2305
2306 INSNE(subu, l_ui_xui_ul, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
2307       FIX1(FIX(op, 0x2f)),
2308       OP3(ORREG1, ORXREG1, OWREGL1),
2309       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2310            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2311 INSNE(subu, l_xui_ui_ul, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(0),
2312       FIX1(FIX(op, 0x3f)),
2313       OP3(ORXREG1, ORREG1, OWREGL1),
2314       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2315            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2316
2317 INSN(sub2, l, 1_or_2_src, 1cycle, C64X, 0,
2318      FIX1(FIX(op, 0x04)),
2319      OP3(ORREG1, ORXREG1, OWREG1),
2320      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2321           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2322 INSN(sub2, s, 1_or_2_src, 1cycle, C62X, 0,
2323      FIX1(FIX(op, 0x11)),
2324      OP3(ORREG1, ORXREG1, OWREG1),
2325      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2326           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2327 INSN(sub2, d, ext_1_or_2_src, 1cycle, C64X, 0,
2328      FIX1(FIX(op, 0x5)),
2329      OP3(ORREG1, ORXREG1, OWREG1),
2330      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2331           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2332
2333 INSN(sub4, l, 1_or_2_src, 1cycle, C64X, 0,
2334      FIX1(FIX(op, 0x66)),
2335      OP3(ORREG1, ORXREG1, OWREG1),
2336      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2337           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2338
2339 INSN(swap2, l, 1_or_2_src, 1cycle, C64X, TIC6X_FLAG_MACRO|TIC6X_FLAG_NO_CROSS,
2340      FIX2(FIX(op, 0x1b), FIX(x, 0)),
2341      OP2(ORREG1, OWREG1),
2342      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2343           ENC(src2, reg, 0), ENC(dst, reg, 1)))
2344 INSN(swap2, s, 1_or_2_src, 1cycle, C64X, TIC6X_FLAG_MACRO|TIC6X_FLAG_NO_CROSS,
2345      FIX2(FIX(op, 0x10), FIX(x, 0)),
2346      OP2(ORREG1, OWREG1),
2347      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2348           ENC(src2, reg, 0), ENC(dst, reg, 1)))
2349
2350 /* Contrary to SPRUFE8, this is the correct encoding for this
2351    instruction.  */
2352 INSN(swap4, l, unary, 1cycle, C64X, 0,
2353      FIX1(FIX(op, 0x1)),
2354      OP2(ORXREG1, OWREG1),
2355      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2356           ENC(dst, reg, 1)))
2357
2358 INSN(swe, nfu, swe, 1cycle, C64XP, 0,
2359      FIX1(FIX(s, 0)),
2360      OP0(),
2361      ENC0())
2362
2363 INSN(swenr, nfu, swenr, 1cycle, C64XP, 0,
2364      FIX1(FIX(s, 0)),
2365      OP0(),
2366      ENC0())
2367
2368 INSN(unpkhu4, l, unary, 1cycle, C64X, 0,
2369      FIX1(FIX(op, 0x03)),
2370      OP2(ORXREG1, OWREG1),
2371      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2372           ENC(dst, reg, 1)))
2373 INSN(unpkhu4, s, unary, 1cycle, C64X, 0,
2374      FIX1(FIX(op, 0x03)),
2375      OP2(ORXREG1, OWREG1),
2376      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2377           ENC(dst, reg, 1)))
2378
2379 INSN(unpklu4, l, unary, 1cycle, C64X, 0,
2380      FIX1(FIX(op, 0x02)),
2381      OP2(ORXREG1, OWREG1),
2382      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2383           ENC(dst, reg, 1)))
2384 INSN(unpklu4, s, unary, 1cycle, C64X, 0,
2385      FIX1(FIX(op, 0x02)),
2386      OP2(ORXREG1, OWREG1),
2387      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2388           ENC(dst, reg, 1)))
2389
2390 INSNE(xor, l_ui_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
2391       FIX1(FIX(op, 0x6f)),
2392       OP3(ORREG1, ORXREG1, OWREG1),
2393       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2394            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2395 INSNE(xor, l_s5_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
2396       FIX1(FIX(op, 0x6e)),
2397       OP3(OACST, ORXREG1, OWREG1),
2398       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2399            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2400 INSNE(xor, s_ui_xui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
2401       FIX1(FIX(op, 0x0b)),
2402       OP3(ORREG1, ORXREG1, OWREG1),
2403       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2404            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2405 INSNE(xor, s_s5_xui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
2406       FIX1(FIX(op, 0x0a)),
2407       OP3(OACST, ORXREG1, OWREG1),
2408       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2409            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2410 INSNE(xor, d_ui_xui_ui, d, ext_1_or_2_src, 1cycle, C64X, 0,
2411       FIX1(FIX(op, 0xe)),
2412       OP3(ORREG1, ORXREG1, OWREG1),
2413       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2414            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2415 INSNE(xor, d_s5_xui_ui, d, ext_1_or_2_src, 1cycle, C64X, 0,
2416       FIX1(FIX(op, 0xf)),
2417       OP3(OACST, ORXREG1, OWREG1),
2418       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2419            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2420
2421 INSN(xormpy, m, 1_or_2_src, 4cycle, C64XP, 0,
2422      FIX1(FIX(op, 0x1b)),
2423      OP3(ORREG1, ORXREG1, OWREG4),
2424      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2425           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2426
2427 INSN(xpnd2, m, unary, 1616_m, C64X, 0,
2428      FIX1(FIX(op, 0x19)),
2429      OP2(ORXREG1, OWREG2),
2430      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2431           ENC(dst, reg, 1)))
2432
2433 INSN(xpnd4, m, unary, 1616_m, C64X, 0,
2434      FIX1(FIX(op, 0x18)),
2435      OP2(ORXREG1, OWREG2),
2436      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2437           ENC(dst, reg, 1)))
2438
2439 INSN(zero, s, mvk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
2440      FIX2(FIX(h, 0), FIX(cst, 0)),
2441      OP1(OWREG1),
2442      ENC2(ENC(s, fu, 0), ENC(dst, reg, 0)))
2443 INSN(zero, l, unary, 1cycle, C64X,
2444      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(1),
2445      FIX3(FIX(x, 0), FIX(op, 0x05), FIX(src2, 0)),
2446      OP1(OWREG1),
2447      ENC2(ENC(s, fu, 0), ENC(dst, reg, 0)))
2448 INSNE(zero, l_sub, l, 1_or_2_src, 1cycle, C62X,
2449       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(0),
2450       FIX2(FIX(op, 0x07), FIX(x, 0)),
2451       OP1(OWREG1),
2452       ENC4(ENC(s, fu, 0), ENC(src1, reg_unused, 0), ENC(src2, reg_unused, 0),
2453            ENC(dst, reg, 0)))
2454 INSNE(zero, l_sub_sl, l, 1_or_2_src, 1cycle, C62X,
2455       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
2456       FIX2(FIX(op, 0x27), FIX(x, 0)),
2457       OP1(OWREGL1),
2458       ENC4(ENC(s, fu, 0), ENC(src1, reg_unused, 0), ENC(src2, reg_unused, 0),
2459            ENC(dst, reg, 0)))
2460 INSNE(zero, d_mvk, d, 1_or_2_src, 1cycle, C64X,
2461       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(1),
2462       FIX3(FIX(op, 0x00), FIX(src1, 0), FIX(src2, 0)),
2463       OP1(OWREG1),
2464       ENC2(ENC(s, fu, 0), ENC(dst, reg, 0)))
2465 INSNE(zero, d_sub, d, 1_or_2_src, 1cycle, C62X,
2466       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(0),
2467       FIX1(FIX(op, 0x11)),
2468       OP1(OWREG1),
2469       ENC4(ENC(s, fu, 0), ENC(src2, reg_unused, 0), ENC(src1, reg_unused, 0),
2470            ENC(dst, reg, 0)))
2471
2472 #undef TIC6X_INSN_C64X_AND_C67X
2473 #undef tic6x_insn_format_nfu_s_branch_nop_cst
2474 #undef tic6x_insn_format_s_l_1_or_2_src
2475 #undef RAN
2476 #undef FIX
2477 #undef FIX0
2478 #undef FIX1
2479 #undef FIX2
2480 #undef FIX3
2481 #undef FIX4
2482 #undef OP0
2483 #undef OP1
2484 #undef OP2
2485 #undef OP3
2486 #undef OP4
2487 #undef OACST
2488 #undef OLCST
2489 #undef OFULIST
2490 #undef ORIRP1
2491 #undef ORNRP1
2492 #undef OWREG1
2493 #undef OWRETREG1
2494 #undef ORREG1
2495 #undef ORDREG1
2496 #undef ORWREG1
2497 #undef ORAREG1
2498 #undef ORXREG1
2499 #undef ORREG12
2500 #undef ORREG14
2501 #undef ORXREG14
2502 #undef OWREG2
2503 #undef OWREG4
2504 #undef OWREG9
2505 #undef OWDREG5
2506 #undef OWREGL1
2507 #undef ORREGL1
2508 #undef OWREGD1
2509 #undef OWREGD12
2510 #undef OWREGD4
2511 #undef ORREGD1
2512 #undef OWREGD45
2513 #undef OWREGD67
2514 #undef ORDREGD1
2515 #undef OWDREGD5
2516 #undef ORREGD12
2517 #undef ORXREGD12
2518 #undef ORREGD1234
2519 #undef ORREGD1324
2520 #undef OWREGD910
2521 #undef ORCREG1
2522 #undef OWCREG1
2523 #undef ORMEMDW
2524 #undef OWMEMDW
2525 #undef ORMEMSB
2526 #undef OWMEMSB
2527 #undef ORMEMLB
2528 #undef OWMEMLB
2529 #undef ORMEMSH
2530 #undef OWMEMSH
2531 #undef ORMEMLH
2532 #undef OWMEMLH
2533 #undef ORMEMSW
2534 #undef OWMEMSW
2535 #undef ORMEMLW
2536 #undef OWMEMLW
2537 #undef ORMEMSD
2538 #undef OWMEMSD
2539 #undef ORMEMND
2540 #undef OWMEMND
2541 #undef ENC
2542 #undef ENC0
2543 #undef ENC1
2544 #undef ENC2
2545 #undef ENC3
2546 #undef ENC4
2547 #undef ENC5
2548 #undef ENC6
2549 #undef ENC7