18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright 2009 Freescale Semiconductor, Inc.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * provides masks and opcode images for use by code generation, emulation
68c2ecf20Sopenharmony_ci * and for instructions that older assemblers might not know about
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_PPC_OPCODE_H
98c2ecf20Sopenharmony_ci#define _ASM_POWERPC_PPC_OPCODE_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#  define stringify_in_c(...)	__VA_ARGS__
138c2ecf20Sopenharmony_ci#  define ASM_CONST(x)		x
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define PPC_INST_VCMPEQUD_RC		0x100000c7
178c2ecf20Sopenharmony_ci#define PPC_INST_VCMPEQUB_RC		0x10000006
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define __PPC_RC21     (0x1 << 10)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* macros to insert fields into opcodes */
228c2ecf20Sopenharmony_ci#define ___PPC_RA(a)	(((a) & 0x1f) << 16)
238c2ecf20Sopenharmony_ci#define ___PPC_RB(b)	(((b) & 0x1f) << 11)
248c2ecf20Sopenharmony_ci#define ___PPC_RS(s)	(((s) & 0x1f) << 21)
258c2ecf20Sopenharmony_ci#define ___PPC_RT(t)	___PPC_RS(t)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define VCMPEQUD_RC(vrt, vra, vrb)	stringify_in_c(.long PPC_INST_VCMPEQUD_RC | \
288c2ecf20Sopenharmony_ci			      ___PPC_RT(vrt) | ___PPC_RA(vra) | \
298c2ecf20Sopenharmony_ci			      ___PPC_RB(vrb) | __PPC_RC21)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define VCMPEQUB_RC(vrt, vra, vrb)	stringify_in_c(.long PPC_INST_VCMPEQUB_RC | \
328c2ecf20Sopenharmony_ci			      ___PPC_RT(vrt) | ___PPC_RA(vra) | \
338c2ecf20Sopenharmony_ci			      ___PPC_RB(vrb) | __PPC_RC21)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#endif /* _ASM_POWERPC_PPC_OPCODE_H */
36