162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
362306a36Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
462306a36Sopenharmony_ci * for more details.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright (C) 2004, 2005, 2006, 2008	 Thiemo Seufer
762306a36Sopenharmony_ci * Copyright (C) 2005  Maciej W. Rozycki
862306a36Sopenharmony_ci * Copyright (C) 2006  Ralf Baechle (ralf@linux-mips.org)
962306a36Sopenharmony_ci * Copyright (C) 2012, 2013  MIPS Technologies, Inc.  All rights reserved.
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#ifndef __ASM_UASM_H
1362306a36Sopenharmony_ci#define __ASM_UASM_H
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#include <linux/types.h>
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#ifdef CONFIG_EXPORT_UASM
1862306a36Sopenharmony_ci#include <linux/export.h>
1962306a36Sopenharmony_ci#define UASM_EXPORT_SYMBOL(sym) EXPORT_SYMBOL(sym)
2062306a36Sopenharmony_ci#else
2162306a36Sopenharmony_ci#define UASM_EXPORT_SYMBOL(sym)
2262306a36Sopenharmony_ci#endif
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define Ip_u1u2u3(op)							\
2562306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define Ip_u2u1u3(op)							\
2862306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define Ip_u3u2u1(op)							\
3162306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define Ip_u3u1u2(op)							\
3462306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#define Ip_u1u2s3(op)							\
3762306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci#define Ip_u2s3u1(op)							\
4062306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c)
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define Ip_s3s1s2(op)							\
4362306a36Sopenharmony_civoid uasm_i##op(u32 **buf, int a, int b, int c)
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define Ip_u2u1s3(op)							\
4662306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#define Ip_u2u1msbu3(op)						\
4962306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
5062306a36Sopenharmony_ci	   unsigned int d)
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define Ip_u1u2(op)							\
5362306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, unsigned int b)
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci#define Ip_u2u1(op)							\
5662306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, unsigned int b)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#define Ip_u1s2(op)							\
5962306a36Sopenharmony_civoid uasm_i##op(u32 **buf, unsigned int a, signed int b)
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define Ip_u1(op) void uasm_i##op(u32 **buf, unsigned int a)
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#define Ip_0(op) void uasm_i##op(u32 **buf)
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ciIp_u2u1s3(_addiu);
6662306a36Sopenharmony_ciIp_u3u1u2(_addu);
6762306a36Sopenharmony_ciIp_u3u1u2(_and);
6862306a36Sopenharmony_ciIp_u2u1u3(_andi);
6962306a36Sopenharmony_ciIp_u1u2s3(_bbit0);
7062306a36Sopenharmony_ciIp_u1u2s3(_bbit1);
7162306a36Sopenharmony_ciIp_u1u2s3(_beq);
7262306a36Sopenharmony_ciIp_u1u2s3(_beql);
7362306a36Sopenharmony_ciIp_u1s2(_bgez);
7462306a36Sopenharmony_ciIp_u1s2(_bgezl);
7562306a36Sopenharmony_ciIp_u1s2(_bgtz);
7662306a36Sopenharmony_ciIp_u1s2(_blez);
7762306a36Sopenharmony_ciIp_u1s2(_bltz);
7862306a36Sopenharmony_ciIp_u1s2(_bltzl);
7962306a36Sopenharmony_ciIp_u1u2s3(_bne);
8062306a36Sopenharmony_ciIp_u1(_break);
8162306a36Sopenharmony_ciIp_u2s3u1(_cache);
8262306a36Sopenharmony_ciIp_u1u2(_cfc1);
8362306a36Sopenharmony_ciIp_u2u1(_cfcmsa);
8462306a36Sopenharmony_ciIp_u1u2(_ctc1);
8562306a36Sopenharmony_ciIp_u2u1(_ctcmsa);
8662306a36Sopenharmony_ciIp_u2u1s3(_daddiu);
8762306a36Sopenharmony_ciIp_u3u1u2(_daddu);
8862306a36Sopenharmony_ciIp_u1u2(_ddivu);
8962306a36Sopenharmony_ciIp_u3u1u2(_ddivu_r6);
9062306a36Sopenharmony_ciIp_u1(_di);
9162306a36Sopenharmony_ciIp_u2u1msbu3(_dins);
9262306a36Sopenharmony_ciIp_u2u1msbu3(_dinsm);
9362306a36Sopenharmony_ciIp_u2u1msbu3(_dinsu);
9462306a36Sopenharmony_ciIp_u1u2(_divu);
9562306a36Sopenharmony_ciIp_u3u1u2(_divu_r6);
9662306a36Sopenharmony_ciIp_u1u2u3(_dmfc0);
9762306a36Sopenharmony_ciIp_u3u1u2(_dmodu);
9862306a36Sopenharmony_ciIp_u1u2u3(_dmtc0);
9962306a36Sopenharmony_ciIp_u1u2(_dmultu);
10062306a36Sopenharmony_ciIp_u3u1u2(_dmulu);
10162306a36Sopenharmony_ciIp_u2u1u3(_drotr);
10262306a36Sopenharmony_ciIp_u2u1u3(_drotr32);
10362306a36Sopenharmony_ciIp_u2u1(_dsbh);
10462306a36Sopenharmony_ciIp_u2u1(_dshd);
10562306a36Sopenharmony_ciIp_u2u1u3(_dsll);
10662306a36Sopenharmony_ciIp_u2u1u3(_dsll32);
10762306a36Sopenharmony_ciIp_u3u2u1(_dsllv);
10862306a36Sopenharmony_ciIp_u2u1u3(_dsra);
10962306a36Sopenharmony_ciIp_u2u1u3(_dsra32);
11062306a36Sopenharmony_ciIp_u3u2u1(_dsrav);
11162306a36Sopenharmony_ciIp_u2u1u3(_dsrl);
11262306a36Sopenharmony_ciIp_u2u1u3(_dsrl32);
11362306a36Sopenharmony_ciIp_u3u2u1(_dsrlv);
11462306a36Sopenharmony_ciIp_u3u1u2(_dsubu);
11562306a36Sopenharmony_ciIp_0(_eret);
11662306a36Sopenharmony_ciIp_u2u1msbu3(_ext);
11762306a36Sopenharmony_ciIp_u2u1msbu3(_ins);
11862306a36Sopenharmony_ciIp_u1(_j);
11962306a36Sopenharmony_ciIp_u1(_jal);
12062306a36Sopenharmony_ciIp_u2u1(_jalr);
12162306a36Sopenharmony_ciIp_u1(_jr);
12262306a36Sopenharmony_ciIp_u2s3u1(_lb);
12362306a36Sopenharmony_ciIp_u2s3u1(_lbu);
12462306a36Sopenharmony_ciIp_u2s3u1(_ld);
12562306a36Sopenharmony_ciIp_u3u1u2(_ldx);
12662306a36Sopenharmony_ciIp_u2s3u1(_lh);
12762306a36Sopenharmony_ciIp_u2s3u1(_lhu);
12862306a36Sopenharmony_ciIp_u2s3u1(_ll);
12962306a36Sopenharmony_ciIp_u2s3u1(_lld);
13062306a36Sopenharmony_ciIp_u1s2(_lui);
13162306a36Sopenharmony_ciIp_u2s3u1(_lw);
13262306a36Sopenharmony_ciIp_u2s3u1(_lwu);
13362306a36Sopenharmony_ciIp_u3u1u2(_lwx);
13462306a36Sopenharmony_ciIp_u1u2u3(_mfc0);
13562306a36Sopenharmony_ciIp_u1u2u3(_mfhc0);
13662306a36Sopenharmony_ciIp_u1(_mfhi);
13762306a36Sopenharmony_ciIp_u1(_mflo);
13862306a36Sopenharmony_ciIp_u3u1u2(_modu);
13962306a36Sopenharmony_ciIp_u3u1u2(_movn);
14062306a36Sopenharmony_ciIp_u3u1u2(_movz);
14162306a36Sopenharmony_ciIp_u1u2u3(_mtc0);
14262306a36Sopenharmony_ciIp_u1u2u3(_mthc0);
14362306a36Sopenharmony_ciIp_u1(_mthi);
14462306a36Sopenharmony_ciIp_u1(_mtlo);
14562306a36Sopenharmony_ciIp_u3u1u2(_mul);
14662306a36Sopenharmony_ciIp_u1u2(_multu);
14762306a36Sopenharmony_ciIp_u3u1u2(_mulu);
14862306a36Sopenharmony_ciIp_u3u1u2(_muhu);
14962306a36Sopenharmony_ciIp_u3u1u2(_nor);
15062306a36Sopenharmony_ciIp_u3u1u2(_or);
15162306a36Sopenharmony_ciIp_u2u1u3(_ori);
15262306a36Sopenharmony_ciIp_u2s3u1(_pref);
15362306a36Sopenharmony_ciIp_0(_rfe);
15462306a36Sopenharmony_ciIp_u2u1u3(_rotr);
15562306a36Sopenharmony_ciIp_u2s3u1(_sb);
15662306a36Sopenharmony_ciIp_u2s3u1(_sc);
15762306a36Sopenharmony_ciIp_u2s3u1(_scd);
15862306a36Sopenharmony_ciIp_u2s3u1(_sd);
15962306a36Sopenharmony_ciIp_u3u1u2(_seleqz);
16062306a36Sopenharmony_ciIp_u3u1u2(_selnez);
16162306a36Sopenharmony_ciIp_u2s3u1(_sh);
16262306a36Sopenharmony_ciIp_u2u1u3(_sll);
16362306a36Sopenharmony_ciIp_u3u2u1(_sllv);
16462306a36Sopenharmony_ciIp_s3s1s2(_slt);
16562306a36Sopenharmony_ciIp_u2u1s3(_slti);
16662306a36Sopenharmony_ciIp_u2u1s3(_sltiu);
16762306a36Sopenharmony_ciIp_u3u1u2(_sltu);
16862306a36Sopenharmony_ciIp_u2u1u3(_sra);
16962306a36Sopenharmony_ciIp_u3u2u1(_srav);
17062306a36Sopenharmony_ciIp_u2u1u3(_srl);
17162306a36Sopenharmony_ciIp_u3u2u1(_srlv);
17262306a36Sopenharmony_ciIp_u3u1u2(_subu);
17362306a36Sopenharmony_ciIp_u2s3u1(_sw);
17462306a36Sopenharmony_ciIp_u1(_sync);
17562306a36Sopenharmony_ciIp_u1(_syscall);
17662306a36Sopenharmony_ciIp_0(_tlbp);
17762306a36Sopenharmony_ciIp_0(_tlbr);
17862306a36Sopenharmony_ciIp_0(_tlbwi);
17962306a36Sopenharmony_ciIp_0(_tlbwr);
18062306a36Sopenharmony_ciIp_u1(_wait);
18162306a36Sopenharmony_ciIp_u2u1(_wsbh);
18262306a36Sopenharmony_ciIp_u3u1u2(_xor);
18362306a36Sopenharmony_ciIp_u2u1u3(_xori);
18462306a36Sopenharmony_ciIp_u2u1(_yield);
18562306a36Sopenharmony_ciIp_u1u2(_ldpte);
18662306a36Sopenharmony_ciIp_u2u1u3(_lddir);
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ci/* Handle labels. */
18962306a36Sopenharmony_cistruct uasm_label {
19062306a36Sopenharmony_ci	u32 *addr;
19162306a36Sopenharmony_ci	int lab;
19262306a36Sopenharmony_ci};
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_civoid uasm_build_label(struct uasm_label **lab, u32 *addr,
19562306a36Sopenharmony_ci			int lid);
19662306a36Sopenharmony_ci#ifdef CONFIG_64BIT
19762306a36Sopenharmony_ciint uasm_in_compat_space_p(long addr);
19862306a36Sopenharmony_ci#endif
19962306a36Sopenharmony_ciint uasm_rel_hi(long val);
20062306a36Sopenharmony_ciint uasm_rel_lo(long val);
20162306a36Sopenharmony_civoid UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr);
20262306a36Sopenharmony_civoid UASM_i_LA(u32 **buf, unsigned int rs, long addr);
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci#define UASM_L_LA(lb)							\
20562306a36Sopenharmony_cistatic inline void uasm_l##lb(struct uasm_label **lab, u32 *addr)	\
20662306a36Sopenharmony_ci{									\
20762306a36Sopenharmony_ci	uasm_build_label(lab, addr, label##lb);				\
20862306a36Sopenharmony_ci}
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci/* convenience macros for instructions */
21162306a36Sopenharmony_ci#ifdef CONFIG_64BIT
21262306a36Sopenharmony_ci# define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_daddiu(buf, rs, rt, val)
21362306a36Sopenharmony_ci# define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_daddu(buf, rs, rt, rd)
21462306a36Sopenharmony_ci# define UASM_i_LL(buf, rs, rt, off) uasm_i_lld(buf, rs, rt, off)
21562306a36Sopenharmony_ci# define UASM_i_LW(buf, rs, rt, off) uasm_i_ld(buf, rs, rt, off)
21662306a36Sopenharmony_ci# define UASM_i_LWX(buf, rs, rt, rd) uasm_i_ldx(buf, rs, rt, rd)
21762306a36Sopenharmony_ci# define UASM_i_MFC0(buf, rt, rd...) uasm_i_dmfc0(buf, rt, rd)
21862306a36Sopenharmony_ci# define UASM_i_MTC0(buf, rt, rd...) uasm_i_dmtc0(buf, rt, rd)
21962306a36Sopenharmony_ci# define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_drotr(buf, rs, rt, sh)
22062306a36Sopenharmony_ci# define UASM_i_SC(buf, rs, rt, off) uasm_i_scd(buf, rs, rt, off)
22162306a36Sopenharmony_ci# define UASM_i_SLL(buf, rs, rt, sh) uasm_i_dsll(buf, rs, rt, sh)
22262306a36Sopenharmony_ci# define UASM_i_SRA(buf, rs, rt, sh) uasm_i_dsra(buf, rs, rt, sh)
22362306a36Sopenharmony_ci# define UASM_i_SRL(buf, rs, rt, sh) uasm_i_dsrl(buf, rs, rt, sh)
22462306a36Sopenharmony_ci# define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_dsrl_safe(buf, rs, rt, sh)
22562306a36Sopenharmony_ci# define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_dsubu(buf, rs, rt, rd)
22662306a36Sopenharmony_ci# define UASM_i_SW(buf, rs, rt, off) uasm_i_sd(buf, rs, rt, off)
22762306a36Sopenharmony_ci#else
22862306a36Sopenharmony_ci# define UASM_i_ADDIU(buf, rs, rt, val) uasm_i_addiu(buf, rs, rt, val)
22962306a36Sopenharmony_ci# define UASM_i_ADDU(buf, rs, rt, rd) uasm_i_addu(buf, rs, rt, rd)
23062306a36Sopenharmony_ci# define UASM_i_LL(buf, rs, rt, off) uasm_i_ll(buf, rs, rt, off)
23162306a36Sopenharmony_ci# define UASM_i_LW(buf, rs, rt, off) uasm_i_lw(buf, rs, rt, off)
23262306a36Sopenharmony_ci# define UASM_i_LWX(buf, rs, rt, rd) uasm_i_lwx(buf, rs, rt, rd)
23362306a36Sopenharmony_ci# define UASM_i_MFC0(buf, rt, rd...) uasm_i_mfc0(buf, rt, rd)
23462306a36Sopenharmony_ci# define UASM_i_MTC0(buf, rt, rd...) uasm_i_mtc0(buf, rt, rd)
23562306a36Sopenharmony_ci# define UASM_i_ROTR(buf, rs, rt, sh) uasm_i_rotr(buf, rs, rt, sh)
23662306a36Sopenharmony_ci# define UASM_i_SC(buf, rs, rt, off) uasm_i_sc(buf, rs, rt, off)
23762306a36Sopenharmony_ci# define UASM_i_SLL(buf, rs, rt, sh) uasm_i_sll(buf, rs, rt, sh)
23862306a36Sopenharmony_ci# define UASM_i_SRA(buf, rs, rt, sh) uasm_i_sra(buf, rs, rt, sh)
23962306a36Sopenharmony_ci# define UASM_i_SRL(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh)
24062306a36Sopenharmony_ci# define UASM_i_SRL_SAFE(buf, rs, rt, sh) uasm_i_srl(buf, rs, rt, sh)
24162306a36Sopenharmony_ci# define UASM_i_SUBU(buf, rs, rt, rd) uasm_i_subu(buf, rs, rt, rd)
24262306a36Sopenharmony_ci# define UASM_i_SW(buf, rs, rt, off) uasm_i_sw(buf, rs, rt, off)
24362306a36Sopenharmony_ci#endif
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci#define uasm_i_b(buf, off) uasm_i_beq(buf, 0, 0, off)
24662306a36Sopenharmony_ci#define uasm_i_beqz(buf, rs, off) uasm_i_beq(buf, rs, 0, off)
24762306a36Sopenharmony_ci#define uasm_i_beqzl(buf, rs, off) uasm_i_beql(buf, rs, 0, off)
24862306a36Sopenharmony_ci#define uasm_i_bnez(buf, rs, off) uasm_i_bne(buf, rs, 0, off)
24962306a36Sopenharmony_ci#define uasm_i_bnezl(buf, rs, off) uasm_i_bnel(buf, rs, 0, off)
25062306a36Sopenharmony_ci#define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3)
25162306a36Sopenharmony_ci#define uasm_i_move(buf, a, b) UASM_i_ADDU(buf, a, 0, b)
25262306a36Sopenharmony_ci#ifdef CONFIG_CPU_NOP_WORKAROUNDS
25362306a36Sopenharmony_ci#define uasm_i_nop(buf) uasm_i_or(buf, 1, 1, 0)
25462306a36Sopenharmony_ci#else
25562306a36Sopenharmony_ci#define uasm_i_nop(buf) uasm_i_sll(buf, 0, 0, 0)
25662306a36Sopenharmony_ci#endif
25762306a36Sopenharmony_ci#define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1)
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_cistatic inline void uasm_i_drotr_safe(u32 **p, unsigned int a1,
26062306a36Sopenharmony_ci				     unsigned int a2, unsigned int a3)
26162306a36Sopenharmony_ci{
26262306a36Sopenharmony_ci	if (a3 < 32)
26362306a36Sopenharmony_ci		uasm_i_drotr(p, a1, a2, a3);
26462306a36Sopenharmony_ci	else
26562306a36Sopenharmony_ci		uasm_i_drotr32(p, a1, a2, a3 - 32);
26662306a36Sopenharmony_ci}
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_cistatic inline void uasm_i_dsll_safe(u32 **p, unsigned int a1,
26962306a36Sopenharmony_ci				    unsigned int a2, unsigned int a3)
27062306a36Sopenharmony_ci{
27162306a36Sopenharmony_ci	if (a3 < 32)
27262306a36Sopenharmony_ci		uasm_i_dsll(p, a1, a2, a3);
27362306a36Sopenharmony_ci	else
27462306a36Sopenharmony_ci		uasm_i_dsll32(p, a1, a2, a3 - 32);
27562306a36Sopenharmony_ci}
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_cistatic inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1,
27862306a36Sopenharmony_ci				    unsigned int a2, unsigned int a3)
27962306a36Sopenharmony_ci{
28062306a36Sopenharmony_ci	if (a3 < 32)
28162306a36Sopenharmony_ci		uasm_i_dsrl(p, a1, a2, a3);
28262306a36Sopenharmony_ci	else
28362306a36Sopenharmony_ci		uasm_i_dsrl32(p, a1, a2, a3 - 32);
28462306a36Sopenharmony_ci}
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_cistatic inline void uasm_i_dsra_safe(u32 **p, unsigned int a1,
28762306a36Sopenharmony_ci				    unsigned int a2, unsigned int a3)
28862306a36Sopenharmony_ci{
28962306a36Sopenharmony_ci	if (a3 < 32)
29062306a36Sopenharmony_ci		uasm_i_dsra(p, a1, a2, a3);
29162306a36Sopenharmony_ci	else
29262306a36Sopenharmony_ci		uasm_i_dsra32(p, a1, a2, a3 - 32);
29362306a36Sopenharmony_ci}
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ci/* Handle relocations. */
29662306a36Sopenharmony_cistruct uasm_reloc {
29762306a36Sopenharmony_ci	u32 *addr;
29862306a36Sopenharmony_ci	unsigned int type;
29962306a36Sopenharmony_ci	int lab;
30062306a36Sopenharmony_ci};
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci/* This is zero so we can use zeroed label arrays. */
30362306a36Sopenharmony_ci#define UASM_LABEL_INVALID 0
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_civoid uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid);
30662306a36Sopenharmony_civoid uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab);
30762306a36Sopenharmony_civoid uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end, long off);
30862306a36Sopenharmony_civoid uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end, long off);
30962306a36Sopenharmony_civoid uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab,
31062306a36Sopenharmony_ci	u32 *first, u32 *end, u32 *target);
31162306a36Sopenharmony_ciint uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr);
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci/* Convenience functions for labeled branches. */
31462306a36Sopenharmony_civoid uasm_il_b(u32 **p, struct uasm_reloc **r, int lid);
31562306a36Sopenharmony_civoid uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg,
31662306a36Sopenharmony_ci		   unsigned int bit, int lid);
31762306a36Sopenharmony_civoid uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg,
31862306a36Sopenharmony_ci		   unsigned int bit, int lid);
31962306a36Sopenharmony_civoid uasm_il_beq(u32 **p, struct uasm_reloc **r, unsigned int r1,
32062306a36Sopenharmony_ci		 unsigned int r2, int lid);
32162306a36Sopenharmony_civoid uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
32262306a36Sopenharmony_civoid uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
32362306a36Sopenharmony_civoid uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
32462306a36Sopenharmony_civoid uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
32562306a36Sopenharmony_civoid uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
32662306a36Sopenharmony_civoid uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1,
32762306a36Sopenharmony_ci		 unsigned int reg2, int lid);
32862306a36Sopenharmony_civoid uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_ci#endif /* __ASM_UASM_H */
331