PR gas/15082
[platform/upstream/binutils.git] / include / opcode / tic6x-opcode-table.h
1 /* TI C6X opcode table.
2    Copyright 2010-2013 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
17    MA 02110-1301, USA.  */
18
19 /* Define the INSN macro before including this file; it takes as
20    arguments the fields from tic6x_opcode (defined in tic6x.h).  The
21    name is given as an identifier; the subsequent four operands should
22    have "tic6x_func_unit_", "tic6x_insn_format_", "tic6x_pipeline_"
23    and "TIC6X_INSN_", respectively, prepended to them by the macro
24    definition.  Also define INSNE, which has a second argument that
25    goes after tic6x_opcode_NAME_ to form the enumeration value for
26    this instruction, where the value otherwise formed from the name,
27    functional unit and format is ambiguous, but otherwise has the same
28    arguments as INSN.  */
29
30 #define TIC6X_INSN_C64X_AND_C67X TIC6X_INSN_C64X|TIC6X_INSN_C67X
31 #define tic6x_insn_format_nfu_s_branch_nop_cst  \
32   tic6x_insn_format_s_branch_nop_cst
33 #define tic6x_insn_format_s_l_1_or_2_src tic6x_insn_format_l_1_or_2_src
34 #define RAN(id, min, max) { CONCAT2(tic6x_field_,id), (min), (max) }
35 #define FIX(id, val) RAN(id, val, val)
36 #define FIX0() 0, { { 0, 0, 0 } }
37 #define FIX1(a) 1, { a }
38 #define FIX2(a, b) 2, { a, b }
39 #define FIX3(a, b, c) 3, { a, b, c }
40 #define FIX4(a, b, c, d) 4, { a, b, c, d }
41 #define OP0() 0, { { 0, 0, FALSE, 0, 0, 0, 0 } }
42 #define OP1(a) 1, { a }
43 #define OP2(a, b) 2, { a, b }
44 #define OP3(a, b, c) 3, { a, b, c }
45 #define OP4(a, b, c, d) 4, { a, b, c, d }
46 #define OACST { tic6x_operand_asm_const, 0, tic6x_rw_none, 0, 0, 0, 0 }
47 #define OLCST { tic6x_operand_link_const, 0, tic6x_rw_none, 0, 0, 0, 0 }
48 #define OFULIST { tic6x_operand_func_unit, 0, tic6x_rw_none, 0, 0, 0, 0 }
49 #define ORIRP1 { tic6x_operand_irp, 4, tic6x_rw_read, 1, 1, 0, 0 }
50 #define ORNRP1 { tic6x_operand_nrp, 4, tic6x_rw_read, 1, 1, 0, 0 }
51 #define OWREG1 { tic6x_operand_reg, 4, tic6x_rw_write, 1, 1, 0, 0 }
52 #define OWRETREG1 { tic6x_operand_retreg, 4, tic6x_rw_write, 1, 1, 0, 0 }
53 #define ORREG1 { tic6x_operand_reg, 4, tic6x_rw_read, 1, 1, 0, 0 }
54 #define ORDREG1 { tic6x_operand_dreg, 4, tic6x_rw_read, 1, 1, 0, 0 }
55 #define ORWREG1 { tic6x_operand_reg, 4, tic6x_rw_read_write, 1, 1, 0, 0 }
56 #define ORAREG1 { tic6x_operand_areg, 4, tic6x_rw_read, 1, 1, 0, 0 }
57 #define ORXREG1 { tic6x_operand_xreg, 4, tic6x_rw_read, 1, 1, 0, 0 }
58 #define ORREG12 { tic6x_operand_reg, 4, tic6x_rw_read, 1, 2, 0, 0 }
59 #define ORREG14 { tic6x_operand_reg, 4, tic6x_rw_read, 1, 4, 0, 0 }
60 #define ORXREG14 { tic6x_operand_xreg, 4, tic6x_rw_read, 1, 4, 0, 0 }
61 #define OWREG2 { tic6x_operand_reg, 4, tic6x_rw_write, 2, 2, 0, 0 }
62 #define OWREG4 { tic6x_operand_reg, 4, tic6x_rw_write, 4, 4, 0, 0 }
63 #define OWREG9 { tic6x_operand_reg, 4, tic6x_rw_write, 9, 9, 0, 0 }
64 #define OWDREG5 { tic6x_operand_dreg, 4, tic6x_rw_write, 5, 5, 0, 0 }
65 #define OWREGL1 { tic6x_operand_regpair, 5, tic6x_rw_write, 1, 1, 1, 1 }
66 #define ORREGL1 { tic6x_operand_regpair, 5, tic6x_rw_read, 1, 1, 1, 1 }
67 #define OWREGD1 { tic6x_operand_regpair, 8, tic6x_rw_write, 1, 1, 1, 1 }
68 #define OWREGD12 { tic6x_operand_regpair, 8, tic6x_rw_write, 1, 1, 2, 2 }
69 #define OWREGD4 { tic6x_operand_regpair, 8, tic6x_rw_write, 4, 4, 4, 4 }
70 #define ORREGD1 { tic6x_operand_regpair, 8, tic6x_rw_read, 1, 1, 1, 1 }
71 #define OWREGD45 { tic6x_operand_regpair, 8, tic6x_rw_write, 4, 4, 5, 5 }
72 #define OWREGD67 { tic6x_operand_regpair, 8, tic6x_rw_write, 6, 6, 7, 7 }
73 #define ORDREGD1 { tic6x_operand_dregpair, 8, tic6x_rw_read, 1, 1, 1, 1 }
74 #define OWDREGD5 { tic6x_operand_dregpair, 8, tic6x_rw_write, 5, 5, 5, 5 }
75 #define ORREGD12 { tic6x_operand_regpair, 8, tic6x_rw_read, 1, 1, 2, 2 }
76 #define ORXREGD12 { tic6x_operand_xregpair, 8, tic6x_rw_read, 1, 1, 2, 2 }
77 #define ORREGD1234 { tic6x_operand_regpair, 8, tic6x_rw_read, 1, 2, 3, 4 }
78 #define ORXREGD1324 { tic6x_operand_xregpair, 8, tic6x_rw_read, 1, 3, 2, 4 }
79 #define OWREGD910 { tic6x_operand_regpair, 8, tic6x_rw_write, 9, 9, 10, 10 }
80 #define ORCREG1 { tic6x_operand_ctrl, 4, tic6x_rw_read, 1, 1, 0, 0 }
81 #define OWCREG1 { tic6x_operand_ctrl, 4, tic6x_rw_write, 1, 1, 0, 0 }
82 #define ORMEMDW { tic6x_operand_mem_deref, 4, tic6x_rw_read, 3, 3, 0, 0 }
83 #define OWMEMDW { tic6x_operand_mem_deref, 4, tic6x_rw_write, 3, 3, 0, 0 }
84 #define ORMEMSB { tic6x_operand_mem_short, 1, tic6x_rw_read, 3, 3, 0, 0 }
85 #define OWMEMSB { tic6x_operand_mem_short, 1, tic6x_rw_write, 3, 3, 0, 0 }
86 #define ORMEMLB { tic6x_operand_mem_long, 1, tic6x_rw_read, 3, 3, 0, 0 }
87 #define OWMEMLB { tic6x_operand_mem_long, 1, tic6x_rw_write, 3, 3, 0, 0 }
88 #define ORMEMSH { tic6x_operand_mem_short, 2, tic6x_rw_read, 3, 3, 0, 0 }
89 #define OWMEMSH { tic6x_operand_mem_short, 2, tic6x_rw_write, 3, 3, 0, 0 }
90 #define ORMEMLH { tic6x_operand_mem_long, 2, tic6x_rw_read, 3, 3, 0, 0 }
91 #define OWMEMLH { tic6x_operand_mem_long, 2, tic6x_rw_write, 3, 3, 0, 0 }
92 #define ORMEMSW { tic6x_operand_mem_short, 4, tic6x_rw_read, 3, 3, 0, 0 }
93 #define OWMEMSW { tic6x_operand_mem_short, 4, tic6x_rw_write, 3, 3, 0, 0 }
94 #define ORMEMLW { tic6x_operand_mem_long, 4, tic6x_rw_read, 3, 3, 0, 0 }
95 #define OWMEMLW { tic6x_operand_mem_long, 4, tic6x_rw_write, 3, 3, 0, 0 }
96 #define ORMEMSD { tic6x_operand_mem_short, 8, tic6x_rw_read, 3, 3, 0, 0 }
97 #define OWMEMSD { tic6x_operand_mem_short, 8, tic6x_rw_write, 3, 3, 0, 0 }
98 #define ORMEMND { tic6x_operand_mem_ndw, 8, tic6x_rw_read, 3, 3, 0, 0 }
99 #define OWMEMND { tic6x_operand_mem_ndw, 8, tic6x_rw_write, 3, 3, 0, 0 }
100 #define ENC(id, meth, op) {                     \
101     CONCAT2(tic6x_field_,id),                   \
102     CONCAT2(tic6x_coding_,meth),                \
103     op                                          \
104   }
105 #define ENC0() 0, { { 0, 0, 0 } }
106 #define ENC1(a) 1, { a }
107 #define ENC2(a, b) 2, { a, b }
108 #define ENC3(a, b, c) 3, { a, b, c }
109 #define ENC4(a, b, c, d) 4, { a, b, c, d }
110 #define ENC5(a, b, c, d, e) 5, { a, b, c, d, e }
111 #define ENC6(a, b, c, d, e, f) 6, { a, b, c, d, e, f }
112 #define ENC7(a, b, c, d, e, f, g) 7, { a, b, c, d, e, f, g }
113
114 INSN(abs, l, unary, 1cycle, C62X, 0,
115      FIX1(FIX(op, 0)),
116      OP2(ORXREG1, OWREG1),
117      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
118           ENC(dst, reg, 1)))
119 INSN(abs, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
120      FIX3(FIX(op, 0x38), FIX(x, 0), FIX(src1, 0)),
121      OP2(ORREGL1, OWREGL1),
122      ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
123
124 INSN(abs2, l, unary, 1cycle, C64X, 0,
125      FIX1(FIX(op, 0x4)),
126      OP2(ORXREG1, OWREG1),
127      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
128           ENC(dst, reg, 1)))
129
130 INSN(absdp, s, 1_or_2_src, 2cycle_dp, C67X, TIC6X_FLAG_NO_CROSS,
131      FIX2(FIX(op, 0x2c), FIX(x, 0)),
132      OP2(ORREGD1, OWREGD12),
133      ENC4(ENC(s, fu, 0), ENC(src2, regpair_msb, 0), ENC(src1, regpair_lsb, 0),
134           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_half, 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      FIX2(FIX(op, 0x8), FIX(x, 0)),
920      OP2(ORREGD1, OWREG4),
921      ENC4(ENC(s, fu, 0), ENC(src2, regpair_msb, 0), ENC(src1, regpair_lsb, 0),
922           ENC(dst, reg, 1)))
923
924 INSN(dpsp, l, 1_or_2_src, 4cycle, C67X, TIC6X_FLAG_NO_CROSS,
925      FIX2(FIX(op, 0x9), FIX(x, 0)),
926      OP2(ORREGD1, OWREG4),
927      ENC4(ENC(s, fu, 0), ENC(src2, regpair_msb, 0), ENC(src1, regpair_lsb, 0),
928           ENC(dst, reg, 1)))
929
930 INSN(dptrunc, l, 1_or_2_src, 4cycle, C67X, TIC6X_FLAG_NO_CROSS,
931      FIX2(FIX(op, 0x1), FIX(x, 0)),
932      OP2(ORREGD1, OWREG4),
933      ENC4(ENC(s, fu, 0), ENC(src2, regpair_msb, 0), ENC(src1, regpair_lsb, 0),
934           ENC(dst, reg, 1)))
935
936 INSN(ext, s, field, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
937      FIX1(FIX(op, 0x1)),
938      OP4(ORREG1, OACST, OACST, OWREG1),
939      ENC5(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(csta, ucst, 1),
940           ENC(cstb, ucst, 2), ENC(dst, reg, 3)))
941 INSN(ext, s, 1_or_2_src, 1cycle, C62X, 0,
942      FIX1(FIX(op, 0x2f)),
943      OP3(ORXREG1, ORREG1, OWREG1),
944      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
945           ENC(src1, reg, 1), ENC(dst, reg, 2)))
946
947 INSN(extu, s, field, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
948      FIX1(FIX(op, 0x0)),
949      OP4(ORREG1, OACST, OACST, OWREG1),
950      ENC5(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(csta, ucst, 1),
951           ENC(cstb, ucst, 2), ENC(dst, reg, 3)))
952 INSN(extu, s, 1_or_2_src, 1cycle, C62X, 0,
953      FIX1(FIX(op, 0x2b)),
954      OP3(ORXREG1, ORREG1, OWREG1),
955      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
956           ENC(src1, reg, 1), ENC(dst, reg, 2)))
957
958 INSN(gmpy, m, 1_or_2_src, 4cycle, C64XP, TIC6X_FLAG_NO_CROSS,
959      FIX2(FIX(op, 0x1f), FIX(x, 0)),
960      OP3(ORREG1, ORREG1, OWREG4),
961      ENC4(ENC(s, fu, 0), ENC(src1, reg, 0), ENC(src2, reg, 1),
962           ENC(dst, reg, 2)))
963
964 /* This instruction can be predicated as usual; SPRUFE8 is incorrect
965    where it shows the "z" field as fixed to 1.  */
966 INSN(gmpy4, m, compound, 4cycle, C64X, 0,
967      FIX1(FIX(op, 0x11)),
968      OP3(ORREG1, ORXREG1, OWREG4),
969      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
970           ENC(src2, reg, 1), ENC(dst, reg, 2)))
971
972 INSN(idle, nfu, nop_idle, nop, C62X, TIC6X_FLAG_MCNOP,
973      FIX2(FIX(s, 0), FIX(op, 0xf)),
974      OP0(),
975      ENC0())
976
977 INSN(intdp, l, 1_or_2_src, intdp, C67X, 0,
978      FIX2(FIX(op, 0x39), FIX(src1, 0)),
979      OP2(ORXREG1, OWREGD45),
980      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
981           ENC(dst, reg, 1)))
982
983 INSN(intdpu, l, 1_or_2_src, intdp, C67X, 0,
984      FIX2(FIX(op, 0x3b), FIX(src1, 0)),
985      OP2(ORXREG1, OWREGD45),
986      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
987           ENC(dst, reg, 1)))
988
989 INSN(intsp, l, 1_or_2_src, 4cycle, C67X, 0,
990      FIX2(FIX(op, 0x4a), FIX(src1, 0)),
991      OP2(ORXREG1, OWREG4),
992      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
993           ENC(dst, reg, 1)))
994
995 INSN(intspu, l, 1_or_2_src, 4cycle, C67X, 0,
996      FIX2(FIX(op, 0x49), FIX(src1, 0)),
997      OP2(ORXREG1, OWREG4),
998      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
999           ENC(dst, reg, 1)))
1000
1001 INSN(ldb, d, load_store, load, C62X,
1002      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
1003      FIX2(FIX(op, 2), FIX(r, 0)),
1004      OP2(ORMEMSB, OWDREG5),
1005      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1006           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1007           ENC(srcdst, reg, 1)))
1008 INSN(ldb, d, load_store_long, load, C62X,
1009      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
1010      FIX1(FIX(op, 2)),
1011      OP2(ORMEMLB, OWDREG5),
1012      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_byte, 0),
1013           ENC(dst, reg, 1)))
1014
1015 INSN(ldbu, d, load_store, load, C62X,
1016      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
1017      FIX2(FIX(op, 1), FIX(r, 0)),
1018      OP2(ORMEMSB, OWDREG5),
1019      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1020           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1021           ENC(srcdst, reg, 1)))
1022 INSN(ldbu, d, load_store_long, load, C62X,
1023      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
1024      FIX1(FIX(op, 1)),
1025      OP2(ORMEMLB, OWDREG5),
1026      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_byte, 0),
1027           ENC(dst, reg, 1)))
1028
1029 INSN(lddw, d, load_store, load, C64X_AND_C67X,
1030      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS,
1031      FIX2(FIX(op, 6), FIX(r, 1)),
1032      OP2(ORMEMSD, OWDREGD5),
1033      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1034           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1035           ENC(srcdst, reg, 1)))
1036
1037 INSN(ldh, d, load_store, load, C62X,
1038      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
1039      FIX2(FIX(op, 4), FIX(r, 0)),
1040      OP2(ORMEMSH, OWDREG5),
1041      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1042           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1043           ENC(srcdst, reg, 1)))
1044 INSN(ldh, d, load_store_long, load, C62X,
1045      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
1046      FIX1(FIX(op, 4)),
1047      OP2(ORMEMLH, OWDREG5),
1048      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_half, 0),
1049           ENC(dst, reg, 1)))
1050
1051 INSN(ldhu, d, load_store, load, C62X,
1052      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
1053      FIX2(FIX(op, 0), FIX(r, 0)),
1054      OP2(ORMEMSH, OWDREG5),
1055      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1056           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1057           ENC(srcdst, reg, 1)))
1058 INSN(ldhu, d, load_store_long, load, C62X,
1059      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
1060      FIX1(FIX(op, 0)),
1061      OP2(ORMEMLH, OWDREG5),
1062      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_half, 0),
1063           ENC(dst, reg, 1)))
1064
1065 INSN(ldndw, d, load_nonaligned, load, C64X,
1066      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_UNALIGNED,
1067      FIX0(),
1068      OP2(ORMEMND, OWDREGD5),
1069      ENC7(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1070           ENC(offsetR, mem_offset_noscale, 0), ENC(baseR, reg, 0),
1071           ENC(sc, scaled, 0), ENC(dst, reg_shift, 1)))
1072
1073 INSN(ldnw, d, load_store, load, C64X,
1074      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_UNALIGNED,
1075      FIX2(FIX(op, 3), FIX(r, 1)),
1076      OP2(ORMEMSW, OWDREG5),
1077      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1078           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1079           ENC(srcdst, reg, 1)))
1080
1081 INSN(ldw, d, load_store, load, C62X,
1082      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
1083      FIX2(FIX(op, 6), FIX(r, 0)),
1084      OP2(ORMEMSW, OWDREG5),
1085      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 0),
1086           ENC(offsetR, mem_offset, 0), ENC(baseR, reg, 0),
1087           ENC(srcdst, reg, 1)))
1088 INSN(ldw, d, load_store_long, load, C62X,
1089      TIC6X_FLAG_LOAD|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
1090      FIX1(FIX(op, 6)),
1091      OP2(ORMEMLW, OWDREG5),
1092      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 0), ENC(offsetR, ulcst_dpr_word, 0),
1093           ENC(dst, reg, 1)))
1094
1095 INSN(ll, d, 1_or_2_src, load, C64XP,
1096      TIC6X_FLAG_LOAD|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_SIDE_T2_ONLY|TIC6X_FLAG_NO_CROSS,
1097      FIX3(FIX(s, 1), FIX(op, 0xc), FIX(src1, 0)),
1098      OP2(ORMEMDW, OWDREG5),
1099      ENC2(ENC(src2, reg, 0), ENC(dst, reg, 1)))
1100
1101 INSNE(lmbd, l_ui_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
1102       FIX1(FIX(op, 0x6b)),
1103       OP3(ORREG1, ORXREG1, OWREG1),
1104       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1105            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1106 INSNE(lmbd, l_s5_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
1107       FIX1(FIX(op, 0x6a)),
1108       OP3(OACST, ORXREG1, OWREG1),
1109       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1110            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1111
1112 INSN(max2, l, 1_or_2_src, 1cycle, C64X, 0,
1113      FIX1(FIX(op, 0x42)),
1114      OP3(ORREG1, ORXREG1, OWREG1),
1115      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1116           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1117 INSN(max2, s, ext_1_or_2_src, 1cycle, C64XP, 0,
1118      FIX1(FIX(op, 0xd)),
1119      OP3(ORREG1, ORXREG1, OWREG1),
1120      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1121           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1122
1123 INSN(maxu4, l, 1_or_2_src, 1cycle, C64X, 0,
1124      FIX1(FIX(op, 0x43)),
1125      OP3(ORREG1, ORXREG1, OWREG1),
1126      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1127           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1128
1129 INSN(min2, l, 1_or_2_src, 1cycle, C64X, 0,
1130      FIX1(FIX(op, 0x41)),
1131      OP3(ORREG1, ORXREG1, OWREG1),
1132      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1133           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1134 INSN(min2, s, ext_1_or_2_src, 1cycle, C64XP, 0,
1135      FIX1(FIX(op, 0xc)),
1136      OP3(ORREG1, ORXREG1, OWREG1),
1137      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1138           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1139
1140 INSN(minu4, l, 1_or_2_src, 1cycle, C64X, 0,
1141      FIX1(FIX(op, 0x48)),
1142      OP3(ORREG1, ORXREG1, OWREG1),
1143      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1144           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1145
1146 INSNE(mpy, m_sl16_xsl16_si, m, mpy, 1616_m, C62X, 0,
1147       FIX1(FIX(op, 0x19)),
1148       OP3(ORREG1, ORXREG1, OWREG2),
1149       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1150            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1151 INSNE(mpy, m_s5_xsl16_si, m, mpy, 1616_m, C62X, 0,
1152       FIX1(FIX(op, 0x18)),
1153       OP3(OACST, ORXREG1, OWREG2),
1154       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1155            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1156
1157 INSN(mpydp, m, mpy, mpydp, C67X, 0,
1158      FIX1(FIX(op, 0x0e)),
1159      OP3(ORREGD1234, ORXREGD1324, OWREGD910),
1160      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1161            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1162
1163 INSN(mpyh, m, mpy, 1616_m, C62X, 0,
1164      FIX1(FIX(op, 0x01)),
1165      OP3(ORREG1, ORXREG1, OWREG2),
1166      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1167           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1168
1169 INSN(mpyhi, m, compound, 4cycle, C64X, 0,
1170      FIX1(FIX(op, 0x14)),
1171      OP3(ORREG1, ORXREG1, OWREGD4),
1172      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1173           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1174
1175 INSN(mpyhir, m, compound, 4cycle, C64X, 0,
1176      FIX1(FIX(op, 0x10)),
1177      OP3(ORREG1, ORXREG1, OWREG4),
1178      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1179           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1180
1181 INSN(mpyhl, m, mpy, 1616_m, C62X, 0,
1182      FIX1(FIX(op, 0x09)),
1183      OP3(ORREG1, ORXREG1, OWREG2),
1184      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1185           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1186
1187 INSN(mpyhlu, m, mpy, 1616_m, C62X, 0,
1188      FIX1(FIX(op, 0x0f)),
1189      OP3(ORREG1, ORXREG1, OWREG2),
1190      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1191           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1192
1193 INSN(mpyhslu, m, mpy, 1616_m, C62X, 0,
1194      FIX1(FIX(op, 0x0b)),
1195      OP3(ORREG1, ORXREG1, OWREG2),
1196      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1197           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1198
1199 INSN(mpyhsu, m, mpy, 1616_m, C62X, 0,
1200      FIX1(FIX(op, 0x03)),
1201      OP3(ORREG1, ORXREG1, OWREG2),
1202      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1203           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1204
1205 INSN(mpyhu, m, mpy, 1616_m, C62X, 0,
1206      FIX1(FIX(op, 0x07)),
1207      OP3(ORREG1, ORXREG1, OWREG2),
1208      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1209           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1210
1211 INSN(mpyhuls, m, mpy, 1616_m, C62X, 0,
1212      FIX1(FIX(op, 0x0d)),
1213      OP3(ORREG1, ORXREG1, OWREG2),
1214      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1215           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1216
1217 INSN(mpyhus, m, mpy, 1616_m, C62X, 0,
1218      FIX1(FIX(op, 0x05)),
1219      OP3(ORREG1, ORXREG1, OWREG2),
1220      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1221           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1222
1223 INSNE(mpyi, m_si_xsi_si, m, mpy, mpyi, C67X, 0,
1224       FIX1(FIX(op, 0x04)),
1225       OP3(ORREG14, ORXREG14, OWREG9),
1226       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1227            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1228 INSNE(mpyi, m_s5_xsi_si, m, mpy, mpyi, C67X, 0,
1229       FIX1(FIX(op, 0x06)),
1230       OP3(OACST, ORXREG14, OWREG9),
1231       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1232            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1233
1234 INSNE(mpyid, m_si_xsi_sll, m, mpy, mpyid, C67X, 0,
1235       FIX1(FIX(op, 0x08)),
1236       OP3(ORREG14, ORXREG14, OWREGD910),
1237       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1238            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1239 INSNE(mpyid, m_s5_xsi_sll, m, mpy, mpyid, C67X, 0,
1240       FIX1(FIX(op, 0x0c)),
1241       OP3(OACST, ORXREG14, OWREGD910),
1242       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1243            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1244
1245 INSN(mpyih, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
1246      FIX1(FIX(op, 0x14)),
1247      OP3(ORXREG1, ORREG1, OWREGD4),
1248      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1249           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1250
1251 INSN(mpyihr, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
1252      FIX1(FIX(op, 0x10)),
1253      OP3(ORXREG1, ORREG1, OWREG4),
1254      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1255           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1256
1257 INSN(mpyil, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
1258      FIX1(FIX(op, 0x15)),
1259      OP3(ORXREG1, ORREG1, OWREGD4),
1260      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1261           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1262
1263 INSN(mpyilr, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
1264      FIX1(FIX(op, 0x0e)),
1265      OP3(ORXREG1, ORREG1, OWREG4),
1266      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1267           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1268
1269 INSN(mpylh, m, mpy, 1616_m, C62X, 0,
1270      FIX1(FIX(op, 0x11)),
1271      OP3(ORREG1, ORXREG1, OWREG2),
1272      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1273           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1274
1275 INSN(mpylhu, m, mpy, 1616_m, C62X, 0,
1276      FIX1(FIX(op, 0x17)),
1277      OP3(ORREG1, ORXREG1, OWREG2),
1278      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1279           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1280
1281 INSN(mpyli, m, compound, 4cycle, C64X, 0,
1282      FIX1(FIX(op, 0x15)),
1283      OP3(ORREG1, ORXREG1, OWREGD4),
1284      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1285           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1286
1287 INSN(mpylir, m, compound, 4cycle, C64X, 0,
1288      FIX1(FIX(op, 0x0e)),
1289      OP3(ORREG1, ORXREG1, OWREG4),
1290      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1291           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1292
1293 INSN(mpylshu, m, mpy, 1616_m, C62X, 0,
1294      FIX1(FIX(op, 0x13)),
1295      OP3(ORREG1, ORXREG1, OWREG2),
1296      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1297           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1298
1299 INSN(mpyluhs, m, mpy, 1616_m, C62X, 0,
1300      FIX1(FIX(op, 0x15)),
1301      OP3(ORREG1, ORXREG1, OWREG2),
1302      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1303           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1304
1305 INSN(mpysp, m, mpy, 4cycle, C67X, 0,
1306      FIX1(FIX(op, 0x1c)),
1307      OP3(ORREG1, ORXREG1, OWREG4),
1308      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1309           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1310
1311 /* Contrary to SPRU733A, MPYSPDP and MPYSP2DP are on both C67X and
1312    C67X+.  */
1313 INSN(mpyspdp, m, compound, mpyspdp, C67X, 0,
1314      FIX1(FIX(op, 0x16)),
1315      OP3(ORREG12, ORXREGD12, OWREGD67),
1316      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1317           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1318
1319 INSN(mpysp2dp, m, compound, mpyspdp, C67X, 0,
1320      FIX1(FIX(op, 0x17)),
1321      OP3(ORREG1, ORXREG1, OWREGD45),
1322      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1323           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1324
1325 INSNE(mpysu, m_sl16_xul16_si, m, mpy, 1616_m, C62X, 0,
1326       FIX1(FIX(op, 0x1b)),
1327       OP3(ORREG1, ORXREG1, OWREG2),
1328       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1329            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1330 INSNE(mpysu, m_s5_xul16_si, m, mpy, 1616_m, C62X, 0,
1331       FIX1(FIX(op, 0x1e)),
1332       OP3(OACST, ORXREG1, OWREG2),
1333       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1334            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1335
1336 INSN(mpysu4, m, compound, 4cycle, C64X, 0,
1337      FIX1(FIX(op, 0x05)),
1338      OP3(ORREG1, ORXREG1, OWREGD4),
1339      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1340           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1341
1342 INSN(mpyu, m, mpy, 1616_m, C62X, 0,
1343      FIX1(FIX(op, 0x1f)),
1344      OP3(ORREG1, ORXREG1, OWREG2),
1345      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1346           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1347
1348 INSN(mpyu4, m, compound, 4cycle, C64X, 0,
1349      FIX1(FIX(op, 0x04)),
1350      OP3(ORREG1, ORXREG1, OWREGD4),
1351      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1352           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1353
1354 INSN(mpyus, m, mpy, 1616_m, C62X, 0,
1355      FIX1(FIX(op, 0x1d)),
1356      OP3(ORREG1, ORXREG1, OWREG2),
1357      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1358           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1359
1360 INSN(mpyus4, m, compound, 4cycle, C64X, TIC6X_FLAG_MACRO,
1361      FIX1(FIX(op, 0x05)),
1362      OP3(ORXREG1, ORREG1, OWREGD4),
1363      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1364           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1365
1366 INSN(mpy2, m, compound, 4cycle, C64X, 0,
1367      FIX1(FIX(op, 0x00)),
1368      OP3(ORREG1, ORXREG1, OWREGD4),
1369      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1370           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1371
1372 INSN(mpy2ir, m, 1_or_2_src, 4cycle, C64XP, 0,
1373      FIX1(FIX(op, 0x0f)),
1374      OP3(ORREG1, ORXREG1, OWREGD4),
1375      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1376           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1377
1378 INSNE(mpy32, 32_32_32, m, mpy, 4cycle, C64XP, 0,
1379       FIX1(FIX(op, 0x10)),
1380       OP3(ORREG1, ORXREG1, OWREG4),
1381       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1382            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1383 INSNE(mpy32, 32_32_64, m, mpy, 4cycle, C64XP, 0,
1384       FIX1(FIX(op, 0x14)),
1385       OP3(ORREG1, ORXREG1, OWREGD4),
1386       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1387            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1388
1389 INSN(mpy32su, m, mpy, 4cycle, C64XP, 0,
1390      FIX1(FIX(op, 0x16)),
1391      OP3(ORREG1, ORXREG1, OWREGD4),
1392      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1393           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1394
1395 INSN(mpy32u, m, compound, 4cycle, C64XP, 0,
1396      FIX1(FIX(op, 0x18)),
1397      OP3(ORREG1, ORXREG1, OWREGD4),
1398      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1399           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1400
1401 INSN(mpy32us, m, compound, 4cycle, C64XP, 0,
1402      FIX1(FIX(op, 0x19)),
1403      OP3(ORREG1, ORXREG1, OWREGD4),
1404      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1405           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1406
1407 /* "or" forms of "mv" are preferred over "add" forms when available
1408    because "or" uses less power.  However, 40-bit moves are only
1409    available through "add", and before C64X D-unit moves are only
1410    available through "add" (without cross paths being available).  */
1411 INSNE(mv, l_xui_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1412       FIX2(FIX(op, 0x7e), FIX(src1, 0)),
1413       OP2(ORXREG1, OWREG1),
1414       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1415            ENC(dst, reg, 1)))
1416 INSNE(mv, l_sl_sl, l, 1_or_2_src, 1cycle, C62X,
1417       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
1418       FIX3(FIX(op, 0x20), FIX(x, 0), FIX(src1, 0)),
1419       OP2(ORREGL1, OWREGL1),
1420       ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
1421 INSNE(mv, s_xui_ui, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1422       FIX2(FIX(op, 0x1a), FIX(src1, 0)),
1423       OP2(ORXREG1, OWREG1),
1424       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1425            ENC(dst, reg, 1)))
1426 INSNE(mv, d_si_si, d, 1_or_2_src, 1cycle, C62X,
1427       TIC6X_FLAG_MACRO|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(0),
1428       FIX2(FIX(op, 0x12), FIX(src1, 0)),
1429       OP2(ORREG1, OWREG1),
1430       ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
1431 INSNE(mv, d_xui_ui, d, ext_1_or_2_src, 1cycle, C64X,
1432       TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(1),
1433       FIX2(FIX(op, 0x3), FIX(src1, 0)),
1434       OP2(ORXREG1, OWREG1),
1435       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1436            ENC(dst, reg, 1)))
1437
1438 INSNE(mvc, from_cr, s, 1_or_2_src, 1cycle, C62X,
1439       TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_NO_CROSS,
1440       FIX3(FIX(s, 1), FIX(op, 0x0f), FIX(x, 0)),
1441       OP2(ORCREG1, OWREG1),
1442       ENC3(ENC(src1, crhi, 0), ENC(src2, crlo, 0), ENC(dst, reg, 1)))
1443 INSNE(mvc, to_cr, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_SIDE_B_ONLY,
1444       FIX2(FIX(s, 1), FIX(op, 0x0e)),
1445       OP2(ORXREG1, OWCREG1),
1446       ENC4(ENC(x, xpath, 0), ENC(src2, reg, 0), ENC(src1, crhi, 1),
1447            ENC(dst, crlo, 1)))
1448
1449 INSN(mvd, m, unary, 4cycle, C64X, 0,
1450      FIX1(FIX(op, 0x1a)),
1451      OP2(ORXREG1, OWREG4),
1452      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1453           ENC(dst, reg, 1)))
1454
1455 INSN(mvk, s, mvk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1456      FIX1(FIX(h, 0)),
1457      OP2(OLCST, OWREG1),
1458      ENC3(ENC(s, fu, 0), ENC(cst, scst, 0), ENC(dst, reg, 1)))
1459 INSN(mvk, l, unary, 1cycle, C64X, TIC6X_FLAG_NO_CROSS,
1460      FIX2(FIX(x, 0), FIX(op, 0x05)),
1461      OP2(OACST, OWREG1),
1462      ENC3(ENC(s, fu, 0), ENC(src2, scst, 0), ENC(dst, reg, 1)))
1463 INSN(mvk, d, 1_or_2_src, 1cycle, C64X, TIC6X_FLAG_NO_CROSS,
1464      FIX2(FIX(op, 0x00), FIX(src2, 0)),
1465      OP2(OACST, OWREG1),
1466      ENC3(ENC(s, fu, 0), ENC(src1, scst, 0), ENC(dst, reg, 1)))
1467
1468 INSN(mvkh, s, mvk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1469      FIX1(FIX(h, 1)),
1470      OP2(OLCST, OWREG1),
1471      ENC3(ENC(s, fu, 0), ENC(cst, lcst_high16, 0), ENC(dst, reg, 1)))
1472
1473 INSN(mvklh, s, mvk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
1474      FIX1(FIX(h, 1)),
1475      OP2(OLCST, OWREG1),
1476      ENC3(ENC(s, fu, 0), ENC(cst, lcst_low16, 0), ENC(dst, reg, 1)))
1477
1478 INSN(mvkl, s, mvk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
1479      FIX1(FIX(h, 0)),
1480      OP2(OLCST, OWREG1),
1481      ENC3(ENC(s, fu, 0), ENC(cst, lcst_low16, 0), ENC(dst, reg, 1)))
1482
1483 INSNE(neg, s_xsi_si, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1484       FIX2(FIX(op, 0x16), FIX(src1, 0)),
1485       OP2(ORXREG1, OWREG1),
1486       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1487            ENC(dst, reg, 1)))
1488 INSNE(neg, l_xsi_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1489       FIX2(FIX(op, 0x06), FIX(src1, 0)),
1490       OP2(ORXREG1, OWREG1),
1491       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1492            ENC(dst, reg, 1)))
1493 INSNE(neg, l_sl_sl, l, 1_or_2_src, 1cycle, C62X,
1494       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
1495       FIX2(FIX(op, 0x24), FIX(src1, 0)),
1496       OP2(ORREGL1, OWREGL1),
1497       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1498            ENC(dst, reg, 1)))
1499
1500 INSN(nop, nfu, nop_idle, nop, C62X, 0,
1501      FIX2(FIX(s, 0), RAN(op, 0, 8)),
1502      OP1(OACST),
1503      ENC1(ENC(op, ucst_minus_one, 0)))
1504 INSNE(nop, 1, nfu, nop_idle, nop, C62X, TIC6X_FLAG_MACRO,
1505       FIX2(FIX(s, 0), FIX(op, 0)),
1506       OP0(),
1507       ENC0())
1508
1509 INSNE(norm, l_xsi_ui, l, 1_or_2_src, 1cycle, C62X, 0,
1510       FIX2(FIX(op, 0x63), FIX(src1, 0)),
1511       OP2(ORXREG1, OWREG1),
1512       ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1513            ENC(dst, reg, 1)))
1514 INSNE(norm, l_sl_ui, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1515       FIX3(FIX(op, 0x60), FIX(x, 0), FIX(src1, 0)),
1516       OP2(ORREGL1, OWREG1),
1517       ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
1518
1519 INSN(not, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1520      FIX2(FIX(op, 0x6e), FIX(src1, 0x1f)),
1521      OP2(ORXREG1, OWREG1),
1522      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1523           ENC(dst, reg, 1)))
1524 INSN(not, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
1525      FIX2(FIX(op, 0x0a), FIX(src1, 0x1f)),
1526      OP2(ORXREG1, OWREG1),
1527      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1528           ENC(dst, reg, 1)))
1529 INSN(not, d, ext_1_or_2_src, 1cycle, C64X, TIC6X_FLAG_MACRO,
1530      FIX2(FIX(op, 0xf), FIX(src1, 0x1f)),
1531      OP2(ORXREG1, OWREG1),
1532      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1533           ENC(dst, reg, 1)))
1534
1535 INSNE(or, d_ui_xui_ui, d, ext_1_or_2_src, 1cycle, C64X, 0,
1536       FIX1(FIX(op, 0x2)),
1537       OP3(ORREG1, ORXREG1, OWREG1),
1538       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1539            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1540 INSNE(or, d_s5_xui_ui, d, ext_1_or_2_src, 1cycle, C64X, 0,
1541       FIX1(FIX(op, 0x3)),
1542       OP3(OACST, ORXREG1, OWREG1),
1543       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1544            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1545 INSNE(or, l_ui_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
1546       FIX1(FIX(op, 0x7f)),
1547       OP3(ORREG1, ORXREG1, OWREG1),
1548       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1549            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1550 INSNE(or, l_s5_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
1551       FIX1(FIX(op, 0x7e)),
1552       OP3(OACST, ORXREG1, OWREG1),
1553       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1554            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1555 INSNE(or, s_ui_xui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
1556       FIX1(FIX(op, 0x1b)),
1557       OP3(ORREG1, ORXREG1, OWREG1),
1558       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1559            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1560 INSNE(or, s_s5_xui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
1561       FIX1(FIX(op, 0x1a)),
1562       OP3(OACST, ORXREG1, OWREG1),
1563       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1564            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1565
1566 INSN(pack2, l, 1_or_2_src, 1cycle, C64X, 0,
1567      FIX1(FIX(op, 0x0)),
1568      OP3(ORREG1, ORXREG1, OWREG1),
1569      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1570           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1571 INSN(pack2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1572      FIX1(FIX(op, 0xf)),
1573      OP3(ORREG1, ORXREG1, OWREG1),
1574      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1575           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1576
1577 INSN(packh2, l, 1_or_2_src, 1cycle, C64X, 0,
1578      FIX1(FIX(op, 0x1e)),
1579      OP3(ORREG1, ORXREG1, OWREG1),
1580      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1581           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1582 INSN(packh2, s, 1_or_2_src, 1cycle, C64X, 0,
1583      FIX1(FIX(op, 0x9)),
1584      OP3(ORREG1, ORXREG1, OWREG1),
1585      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1586           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1587
1588 INSN(packh4, l, 1_or_2_src, 1cycle, C64X, 0,
1589      FIX1(FIX(op, 0x69)),
1590      OP3(ORREG1, ORXREG1, OWREG1),
1591      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1592           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1593
1594 INSN(packhl2, l, 1_or_2_src, 1cycle, C64X, 0,
1595      FIX1(FIX(op, 0x1c)),
1596      OP3(ORREG1, ORXREG1, OWREG1),
1597      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1598           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1599 INSN(packhl2, s, 1_or_2_src, 1cycle, C64X, 0,
1600      FIX1(FIX(op, 0x8)),
1601      OP3(ORREG1, ORXREG1, OWREG1),
1602      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1603           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1604
1605 INSN(packlh2, l, 1_or_2_src, 1cycle, C64X, 0,
1606      FIX1(FIX(op, 0x1b)),
1607      OP3(ORREG1, ORXREG1, OWREG1),
1608      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1609           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1610 INSN(packlh2, s, 1_or_2_src, 1cycle, C64X, 0,
1611      FIX1(FIX(op, 0x10)),
1612      OP3(ORREG1, ORXREG1, OWREG1),
1613      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1614           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1615
1616 INSN(packl4, l, 1_or_2_src, 1cycle, C64X, 0,
1617      FIX1(FIX(op, 0x68)),
1618      OP3(ORREG1, ORXREG1, OWREG1),
1619      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1620           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1621
1622 INSN(rcpdp, s, 1_or_2_src, 2cycle_dp, C67X, TIC6X_FLAG_NO_CROSS,
1623      FIX2(FIX(op, 0x2d), FIX(x, 0)),
1624      OP2(ORREGD1, OWREGD12),
1625      ENC4(ENC(s, fu, 0), ENC(src2, regpair_msb, 0), ENC(src1, regpair_lsb, 0),
1626           ENC(dst, reg, 1)))
1627
1628 INSN(rcpsp, s, 1_or_2_src, 1cycle, C67X, 0,
1629      FIX2(FIX(op, 0x3d), FIX(src1, 0)),
1630      OP2(ORXREG1, OWREG1),
1631      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1632           ENC(dst, reg, 1)))
1633
1634 INSN(ret, s, ext_branch_cond_imm, branch, C62X,
1635      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_RETURN,
1636      FIX0(),
1637      OP1(OLCST),
1638      ENC2(ENC(s, fu, 0), ENC(cst, pcrel, 0)))
1639 INSN(ret, s, branch, branch, C62X,
1640      TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_RETURN,
1641      FIX1(FIX(s, 1)),
1642      OP1(ORXREG1),
1643      ENC2(ENC(x, xpath, 0), ENC(src2, reg, 0)))
1644 INSN(ret, s, b_irp, branch, C62X,
1645      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_RETURN,
1646      FIX3(FIX(s, 1), FIX(x, 0), FIX(dst, 0)),
1647      OP1(ORIRP1),
1648      ENC0())
1649 INSN(ret, s, b_nrp, branch, C62X,
1650      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_MACRO|TIC6X_FLAG_RETURN,
1651      FIX3(FIX(s, 1), FIX(x, 0), FIX(dst, 0)),
1652      OP1(ORNRP1),
1653      ENC0())
1654
1655 INSN(retp, s, call_imm_nop, branch, C64XP,
1656      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MCNOP|TIC6X_FLAG_MACRO|TIC6X_FLAG_RETURN,
1657      FIX1(FIX(z, 1)),
1658      OP2(OLCST, OWRETREG1),
1659      ENC2(ENC(s, fu, 0), ENC(cst, pcrel, 0)))
1660
1661 INSN(rint, nfu, rint, 1cycle, C64XP, 0,
1662      FIX1(FIX(s, 0)),
1663      OP0(),
1664      ENC0())
1665
1666 INSNE(rotl, m_ui_xui_ui, m, compound, 1616_m, C64X, 0,
1667       FIX1(FIX(op, 0x1d)),
1668       OP3(ORXREG1, ORREG1, OWREG2),
1669       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1670            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1671 INSNE(rotl, m_u5_xui_ui, m, compound, 1616_m, C64X, 0,
1672       FIX1(FIX(op, 0x1e)),
1673       OP3(ORXREG1, OACST, OWREG2),
1674       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1675            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1676
1677 INSN(rpack2, s, ext_1_or_2_src_noncond, 1cycle, C64XP, 0,
1678      FIX2(FIX(op, 0xb), FIX(z, 1)),
1679      OP3(ORREG1, ORXREG1, OWREG1),
1680      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1681           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1682
1683 INSN(rsqrdp, s, 1_or_2_src, 2cycle_dp, C67X, TIC6X_FLAG_NO_CROSS,
1684      FIX2(FIX(op, 0x2e), FIX(x, 0)),
1685      OP2(ORREGD1, OWREGD12),
1686      ENC4(ENC(s, fu, 0), ENC(src2, regpair_msb, 0), ENC(src1, regpair_lsb, 0),
1687           ENC(dst, reg, 1)))
1688
1689 INSN(rsqrsp, s, 1_or_2_src, 1cycle, C67X, 0,
1690      FIX2(FIX(op, 0x3e), FIX(src1, 0)),
1691      OP2(ORXREG1, OWREG1),
1692      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1693           ENC(dst, reg, 1)))
1694
1695 INSNE(sadd, l_si_xsi_si, l, 1_or_2_src, 1cycle, C62X, 0,
1696       FIX1(FIX(op, 0x13)),
1697       OP3(ORREG1, ORXREG1, OWREG1),
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_xsi_sl_sl, l, 1_or_2_src, 1cycle, C62X, 0,
1701       FIX1(FIX(op, 0x31)),
1702       OP3(ORXREG1, ORREGL1, OWREGL1),
1703       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1704            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1705 INSNE(sadd, l_s5_xsi_si, l, 1_or_2_src, 1cycle, C62X, 0,
1706       FIX1(FIX(op, 0x12)),
1707       OP3(OACST, ORXREG1, OWREG1),
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, l_s5_sl_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1711       FIX1(FIX(op, 0x30)),
1712       OP3(OACST, ORREGL1, OWREGL1),
1713       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
1714            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1715 INSNE(sadd, s_si_xsi_si, s, 1_or_2_src, 1cycle, C64X, 0,
1716       FIX1(FIX(op, 0x20)),
1717       OP3(ORREG1, ORXREG1, OWREG1),
1718       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1719            ENC(src2, reg, 1), ENC(dst, reg, 2)))
1720
1721 INSN(sadd2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1722      FIX1(FIX(op, 0x0)),
1723      OP3(ORREG1, ORXREG1, OWREG1),
1724      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1725           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1726
1727 INSN(saddsub, l, 1_or_2_src_noncond, 1cycle, C64XP, 0,
1728      FIX1(FIX(op, 0x0e)),
1729      OP3(ORREG1, ORXREG1, OWREGD1),
1730      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1731           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1732
1733 INSN(saddsub2, l, 1_or_2_src_noncond, 1cycle, C64XP, 0,
1734      FIX1(FIX(op, 0x0f)),
1735      OP3(ORREG1, ORXREG1, OWREGD1),
1736      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1737           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1738
1739 INSN(saddsu2, s, ext_1_or_2_src, 1cycle, C64X, TIC6X_FLAG_MACRO,
1740      FIX1(FIX(op, 0x1)),
1741      OP3(ORXREG1, ORREG1, OWREG1),
1742      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1743           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1744
1745 INSN(saddus2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1746      FIX1(FIX(op, 0x1)),
1747      OP3(ORREG1, ORXREG1, OWREG1),
1748      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1749           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1750
1751 INSN(saddu4, s, ext_1_or_2_src, 1cycle, C64X, 0,
1752      FIX1(FIX(op, 0x3)),
1753      OP3(ORREG1, ORXREG1, OWREG1),
1754      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1755           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1756
1757 INSN(sat, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1758      FIX3(FIX(op, 0x40), FIX(x, 0), FIX(src1, 0)),
1759      OP2(ORREGL1, OWREG1),
1760      ENC3(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(dst, reg, 1)))
1761
1762 INSN(set, s, field, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1763      FIX1(FIX(op, 0x2)),
1764      OP4(ORREG1, OACST, OACST, OWREG1),
1765      ENC5(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(csta, ucst, 1),
1766           ENC(cstb, ucst, 2), ENC(dst, reg, 3)))
1767 INSN(set, s, 1_or_2_src, 1cycle, C62X, 0,
1768      FIX1(FIX(op, 0x3b)),
1769      OP3(ORXREG1, ORREG1, OWREG1),
1770      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1771           ENC(src1, reg, 1), ENC(dst, reg, 2)))
1772
1773 INSN(shfl, m, unary, 1616_m, C64X, 0,
1774      FIX1(FIX(op, 0x1c)),
1775      OP2(ORXREG1, OWREG2),
1776      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1777           ENC(dst, reg, 1)))
1778
1779 INSN(shfl3, l, 1_or_2_src_noncond, 1cycle, C64XP, 0,
1780      FIX1(FIX(op, 0x36)),
1781      OP3(ORREG1, ORXREG1, OWREGD1),
1782      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1783           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1784
1785 INSNE(shl, s_xsi_ui_si, s, 1_or_2_src, 1cycle, C62X, 0,
1786       FIX1(FIX(op, 0x33)),
1787       OP3(ORXREG1, ORREG1, OWREG1),
1788       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1789            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1790 INSNE(shl, s_sl_ui_sl, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1791       FIX2(FIX(op, 0x31), FIX(x, 0)),
1792       OP3(ORREGL1, ORREG1, OWREGL1),
1793       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
1794            ENC(dst, reg, 2)))
1795 INSNE(shl, s_xui_ui_ul, s, 1_or_2_src, 1cycle, C62X, 0,
1796       FIX1(FIX(op, 0x13)),
1797       OP3(ORXREG1, ORREG1, OWREGL1),
1798       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1799            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1800 INSNE(shl, s_xsi_u5_si, s, 1_or_2_src, 1cycle, C62X, 0,
1801       FIX1(FIX(op, 0x32)),
1802       OP3(ORXREG1, OACST, OWREG1),
1803       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1804            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1805 INSNE(shl, s_sl_u5_sl, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1806       FIX2(FIX(op, 0x30), FIX(x, 0)),
1807       OP3(ORREGL1, OACST, OWREGL1),
1808       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
1809            ENC(dst, reg, 2)))
1810 INSNE(shl, s_xui_u5_ul, s, 1_or_2_src, 1cycle, C62X, 0,
1811       FIX1(FIX(op, 0x12)),
1812       OP3(ORXREG1, OACST, OWREGL1),
1813       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1814            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1815
1816 INSN(shlmb, l, 1_or_2_src, 1cycle, C64X, 0,
1817      FIX1(FIX(op, 0x61)),
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 INSN(shlmb, s, ext_1_or_2_src, 1cycle, C64X, 0,
1822      FIX1(FIX(op, 0x9)),
1823      OP3(ORREG1, ORXREG1, OWREG1),
1824      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1825           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1826
1827 INSNE(shr, s_xsi_ui_si, s, 1_or_2_src, 1cycle, C62X, 0,
1828       FIX1(FIX(op, 0x37)),
1829       OP3(ORXREG1, ORREG1, OWREG1),
1830       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1831            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1832 INSNE(shr, s_sl_ui_sl, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1833       FIX2(FIX(op, 0x35), FIX(x, 0)),
1834       OP3(ORREGL1, ORREG1, OWREGL1),
1835       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
1836            ENC(dst, reg, 2)))
1837 INSNE(shr, s_xsi_u5_si, s, 1_or_2_src, 1cycle, C62X, 0,
1838       FIX1(FIX(op, 0x36)),
1839       OP3(ORXREG1, OACST, OWREG1),
1840       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1841            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1842 INSNE(shr, s_sl_u5_sl, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1843       FIX2(FIX(op, 0x34), FIX(x, 0)),
1844       OP3(ORREGL1, OACST, OWREGL1),
1845       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
1846            ENC(dst, reg, 2)))
1847
1848 INSNE(shr2, s_xs2_ui_s2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1849       FIX1(FIX(op, 0x7)),
1850       OP3(ORXREG1, ORREG1, OWREG1),
1851       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1852            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1853 INSNE(shr2, s_xs2_u5_s2, s, 1_or_2_src, 1cycle, C64X, 0,
1854       FIX1(FIX(op, 0x18)),
1855       OP3(ORXREG1, OACST, OWREG1),
1856       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1857            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1858
1859 INSN(shrmb, l, 1_or_2_src, 1cycle, C64X, 0,
1860      FIX1(FIX(op, 0x62)),
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 INSN(shrmb, s, ext_1_or_2_src, 1cycle, C64X, 0,
1865      FIX1(FIX(op, 0xa)),
1866      OP3(ORREG1, ORXREG1, OWREG1),
1867      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1868           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1869
1870 INSNE(shru, s_xui_ui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
1871       FIX1(FIX(op, 0x27)),
1872       OP3(ORXREG1, ORREG1, OWREG1),
1873       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1874            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1875 INSNE(shru, s_ul_ui_ul, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1876       FIX2(FIX(op, 0x25), FIX(x, 0)),
1877       OP3(ORREGL1, ORREG1, OWREGL1),
1878       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
1879            ENC(dst, reg, 2)))
1880 INSNE(shru, s_xui_u5_ui, s, 1_or_2_src, 1cycle, C62X, 0,
1881       FIX1(FIX(op, 0x26)),
1882       OP3(ORXREG1, OACST, OWREG1),
1883       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1884            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1885 INSNE(shru, s_ul_u5_ul, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
1886       FIX2(FIX(op, 0x24), FIX(x, 0)),
1887       OP3(ORREGL1, OACST, OWREGL1),
1888       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
1889            ENC(dst, reg, 2)))
1890
1891 INSNE(shru2, s_xu2_ui_u2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1892       FIX1(FIX(op, 0x8)),
1893       OP3(ORXREG1, ORREG1, OWREG1),
1894       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1895            ENC(src1, reg, 1), ENC(dst, reg, 2)))
1896 INSNE(shru2, s_xu2_u5_u2, s, 1_or_2_src, 1cycle, C64X, 0,
1897       FIX1(FIX(op, 0x19)),
1898       OP3(ORXREG1, OACST, OWREG1),
1899       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1900            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
1901
1902 INSN(sl, d, 1_or_2_src, store, C64XP,
1903      TIC6X_FLAG_STORE|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_SIDE_T2_ONLY|TIC6X_FLAG_NO_CROSS,
1904      FIX3(FIX(s, 1), FIX(op, 0xd), FIX(src1, 0)),
1905      OP2(ORDREG1, OWMEMDW),
1906      ENC2(ENC(dst, reg, 0), ENC(src2, reg, 1)))
1907
1908 INSN(smpy, m, mpy, 1616_m, C62X, 0,
1909      FIX1(FIX(op, 0x1a)),
1910      OP3(ORREG1, ORXREG1, OWREG2),
1911      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1912           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1913
1914 INSN(smpyh, m, mpy, 1616_m, C62X, 0,
1915      FIX1(FIX(op, 0x02)),
1916      OP3(ORREG1, ORXREG1, OWREG2),
1917      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1918           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1919
1920 INSN(smpyhl, m, mpy, 1616_m, C62X, 0,
1921      FIX1(FIX(op, 0x0a)),
1922      OP3(ORREG1, ORXREG1, OWREG2),
1923      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1924           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1925
1926 INSN(smpylh, m, mpy, 1616_m, C62X, 0,
1927      FIX1(FIX(op, 0x12)),
1928      OP3(ORREG1, ORXREG1, OWREG2),
1929      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1930           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1931
1932 INSN(smpy2, m, compound, 4cycle, C64X, 0,
1933      FIX1(FIX(op, 0x01)),
1934      OP3(ORREG1, ORXREG1, OWREGD4),
1935      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1936           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1937
1938 /* Contrary to SPRUFE8, this is the correct operand order for this
1939    instruction.  */
1940 INSN(smpy32, m, 1_or_2_src, 4cycle, C64XP, 0,
1941      FIX1(FIX(op, 0x19)),
1942      OP3(ORREG1, ORXREG1, OWREG4),
1943      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1944           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1945
1946 INSN(spack2, s, ext_1_or_2_src, 1cycle, C64X, 0,
1947      FIX1(FIX(op, 0x2)),
1948      OP3(ORREG1, ORXREG1, OWREG1),
1949      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1950           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1951
1952 INSN(spacku4, s, ext_1_or_2_src, 1cycle, C64X, 0,
1953      FIX1(FIX(op, 0x4)),
1954      OP3(ORREG1, ORXREG1, OWREG1),
1955      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
1956           ENC(src2, reg, 1), ENC(dst, reg, 2)))
1957
1958 INSN(spdp, s, 1_or_2_src, 2cycle_dp, C67X, 0,
1959      FIX2(FIX(op, 0x02), FIX(src1, 0)),
1960      OP2(ORXREG1, OWREGD12),
1961      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1962           ENC(dst, reg, 1)))
1963
1964 INSN(spint, l, 1_or_2_src, 4cycle, C67X, 0,
1965      FIX2(FIX(op, 0x0a), FIX(src1, 0)),
1966      OP2(ORXREG1, OWREG4),
1967      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
1968           ENC(dst, reg, 1)))
1969
1970 INSNE(spkernel, nfu_2, nfu, spkernel, 1cycle, C64XP,
1971       TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPKERNEL,
1972       FIX1(FIX(s, 0)),
1973       OP2(OACST, OACST),
1974       ENC2(ENC(fstgfcyc, fstg, 0), ENC(fstgfcyc, fcyc, 1)))
1975 INSNE(spkernel, nfu_0, nfu, spkernel, 1cycle, C64XP,
1976       TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPKERNEL|TIC6X_FLAG_MACRO,
1977       FIX2(FIX(s, 0), FIX(fstgfcyc, 0)),
1978       OP0(),
1979       ENC0())
1980
1981 INSN(spkernelr, nfu, spkernelr, 1cycle, C64XP,
1982      TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPKERNEL,
1983      FIX1(FIX(s, 0)),
1984      OP0(),
1985      ENC0())
1986
1987 INSN(sploop, nfu, loop_buffer, 1cycle, C64XP,
1988      TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPLOOP,
1989      FIX4(FIX(s, 0), FIX(op, 0xc), FIX(csta, 0), RAN(cstb, 0, 13)),
1990      OP1(OACST),
1991      ENC1(ENC(cstb, ucst_minus_one, 0)))
1992
1993 INSN(sploopd, nfu, loop_buffer, 1cycle, C64XP,
1994      TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPLOOP,
1995      FIX4(FIX(s, 0), FIX(op, 0xd), FIX(csta, 0), RAN(cstb, 0, 13)),
1996      OP1(OACST),
1997      ENC1(ENC(cstb, ucst_minus_one, 0)))
1998
1999 INSN(sploopw, nfu, loop_buffer, 1cycle, C64XP,
2000      TIC6X_FLAG_FIRST|TIC6X_FLAG_NO_MCNOP|TIC6X_FLAG_SPLOOP,
2001      FIX4(FIX(s, 0), FIX(op, 0xf), FIX(csta, 0), RAN(cstb, 0, 13)),
2002      OP1(OACST),
2003      ENC1(ENC(cstb, ucst_minus_one, 0)))
2004
2005 /* Contrary to SPRUFE8, this is the correct encoding for this
2006    instruction.  */
2007 INSN(spmask, nfu, spmask, 1cycle, C64XP, TIC6X_FLAG_FIRST|TIC6X_FLAG_SPMASK,
2008      FIX2(FIX(s, 0), FIX(op, 0x8)),
2009      OP1(OFULIST),
2010      ENC1(ENC(mask, spmask, 0)))
2011
2012 INSN(spmaskr, nfu, spmask, 1cycle, C64XP, TIC6X_FLAG_FIRST|TIC6X_FLAG_SPMASK,
2013      FIX2(FIX(s, 0), FIX(op, 0x9)),
2014      OP1(OFULIST),
2015      ENC1(ENC(mask, spmask, 0)))
2016
2017 INSN(sptrunc, l, 1_or_2_src, 4cycle, C67X, 0,
2018      FIX2(FIX(op, 0x0b), FIX(src1, 0)),
2019      OP2(ORXREG1, OWREG4),
2020      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2021           ENC(dst, reg, 1)))
2022
2023 INSNE(sshl, s_xsi_ui_si, s, 1_or_2_src, 1cycle, C62X, 0,
2024       FIX1(FIX(op, 0x23)),
2025       OP3(ORXREG1, ORREG1, OWREG1),
2026       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2027            ENC(src1, reg, 1), ENC(dst, reg, 2)))
2028 INSNE(sshl, s_xsi_u5_si, s, 1_or_2_src, 1cycle, C62X, 0,
2029       FIX1(FIX(op, 0x22)),
2030       OP3(ORXREG1, OACST, OWREG1),
2031       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2032            ENC(src1, ucst, 1), ENC(dst, reg, 2)))
2033
2034 INSN(sshvl, m, compound, 1616_m, C64X, 0,
2035      FIX1(FIX(op, 0x1c)),
2036      OP3(ORXREG1, ORREG1, OWREG2),
2037      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2038           ENC(src1, reg, 1), ENC(dst, reg, 2)))
2039
2040 /* Contrary to SPRUFE8, this is the correct encoding for this
2041    instruction.  */
2042 INSN(sshvr, m, compound, 1616_m, C64X, 0,
2043      FIX1(FIX(op, 0x1a)),
2044      OP3(ORXREG1, ORREG1, OWREG2),
2045      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2046           ENC(src1, reg, 1), ENC(dst, reg, 2)))
2047
2048 INSNE(ssub, l_si_xsi_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
2049       FIX1(FIX(op, 0x0f)),
2050       OP3(ORREG1, ORXREG1, 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_xsi_si_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(0),
2054       FIX1(FIX(op, 0x1f)),
2055       OP3(ORXREG1, ORREG1, OWREG1),
2056       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2057            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2058 INSNE(ssub, l_s5_xsi_si, l, 1_or_2_src, 1cycle, C62X, 0,
2059       FIX1(FIX(op, 0x0e)),
2060       OP3(OACST, ORXREG1, OWREG1),
2061       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2062            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2063 INSNE(ssub, l_s5_sl_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2064       FIX1(FIX(op, 0x2c)),
2065       OP3(OACST, ORREGL1, OWREGL1),
2066       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2067            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2068
2069 INSN(ssub2, l, 1_or_2_src, 1cycle, C64XP, 0,
2070      FIX1(FIX(op, 0x64)),
2071      OP3(ORREG1, ORXREG1, OWREG1),
2072      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2073           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2074
2075 INSN(stb, d, load_store, store, C62X,
2076      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
2077      FIX2(FIX(op, 3), FIX(r, 0)),
2078      OP2(ORDREG1, OWMEMSB),
2079      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2080           ENC(offsetR, mem_offset, 1), ENC(baseR, reg, 1),
2081           ENC(srcdst, reg, 0)))
2082 INSN(stb, d, load_store_long, store, C62X,
2083      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
2084      FIX1(FIX(op, 3)),
2085      OP2(ORDREG1, OWMEMLB),
2086      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 1), ENC(offsetR, ulcst_dpr_byte, 1),
2087           ENC(dst, reg, 0)))
2088
2089 INSN(stdw, d, load_store, store, C64X, TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS,
2090      FIX2(FIX(op, 4), FIX(r, 1)),
2091      OP2(ORDREGD1, OWMEMSD),
2092      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2093           ENC(offsetR, mem_offset, 1), ENC(baseR, reg, 1),
2094           ENC(srcdst, reg, 0)))
2095
2096 INSN(sth, d, load_store, store, C62X,
2097      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
2098      FIX2(FIX(op, 5), FIX(r, 0)),
2099      OP2(ORDREG1, OWMEMSH),
2100      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2101           ENC(offsetR, mem_offset, 1), ENC(baseR, reg, 1),
2102           ENC(srcdst, reg, 0)))
2103 INSN(sth, d, load_store_long, store, C62X,
2104      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
2105      FIX1(FIX(op, 5)),
2106      OP2(ORDREG1, OWMEMLH),
2107      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 1), ENC(offsetR, ulcst_dpr_half, 1),
2108           ENC(dst, reg, 0)))
2109
2110 INSN(stndw, d, store_nonaligned, store, C64X,
2111      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_UNALIGNED,
2112      FIX0(),
2113      OP2(ORDREGD1, OWMEMND),
2114      ENC7(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2115           ENC(offsetR, mem_offset_noscale, 1), ENC(baseR, reg, 1),
2116           ENC(sc, scaled, 1), ENC(src, reg_shift, 0)))
2117
2118 INSN(stnw, d, load_store, store, C64X,
2119      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_UNALIGNED,
2120      FIX2(FIX(op, 5), FIX(r, 1)),
2121      OP2(ORDREG1, OWMEMSW),
2122      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2123           ENC(offsetR, mem_offset, 1), ENC(baseR, reg, 1),
2124           ENC(srcdst, reg, 0)))
2125
2126 INSN(stw, d, load_store, store, C62X,
2127      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
2128      FIX2(FIX(op, 7), FIX(r, 0)),
2129      OP2(ORDREG1, OWMEMSW),
2130      ENC6(ENC(s, data_fu, 0), ENC(y, fu, 0), ENC(mode, mem_mode, 1),
2131           ENC(offsetR, mem_offset, 1), ENC(baseR, reg, 1),
2132           ENC(srcdst, reg, 0)))
2133 INSN(stw, d, load_store_long, store, C62X,
2134      TIC6X_FLAG_STORE|TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_SIDE_B_ONLY|TIC6X_FLAG_PREFER(0),
2135      FIX1(FIX(op, 7)),
2136      OP2(ORDREG1, OWMEMLW),
2137      ENC4(ENC(s, data_fu, 0), ENC(y, areg, 1), ENC(offsetR, ulcst_dpr_word, 1),
2138           ENC(dst, reg, 0)))
2139
2140 INSNE(sub, l_si_xsi_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
2141       FIX1(FIX(op, 0x07)),
2142       OP3(ORREG1, ORXREG1, 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_xsi_si_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(0),
2146       FIX1(FIX(op, 0x17)),
2147       OP3(ORXREG1, ORREG1, OWREG1),
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_si_xsi_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
2151       FIX1(FIX(op, 0x27)),
2152       OP3(ORREG1, ORXREG1, 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_xsi_si_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(0),
2156       FIX1(FIX(op, 0x37)),
2157       OP3(ORXREG1, ORREG1, OWREGL1),
2158       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2159            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2160 INSNE(sub, l_s5_xsi_si, l, 1_or_2_src, 1cycle, C62X, 0,
2161       FIX1(FIX(op, 0x06)),
2162       OP3(OACST, ORXREG1, OWREG1),
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_s5_sl_sl, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2166       FIX1(FIX(op, 0x24)),
2167       OP3(OACST, ORREGL1, OWREGL1),
2168       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2169            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2170 INSNE(sub, l_xsi_s5_si, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
2171       FIX1(FIX(op, 0x2)),
2172       OP3(ORXREG1, OACST, OWREG1),
2173       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst_negate, 1),
2174            ENC(src2, reg, 0), ENC(dst, reg, 2)))
2175 INSNE(sub, l_sl_s5_sl, l, 1_or_2_src, 1cycle, C62X,
2176       TIC6X_FLAG_MACRO|TIC6X_FLAG_NO_CROSS,
2177       FIX2(FIX(op, 0x20), FIX(x, 0)),
2178       OP3(ORREGL1, OACST, OWREGL1),
2179       ENC4(ENC(s, fu, 0), ENC(src1, scst_negate, 1), ENC(src2, reg, 0),
2180            ENC(dst, reg, 2)))
2181 INSNE(sub, s_si_xsi_si, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
2182       FIX1(FIX(op, 0x17)),
2183       OP3(ORREG1, ORXREG1, OWREG1),
2184       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2185            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2186 INSNE(sub, s_s5_xsi_si, s, 1_or_2_src, 1cycle, C62X, 0,
2187       FIX1(FIX(op, 0x16)),
2188       OP3(OACST, ORXREG1, OWREG1),
2189       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2190            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2191 /* Contrary to SPRUFE8, this is the correct encoding for this
2192    instruction; this instruction can be predicated.  */
2193 INSNE(sub, s_xsi_si_si, s, ext_1_or_2_src, 1cycle, C64X, TIC6X_FLAG_PREFER(0),
2194       FIX1(FIX(op, 0x5)),
2195       OP3(ORXREG1, ORREG1, OWREG1),
2196       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2197            ENC(src1, reg, 1), ENC(dst, reg, 2)))
2198 INSNE(sub, s_xsi_s5_si, s, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_MACRO,
2199       FIX1(FIX(op, 0x6)),
2200       OP3(ORXREG1, OACST, OWREG1),
2201       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst_negate, 1),
2202            ENC(src2, reg, 0), ENC(dst, reg, 2)))
2203 INSNE(sub, d_si_si_si, d, 1_or_2_src, 1cycle, C62X,
2204       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_PREFER(1),
2205       FIX1(FIX(op, 0x11)),
2206       OP3(ORREG1, ORREG1, OWREG1),
2207       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
2208            ENC(dst, reg, 2)))
2209 INSNE(sub, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2210       FIX1(FIX(op, 0x13)),
2211       OP3(ORREG1, OACST, OWREG1),
2212       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
2213            ENC(dst, reg, 2)))
2214 INSNE(sub, d_si_xsi_si, d, ext_1_or_2_src, 1cycle, C64X, TIC6X_FLAG_PREFER(0),
2215       FIX1(FIX(op, 0xc)),
2216       OP3(ORREG1, ORXREG1, OWREG1),
2217       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2218            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2219
2220 INSNE(subab, d_si_si_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2221       FIX1(FIX(op, 0x31)),
2222       OP3(ORREG1, ORREG1, OWREG1),
2223       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
2224            ENC(dst, reg, 2)))
2225 INSNE(subab, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2226       FIX1(FIX(op, 0x33)),
2227       OP3(ORREG1, OACST, OWREG1),
2228       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
2229            ENC(dst, reg, 2)))
2230
2231 INSN(subabs4, l, 1_or_2_src, 1cycle, C64X, 0,
2232      FIX1(FIX(op, 0x5a)),
2233      OP3(ORREG1, ORXREG1, OWREG1),
2234      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2235           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2236
2237 INSNE(subah, d_si_si_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2238       FIX1(FIX(op, 0x35)),
2239       OP3(ORREG1, ORREG1, OWREG1),
2240       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
2241            ENC(dst, reg, 2)))
2242 INSNE(subah, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2243       FIX1(FIX(op, 0x37)),
2244       OP3(ORREG1, OACST, OWREG1),
2245       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
2246            ENC(dst, reg, 2)))
2247
2248 INSNE(subaw, d_si_si_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2249       FIX1(FIX(op, 0x39)),
2250       OP3(ORREG1, ORREG1, OWREG1),
2251       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, reg, 1),
2252            ENC(dst, reg, 2)))
2253 INSNE(subaw, d_si_u5_si, d, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_NO_CROSS,
2254       FIX1(FIX(op, 0x3b)),
2255       OP3(ORREG1, OACST, OWREG1),
2256       ENC4(ENC(s, fu, 0), ENC(src2, reg, 0), ENC(src1, ucst, 1),
2257            ENC(dst, reg, 2)))
2258
2259 INSN(subc, l, 1_or_2_src, 1cycle, C62X, 0,
2260      FIX1(FIX(op, 0x4b)),
2261      OP3(ORREG1, ORXREG1, OWREG1),
2262      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2263           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2264
2265 INSNE(subdp, l_dp_xdp_dp, l, 1_or_2_src, addsubdp, C67X, TIC6X_FLAG_PREFER(1),
2266       FIX1(FIX(op, 0x19)),
2267       OP3(ORREGD12, ORXREGD12, 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, l_xdp_dp_dp, l, 1_or_2_src, addsubdp, C67X, TIC6X_FLAG_PREFER(0),
2271       FIX1(FIX(op, 0x1d)),
2272       OP3(ORXREGD12, ORREGD12, OWREGD67),
2273       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2274            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2275 INSNE(subdp, s_dp_xdp_dp, s, l_1_or_2_src, addsubdp, C67XP,
2276       TIC6X_FLAG_PREFER(1),
2277       FIX1(FIX(op, 0x73)),
2278       OP3(ORREGD12, ORXREGD12, OWREGD67),
2279       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2280            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2281 INSNE(subdp, s_xdp_dp_dp, s, l_1_or_2_src, addsubdp, C67XP,
2282       TIC6X_FLAG_PREFER(0),
2283       FIX1(FIX(op, 0x77)),
2284       OP3(ORXREGD12, ORREGD12, OWREGD67),
2285       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2286            ENC(src1, reg, 1), ENC(dst, reg, 2)))
2287
2288 INSNE(subsp, l_sp_xsp_sp, l, 1_or_2_src, 4cycle, C67X, TIC6X_FLAG_PREFER(1),
2289       FIX1(FIX(op, 0x11)),
2290       OP3(ORREG1, ORXREG1, 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, l_xsp_sp_sp, l, 1_or_2_src, 4cycle, C67X, TIC6X_FLAG_PREFER(0),
2294       FIX1(FIX(op, 0x15)),
2295       OP3(ORXREG1, ORREG1, OWREG4),
2296       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2297            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2298 INSNE(subsp, s_sp_xsp_sp, s, l_1_or_2_src, 4cycle, C67XP,
2299       TIC6X_FLAG_PREFER(1),
2300       FIX1(FIX(op, 0x71)),
2301       OP3(ORREG1, ORXREG1, OWREG4),
2302       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2303            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2304 INSNE(subsp, s_xsp_sp_sp, s, l_1_or_2_src, 4cycle, C67XP,
2305       TIC6X_FLAG_PREFER(0),
2306       FIX1(FIX(op, 0x75)),
2307       OP3(ORXREG1, ORREG1, OWREG4),
2308       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2309            ENC(src1, reg, 1), ENC(dst, reg, 2)))
2310
2311 INSNE(subu, l_ui_xui_ul, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(1),
2312       FIX1(FIX(op, 0x2f)),
2313       OP3(ORREG1, ORXREG1, 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 INSNE(subu, l_xui_ui_ul, l, 1_or_2_src, 1cycle, C62X, TIC6X_FLAG_PREFER(0),
2317       FIX1(FIX(op, 0x3f)),
2318       OP3(ORXREG1, ORREG1, OWREGL1),
2319       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2320            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2321
2322 INSN(sub2, l, 1_or_2_src, 1cycle, C64X, 0,
2323      FIX1(FIX(op, 0x04)),
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, s, 1_or_2_src, 1cycle, C62X, 0,
2328      FIX1(FIX(op, 0x11)),
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 INSN(sub2, d, ext_1_or_2_src, 1cycle, C64X, 0,
2333      FIX1(FIX(op, 0x5)),
2334      OP3(ORREG1, ORXREG1, OWREG1),
2335      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2336           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2337
2338 INSN(sub4, l, 1_or_2_src, 1cycle, C64X, 0,
2339      FIX1(FIX(op, 0x66)),
2340      OP3(ORREG1, ORXREG1, OWREG1),
2341      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2342           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2343
2344 INSN(swap2, l, 1_or_2_src, 1cycle, C64X, TIC6X_FLAG_MACRO|TIC6X_FLAG_NO_CROSS,
2345      FIX2(FIX(op, 0x1b), 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 INSN(swap2, s, 1_or_2_src, 1cycle, C64X, TIC6X_FLAG_MACRO|TIC6X_FLAG_NO_CROSS,
2350      FIX2(FIX(op, 0x10), FIX(x, 0)),
2351      OP2(ORREG1, OWREG1),
2352      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2353           ENC(src2, reg, 0), ENC(dst, reg, 1)))
2354
2355 /* Contrary to SPRUFE8, this is the correct encoding for this
2356    instruction.  */
2357 INSN(swap4, l, unary, 1cycle, C64X, 0,
2358      FIX1(FIX(op, 0x1)),
2359      OP2(ORXREG1, OWREG1),
2360      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2361           ENC(dst, reg, 1)))
2362
2363 INSN(swe, nfu, swe, 1cycle, C64XP, 0,
2364      FIX1(FIX(s, 0)),
2365      OP0(),
2366      ENC0())
2367
2368 INSN(swenr, nfu, swenr, 1cycle, C64XP, 0,
2369      FIX1(FIX(s, 0)),
2370      OP0(),
2371      ENC0())
2372
2373 INSN(unpkhu4, l, 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 INSN(unpkhu4, s, unary, 1cycle, C64X, 0,
2379      FIX1(FIX(op, 0x03)),
2380      OP2(ORXREG1, OWREG1),
2381      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2382           ENC(dst, reg, 1)))
2383
2384 INSN(unpklu4, l, 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 INSN(unpklu4, s, unary, 1cycle, C64X, 0,
2390      FIX1(FIX(op, 0x02)),
2391      OP2(ORXREG1, OWREG1),
2392      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2393           ENC(dst, reg, 1)))
2394
2395 INSNE(xor, l_ui_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
2396       FIX1(FIX(op, 0x6f)),
2397       OP3(ORREG1, ORXREG1, OWREG1),
2398       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2399            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2400 INSNE(xor, l_s5_xui_ui, l, 1_or_2_src, 1cycle, C62X, 0,
2401       FIX1(FIX(op, 0x6e)),
2402       OP3(OACST, ORXREG1, OWREG1),
2403       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2404            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2405 INSNE(xor, s_ui_xui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
2406       FIX1(FIX(op, 0x0b)),
2407       OP3(ORREG1, ORXREG1, OWREG1),
2408       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2409            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2410 INSNE(xor, s_s5_xui_ui, s, 1_or_2_src, 1cycle, C62X, 0,
2411       FIX1(FIX(op, 0x0a)),
2412       OP3(OACST, ORXREG1, OWREG1),
2413       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2414            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2415 INSNE(xor, d_ui_xui_ui, d, ext_1_or_2_src, 1cycle, C64X, 0,
2416       FIX1(FIX(op, 0xe)),
2417       OP3(ORREG1, ORXREG1, OWREG1),
2418       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2419            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2420 INSNE(xor, d_s5_xui_ui, d, ext_1_or_2_src, 1cycle, C64X, 0,
2421       FIX1(FIX(op, 0xf)),
2422       OP3(OACST, ORXREG1, OWREG1),
2423       ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, scst, 0),
2424            ENC(src2, reg, 1), ENC(dst, reg, 2)))
2425
2426 INSN(xormpy, m, 1_or_2_src, 4cycle, C64XP, 0,
2427      FIX1(FIX(op, 0x1b)),
2428      OP3(ORREG1, ORXREG1, OWREG4),
2429      ENC5(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src1, reg, 0),
2430           ENC(src2, reg, 1), ENC(dst, reg, 2)))
2431
2432 INSN(xpnd2, m, unary, 1616_m, C64X, 0,
2433      FIX1(FIX(op, 0x19)),
2434      OP2(ORXREG1, OWREG2),
2435      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2436           ENC(dst, reg, 1)))
2437
2438 INSN(xpnd4, m, unary, 1616_m, C64X, 0,
2439      FIX1(FIX(op, 0x18)),
2440      OP2(ORXREG1, OWREG2),
2441      ENC4(ENC(s, fu, 0), ENC(x, xpath, 0), ENC(src2, reg, 0),
2442           ENC(dst, reg, 1)))
2443
2444 INSN(zero, s, mvk, 1cycle, C62X, TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
2445      FIX2(FIX(h, 0), FIX(cst, 0)),
2446      OP1(OWREG1),
2447      ENC2(ENC(s, fu, 0), ENC(dst, reg, 0)))
2448 INSN(zero, l, unary, 1cycle, C64X,
2449      TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(1),
2450      FIX3(FIX(x, 0), FIX(op, 0x05), FIX(src2, 0)),
2451      OP1(OWREG1),
2452      ENC2(ENC(s, fu, 0), ENC(dst, reg, 0)))
2453 INSNE(zero, l_sub, l, 1_or_2_src, 1cycle, C62X,
2454       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(0),
2455       FIX2(FIX(op, 0x07), FIX(x, 0)),
2456       OP1(OWREG1),
2457       ENC4(ENC(s, fu, 0), ENC(src1, reg_unused, 0), ENC(src2, reg_unused, 0),
2458            ENC(dst, reg, 0)))
2459 INSNE(zero, l_sub_sl, l, 1_or_2_src, 1cycle, C62X,
2460       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO,
2461       FIX2(FIX(op, 0x27), FIX(x, 0)),
2462       OP1(OWREGL1),
2463       ENC4(ENC(s, fu, 0), ENC(src1, reg_unused, 0), ENC(src2, reg_unused, 0),
2464            ENC(dst, reg, 0)))
2465 INSNE(zero, d_mvk, d, 1_or_2_src, 1cycle, C64X,
2466       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(1),
2467       FIX3(FIX(op, 0x00), FIX(src1, 0), FIX(src2, 0)),
2468       OP1(OWREG1),
2469       ENC2(ENC(s, fu, 0), ENC(dst, reg, 0)))
2470 INSNE(zero, d_sub, d, 1_or_2_src, 1cycle, C62X,
2471       TIC6X_FLAG_NO_CROSS|TIC6X_FLAG_MACRO|TIC6X_FLAG_PREFER(0),
2472       FIX1(FIX(op, 0x11)),
2473       OP1(OWREG1),
2474       ENC4(ENC(s, fu, 0), ENC(src2, reg_unused, 0), ENC(src1, reg_unused, 0),
2475            ENC(dst, reg, 0)))
2476
2477 #undef TIC6X_INSN_C64X_AND_C67X
2478 #undef tic6x_insn_format_nfu_s_branch_nop_cst
2479 #undef tic6x_insn_format_s_l_1_or_2_src
2480 #undef RAN
2481 #undef FIX
2482 #undef FIX0
2483 #undef FIX1
2484 #undef FIX2
2485 #undef FIX3
2486 #undef FIX4
2487 #undef OP0
2488 #undef OP1
2489 #undef OP2
2490 #undef OP3
2491 #undef OP4
2492 #undef OACST
2493 #undef OLCST
2494 #undef OFULIST
2495 #undef ORIRP1
2496 #undef ORNRP1
2497 #undef OWREG1
2498 #undef OWRETREG1
2499 #undef ORREG1
2500 #undef ORDREG1
2501 #undef ORWREG1
2502 #undef ORAREG1
2503 #undef ORXREG1
2504 #undef ORREG12
2505 #undef ORREG14
2506 #undef ORXREG14
2507 #undef OWREG2
2508 #undef OWREG4
2509 #undef OWREG9
2510 #undef OWDREG5
2511 #undef OWREGL1
2512 #undef ORREGL1
2513 #undef OWREGD1
2514 #undef OWREGD12
2515 #undef OWREGD4
2516 #undef ORREGD1
2517 #undef OWREGD45
2518 #undef OWREGD67
2519 #undef ORDREGD1
2520 #undef OWDREGD5
2521 #undef ORREGD12
2522 #undef ORXREGD12
2523 #undef ORXREGD1234
2524 #undef ORREGD1324
2525 #undef OWREGD910
2526 #undef ORCREG1
2527 #undef OWCREG1
2528 #undef ORMEMDW
2529 #undef OWMEMDW
2530 #undef ORMEMSB
2531 #undef OWMEMSB
2532 #undef ORMEMLB
2533 #undef OWMEMLB
2534 #undef ORMEMSH
2535 #undef OWMEMSH
2536 #undef ORMEMLH
2537 #undef OWMEMLH
2538 #undef ORMEMSW
2539 #undef OWMEMSW
2540 #undef ORMEMLW
2541 #undef OWMEMLW
2542 #undef ORMEMSD
2543 #undef OWMEMSD
2544 #undef ORMEMND
2545 #undef OWMEMND
2546 #undef ENC
2547 #undef ENC0
2548 #undef ENC1
2549 #undef ENC2
2550 #undef ENC3
2551 #undef ENC4
2552 #undef ENC5
2553 #undef ENC6
2554 #undef ENC7