uasm.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * A small micro-assembler. It is intentionally kept simple, does only
  7. * support a subset of instructions, and does not try to hide pipeline
  8. * effects like branch delay slots.
  9. *
  10. * Copyright (C) 2004, 2005, 2006, 2008 Thiemo Seufer
  11. * Copyright (C) 2005, 2007 Maciej W. Rozycki
  12. * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
  13. * Copyright (C) 2012, 2013 MIPS Technologies, Inc. All rights reserved.
  14. */
  15. enum fields {
  16. RS = 0x001,
  17. RT = 0x002,
  18. RD = 0x004,
  19. RE = 0x008,
  20. SIMM = 0x010,
  21. UIMM = 0x020,
  22. BIMM = 0x040,
  23. JIMM = 0x080,
  24. FUNC = 0x100,
  25. SET = 0x200,
  26. SCIMM = 0x400,
  27. SIMM9 = 0x800,
  28. };
  29. #define OP_MASK 0x3f
  30. #define OP_SH 26
  31. #define RD_MASK 0x1f
  32. #define RD_SH 11
  33. #define RE_MASK 0x1f
  34. #define RE_SH 6
  35. #define IMM_MASK 0xffff
  36. #define IMM_SH 0
  37. #define JIMM_MASK 0x3ffffff
  38. #define JIMM_SH 0
  39. #define FUNC_MASK 0x3f
  40. #define FUNC_SH 0
  41. #define SET_MASK 0x7
  42. #define SET_SH 0
  43. #define SIMM9_SH 7
  44. #define SIMM9_MASK 0x1ff
  45. enum opcode {
  46. insn_addiu, insn_addu, insn_and, insn_andi, insn_bbit0, insn_bbit1,
  47. insn_beq, insn_beql, insn_bgez, insn_bgezl, insn_bgtz, insn_blez,
  48. insn_bltz, insn_bltzl, insn_bne, insn_break, insn_cache, insn_cfc1,
  49. insn_cfcmsa, insn_ctc1, insn_ctcmsa, insn_daddiu, insn_daddu, insn_ddivu,
  50. insn_di, insn_dins, insn_dinsm, insn_dinsu, insn_divu, insn_dmfc0,
  51. insn_dmtc0, insn_dmultu, insn_drotr, insn_drotr32, insn_dsbh, insn_dshd,
  52. insn_dsll, insn_dsll32, insn_dsllv, insn_dsra, insn_dsra32, insn_dsrav,
  53. insn_dsrl, insn_dsrl32, insn_dsrlv, insn_dsubu, insn_eret, insn_ext,
  54. insn_ins, insn_j, insn_jal, insn_jalr, insn_jr, insn_lb, insn_lbu,
  55. insn_ld, insn_lddir, insn_ldpte, insn_ldx, insn_lh, insn_lhu,
  56. insn_ll, insn_lld, insn_lui, insn_lw, insn_lwu, insn_lwx, insn_mfc0,
  57. insn_mfhc0, insn_mfhi, insn_mflo, insn_movn, insn_movz, insn_mtc0,
  58. insn_mthc0, insn_mthi, insn_mtlo, insn_mul, insn_multu, insn_nor,
  59. insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sb,
  60. insn_sc, insn_scd, insn_sd, insn_sh, insn_sll, insn_sllv,
  61. insn_slt, insn_slti, insn_sltiu, insn_sltu, insn_sra, insn_srl,
  62. insn_srlv, insn_subu, insn_sw, insn_sync, insn_syscall, insn_tlbp,
  63. insn_tlbr, insn_tlbwi, insn_tlbwr, insn_wait, insn_wsbh, insn_xor,
  64. insn_xori, insn_yield,
  65. insn_invalid /* insn_invalid must be last */
  66. };
  67. struct insn {
  68. u32 match;
  69. enum fields fields;
  70. };
  71. static inline u32 build_rs(u32 arg)
  72. {
  73. WARN(arg & ~RS_MASK, KERN_WARNING "Micro-assembler field overflow\n");
  74. return (arg & RS_MASK) << RS_SH;
  75. }
  76. static inline u32 build_rt(u32 arg)
  77. {
  78. WARN(arg & ~RT_MASK, KERN_WARNING "Micro-assembler field overflow\n");
  79. return (arg & RT_MASK) << RT_SH;
  80. }
  81. static inline u32 build_rd(u32 arg)
  82. {
  83. WARN(arg & ~RD_MASK, KERN_WARNING "Micro-assembler field overflow\n");
  84. return (arg & RD_MASK) << RD_SH;
  85. }
  86. static inline u32 build_re(u32 arg)
  87. {
  88. WARN(arg & ~RE_MASK, KERN_WARNING "Micro-assembler field overflow\n");
  89. return (arg & RE_MASK) << RE_SH;
  90. }
  91. static inline u32 build_simm(s32 arg)
  92. {
  93. WARN(arg > 0x7fff || arg < -0x8000,
  94. KERN_WARNING "Micro-assembler field overflow\n");
  95. return arg & 0xffff;
  96. }
  97. static inline u32 build_uimm(u32 arg)
  98. {
  99. WARN(arg & ~IMM_MASK, KERN_WARNING "Micro-assembler field overflow\n");
  100. return arg & IMM_MASK;
  101. }
  102. static inline u32 build_scimm(u32 arg)
  103. {
  104. WARN(arg & ~SCIMM_MASK,
  105. KERN_WARNING "Micro-assembler field overflow\n");
  106. return (arg & SCIMM_MASK) << SCIMM_SH;
  107. }
  108. static inline u32 build_scimm9(s32 arg)
  109. {
  110. WARN((arg > 0xff || arg < -0x100),
  111. KERN_WARNING "Micro-assembler field overflow\n");
  112. return (arg & SIMM9_MASK) << SIMM9_SH;
  113. }
  114. static inline u32 build_func(u32 arg)
  115. {
  116. WARN(arg & ~FUNC_MASK, KERN_WARNING "Micro-assembler field overflow\n");
  117. return arg & FUNC_MASK;
  118. }
  119. static inline u32 build_set(u32 arg)
  120. {
  121. WARN(arg & ~SET_MASK, KERN_WARNING "Micro-assembler field overflow\n");
  122. return arg & SET_MASK;
  123. }
  124. static void build_insn(u32 **buf, enum opcode opc, ...);
  125. #define I_u1u2u3(op) \
  126. Ip_u1u2u3(op) \
  127. { \
  128. build_insn(buf, insn##op, a, b, c); \
  129. } \
  130. UASM_EXPORT_SYMBOL(uasm_i##op);
  131. #define I_s3s1s2(op) \
  132. Ip_s3s1s2(op) \
  133. { \
  134. build_insn(buf, insn##op, b, c, a); \
  135. } \
  136. UASM_EXPORT_SYMBOL(uasm_i##op);
  137. #define I_u2u1u3(op) \
  138. Ip_u2u1u3(op) \
  139. { \
  140. build_insn(buf, insn##op, b, a, c); \
  141. } \
  142. UASM_EXPORT_SYMBOL(uasm_i##op);
  143. #define I_u3u2u1(op) \
  144. Ip_u3u2u1(op) \
  145. { \
  146. build_insn(buf, insn##op, c, b, a); \
  147. } \
  148. UASM_EXPORT_SYMBOL(uasm_i##op);
  149. #define I_u3u1u2(op) \
  150. Ip_u3u1u2(op) \
  151. { \
  152. build_insn(buf, insn##op, b, c, a); \
  153. } \
  154. UASM_EXPORT_SYMBOL(uasm_i##op);
  155. #define I_u1u2s3(op) \
  156. Ip_u1u2s3(op) \
  157. { \
  158. build_insn(buf, insn##op, a, b, c); \
  159. } \
  160. UASM_EXPORT_SYMBOL(uasm_i##op);
  161. #define I_u2s3u1(op) \
  162. Ip_u2s3u1(op) \
  163. { \
  164. build_insn(buf, insn##op, c, a, b); \
  165. } \
  166. UASM_EXPORT_SYMBOL(uasm_i##op);
  167. #define I_u2u1s3(op) \
  168. Ip_u2u1s3(op) \
  169. { \
  170. build_insn(buf, insn##op, b, a, c); \
  171. } \
  172. UASM_EXPORT_SYMBOL(uasm_i##op);
  173. #define I_u2u1msbu3(op) \
  174. Ip_u2u1msbu3(op) \
  175. { \
  176. build_insn(buf, insn##op, b, a, c+d-1, c); \
  177. } \
  178. UASM_EXPORT_SYMBOL(uasm_i##op);
  179. #define I_u2u1msb32u3(op) \
  180. Ip_u2u1msbu3(op) \
  181. { \
  182. build_insn(buf, insn##op, b, a, c+d-33, c); \
  183. } \
  184. UASM_EXPORT_SYMBOL(uasm_i##op);
  185. #define I_u2u1msb32msb3(op) \
  186. Ip_u2u1msbu3(op) \
  187. { \
  188. build_insn(buf, insn##op, b, a, c+d-33, c-32); \
  189. } \
  190. UASM_EXPORT_SYMBOL(uasm_i##op);
  191. #define I_u2u1msbdu3(op) \
  192. Ip_u2u1msbu3(op) \
  193. { \
  194. build_insn(buf, insn##op, b, a, d-1, c); \
  195. } \
  196. UASM_EXPORT_SYMBOL(uasm_i##op);
  197. #define I_u1u2(op) \
  198. Ip_u1u2(op) \
  199. { \
  200. build_insn(buf, insn##op, a, b); \
  201. } \
  202. UASM_EXPORT_SYMBOL(uasm_i##op);
  203. #define I_u2u1(op) \
  204. Ip_u1u2(op) \
  205. { \
  206. build_insn(buf, insn##op, b, a); \
  207. } \
  208. UASM_EXPORT_SYMBOL(uasm_i##op);
  209. #define I_u1s2(op) \
  210. Ip_u1s2(op) \
  211. { \
  212. build_insn(buf, insn##op, a, b); \
  213. } \
  214. UASM_EXPORT_SYMBOL(uasm_i##op);
  215. #define I_u1(op) \
  216. Ip_u1(op) \
  217. { \
  218. build_insn(buf, insn##op, a); \
  219. } \
  220. UASM_EXPORT_SYMBOL(uasm_i##op);
  221. #define I_0(op) \
  222. Ip_0(op) \
  223. { \
  224. build_insn(buf, insn##op); \
  225. } \
  226. UASM_EXPORT_SYMBOL(uasm_i##op);
  227. I_u2u1s3(_addiu)
  228. I_u3u1u2(_addu)
  229. I_u2u1u3(_andi)
  230. I_u3u1u2(_and)
  231. I_u1u2s3(_beq)
  232. I_u1u2s3(_beql)
  233. I_u1s2(_bgez)
  234. I_u1s2(_bgezl)
  235. I_u1s2(_bgtz)
  236. I_u1s2(_blez)
  237. I_u1s2(_bltz)
  238. I_u1s2(_bltzl)
  239. I_u1u2s3(_bne)
  240. I_u1(_break)
  241. I_u2s3u1(_cache)
  242. I_u1u2(_cfc1)
  243. I_u2u1(_cfcmsa)
  244. I_u1u2(_ctc1)
  245. I_u2u1(_ctcmsa)
  246. I_u1u2(_ddivu)
  247. I_u1u2u3(_dmfc0)
  248. I_u1u2u3(_dmtc0)
  249. I_u1u2(_dmultu)
  250. I_u2u1s3(_daddiu)
  251. I_u3u1u2(_daddu)
  252. I_u1(_di);
  253. I_u1u2(_divu)
  254. I_u2u1(_dsbh);
  255. I_u2u1(_dshd);
  256. I_u2u1u3(_dsll)
  257. I_u2u1u3(_dsll32)
  258. I_u3u2u1(_dsllv)
  259. I_u2u1u3(_dsra)
  260. I_u2u1u3(_dsra32)
  261. I_u3u2u1(_dsrav)
  262. I_u2u1u3(_dsrl)
  263. I_u2u1u3(_dsrl32)
  264. I_u3u2u1(_dsrlv)
  265. I_u2u1u3(_drotr)
  266. I_u2u1u3(_drotr32)
  267. I_u3u1u2(_dsubu)
  268. I_0(_eret)
  269. I_u2u1msbdu3(_ext)
  270. I_u2u1msbu3(_ins)
  271. I_u1(_j)
  272. I_u1(_jal)
  273. I_u2u1(_jalr)
  274. I_u1(_jr)
  275. I_u2s3u1(_lb)
  276. I_u2s3u1(_lbu)
  277. I_u2s3u1(_ld)
  278. I_u2s3u1(_lh)
  279. I_u2s3u1(_lhu)
  280. I_u2s3u1(_ll)
  281. I_u2s3u1(_lld)
  282. I_u1s2(_lui)
  283. I_u2s3u1(_lw)
  284. I_u2s3u1(_lwu)
  285. I_u1u2u3(_mfc0)
  286. I_u1u2u3(_mfhc0)
  287. I_u3u1u2(_movn)
  288. I_u3u1u2(_movz)
  289. I_u1(_mfhi)
  290. I_u1(_mflo)
  291. I_u1u2u3(_mtc0)
  292. I_u1u2u3(_mthc0)
  293. I_u1(_mthi)
  294. I_u1(_mtlo)
  295. I_u3u1u2(_mul)
  296. I_u1u2(_multu)
  297. I_u3u1u2(_nor)
  298. I_u3u1u2(_or)
  299. I_u2u1u3(_ori)
  300. I_0(_rfe)
  301. I_u2s3u1(_sb)
  302. I_u2s3u1(_sc)
  303. I_u2s3u1(_scd)
  304. I_u2s3u1(_sd)
  305. I_u2s3u1(_sh)
  306. I_u2u1u3(_sll)
  307. I_u3u2u1(_sllv)
  308. I_s3s1s2(_slt)
  309. I_u2u1s3(_slti)
  310. I_u2u1s3(_sltiu)
  311. I_u3u1u2(_sltu)
  312. I_u2u1u3(_sra)
  313. I_u2u1u3(_srl)
  314. I_u3u2u1(_srlv)
  315. I_u2u1u3(_rotr)
  316. I_u3u1u2(_subu)
  317. I_u2s3u1(_sw)
  318. I_u1(_sync)
  319. I_0(_tlbp)
  320. I_0(_tlbr)
  321. I_0(_tlbwi)
  322. I_0(_tlbwr)
  323. I_u1(_wait);
  324. I_u2u1(_wsbh)
  325. I_u3u1u2(_xor)
  326. I_u2u1u3(_xori)
  327. I_u2u1(_yield)
  328. I_u2u1msbu3(_dins);
  329. I_u2u1msb32u3(_dinsm);
  330. I_u2u1msb32msb3(_dinsu);
  331. I_u1(_syscall);
  332. I_u1u2s3(_bbit0);
  333. I_u1u2s3(_bbit1);
  334. I_u3u1u2(_lwx)
  335. I_u3u1u2(_ldx)
  336. I_u1u2(_ldpte)
  337. I_u2u1u3(_lddir)
  338. #ifdef CONFIG_CPU_CAVIUM_OCTEON
  339. #include <asm/octeon/octeon.h>
  340. void uasm_i_pref(u32 **buf, unsigned int a, signed int b,
  341. unsigned int c)
  342. {
  343. if (CAVIUM_OCTEON_DCACHE_PREFETCH_WAR && a <= 24 && a != 5)
  344. /*
  345. * As per erratum Core-14449, replace prefetches 0-4,
  346. * 6-24 with 'pref 28'.
  347. */
  348. build_insn(buf, insn_pref, c, 28, b);
  349. else
  350. build_insn(buf, insn_pref, c, a, b);
  351. }
  352. UASM_EXPORT_SYMBOL(uasm_i_pref);
  353. #else
  354. I_u2s3u1(_pref)
  355. #endif
  356. /* Handle labels. */
  357. void uasm_build_label(struct uasm_label **lab, u32 *addr, int lid)
  358. {
  359. (*lab)->addr = addr;
  360. (*lab)->lab = lid;
  361. (*lab)++;
  362. }
  363. UASM_EXPORT_SYMBOL(uasm_build_label);
  364. int uasm_in_compat_space_p(long addr)
  365. {
  366. /* Is this address in 32bit compat space? */
  367. return addr == (int)addr;
  368. }
  369. UASM_EXPORT_SYMBOL(uasm_in_compat_space_p);
  370. static int uasm_rel_highest(long val)
  371. {
  372. #ifdef CONFIG_64BIT
  373. return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000;
  374. #else
  375. return 0;
  376. #endif
  377. }
  378. static int uasm_rel_higher(long val)
  379. {
  380. #ifdef CONFIG_64BIT
  381. return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000;
  382. #else
  383. return 0;
  384. #endif
  385. }
  386. int uasm_rel_hi(long val)
  387. {
  388. return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000;
  389. }
  390. UASM_EXPORT_SYMBOL(uasm_rel_hi);
  391. int uasm_rel_lo(long val)
  392. {
  393. return ((val & 0xffff) ^ 0x8000) - 0x8000;
  394. }
  395. UASM_EXPORT_SYMBOL(uasm_rel_lo);
  396. void UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr)
  397. {
  398. if (!uasm_in_compat_space_p(addr)) {
  399. uasm_i_lui(buf, rs, uasm_rel_highest(addr));
  400. if (uasm_rel_higher(addr))
  401. uasm_i_daddiu(buf, rs, rs, uasm_rel_higher(addr));
  402. if (uasm_rel_hi(addr)) {
  403. uasm_i_dsll(buf, rs, rs, 16);
  404. uasm_i_daddiu(buf, rs, rs,
  405. uasm_rel_hi(addr));
  406. uasm_i_dsll(buf, rs, rs, 16);
  407. } else
  408. uasm_i_dsll32(buf, rs, rs, 0);
  409. } else
  410. uasm_i_lui(buf, rs, uasm_rel_hi(addr));
  411. }
  412. UASM_EXPORT_SYMBOL(UASM_i_LA_mostly);
  413. void UASM_i_LA(u32 **buf, unsigned int rs, long addr)
  414. {
  415. UASM_i_LA_mostly(buf, rs, addr);
  416. if (uasm_rel_lo(addr)) {
  417. if (!uasm_in_compat_space_p(addr))
  418. uasm_i_daddiu(buf, rs, rs,
  419. uasm_rel_lo(addr));
  420. else
  421. uasm_i_addiu(buf, rs, rs,
  422. uasm_rel_lo(addr));
  423. }
  424. }
  425. UASM_EXPORT_SYMBOL(UASM_i_LA);
  426. /* Handle relocations. */
  427. void uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid)
  428. {
  429. (*rel)->addr = addr;
  430. (*rel)->type = R_MIPS_PC16;
  431. (*rel)->lab = lid;
  432. (*rel)++;
  433. }
  434. UASM_EXPORT_SYMBOL(uasm_r_mips_pc16);
  435. static inline void __resolve_relocs(struct uasm_reloc *rel,
  436. struct uasm_label *lab);
  437. void uasm_resolve_relocs(struct uasm_reloc *rel,
  438. struct uasm_label *lab)
  439. {
  440. struct uasm_label *l;
  441. for (; rel->lab != UASM_LABEL_INVALID; rel++)
  442. for (l = lab; l->lab != UASM_LABEL_INVALID; l++)
  443. if (rel->lab == l->lab)
  444. __resolve_relocs(rel, l);
  445. }
  446. UASM_EXPORT_SYMBOL(uasm_resolve_relocs);
  447. void uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end,
  448. long off)
  449. {
  450. for (; rel->lab != UASM_LABEL_INVALID; rel++)
  451. if (rel->addr >= first && rel->addr < end)
  452. rel->addr += off;
  453. }
  454. UASM_EXPORT_SYMBOL(uasm_move_relocs);
  455. void uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end,
  456. long off)
  457. {
  458. for (; lab->lab != UASM_LABEL_INVALID; lab++)
  459. if (lab->addr >= first && lab->addr < end)
  460. lab->addr += off;
  461. }
  462. UASM_EXPORT_SYMBOL(uasm_move_labels);
  463. void uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab,
  464. u32 *first, u32 *end, u32 *target)
  465. {
  466. long off = (long)(target - first);
  467. memcpy(target, first, (end - first) * sizeof(u32));
  468. uasm_move_relocs(rel, first, end, off);
  469. uasm_move_labels(lab, first, end, off);
  470. }
  471. UASM_EXPORT_SYMBOL(uasm_copy_handler);
  472. int uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr)
  473. {
  474. for (; rel->lab != UASM_LABEL_INVALID; rel++) {
  475. if (rel->addr == addr
  476. && (rel->type == R_MIPS_PC16
  477. || rel->type == R_MIPS_26))
  478. return 1;
  479. }
  480. return 0;
  481. }
  482. UASM_EXPORT_SYMBOL(uasm_insn_has_bdelay);
  483. /* Convenience functions for labeled branches. */
  484. void uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg,
  485. int lid)
  486. {
  487. uasm_r_mips_pc16(r, *p, lid);
  488. uasm_i_bltz(p, reg, 0);
  489. }
  490. UASM_EXPORT_SYMBOL(uasm_il_bltz);
  491. void uasm_il_b(u32 **p, struct uasm_reloc **r, int lid)
  492. {
  493. uasm_r_mips_pc16(r, *p, lid);
  494. uasm_i_b(p, 0);
  495. }
  496. UASM_EXPORT_SYMBOL(uasm_il_b);
  497. void uasm_il_beq(u32 **p, struct uasm_reloc **r, unsigned int r1,
  498. unsigned int r2, int lid)
  499. {
  500. uasm_r_mips_pc16(r, *p, lid);
  501. uasm_i_beq(p, r1, r2, 0);
  502. }
  503. UASM_EXPORT_SYMBOL(uasm_il_beq);
  504. void uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg,
  505. int lid)
  506. {
  507. uasm_r_mips_pc16(r, *p, lid);
  508. uasm_i_beqz(p, reg, 0);
  509. }
  510. UASM_EXPORT_SYMBOL(uasm_il_beqz);
  511. void uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg,
  512. int lid)
  513. {
  514. uasm_r_mips_pc16(r, *p, lid);
  515. uasm_i_beqzl(p, reg, 0);
  516. }
  517. UASM_EXPORT_SYMBOL(uasm_il_beqzl);
  518. void uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1,
  519. unsigned int reg2, int lid)
  520. {
  521. uasm_r_mips_pc16(r, *p, lid);
  522. uasm_i_bne(p, reg1, reg2, 0);
  523. }
  524. UASM_EXPORT_SYMBOL(uasm_il_bne);
  525. void uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg,
  526. int lid)
  527. {
  528. uasm_r_mips_pc16(r, *p, lid);
  529. uasm_i_bnez(p, reg, 0);
  530. }
  531. UASM_EXPORT_SYMBOL(uasm_il_bnez);
  532. void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg,
  533. int lid)
  534. {
  535. uasm_r_mips_pc16(r, *p, lid);
  536. uasm_i_bgezl(p, reg, 0);
  537. }
  538. UASM_EXPORT_SYMBOL(uasm_il_bgezl);
  539. void uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg,
  540. int lid)
  541. {
  542. uasm_r_mips_pc16(r, *p, lid);
  543. uasm_i_bgez(p, reg, 0);
  544. }
  545. UASM_EXPORT_SYMBOL(uasm_il_bgez);
  546. void uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg,
  547. unsigned int bit, int lid)
  548. {
  549. uasm_r_mips_pc16(r, *p, lid);
  550. uasm_i_bbit0(p, reg, bit, 0);
  551. }
  552. UASM_EXPORT_SYMBOL(uasm_il_bbit0);
  553. void uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg,
  554. unsigned int bit, int lid)
  555. {
  556. uasm_r_mips_pc16(r, *p, lid);
  557. uasm_i_bbit1(p, reg, bit, 0);
  558. }
  559. UASM_EXPORT_SYMBOL(uasm_il_bbit1);