uasm.c 14 KB

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