162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2009 Freescale Semiconductor, Inc.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * provides masks and opcode images for use by code generation, emulation
662306a36Sopenharmony_ci * and for instructions that older assemblers might not know about
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#ifndef _ASM_POWERPC_PPC_OPCODE_H
962306a36Sopenharmony_ci#define _ASM_POWERPC_PPC_OPCODE_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#  define stringify_in_c(...)	__VA_ARGS__
1362306a36Sopenharmony_ci#  define ASM_CONST(x)		x
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define PPC_INST_VCMPEQUD_RC		0x100000c7
1762306a36Sopenharmony_ci#define PPC_INST_VCMPEQUB_RC		0x10000006
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define __PPC_RC21     (0x1 << 10)
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* macros to insert fields into opcodes */
2262306a36Sopenharmony_ci#define ___PPC_RA(a)	(((a) & 0x1f) << 16)
2362306a36Sopenharmony_ci#define ___PPC_RB(b)	(((b) & 0x1f) << 11)
2462306a36Sopenharmony_ci#define ___PPC_RS(s)	(((s) & 0x1f) << 21)
2562306a36Sopenharmony_ci#define ___PPC_RT(t)	___PPC_RS(t)
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define VCMPEQUD_RC(vrt, vra, vrb)	stringify_in_c(.long PPC_INST_VCMPEQUD_RC | \
2862306a36Sopenharmony_ci			      ___PPC_RT(vrt) | ___PPC_RA(vra) | \
2962306a36Sopenharmony_ci			      ___PPC_RB(vrb) | __PPC_RC21)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#define VCMPEQUB_RC(vrt, vra, vrb)	stringify_in_c(.long PPC_INST_VCMPEQUB_RC | \
3262306a36Sopenharmony_ci			      ___PPC_RT(vrt) | ___PPC_RA(vra) | \
3362306a36Sopenharmony_ci			      ___PPC_RB(vrb) | __PPC_RC21)
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#endif /* _ASM_POWERPC_PPC_OPCODE_H */
36