dsp2.igen 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. // -*- C -*-
  2. // Simulator definition for the MIPS DSP REV 2 ASE.
  3. // Copyright (C) 2007-2022 Free Software Foundation, Inc.
  4. // Contributed by MIPS Technologies, Inc.
  5. // Written by Chao-ying Fu (fu@mips.com).
  6. //
  7. // This file is part of the MIPS sim
  8. //
  9. // This program is free software; you can redistribute it and/or modify
  10. // it under the terms of the GNU General Public License as published by
  11. // the Free Software Foundation; either version 3 of the License, or
  12. // (at your option) any later version.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. // GNU General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License
  20. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. // op: 0 = ADD, 1 = SUB
  22. // sat: 0 = no saturation, 1 = saturation
  23. :function:::void:do_u_ph_op:int rd, int rs, int rt, int op, int sat
  24. {
  25. int i;
  26. uint32_t h0;
  27. uint16_t h1, h2;
  28. uint32_t v1 = GPR[rs];
  29. uint32_t v2 = GPR[rt];
  30. uint32_t result = 0;
  31. for (i = 0; i < 32; i += 16, v1 >>= 16, v2 >>= 16)
  32. {
  33. h1 = (uint16_t)(v1 & 0xffff);
  34. h2 = (uint16_t)(v2 & 0xffff);
  35. if (op == 0) // ADD
  36. h0 = (uint32_t)h1 + (uint32_t)h2;
  37. else // SUB
  38. h0 = (uint32_t)h1 - (uint32_t)h2;
  39. if (op == 0 && (h0 > (uint32_t)0x0000ffff)) // ADD SAT
  40. {
  41. DSPCR |= DSPCR_OUFLAG4;
  42. if (sat == 1)
  43. h0 = 0xffff;
  44. }
  45. else if (op == 1 && h1 < h2) // SUB SAT
  46. {
  47. DSPCR |= DSPCR_OUFLAG4;
  48. if (sat == 1)
  49. h0 = 0x0;
  50. }
  51. result |= ((uint32_t)((uint16_t)h0) << i);
  52. }
  53. GPR[rd] = EXTEND32 (result);
  54. }
  55. // op: 0 = ADD, 1 = SUB
  56. // round: 0 = no rounding, 1 = rounding
  57. :function:::void:do_uh_qb_op:int rd, int rs, int rt, int op, int round
  58. {
  59. int i;
  60. uint32_t h0;
  61. uint8_t h1, h2;
  62. uint32_t v1 = GPR[rs];
  63. uint32_t v2 = GPR[rt];
  64. uint32_t result = 0;
  65. for (i = 0; i < 32; i += 8, v1 >>= 8, v2 >>= 8)
  66. {
  67. h1 = (uint8_t)(v1 & 0xff);
  68. h2 = (uint8_t)(v2 & 0xff);
  69. if (op == 0) // ADD
  70. h0 = (uint32_t)h1 + (uint32_t)h2;
  71. else // SUB
  72. h0 = (uint32_t)h1 - (uint32_t)h2;
  73. if (round == 1)
  74. h0 = (h0 + 1) >> 1;
  75. else
  76. h0 = h0 >> 1;
  77. result |= ((uint32_t)((uint8_t)h0) << i);
  78. }
  79. GPR[rd] = EXTEND32 (result);
  80. }
  81. // op: 0 = EQ, 1 = LT, 2 = LE
  82. :function:::void:do_qb_cmpgdu:int rd, int rs, int rt, int op
  83. {
  84. int i, j;
  85. uint32_t v1 = GPR[rs];
  86. uint32_t v2 = GPR[rt];
  87. uint8_t h1, h2;
  88. uint32_t result = 0;
  89. uint32_t mask;
  90. for (i = 0, j = 0; i < 32; i += 8, j++, v1 >>= 8, v2 >>= 8)
  91. {
  92. h1 = (uint8_t)(v1 & 0xff);
  93. h2 = (uint8_t)(v2 & 0xff);
  94. mask = ~(1 << (DSPCR_CCOND_SHIFT + j));
  95. DSPCR &= mask;
  96. if (op == 0) // EQ
  97. {
  98. result |= ((h1 == h2) << j);
  99. DSPCR |= ((h1 == h2) << (DSPCR_CCOND_SHIFT + j));
  100. }
  101. else if (op == 1) // LT
  102. {
  103. result |= ((h1 < h2) << j);
  104. DSPCR |= ((h1 < h2) << (DSPCR_CCOND_SHIFT + j));
  105. }
  106. else // LE
  107. {
  108. result |= ((h1 <= h2) << j);
  109. DSPCR |= ((h1 <= h2) << (DSPCR_CCOND_SHIFT + j));
  110. }
  111. }
  112. GPR[rd] = EXTEND32 (result);
  113. }
  114. // op: 0 = DPA 1 = DPS
  115. :function:::void:do_w_ph_dot_product:int ac, int rs, int rt, int op
  116. {
  117. int i;
  118. uint32_t v1 = GPR[rs];
  119. uint32_t v2 = GPR[rt];
  120. int16_t h1, h2;
  121. int32_t result;
  122. uint32_t lo = DSPLO(ac);
  123. uint32_t hi = DSPHI(ac);
  124. int64_t prod = (int64_t)((((uint64_t)hi) << 32) + (uint64_t)lo);
  125. for (i = 0; i < 32; i += 16, v1 >>= 16, v2 >>= 16)
  126. {
  127. h1 = (int16_t)(v1 & 0xffff);
  128. h2 = (int16_t)(v2 & 0xffff);
  129. result = (int32_t)h1 * (int32_t)h2;
  130. if (op == 0) // DPA
  131. prod += (int64_t)result;
  132. else // DPS
  133. prod -= (int64_t)result;
  134. }
  135. DSPLO(ac) = EXTEND32 (prod);
  136. DSPHI(ac) = EXTEND32 (prod >> 32);
  137. }
  138. // round: 0 = no rounding, 1 = rounding
  139. :function:::void:do_w_mulq:int rd, int rs, int rt, int round
  140. {
  141. uint32_t v1 = GPR[rs];
  142. uint32_t v2 = GPR[rt];
  143. int32_t w1, w2;
  144. int64_t prod;
  145. uint32_t result;
  146. w1 = (int32_t) v1;
  147. w2 = (int32_t) v2;
  148. if (w1 == (int32_t) 0x80000000 && w2 == (int32_t) 0x80000000)
  149. {
  150. DSPCR |= DSPCR_OUFLAG5;
  151. prod = 0x7fffffff;
  152. }
  153. else
  154. {
  155. prod = ((int64_t) w1 * (int64_t) w2) << 1;
  156. if (round == 1)
  157. prod += 0x0000000080000000LL;
  158. prod = prod >> 32;
  159. }
  160. result = (uint32_t) prod;
  161. GPR[rd] = EXTEND32 (result);
  162. }
  163. // round: 0 = no rounding, 1 = rounding
  164. :function:::void:do_precr_sra:int rt, int rs, int sa, int round
  165. {
  166. uint32_t v1 = GPR[rt];
  167. uint32_t v2 = GPR[rs];
  168. int32_t w1 = (int32_t) v1;
  169. int32_t w2 = (int32_t) v2;
  170. int32_t result;
  171. if (sa != 0)
  172. {
  173. if (round == 1 && (w1 & (1 << (sa - 1))))
  174. w1 = (w1 >> sa) + 1;
  175. else
  176. w1 = w1 >> sa;
  177. if (round == 1 && (w2 & (1 << (sa - 1))))
  178. w2 = (w2 >> sa) + 1;
  179. else
  180. w2 = w2 >> sa;
  181. }
  182. result = (w1 << 16) | (w2 & 0xffff);
  183. GPR[rt] = EXTEND32 (result);
  184. }
  185. // round: 0 = no rounding, 1 = rounding
  186. :function:::void:do_qb_shra:int rd, int rt, int shift, int round
  187. {
  188. int i, j;
  189. int8_t q0;
  190. uint32_t v1 = GPR[rt];
  191. uint32_t result = 0;
  192. for (i = 0; i < 32; i += 8, v1 >>= 8)
  193. {
  194. q0 = (int8_t)(v1 & 0xff);
  195. if (shift != 0)
  196. {
  197. if (round == 1 && (q0 & (1 << (shift - 1))))
  198. q0 = (q0 >> shift) + 1;
  199. else
  200. q0 = q0 >> shift;
  201. }
  202. result |= ((uint32_t)((uint8_t)q0) << i);
  203. }
  204. GPR[rd] = EXTEND32 (result);
  205. }
  206. :function:::void:do_ph_shrl:int rd, int rt, int shift
  207. {
  208. int i, j;
  209. uint16_t h0;
  210. uint32_t v1 = GPR[rt];
  211. uint32_t result = 0;
  212. for (i = 0; i < 32; i += 16, v1 >>= 16)
  213. {
  214. h0 = (uint16_t)(v1 & 0xffff);
  215. h0 = h0 >> shift;
  216. result |= ((uint32_t)h0 << i);
  217. }
  218. GPR[rd] = EXTEND32 (result);
  219. }
  220. // op: 0 = ADD, 1 = SUB
  221. // round: 0 = no rounding, 1 = rounding
  222. :function:::void:do_qh_ph_op:int rd, int rs, int rt, int op, int round
  223. {
  224. int i;
  225. int32_t h0;
  226. int16_t h1, h2;
  227. uint32_t v1 = GPR[rs];
  228. uint32_t v2 = GPR[rt];
  229. uint32_t result = 0;
  230. for (i = 0; i < 32; i += 16, v1 >>= 16, v2 >>= 16)
  231. {
  232. h1 = (int16_t)(v1 & 0xffff);
  233. h2 = (int16_t)(v2 & 0xffff);
  234. if (op == 0) // ADD
  235. h0 = (int32_t)h1 + (int32_t)h2;
  236. else // SUB
  237. h0 = (int32_t)h1 - (int32_t)h2;
  238. if (round == 1)
  239. h0 = (h0 + 1) >> 1;
  240. else
  241. h0 = h0 >> 1;
  242. result |= ((uint32_t)((uint16_t)h0) << i);
  243. }
  244. GPR[rd] = EXTEND32 (result);
  245. }
  246. // op: 0 = ADD, 1 = SUB
  247. // round: 0 = no rounding, 1 = rounding
  248. :function:::void:do_qh_w_op:int rd, int rs, int rt, int op, int round
  249. {
  250. int i;
  251. int64_t v0;
  252. int32_t v1 = (int32_t)GPR[rs];
  253. int32_t v2 = (int32_t)GPR[rt];
  254. if (op == 0) // ADD
  255. v0 = (int64_t)v1 + (int64_t)v2;
  256. else // SUB
  257. v0 = (int64_t)v1 - (int64_t)v2;
  258. if (round == 1)
  259. v0 = (v0 + 1) >> 1;
  260. else
  261. v0 = v0 >> 1;
  262. GPR[rd] = EXTEND32 (v0);
  263. }
  264. // op: 0 = DPAX, 1 = DPSX
  265. :function:::void:do_x_w_ph_dot_product:int ac, int rs, int rt, int op
  266. {
  267. int i;
  268. uint32_t v1 = GPR[rs];
  269. uint32_t v2 = GPR[rt];
  270. int16_t h1, h2;
  271. int32_t result;
  272. uint32_t lo = DSPLO(ac);
  273. uint32_t hi = DSPHI(ac);
  274. int64_t prod = (int64_t)((((uint64_t)hi) << 32) + (uint64_t)lo);
  275. for (i = 0; i < 32; i += 16, v1 >>= 16, v2 <<= 16)
  276. {
  277. h1 = (int16_t)(v1 & 0xffff);
  278. h2 = (int16_t)((v2 & 0xffff0000) >> 16);
  279. result = (int32_t)h1 * (int32_t)h2;
  280. if (op == 0) // DPAX
  281. prod += (int64_t)result;
  282. else // DPSX
  283. prod -= (int64_t)result;
  284. }
  285. DSPLO(ac) = EXTEND32 (prod);
  286. DSPHI(ac) = EXTEND32 (prod >> 32);
  287. }
  288. // op: 0 = DPAQX, 1 = DPSQX
  289. // sat: 0 = no saturation, 1 = saturation of the accumulator
  290. :function:::void:do_qx_w_ph_dot_product:int ac, int rs, int rt, int op, int sat
  291. {
  292. int i;
  293. uint32_t v1 = GPR[rs];
  294. uint32_t v2 = GPR[rt];
  295. int16_t h1, h2;
  296. int32_t result;
  297. uint32_t lo = DSPLO(ac);
  298. uint32_t hi = DSPHI(ac);
  299. int64_t prod = (int64_t)((((uint64_t)hi) << 32) + (uint64_t)lo);
  300. int64_t max, min;
  301. for (i = 0; i < 32; i += 16, v1 >>= 16, v2 <<= 16)
  302. {
  303. h1 = (int16_t)(v1 & 0xffff);
  304. h2 = (int16_t)((v2 & 0xffff0000) >> 16);
  305. if (h1 == (int16_t)0x8000 && h2 == (int16_t)0x8000)
  306. {
  307. DSPCR |= (1 << (DSPCR_OUFLAG_SHIFT + ac));
  308. result = 0x7fffffff;
  309. }
  310. else
  311. result = ((int32_t)h1 * (int32_t)h2) << 1;
  312. if (op == 0) // DPAQX
  313. prod += (int64_t)result;
  314. else // DPSQX
  315. prod -= (int64_t)result;
  316. }
  317. // Saturation on the accumulator.
  318. if (sat == 1)
  319. {
  320. max = (int64_t) 0x7fffffffLL;
  321. min = (int64_t) 0xffffffff80000000LL;
  322. if (prod > max)
  323. {
  324. DSPCR |= (1 << (DSPCR_OUFLAG_SHIFT + ac));
  325. prod = max;
  326. }
  327. else if (prod < min)
  328. {
  329. DSPCR |= (1 << (DSPCR_OUFLAG_SHIFT + ac));
  330. prod = min;
  331. }
  332. }
  333. DSPLO(ac) = EXTEND32 (prod);
  334. DSPHI(ac) = EXTEND32 (prod >> 32);
  335. }
  336. 011111,00000,5.RT,5.RD,00001,010010:SPECIAL3:32::ABSQ_S.QB
  337. "absq_s.qb r<RD>, r<RT>"
  338. *dsp2:
  339. {
  340. do_qb_s_absq (SD_, RD, RT);
  341. }
  342. 011111,5.RS,5.RT,5.RD,01000,010000:SPECIAL3:32::ADDU.PH
  343. "addu.ph r<RD>, r<RS>, r<RT>"
  344. *dsp2:
  345. {
  346. do_u_ph_op (SD_, RD, RS, RT, 0, 0);
  347. }
  348. 011111,5.RS,5.RT,5.RD,01100,010000:SPECIAL3:32::ADDU_S.PH
  349. "addu_s.ph r<RD>, r<RS>, r<RT>"
  350. *dsp2:
  351. {
  352. do_u_ph_op (SD_, RD, RS, RT, 0, 1);
  353. }
  354. 011111,5.RS,5.RT,5.RD,00000,011000:SPECIAL3:32::ADDUH.QB
  355. "adduh.qb r<RD>, r<RS>, r<RT>"
  356. *dsp2:
  357. {
  358. do_uh_qb_op (SD_, RD, RS, RT, 0, 0);
  359. }
  360. 011111,5.RS,5.RT,5.RD,00010,011000:SPECIAL3:32::ADDUH_R.QB
  361. "adduh_r.qb r<RD>, r<RS>, r<RT>"
  362. *dsp2:
  363. {
  364. do_uh_qb_op (SD_, RD, RS, RT, 0, 1);
  365. }
  366. 011111,5.RS,5.RT,5.SA,00000,110001:SPECIAL3:32::APPEND
  367. "append r<RT>, r<RS>, <SA>"
  368. *dsp2:
  369. {
  370. do_append (SD_, RT, RS, SA);
  371. }
  372. 011111,5.RS,5.RT,000,2.BP,10000,110001:SPECIAL3:32::BALIGN
  373. "balign r<RT>, r<RS>, <BP>"
  374. *dsp2:
  375. {
  376. do_balign (SD_, RT, RS, BP);
  377. }
  378. 011111,5.RS,5.RT,5.RD,11000,010001:SPECIAL3:32::CMPGDU.EQ.QB
  379. "cmpgdu.eq.qb r<RD>, r<RS>, r<RT>"
  380. *dsp2:
  381. {
  382. do_qb_cmpgdu (SD_, RD, RS, RT, 0);
  383. }
  384. 011111,5.RS,5.RT,5.RD,11001,010001:SPECIAL3:32::CMPGDU.LT.QB
  385. "cmpgdu.lt.qb r<RD>, r<RS>, r<RT>"
  386. *dsp2:
  387. {
  388. do_qb_cmpgdu (SD_, RD, RS, RT, 1);
  389. }
  390. 011111,5.RS,5.RT,5.RD,11010,010001:SPECIAL3:32::CMPGDU.LE.QB
  391. "cmpgdu.le.qb r<RD>, r<RS>, r<RT>"
  392. *dsp2:
  393. {
  394. do_qb_cmpgdu (SD_, RD, RS, RT, 2);
  395. }
  396. 011111,5.RS,5.RT,000,2.AC,00000,110000:SPECIAL3:32::DPA.W.PH
  397. "dpa.w.ph ac<AC>, r<RS>, r<RT>"
  398. *dsp2:
  399. {
  400. do_w_ph_dot_product (SD_, AC, RS, RT, 0);
  401. }
  402. 011111,5.RS,5.RT,000,2.AC,00001,110000:SPECIAL3:32::DPS.W.PH
  403. "dps.w.ph ac<AC>, r<RS>, r<RT>"
  404. *dsp2:
  405. {
  406. do_w_ph_dot_product (SD_, AC, RS, RT, 1);
  407. }
  408. 011111,5.RS,5.RT,5.RD,01100,011000:SPECIAL3:32::MUL.PH
  409. "mul.ph r<RD>, r<RS>, r<RT>"
  410. *dsp2:
  411. {
  412. do_ph_op (SD_, RD, RS, RT, 2, 0);
  413. }
  414. 011111,5.RS,5.RT,5.RD,01110,011000:SPECIAL3:32::MUL_S.PH
  415. "mul_s.ph r<RD>, r<RS>, r<RT>"
  416. *dsp2:
  417. {
  418. do_ph_op (SD_, RD, RS, RT, 2, 1);
  419. }
  420. 011111,5.RS,5.RT,5.RD,10111,011000:SPECIAL3:32::MULQ_RS.W
  421. "mulq_rs.w r<RD>, r<RS>, r<RT>"
  422. *dsp2:
  423. {
  424. do_w_mulq (SD_, RD, RS, RT, 1);
  425. }
  426. 011111,5.RS,5.RT,5.RD,11110,010000:SPECIAL3:32::MULQ_S.PH
  427. "mulq_s.ph r<RD>, r<RS>, r<RT>"
  428. *dsp2:
  429. {
  430. do_ph_mulq (SD_, RD, RS, RT, 0);
  431. }
  432. 011111,5.RS,5.RT,5.RD,10110,011000:SPECIAL3:32::MULQ_S.W
  433. "mulq_s.w r<RD>, r<RS>, r<RT>"
  434. *dsp2:
  435. {
  436. do_w_mulq (SD_, RD, RS, RT, 0);
  437. }
  438. 011111,5.RS,5.RT,000,2.AC,00010,110000:SPECIAL3:32::MULSA.W.PH
  439. "mulsa.w.ph ac<AC>, r<RS>, r<RT>"
  440. *dsp2:
  441. {
  442. do_ph_w_mulsa (SD_, AC, RS, RT);
  443. }
  444. 011111,5.RS,5.RT,5.RD,01101,010001:SPECIAL3:32::PRECR.QB.PH
  445. "precr.qb.ph r<RD>, r<RS>, r<RT>"
  446. *dsp2:
  447. {
  448. do_ph_qb_precr (SD_, RD, RS, RT);
  449. }
  450. 011111,5.RS,5.RT,5.SA,11110,010001:SPECIAL3:32::PRECR_SRA.PH.W
  451. "precr_sra.ph.w r<RT>, r<RS>, <SA>"
  452. *dsp2:
  453. {
  454. do_precr_sra (SD_, RT, RS, SA, 0);
  455. }
  456. 011111,5.RS,5.RT,5.SA,11111,010001:SPECIAL3:32::PRECR_SRA_R.PH.W
  457. "precr_sra_r.ph.w r<RT>, r<RS>, <SA>"
  458. *dsp2:
  459. {
  460. do_precr_sra (SD_, RT, RS, SA, 1);
  461. }
  462. 011111,5.RS,5.RT,5.SA,00001,110001:SPECIAL3:32::PREPEND
  463. "prepend r<RT>, r<RS>, <SA>"
  464. *dsp2:
  465. {
  466. do_prepend (SD_, RT, RS, SA);
  467. }
  468. 011111,00,3.SHIFT3,5.RT,5.RD,00100,010011:SPECIAL3:32::SHRA.QB
  469. "shra.qb r<RD>, r<RT>, <SHIFT3>"
  470. *dsp2:
  471. {
  472. do_qb_shra (SD_, RD, RT, SHIFT3, 0);
  473. }
  474. 011111,00,3.SHIFT3,5.RT,5.RD,00101,010011:SPECIAL3:32::SHRA_R.QB
  475. "shra_r.qb r<RD>, r<RT>, <SHIFT3>"
  476. *dsp2:
  477. {
  478. do_qb_shra (SD_, RD, RT, SHIFT3, 1);
  479. }
  480. 011111,5.RS,5.RT,5.RD,00110,010011:SPECIAL3:32::SHRAV.QB
  481. "shrav.qb r<RD>, r<RT>, r<RS>"
  482. *dsp2:
  483. {
  484. do_qb_shrav (SD_, RD, RT, RS, 0);
  485. }
  486. 011111,5.RS,5.RT,5.RD,00111,010011:SPECIAL3:32::SHRAV_R.QB
  487. "shrav_r.qb r<RD>, r<RT>, r<RS>"
  488. *dsp2:
  489. {
  490. do_qb_shrav (SD_, RD, RT, RS, 1);
  491. }
  492. 011111,0,4.SHIFT4,5.RT,5.RD,11001,010011:SPECIAL3:32::SHRL.PH
  493. "shrl.ph r<RD>, r<RT>, <SHIFT4>"
  494. *dsp2:
  495. {
  496. do_ph_shrl (SD_, RD, RT, SHIFT4);
  497. }
  498. 011111,5.RS,5.RT,5.RD,11011,010011:SPECIAL3:32::SHRLV.PH
  499. "shrlv.ph r<RD>, r<RT>, r<RS>"
  500. *dsp2:
  501. {
  502. do_ph_shrlv (SD_, RD, RT, RS);
  503. }
  504. 011111,5.RS,5.RT,5.RD,01001,010000:SPECIAL3:32::SUBU.PH
  505. "subu.ph r<RD>, r<RS>, r<RT>"
  506. *dsp2:
  507. {
  508. do_u_ph_op (SD_, RD, RS, RT, 1, 0);
  509. }
  510. 011111,5.RS,5.RT,5.RD,01101,010000:SPECIAL3:32::SUBU_S.PH
  511. "subu_s.ph r<RD>, r<RS>, r<RT>"
  512. *dsp2:
  513. {
  514. do_u_ph_op (SD_, RD, RS, RT, 1, 1);
  515. }
  516. 011111,5.RS,5.RT,5.RD,00001,011000:SPECIAL3:32::SUBUH.QB
  517. "subuh.qb r<RD>, r<RS>, r<RT>"
  518. *dsp2:
  519. {
  520. do_uh_qb_op (SD_, RD, RS, RT, 1, 0);
  521. }
  522. 011111,5.RS,5.RT,5.RD,00011,011000:SPECIAL3:32::SUBUH_R.QB
  523. "subuh_r.qb r<RD>, r<RS>, r<RT>"
  524. *dsp2:
  525. {
  526. do_uh_qb_op (SD_, RD, RS, RT, 1, 1);
  527. }
  528. 011111,5.RS,5.RT,5.RD,01000,011000:SPECIAL3:32::ADDQH.PH
  529. "addqh.ph r<RD>, r<RS>, r<RT>"
  530. *dsp2:
  531. {
  532. do_qh_ph_op (SD_, RD, RS, RT, 0, 0);
  533. }
  534. 011111,5.RS,5.RT,5.RD,01010,011000:SPECIAL3:32::ADDQH_R.PH
  535. "addqh_r.ph r<RD>, r<RS>, r<RT>"
  536. *dsp2:
  537. {
  538. do_qh_ph_op (SD_, RD, RS, RT, 0, 1);
  539. }
  540. 011111,5.RS,5.RT,5.RD,10000,011000:SPECIAL3:32::ADDQH.W
  541. "addqh.w r<RD>, r<RS>, r<RT>"
  542. *dsp2:
  543. {
  544. do_qh_w_op (SD_, RD, RS, RT, 0, 0);
  545. }
  546. 011111,5.RS,5.RT,5.RD,10010,011000:SPECIAL3:32::ADDQH_R.W
  547. "addqh_r.w r<RD>, r<RS>, r<RT>"
  548. *dsp2:
  549. {
  550. do_qh_w_op (SD_, RD, RS, RT, 0, 1);
  551. }
  552. 011111,5.RS,5.RT,5.RD,01001,011000:SPECIAL3:32::SUBQH.PH
  553. "subqh.ph r<RD>, r<RS>, r<RT>"
  554. *dsp2:
  555. {
  556. do_qh_ph_op (SD_, RD, RS, RT, 1, 0);
  557. }
  558. 011111,5.RS,5.RT,5.RD,01011,011000:SPECIAL3:32::SUBQH_R.PH
  559. "subqh_r.ph r<RD>, r<RS>, r<RT>"
  560. *dsp2:
  561. {
  562. do_qh_ph_op (SD_, RD, RS, RT, 1, 1);
  563. }
  564. 011111,5.RS,5.RT,5.RD,10001,011000:SPECIAL3:32::SUBQH.W
  565. "subqh.w r<RD>, r<RS>, r<RT>"
  566. *dsp2:
  567. {
  568. do_qh_w_op (SD_, RD, RS, RT, 1, 0);
  569. }
  570. 011111,5.RS,5.RT,5.RD,10011,011000:SPECIAL3:32::SUBQH_R.W
  571. "subqh_r.w r<RD>, r<RS>, r<RT>"
  572. *dsp2:
  573. {
  574. do_qh_w_op (SD_, RD, RS, RT, 1, 1);
  575. }
  576. 011111,5.RS,5.RT,000,2.AC,01000,110000:SPECIAL3:32::DPAX.W.PH
  577. "dpax.w.ph ac<AC>, r<RS>, r<RT>"
  578. *dsp2:
  579. {
  580. do_x_w_ph_dot_product (SD_, AC, RS, RT, 0);
  581. }
  582. 011111,5.RS,5.RT,000,2.AC,01001,110000:SPECIAL3:32::DPSX.W.PH
  583. "dpsx.w.ph ac<AC>, r<RS>, r<RT>"
  584. *dsp2:
  585. {
  586. do_x_w_ph_dot_product (SD_, AC, RS, RT, 1);
  587. }
  588. 011111,5.RS,5.RT,000,2.AC,11000,110000:SPECIAL3:32::DPAQX_S.W.PH
  589. "dpaqx_s.w.ph ac<AC>, r<RS>, r<RT>"
  590. *dsp2:
  591. {
  592. do_qx_w_ph_dot_product (SD_, AC, RS, RT, 0, 0);
  593. }
  594. 011111,5.RS,5.RT,000,2.AC,11010,110000:SPECIAL3:32::DPAQX_SA.W.PH
  595. "dpaqx_sa.w.ph ac<AC>, r<RS>, r<RT>"
  596. *dsp2:
  597. {
  598. do_qx_w_ph_dot_product (SD_, AC, RS, RT, 0, 1);
  599. }
  600. 011111,5.RS,5.RT,000,2.AC,11001,110000:SPECIAL3:32::DPSQX_S.W.PH
  601. "dpsqx_s.w.ph ac<AC>, r<RS>, r<RT>"
  602. *dsp2:
  603. {
  604. do_qx_w_ph_dot_product (SD_, AC, RS, RT, 1, 0);
  605. }
  606. 011111,5.RS,5.RT,000,2.AC,11011,110000:SPECIAL3:32::DPSQX_SA.W.PH
  607. "dpsqx_sa.w.ph ac<AC>, r<RS>, r<RT>"
  608. *dsp2:
  609. {
  610. do_qx_w_ph_dot_product (SD_, AC, RS, RT, 1, 1);
  611. }