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#include <asm/asm-const.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#define __REG_R0 0 1462306a36Sopenharmony_ci#define __REG_R1 1 1562306a36Sopenharmony_ci#define __REG_R2 2 1662306a36Sopenharmony_ci#define __REG_R3 3 1762306a36Sopenharmony_ci#define __REG_R4 4 1862306a36Sopenharmony_ci#define __REG_R5 5 1962306a36Sopenharmony_ci#define __REG_R6 6 2062306a36Sopenharmony_ci#define __REG_R7 7 2162306a36Sopenharmony_ci#define __REG_R8 8 2262306a36Sopenharmony_ci#define __REG_R9 9 2362306a36Sopenharmony_ci#define __REG_R10 10 2462306a36Sopenharmony_ci#define __REG_R11 11 2562306a36Sopenharmony_ci#define __REG_R12 12 2662306a36Sopenharmony_ci#define __REG_R13 13 2762306a36Sopenharmony_ci#define __REG_R14 14 2862306a36Sopenharmony_ci#define __REG_R15 15 2962306a36Sopenharmony_ci#define __REG_R16 16 3062306a36Sopenharmony_ci#define __REG_R17 17 3162306a36Sopenharmony_ci#define __REG_R18 18 3262306a36Sopenharmony_ci#define __REG_R19 19 3362306a36Sopenharmony_ci#define __REG_R20 20 3462306a36Sopenharmony_ci#define __REG_R21 21 3562306a36Sopenharmony_ci#define __REG_R22 22 3662306a36Sopenharmony_ci#define __REG_R23 23 3762306a36Sopenharmony_ci#define __REG_R24 24 3862306a36Sopenharmony_ci#define __REG_R25 25 3962306a36Sopenharmony_ci#define __REG_R26 26 4062306a36Sopenharmony_ci#define __REG_R27 27 4162306a36Sopenharmony_ci#define __REG_R28 28 4262306a36Sopenharmony_ci#define __REG_R29 29 4362306a36Sopenharmony_ci#define __REG_R30 30 4462306a36Sopenharmony_ci#define __REG_R31 31 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci#define __REGA0_0 0 4762306a36Sopenharmony_ci#define __REGA0_R1 1 4862306a36Sopenharmony_ci#define __REGA0_R2 2 4962306a36Sopenharmony_ci#define __REGA0_R3 3 5062306a36Sopenharmony_ci#define __REGA0_R4 4 5162306a36Sopenharmony_ci#define __REGA0_R5 5 5262306a36Sopenharmony_ci#define __REGA0_R6 6 5362306a36Sopenharmony_ci#define __REGA0_R7 7 5462306a36Sopenharmony_ci#define __REGA0_R8 8 5562306a36Sopenharmony_ci#define __REGA0_R9 9 5662306a36Sopenharmony_ci#define __REGA0_R10 10 5762306a36Sopenharmony_ci#define __REGA0_R11 11 5862306a36Sopenharmony_ci#define __REGA0_R12 12 5962306a36Sopenharmony_ci#define __REGA0_R13 13 6062306a36Sopenharmony_ci#define __REGA0_R14 14 6162306a36Sopenharmony_ci#define __REGA0_R15 15 6262306a36Sopenharmony_ci#define __REGA0_R16 16 6362306a36Sopenharmony_ci#define __REGA0_R17 17 6462306a36Sopenharmony_ci#define __REGA0_R18 18 6562306a36Sopenharmony_ci#define __REGA0_R19 19 6662306a36Sopenharmony_ci#define __REGA0_R20 20 6762306a36Sopenharmony_ci#define __REGA0_R21 21 6862306a36Sopenharmony_ci#define __REGA0_R22 22 6962306a36Sopenharmony_ci#define __REGA0_R23 23 7062306a36Sopenharmony_ci#define __REGA0_R24 24 7162306a36Sopenharmony_ci#define __REGA0_R25 25 7262306a36Sopenharmony_ci#define __REGA0_R26 26 7362306a36Sopenharmony_ci#define __REGA0_R27 27 7462306a36Sopenharmony_ci#define __REGA0_R28 28 7562306a36Sopenharmony_ci#define __REGA0_R29 29 7662306a36Sopenharmony_ci#define __REGA0_R30 30 7762306a36Sopenharmony_ci#define __REGA0_R31 31 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci/* For use with PPC_RAW_() macros */ 8062306a36Sopenharmony_ci#define _R0 0 8162306a36Sopenharmony_ci#define _R1 1 8262306a36Sopenharmony_ci#define _R2 2 8362306a36Sopenharmony_ci#define _R3 3 8462306a36Sopenharmony_ci#define _R4 4 8562306a36Sopenharmony_ci#define _R5 5 8662306a36Sopenharmony_ci#define _R6 6 8762306a36Sopenharmony_ci#define _R7 7 8862306a36Sopenharmony_ci#define _R8 8 8962306a36Sopenharmony_ci#define _R9 9 9062306a36Sopenharmony_ci#define _R10 10 9162306a36Sopenharmony_ci#define _R11 11 9262306a36Sopenharmony_ci#define _R12 12 9362306a36Sopenharmony_ci#define _R13 13 9462306a36Sopenharmony_ci#define _R14 14 9562306a36Sopenharmony_ci#define _R15 15 9662306a36Sopenharmony_ci#define _R16 16 9762306a36Sopenharmony_ci#define _R17 17 9862306a36Sopenharmony_ci#define _R18 18 9962306a36Sopenharmony_ci#define _R19 19 10062306a36Sopenharmony_ci#define _R20 20 10162306a36Sopenharmony_ci#define _R21 21 10262306a36Sopenharmony_ci#define _R22 22 10362306a36Sopenharmony_ci#define _R23 23 10462306a36Sopenharmony_ci#define _R24 24 10562306a36Sopenharmony_ci#define _R25 25 10662306a36Sopenharmony_ci#define _R26 26 10762306a36Sopenharmony_ci#define _R27 27 10862306a36Sopenharmony_ci#define _R28 28 10962306a36Sopenharmony_ci#define _R29 29 11062306a36Sopenharmony_ci#define _R30 30 11162306a36Sopenharmony_ci#define _R31 31 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci#define IMM_L(i) ((uintptr_t)(i) & 0xffff) 11462306a36Sopenharmony_ci#define IMM_DS(i) ((uintptr_t)(i) & 0xfffc) 11562306a36Sopenharmony_ci#define IMM_DQ(i) ((uintptr_t)(i) & 0xfff0) 11662306a36Sopenharmony_ci#define IMM_D0(i) (((uintptr_t)(i) >> 16) & 0x3ffff) 11762306a36Sopenharmony_ci#define IMM_D1(i) IMM_L(i) 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci/* 12062306a36Sopenharmony_ci * 16-bit immediate helper macros: HA() is for use with sign-extending instrs 12162306a36Sopenharmony_ci * (e.g. LD, ADDI). If the bottom 16 bits is "-ve", add another bit into the 12262306a36Sopenharmony_ci * top half to negate the effect (i.e. 0xffff + 1 = 0x(1)0000). 12362306a36Sopenharmony_ci * 12462306a36Sopenharmony_ci * XXX: should these mask out possible sign bits? 12562306a36Sopenharmony_ci */ 12662306a36Sopenharmony_ci#define IMM_H(i) ((uintptr_t)(i)>>16) 12762306a36Sopenharmony_ci#define IMM_HA(i) (((uintptr_t)(i)>>16) + \ 12862306a36Sopenharmony_ci (((uintptr_t)(i) & 0x8000) >> 15)) 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci/* 13162306a36Sopenharmony_ci * 18-bit immediate helper for prefix 18-bit upper immediate si0 field. 13262306a36Sopenharmony_ci */ 13362306a36Sopenharmony_ci#define IMM_H18(i) (((uintptr_t)(i)>>16) & 0x3ffff) 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci/* opcode and xopcode for instructions */ 13762306a36Sopenharmony_ci#define OP_PREFIX 1 13862306a36Sopenharmony_ci#define OP_TRAP_64 2 13962306a36Sopenharmony_ci#define OP_TRAP 3 14062306a36Sopenharmony_ci#define OP_SC 17 14162306a36Sopenharmony_ci#define OP_19 19 14262306a36Sopenharmony_ci#define OP_31 31 14362306a36Sopenharmony_ci#define OP_LWZ 32 14462306a36Sopenharmony_ci#define OP_LWZU 33 14562306a36Sopenharmony_ci#define OP_LBZ 34 14662306a36Sopenharmony_ci#define OP_LBZU 35 14762306a36Sopenharmony_ci#define OP_STW 36 14862306a36Sopenharmony_ci#define OP_STWU 37 14962306a36Sopenharmony_ci#define OP_STB 38 15062306a36Sopenharmony_ci#define OP_STBU 39 15162306a36Sopenharmony_ci#define OP_LHZ 40 15262306a36Sopenharmony_ci#define OP_LHZU 41 15362306a36Sopenharmony_ci#define OP_LHA 42 15462306a36Sopenharmony_ci#define OP_LHAU 43 15562306a36Sopenharmony_ci#define OP_STH 44 15662306a36Sopenharmony_ci#define OP_STHU 45 15762306a36Sopenharmony_ci#define OP_LMW 46 15862306a36Sopenharmony_ci#define OP_STMW 47 15962306a36Sopenharmony_ci#define OP_LFS 48 16062306a36Sopenharmony_ci#define OP_LFSU 49 16162306a36Sopenharmony_ci#define OP_LFD 50 16262306a36Sopenharmony_ci#define OP_LFDU 51 16362306a36Sopenharmony_ci#define OP_STFS 52 16462306a36Sopenharmony_ci#define OP_STFSU 53 16562306a36Sopenharmony_ci#define OP_STFD 54 16662306a36Sopenharmony_ci#define OP_STFDU 55 16762306a36Sopenharmony_ci#define OP_LQ 56 16862306a36Sopenharmony_ci#define OP_LD 58 16962306a36Sopenharmony_ci#define OP_STD 62 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci#define OP_19_XOP_RFID 18 17262306a36Sopenharmony_ci#define OP_19_XOP_RFMCI 38 17362306a36Sopenharmony_ci#define OP_19_XOP_RFDI 39 17462306a36Sopenharmony_ci#define OP_19_XOP_RFI 50 17562306a36Sopenharmony_ci#define OP_19_XOP_RFCI 51 17662306a36Sopenharmony_ci#define OP_19_XOP_RFSCV 82 17762306a36Sopenharmony_ci#define OP_19_XOP_HRFID 274 17862306a36Sopenharmony_ci#define OP_19_XOP_URFID 306 17962306a36Sopenharmony_ci#define OP_19_XOP_STOP 370 18062306a36Sopenharmony_ci#define OP_19_XOP_DOZE 402 18162306a36Sopenharmony_ci#define OP_19_XOP_NAP 434 18262306a36Sopenharmony_ci#define OP_19_XOP_SLEEP 466 18362306a36Sopenharmony_ci#define OP_19_XOP_RVWINKLE 498 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_ci#define OP_31_XOP_TRAP 4 18662306a36Sopenharmony_ci#define OP_31_XOP_LDX 21 18762306a36Sopenharmony_ci#define OP_31_XOP_LWZX 23 18862306a36Sopenharmony_ci#define OP_31_XOP_LDUX 53 18962306a36Sopenharmony_ci#define OP_31_XOP_DCBST 54 19062306a36Sopenharmony_ci#define OP_31_XOP_LWZUX 55 19162306a36Sopenharmony_ci#define OP_31_XOP_TRAP_64 68 19262306a36Sopenharmony_ci#define OP_31_XOP_DCBF 86 19362306a36Sopenharmony_ci#define OP_31_XOP_LBZX 87 19462306a36Sopenharmony_ci#define OP_31_XOP_STDX 149 19562306a36Sopenharmony_ci#define OP_31_XOP_STWX 151 19662306a36Sopenharmony_ci#define OP_31_XOP_STDUX 181 19762306a36Sopenharmony_ci#define OP_31_XOP_STWUX 183 19862306a36Sopenharmony_ci#define OP_31_XOP_STBX 215 19962306a36Sopenharmony_ci#define OP_31_XOP_LBZUX 119 20062306a36Sopenharmony_ci#define OP_31_XOP_STBUX 247 20162306a36Sopenharmony_ci#define OP_31_XOP_LHZX 279 20262306a36Sopenharmony_ci#define OP_31_XOP_LHZUX 311 20362306a36Sopenharmony_ci#define OP_31_XOP_MSGSNDP 142 20462306a36Sopenharmony_ci#define OP_31_XOP_MSGCLRP 174 20562306a36Sopenharmony_ci#define OP_31_XOP_MTMSR 146 20662306a36Sopenharmony_ci#define OP_31_XOP_MTMSRD 178 20762306a36Sopenharmony_ci#define OP_31_XOP_TLBIE 306 20862306a36Sopenharmony_ci#define OP_31_XOP_MFSPR 339 20962306a36Sopenharmony_ci#define OP_31_XOP_LWAX 341 21062306a36Sopenharmony_ci#define OP_31_XOP_LHAX 343 21162306a36Sopenharmony_ci#define OP_31_XOP_LWAUX 373 21262306a36Sopenharmony_ci#define OP_31_XOP_LHAUX 375 21362306a36Sopenharmony_ci#define OP_31_XOP_STHX 407 21462306a36Sopenharmony_ci#define OP_31_XOP_STHUX 439 21562306a36Sopenharmony_ci#define OP_31_XOP_MTSPR 467 21662306a36Sopenharmony_ci#define OP_31_XOP_DCBI 470 21762306a36Sopenharmony_ci#define OP_31_XOP_LDBRX 532 21862306a36Sopenharmony_ci#define OP_31_XOP_LWBRX 534 21962306a36Sopenharmony_ci#define OP_31_XOP_TLBSYNC 566 22062306a36Sopenharmony_ci#define OP_31_XOP_STDBRX 660 22162306a36Sopenharmony_ci#define OP_31_XOP_STWBRX 662 22262306a36Sopenharmony_ci#define OP_31_XOP_STFSX 663 22362306a36Sopenharmony_ci#define OP_31_XOP_STFSUX 695 22462306a36Sopenharmony_ci#define OP_31_XOP_STFDX 727 22562306a36Sopenharmony_ci#define OP_31_XOP_HASHCHK 754 22662306a36Sopenharmony_ci#define OP_31_XOP_STFDUX 759 22762306a36Sopenharmony_ci#define OP_31_XOP_LHBRX 790 22862306a36Sopenharmony_ci#define OP_31_XOP_LFIWAX 855 22962306a36Sopenharmony_ci#define OP_31_XOP_LFIWZX 887 23062306a36Sopenharmony_ci#define OP_31_XOP_STHBRX 918 23162306a36Sopenharmony_ci#define OP_31_XOP_STFIWX 983 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_ci/* VSX Scalar Load Instructions */ 23462306a36Sopenharmony_ci#define OP_31_XOP_LXSDX 588 23562306a36Sopenharmony_ci#define OP_31_XOP_LXSSPX 524 23662306a36Sopenharmony_ci#define OP_31_XOP_LXSIWAX 76 23762306a36Sopenharmony_ci#define OP_31_XOP_LXSIWZX 12 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci/* VSX Scalar Store Instructions */ 24062306a36Sopenharmony_ci#define OP_31_XOP_STXSDX 716 24162306a36Sopenharmony_ci#define OP_31_XOP_STXSSPX 652 24262306a36Sopenharmony_ci#define OP_31_XOP_STXSIWX 140 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci/* VSX Vector Load Instructions */ 24562306a36Sopenharmony_ci#define OP_31_XOP_LXVD2X 844 24662306a36Sopenharmony_ci#define OP_31_XOP_LXVW4X 780 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_ci/* VSX Vector Load and Splat Instruction */ 24962306a36Sopenharmony_ci#define OP_31_XOP_LXVDSX 332 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci/* VSX Vector Store Instructions */ 25262306a36Sopenharmony_ci#define OP_31_XOP_STXVD2X 972 25362306a36Sopenharmony_ci#define OP_31_XOP_STXVW4X 908 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_ci#define OP_31_XOP_LFSX 535 25662306a36Sopenharmony_ci#define OP_31_XOP_LFSUX 567 25762306a36Sopenharmony_ci#define OP_31_XOP_LFDX 599 25862306a36Sopenharmony_ci#define OP_31_XOP_LFDUX 631 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_ci/* VMX Vector Load Instructions */ 26162306a36Sopenharmony_ci#define OP_31_XOP_LVX 103 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_ci/* VMX Vector Store Instructions */ 26462306a36Sopenharmony_ci#define OP_31_XOP_STVX 231 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_ci/* sorted alphabetically */ 26762306a36Sopenharmony_ci#define PPC_INST_BCCTR_FLUSH 0x4c400420 26862306a36Sopenharmony_ci#define PPC_INST_COPY 0x7c20060c 26962306a36Sopenharmony_ci#define PPC_INST_DCBA 0x7c0005ec 27062306a36Sopenharmony_ci#define PPC_INST_DCBA_MASK 0xfc0007fe 27162306a36Sopenharmony_ci#define PPC_INST_DSSALL 0x7e00066c 27262306a36Sopenharmony_ci#define PPC_INST_ISEL 0x7c00001e 27362306a36Sopenharmony_ci#define PPC_INST_ISEL_MASK 0xfc00003e 27462306a36Sopenharmony_ci#define PPC_INST_LSWI 0x7c0004aa 27562306a36Sopenharmony_ci#define PPC_INST_LSWX 0x7c00042a 27662306a36Sopenharmony_ci#define PPC_INST_LWSYNC 0x7c2004ac 27762306a36Sopenharmony_ci#define PPC_INST_SYNC 0x7c0004ac 27862306a36Sopenharmony_ci#define PPC_INST_SYNC_MASK 0xfc0007fe 27962306a36Sopenharmony_ci#define PPC_INST_MCRXR 0x7c000400 28062306a36Sopenharmony_ci#define PPC_INST_MCRXR_MASK 0xfc0007fe 28162306a36Sopenharmony_ci#define PPC_INST_MFSPR_PVR 0x7c1f42a6 28262306a36Sopenharmony_ci#define PPC_INST_MFSPR_PVR_MASK 0xfc1ffffe 28362306a36Sopenharmony_ci#define PPC_INST_MTMSRD 0x7c000164 28462306a36Sopenharmony_ci#define PPC_INST_PASTE 0x7c20070d 28562306a36Sopenharmony_ci#define PPC_INST_PASTE_MASK 0xfc2007ff 28662306a36Sopenharmony_ci#define PPC_INST_POPCNTB 0x7c0000f4 28762306a36Sopenharmony_ci#define PPC_INST_POPCNTB_MASK 0xfc0007fe 28862306a36Sopenharmony_ci#define PPC_INST_RFEBB 0x4c000124 28962306a36Sopenharmony_ci#define PPC_INST_RFID 0x4c000024 29062306a36Sopenharmony_ci#define PPC_INST_MFSPR_DSCR 0x7c1102a6 29162306a36Sopenharmony_ci#define PPC_INST_MFSPR_DSCR_MASK 0xfc1ffffe 29262306a36Sopenharmony_ci#define PPC_INST_MTSPR_DSCR 0x7c1103a6 29362306a36Sopenharmony_ci#define PPC_INST_MTSPR_DSCR_MASK 0xfc1ffffe 29462306a36Sopenharmony_ci#define PPC_INST_MFSPR_DSCR_USER 0x7c0302a6 29562306a36Sopenharmony_ci#define PPC_INST_MFSPR_DSCR_USER_MASK 0xfc1ffffe 29662306a36Sopenharmony_ci#define PPC_INST_MTSPR_DSCR_USER 0x7c0303a6 29762306a36Sopenharmony_ci#define PPC_INST_MTSPR_DSCR_USER_MASK 0xfc1ffffe 29862306a36Sopenharmony_ci#define PPC_INST_STRING 0x7c00042a 29962306a36Sopenharmony_ci#define PPC_INST_STRING_MASK 0xfc0007fe 30062306a36Sopenharmony_ci#define PPC_INST_STRING_GEN_MASK 0xfc00067e 30162306a36Sopenharmony_ci#define PPC_INST_STSWI 0x7c0005aa 30262306a36Sopenharmony_ci#define PPC_INST_STSWX 0x7c00052a 30362306a36Sopenharmony_ci#define PPC_INST_TRECHKPT 0x7c0007dd 30462306a36Sopenharmony_ci#define PPC_INST_TRECLAIM 0x7c00075d 30562306a36Sopenharmony_ci#define PPC_INST_TSR 0x7c0005dd 30662306a36Sopenharmony_ci#define PPC_INST_BRANCH_COND 0x40800000 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_ci/* Prefixes */ 30962306a36Sopenharmony_ci#define PPC_INST_LFS 0xc0000000 31062306a36Sopenharmony_ci#define PPC_INST_STFS 0xd0000000 31162306a36Sopenharmony_ci#define PPC_INST_LFD 0xc8000000 31262306a36Sopenharmony_ci#define PPC_INST_STFD 0xd8000000 31362306a36Sopenharmony_ci#define PPC_PREFIX_MLS 0x06000000 31462306a36Sopenharmony_ci#define PPC_PREFIX_8LS 0x04000000 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci/* Prefixed instructions */ 31762306a36Sopenharmony_ci#define PPC_INST_PADDI 0x38000000 31862306a36Sopenharmony_ci#define PPC_INST_PLD 0xe4000000 31962306a36Sopenharmony_ci#define PPC_INST_PSTD 0xf4000000 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ci/* macros to insert fields into opcodes */ 32262306a36Sopenharmony_ci#define ___PPC_RA(a) (((a) & 0x1f) << 16) 32362306a36Sopenharmony_ci#define ___PPC_RB(b) (((b) & 0x1f) << 11) 32462306a36Sopenharmony_ci#define ___PPC_RC(c) (((c) & 0x1f) << 6) 32562306a36Sopenharmony_ci#define ___PPC_RS(s) (((s) & 0x1f) << 21) 32662306a36Sopenharmony_ci#define ___PPC_RT(t) ___PPC_RS(t) 32762306a36Sopenharmony_ci#define ___PPC_R(r) (((r) & 0x1) << 16) 32862306a36Sopenharmony_ci#define ___PPC_PRS(prs) (((prs) & 0x1) << 17) 32962306a36Sopenharmony_ci#define ___PPC_RIC(ric) (((ric) & 0x3) << 18) 33062306a36Sopenharmony_ci#define __PPC_RA(a) ___PPC_RA(__REG_##a) 33162306a36Sopenharmony_ci#define __PPC_RA0(a) ___PPC_RA(__REGA0_##a) 33262306a36Sopenharmony_ci#define __PPC_RB(b) ___PPC_RB(__REG_##b) 33362306a36Sopenharmony_ci#define __PPC_RS(s) ___PPC_RS(__REG_##s) 33462306a36Sopenharmony_ci#define __PPC_RT(t) ___PPC_RT(__REG_##t) 33562306a36Sopenharmony_ci#define __PPC_XA(a) ((((a) & 0x1f) << 16) | (((a) & 0x20) >> 3)) 33662306a36Sopenharmony_ci#define __PPC_XB(b) ((((b) & 0x1f) << 11) | (((b) & 0x20) >> 4)) 33762306a36Sopenharmony_ci#define __PPC_XS(s) ((((s) & 0x1f) << 21) | (((s) & 0x20) >> 5)) 33862306a36Sopenharmony_ci#define __PPC_XT(s) __PPC_XS(s) 33962306a36Sopenharmony_ci#define __PPC_XSP(s) ((((s) & 0x1e) | (((s) >> 5) & 0x1)) << 21) 34062306a36Sopenharmony_ci#define __PPC_XTP(s) __PPC_XSP(s) 34162306a36Sopenharmony_ci#define __PPC_T_TLB(t) (((t) & 0x3) << 21) 34262306a36Sopenharmony_ci#define __PPC_PL(p) (((p) & 0x3) << 16) 34362306a36Sopenharmony_ci#define __PPC_WC(w) (((w) & 0x3) << 21) 34462306a36Sopenharmony_ci#define __PPC_WS(w) (((w) & 0x1f) << 11) 34562306a36Sopenharmony_ci#define __PPC_SH(s) __PPC_WS(s) 34662306a36Sopenharmony_ci#define __PPC_SH64(s) (__PPC_SH(s) | (((s) & 0x20) >> 4)) 34762306a36Sopenharmony_ci#define __PPC_MB(s) ___PPC_RC(s) 34862306a36Sopenharmony_ci#define __PPC_ME(s) (((s) & 0x1f) << 1) 34962306a36Sopenharmony_ci#define __PPC_MB64(s) (__PPC_MB(s) | ((s) & 0x20)) 35062306a36Sopenharmony_ci#define __PPC_ME64(s) __PPC_MB64(s) 35162306a36Sopenharmony_ci#define __PPC_BI(s) (((s) & 0x1f) << 16) 35262306a36Sopenharmony_ci#define __PPC_CT(t) (((t) & 0x0f) << 21) 35362306a36Sopenharmony_ci#define __PPC_SPR(r) ((((r) & 0x1f) << 16) | ((((r) >> 5) & 0x1f) << 11)) 35462306a36Sopenharmony_ci#define __PPC_RC21 (0x1 << 10) 35562306a36Sopenharmony_ci#define __PPC_PRFX_R(r) (((r) & 0x1) << 20) 35662306a36Sopenharmony_ci#define __PPC_EH(eh) (((eh) & 0x1) << 0) 35762306a36Sopenharmony_ci 35862306a36Sopenharmony_ci/* 35962306a36Sopenharmony_ci * Both low and high 16 bits are added as SIGNED additions, so if low 16 bits 36062306a36Sopenharmony_ci * has high bit set, high 16 bits must be adjusted. These macros do that (stolen 36162306a36Sopenharmony_ci * from binutils). 36262306a36Sopenharmony_ci */ 36362306a36Sopenharmony_ci#define PPC_LO(v) ((v) & 0xffff) 36462306a36Sopenharmony_ci#define PPC_HI(v) (((v) >> 16) & 0xffff) 36562306a36Sopenharmony_ci#define PPC_HA(v) PPC_HI((v) + 0x8000) 36662306a36Sopenharmony_ci#define PPC_HIGHER(v) (((v) >> 32) & 0xffff) 36762306a36Sopenharmony_ci#define PPC_HIGHEST(v) (((v) >> 48) & 0xffff) 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci/* LI Field */ 37062306a36Sopenharmony_ci#define PPC_LI_MASK 0x03fffffc 37162306a36Sopenharmony_ci#define PPC_LI(v) ((v) & PPC_LI_MASK) 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci/* Base instruction encoding */ 37462306a36Sopenharmony_ci#define PPC_RAW_CP_ABORT (0x7c00068c) 37562306a36Sopenharmony_ci#define PPC_RAW_COPY(a, b) (PPC_INST_COPY | ___PPC_RA(a) | ___PPC_RB(b)) 37662306a36Sopenharmony_ci#define PPC_RAW_DARN(t, l) (0x7c0005e6 | ___PPC_RT(t) | (((l) & 0x3) << 16)) 37762306a36Sopenharmony_ci#define PPC_RAW_DCBAL(a, b) (0x7c2005ec | __PPC_RA(a) | __PPC_RB(b)) 37862306a36Sopenharmony_ci#define PPC_RAW_DCBZL(a, b) (0x7c2007ec | __PPC_RA(a) | __PPC_RB(b)) 37962306a36Sopenharmony_ci#define PPC_RAW_LQARX(t, a, b, eh) (0x7c000228 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | __PPC_EH(eh)) 38062306a36Sopenharmony_ci#define PPC_RAW_LDARX(t, a, b, eh) (0x7c0000a8 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | __PPC_EH(eh)) 38162306a36Sopenharmony_ci#define PPC_RAW_LWARX(t, a, b, eh) (0x7c000028 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | __PPC_EH(eh)) 38262306a36Sopenharmony_ci#define PPC_RAW_PHWSYNC (0x7c8004ac) 38362306a36Sopenharmony_ci#define PPC_RAW_PLWSYNC (0x7ca004ac) 38462306a36Sopenharmony_ci#define PPC_RAW_STQCX(t, a, b) (0x7c00016d | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b)) 38562306a36Sopenharmony_ci#define PPC_RAW_MADDHD(t, a, b, c) (0x10000030 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | ___PPC_RC(c)) 38662306a36Sopenharmony_ci#define PPC_RAW_MADDHDU(t, a, b, c) (0x10000031 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | ___PPC_RC(c)) 38762306a36Sopenharmony_ci#define PPC_RAW_MADDLD(t, a, b, c) (0x10000033 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | ___PPC_RC(c)) 38862306a36Sopenharmony_ci#define PPC_RAW_MSGSND(b) (0x7c00019c | ___PPC_RB(b)) 38962306a36Sopenharmony_ci#define PPC_RAW_MSGSYNC (0x7c0006ec) 39062306a36Sopenharmony_ci#define PPC_RAW_MSGCLR(b) (0x7c0001dc | ___PPC_RB(b)) 39162306a36Sopenharmony_ci#define PPC_RAW_MSGSNDP(b) (0x7c00011c | ___PPC_RB(b)) 39262306a36Sopenharmony_ci#define PPC_RAW_MSGCLRP(b) (0x7c00015c | ___PPC_RB(b)) 39362306a36Sopenharmony_ci#define PPC_RAW_PASTE(a, b) (0x7c20070d | ___PPC_RA(a) | ___PPC_RB(b)) 39462306a36Sopenharmony_ci#define PPC_RAW_POPCNTB(a, s) (PPC_INST_POPCNTB | __PPC_RA(a) | __PPC_RS(s)) 39562306a36Sopenharmony_ci#define PPC_RAW_POPCNTD(a, s) (0x7c0003f4 | __PPC_RA(a) | __PPC_RS(s)) 39662306a36Sopenharmony_ci#define PPC_RAW_POPCNTW(a, s) (0x7c0002f4 | __PPC_RA(a) | __PPC_RS(s)) 39762306a36Sopenharmony_ci#define PPC_RAW_RFCI (0x4c000066) 39862306a36Sopenharmony_ci#define PPC_RAW_RFDI (0x4c00004e) 39962306a36Sopenharmony_ci#define PPC_RAW_RFMCI (0x4c00004c) 40062306a36Sopenharmony_ci#define PPC_RAW_TLBILX_LPID (0x7c000024) 40162306a36Sopenharmony_ci#define PPC_RAW_TLBILX(t, a, b) (0x7c000024 | __PPC_T_TLB(t) | __PPC_RA0(a) | __PPC_RB(b)) 40262306a36Sopenharmony_ci#define PPC_RAW_WAIT_v203 (0x7c00007c) 40362306a36Sopenharmony_ci#define PPC_RAW_WAIT(w, p) (0x7c00003c | __PPC_WC(w) | __PPC_PL(p)) 40462306a36Sopenharmony_ci#define PPC_RAW_TLBIE(lp, a) (0x7c000264 | ___PPC_RB(a) | ___PPC_RS(lp)) 40562306a36Sopenharmony_ci#define PPC_RAW_TLBIE_5(rb, rs, ric, prs, r) \ 40662306a36Sopenharmony_ci (0x7c000264 | ___PPC_RB(rb) | ___PPC_RS(rs) | ___PPC_RIC(ric) | ___PPC_PRS(prs) | ___PPC_R(r)) 40762306a36Sopenharmony_ci#define PPC_RAW_TLBIEL(rb, rs, ric, prs, r) \ 40862306a36Sopenharmony_ci (0x7c000224 | ___PPC_RB(rb) | ___PPC_RS(rs) | ___PPC_RIC(ric) | ___PPC_PRS(prs) | ___PPC_R(r)) 40962306a36Sopenharmony_ci#define PPC_RAW_TLBIEL_v205(rb, l) (0x7c000224 | ___PPC_RB(rb) | (l << 21)) 41062306a36Sopenharmony_ci#define PPC_RAW_TLBSRX_DOT(a, b) (0x7c0006a5 | __PPC_RA0(a) | __PPC_RB(b)) 41162306a36Sopenharmony_ci#define PPC_RAW_TLBIVAX(a, b) (0x7c000624 | __PPC_RA0(a) | __PPC_RB(b)) 41262306a36Sopenharmony_ci#define PPC_RAW_ERATWE(s, a, w) (0x7c0001a6 | __PPC_RS(s) | __PPC_RA(a) | __PPC_WS(w)) 41362306a36Sopenharmony_ci#define PPC_RAW_ERATRE(s, a, w) (0x7c000166 | __PPC_RS(s) | __PPC_RA(a) | __PPC_WS(w)) 41462306a36Sopenharmony_ci#define PPC_RAW_ERATILX(t, a, b) (0x7c000066 | __PPC_T_TLB(t) | __PPC_RA0(a) | __PPC_RB(b)) 41562306a36Sopenharmony_ci#define PPC_RAW_ERATIVAX(s, a, b) (0x7c000666 | __PPC_RS(s) | __PPC_RA0(a) | __PPC_RB(b)) 41662306a36Sopenharmony_ci#define PPC_RAW_ERATSX(t, a, w) (0x7c000126 | __PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b)) 41762306a36Sopenharmony_ci#define PPC_RAW_ERATSX_DOT(t, a, w) (0x7c000127 | __PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b)) 41862306a36Sopenharmony_ci#define PPC_RAW_SLBFEE_DOT(t, b) (0x7c0007a7 | __PPC_RT(t) | __PPC_RB(b)) 41962306a36Sopenharmony_ci#define __PPC_RAW_SLBFEE_DOT(t, b) (0x7c0007a7 | ___PPC_RT(t) | ___PPC_RB(b)) 42062306a36Sopenharmony_ci#define PPC_RAW_ICBT(c, a, b) (0x7c00002c | __PPC_CT(c) | __PPC_RA0(a) | __PPC_RB(b)) 42162306a36Sopenharmony_ci#define PPC_RAW_LBZCIX(t, a, b) (0x7c0006aa | __PPC_RT(t) | __PPC_RA(a) | __PPC_RB(b)) 42262306a36Sopenharmony_ci#define PPC_RAW_STBCIX(s, a, b) (0x7c0007aa | __PPC_RS(s) | __PPC_RA(a) | __PPC_RB(b)) 42362306a36Sopenharmony_ci#define PPC_RAW_DCBFPS(a, b) (0x7c0000ac | ___PPC_RA(a) | ___PPC_RB(b) | (4 << 21)) 42462306a36Sopenharmony_ci#define PPC_RAW_DCBSTPS(a, b) (0x7c0000ac | ___PPC_RA(a) | ___PPC_RB(b) | (6 << 21)) 42562306a36Sopenharmony_ci#define PPC_RAW_SC() (0x44000002) 42662306a36Sopenharmony_ci#define PPC_RAW_SYNC() (0x7c0004ac) 42762306a36Sopenharmony_ci#define PPC_RAW_ISYNC() (0x4c00012c) 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_ci/* 43062306a36Sopenharmony_ci * Define what the VSX XX1 form instructions will look like, then add 43162306a36Sopenharmony_ci * the 128 bit load store instructions based on that. 43262306a36Sopenharmony_ci */ 43362306a36Sopenharmony_ci#define VSX_XX1(s, a, b) (__PPC_XS(s) | __PPC_RA(a) | __PPC_RB(b)) 43462306a36Sopenharmony_ci#define VSX_XX3(t, a, b) (__PPC_XT(t) | __PPC_XA(a) | __PPC_XB(b)) 43562306a36Sopenharmony_ci#define PPC_RAW_STXVD2X(s, a, b) (0x7c000798 | VSX_XX1((s), a, b)) 43662306a36Sopenharmony_ci#define PPC_RAW_LXVD2X(s, a, b) (0x7c000698 | VSX_XX1((s), a, b)) 43762306a36Sopenharmony_ci#define PPC_RAW_MFVRD(a, t) (0x7c000066 | VSX_XX1((t) + 32, a, R0)) 43862306a36Sopenharmony_ci#define PPC_RAW_MTVRD(t, a) (0x7c000166 | VSX_XX1((t) + 32, a, R0)) 43962306a36Sopenharmony_ci#define PPC_RAW_VPMSUMW(t, a, b) (0x10000488 | VSX_XX3((t), a, b)) 44062306a36Sopenharmony_ci#define PPC_RAW_VPMSUMD(t, a, b) (0x100004c8 | VSX_XX3((t), a, b)) 44162306a36Sopenharmony_ci#define PPC_RAW_XXLOR(t, a, b) (0xf0000490 | VSX_XX3((t), a, b)) 44262306a36Sopenharmony_ci#define PPC_RAW_XXSWAPD(t, a) (0xf0000250 | VSX_XX3((t), a, a)) 44362306a36Sopenharmony_ci#define PPC_RAW_XVCPSGNDP(t, a, b) ((0xf0000780 | VSX_XX3((t), (a), (b)))) 44462306a36Sopenharmony_ci#define PPC_RAW_VPERMXOR(vrt, vra, vrb, vrc) \ 44562306a36Sopenharmony_ci ((0x1000002d | ___PPC_RT(vrt) | ___PPC_RA(vra) | ___PPC_RB(vrb) | (((vrc) & 0x1f) << 6))) 44662306a36Sopenharmony_ci#define PPC_RAW_LXVP(xtp, a, i) (0x18000000 | __PPC_XTP(xtp) | ___PPC_RA(a) | IMM_DQ(i)) 44762306a36Sopenharmony_ci#define PPC_RAW_STXVP(xsp, a, i) (0x18000001 | __PPC_XSP(xsp) | ___PPC_RA(a) | IMM_DQ(i)) 44862306a36Sopenharmony_ci#define PPC_RAW_LXVPX(xtp, a, b) (0x7c00029a | __PPC_XTP(xtp) | ___PPC_RA(a) | ___PPC_RB(b)) 44962306a36Sopenharmony_ci#define PPC_RAW_STXVPX(xsp, a, b) (0x7c00039a | __PPC_XSP(xsp) | ___PPC_RA(a) | ___PPC_RB(b)) 45062306a36Sopenharmony_ci#define PPC_RAW_PLXVP_P(xtp, i, a, pr) (PPC_PREFIX_8LS | __PPC_PRFX_R(pr) | IMM_D0(i)) 45162306a36Sopenharmony_ci#define PPC_RAW_PLXVP_S(xtp, i, a, pr) (0xe8000000 | __PPC_XTP(xtp) | ___PPC_RA(a) | IMM_D1(i)) 45262306a36Sopenharmony_ci#define PPC_RAW_PSTXVP_P(xsp, i, a, pr) (PPC_PREFIX_8LS | __PPC_PRFX_R(pr) | IMM_D0(i)) 45362306a36Sopenharmony_ci#define PPC_RAW_PSTXVP_S(xsp, i, a, pr) (0xf8000000 | __PPC_XSP(xsp) | ___PPC_RA(a) | IMM_D1(i)) 45462306a36Sopenharmony_ci#define PPC_RAW_NAP (0x4c000364) 45562306a36Sopenharmony_ci#define PPC_RAW_SLEEP (0x4c0003a4) 45662306a36Sopenharmony_ci#define PPC_RAW_WINKLE (0x4c0003e4) 45762306a36Sopenharmony_ci#define PPC_RAW_STOP (0x4c0002e4) 45862306a36Sopenharmony_ci#define PPC_RAW_CLRBHRB (0x7c00035c) 45962306a36Sopenharmony_ci#define PPC_RAW_MFBHRBE(r, n) (0x7c00025c | __PPC_RT(r) | (((n) & 0x3ff) << 11)) 46062306a36Sopenharmony_ci#define PPC_RAW_TRECHKPT (PPC_INST_TRECHKPT) 46162306a36Sopenharmony_ci#define PPC_RAW_TRECLAIM(r) (PPC_INST_TRECLAIM | __PPC_RA(r)) 46262306a36Sopenharmony_ci#define PPC_RAW_TABORT(r) (0x7c00071d | __PPC_RA(r)) 46362306a36Sopenharmony_ci#define TMRN(x) ((((x) & 0x1f) << 16) | (((x) & 0x3e0) << 6)) 46462306a36Sopenharmony_ci#define PPC_RAW_MTTMR(tmr, r) (0x7c0003dc | TMRN(tmr) | ___PPC_RS(r)) 46562306a36Sopenharmony_ci#define PPC_RAW_MFTMR(tmr, r) (0x7c0002dc | TMRN(tmr) | ___PPC_RT(r)) 46662306a36Sopenharmony_ci#define PPC_RAW_ICSWX(s, a, b) (0x7c00032d | ___PPC_RS(s) | ___PPC_RA(a) | ___PPC_RB(b)) 46762306a36Sopenharmony_ci#define PPC_RAW_ICSWEPX(s, a, b) (0x7c00076d | ___PPC_RS(s) | ___PPC_RA(a) | ___PPC_RB(b)) 46862306a36Sopenharmony_ci#define PPC_RAW_SLBIA(IH) (0x7c0003e4 | (((IH) & 0x7) << 21)) 46962306a36Sopenharmony_ci#define PPC_RAW_VCMPEQUD_RC(vrt, vra, vrb) \ 47062306a36Sopenharmony_ci (0x100000c7 | ___PPC_RT(vrt) | ___PPC_RA(vra) | ___PPC_RB(vrb) | __PPC_RC21) 47162306a36Sopenharmony_ci#define PPC_RAW_VCMPEQUB_RC(vrt, vra, vrb) \ 47262306a36Sopenharmony_ci (0x10000006 | ___PPC_RT(vrt) | ___PPC_RA(vra) | ___PPC_RB(vrb) | __PPC_RC21) 47362306a36Sopenharmony_ci#define PPC_RAW_LD(r, base, i) (0xe8000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_DS(i)) 47462306a36Sopenharmony_ci#define PPC_RAW_LWZ(r, base, i) (0x80000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_L(i)) 47562306a36Sopenharmony_ci#define PPC_RAW_LWZX(t, a, b) (0x7c00002e | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b)) 47662306a36Sopenharmony_ci#define PPC_RAW_STD(r, base, i) (0xf8000000 | ___PPC_RS(r) | ___PPC_RA(base) | IMM_DS(i)) 47762306a36Sopenharmony_ci#define PPC_RAW_STDCX(s, a, b) (0x7c0001ad | ___PPC_RS(s) | ___PPC_RA(a) | ___PPC_RB(b)) 47862306a36Sopenharmony_ci#define PPC_RAW_LFSX(t, a, b) (0x7c00042e | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b)) 47962306a36Sopenharmony_ci#define PPC_RAW_STFSX(s, a, b) (0x7c00052e | ___PPC_RS(s) | ___PPC_RA(a) | ___PPC_RB(b)) 48062306a36Sopenharmony_ci#define PPC_RAW_LFDX(t, a, b) (0x7c0004ae | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b)) 48162306a36Sopenharmony_ci#define PPC_RAW_STFDX(s, a, b) (0x7c0005ae | ___PPC_RS(s) | ___PPC_RA(a) | ___PPC_RB(b)) 48262306a36Sopenharmony_ci#define PPC_RAW_LVX(t, a, b) (0x7c0000ce | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b)) 48362306a36Sopenharmony_ci#define PPC_RAW_STVX(s, a, b) (0x7c0001ce | ___PPC_RS(s) | ___PPC_RA(a) | ___PPC_RB(b)) 48462306a36Sopenharmony_ci#define PPC_RAW_ADDE(t, a, b) (0x7c000114 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b)) 48562306a36Sopenharmony_ci#define PPC_RAW_ADDZE(t, a) (0x7c000194 | ___PPC_RT(t) | ___PPC_RA(a)) 48662306a36Sopenharmony_ci#define PPC_RAW_ADDME(t, a) (0x7c0001d4 | ___PPC_RT(t) | ___PPC_RA(a)) 48762306a36Sopenharmony_ci#define PPC_RAW_ADD(t, a, b) (0x7c000214 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b)) 48862306a36Sopenharmony_ci#define PPC_RAW_ADD_DOT(t, a, b) (0x7c000214 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | 0x1) 48962306a36Sopenharmony_ci#define PPC_RAW_ADDC(t, a, b) (0x7c000014 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b)) 49062306a36Sopenharmony_ci#define PPC_RAW_ADDC_DOT(t, a, b) (0x7c000014 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | 0x1) 49162306a36Sopenharmony_ci#define PPC_RAW_NOP() PPC_RAW_ORI(0, 0, 0) 49262306a36Sopenharmony_ci#define PPC_RAW_BLR() (0x4e800020) 49362306a36Sopenharmony_ci#define PPC_RAW_BLRL() (0x4e800021) 49462306a36Sopenharmony_ci#define PPC_RAW_MTLR(r) (0x7c0803a6 | ___PPC_RT(r)) 49562306a36Sopenharmony_ci#define PPC_RAW_MFLR(t) (0x7c0802a6 | ___PPC_RT(t)) 49662306a36Sopenharmony_ci#define PPC_RAW_BCTR() (0x4e800420) 49762306a36Sopenharmony_ci#define PPC_RAW_BCTRL() (0x4e800421) 49862306a36Sopenharmony_ci#define PPC_RAW_MTCTR(r) (0x7c0903a6 | ___PPC_RT(r)) 49962306a36Sopenharmony_ci#define PPC_RAW_ADDI(d, a, i) (0x38000000 | ___PPC_RT(d) | ___PPC_RA(a) | IMM_L(i)) 50062306a36Sopenharmony_ci#define PPC_RAW_LI(r, i) PPC_RAW_ADDI(r, 0, i) 50162306a36Sopenharmony_ci#define PPC_RAW_ADDIS(d, a, i) (0x3c000000 | ___PPC_RT(d) | ___PPC_RA(a) | IMM_L(i)) 50262306a36Sopenharmony_ci#define PPC_RAW_ADDIC(d, a, i) (0x30000000 | ___PPC_RT(d) | ___PPC_RA(a) | IMM_L(i)) 50362306a36Sopenharmony_ci#define PPC_RAW_ADDIC_DOT(d, a, i) (0x34000000 | ___PPC_RT(d) | ___PPC_RA(a) | IMM_L(i)) 50462306a36Sopenharmony_ci#define PPC_RAW_LIS(r, i) PPC_RAW_ADDIS(r, 0, i) 50562306a36Sopenharmony_ci#define PPC_RAW_STDX(r, base, b) (0x7c00012a | ___PPC_RS(r) | ___PPC_RA(base) | ___PPC_RB(b)) 50662306a36Sopenharmony_ci#define PPC_RAW_STDU(r, base, i) (0xf8000001 | ___PPC_RS(r) | ___PPC_RA(base) | ((i) & 0xfffc)) 50762306a36Sopenharmony_ci#define PPC_RAW_STW(r, base, i) (0x90000000 | ___PPC_RS(r) | ___PPC_RA(base) | IMM_L(i)) 50862306a36Sopenharmony_ci#define PPC_RAW_STWU(r, base, i) (0x94000000 | ___PPC_RS(r) | ___PPC_RA(base) | IMM_L(i)) 50962306a36Sopenharmony_ci#define PPC_RAW_STH(r, base, i) (0xb0000000 | ___PPC_RS(r) | ___PPC_RA(base) | IMM_L(i)) 51062306a36Sopenharmony_ci#define PPC_RAW_STB(r, base, i) (0x98000000 | ___PPC_RS(r) | ___PPC_RA(base) | IMM_L(i)) 51162306a36Sopenharmony_ci#define PPC_RAW_LBZ(r, base, i) (0x88000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_L(i)) 51262306a36Sopenharmony_ci#define PPC_RAW_LDX(r, base, b) (0x7c00002a | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) 51362306a36Sopenharmony_ci#define PPC_RAW_LHZ(r, base, i) (0xa0000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_L(i)) 51462306a36Sopenharmony_ci#define PPC_RAW_LHBRX(r, base, b) (0x7c00062c | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) 51562306a36Sopenharmony_ci#define PPC_RAW_LWBRX(r, base, b) (0x7c00042c | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) 51662306a36Sopenharmony_ci#define PPC_RAW_LDBRX(r, base, b) (0x7c000428 | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b)) 51762306a36Sopenharmony_ci#define PPC_RAW_STWCX(s, a, b) (0x7c00012d | ___PPC_RS(s) | ___PPC_RA(a) | ___PPC_RB(b)) 51862306a36Sopenharmony_ci#define PPC_RAW_CMPWI(a, i) (0x2c000000 | ___PPC_RA(a) | IMM_L(i)) 51962306a36Sopenharmony_ci#define PPC_RAW_CMPDI(a, i) (0x2c200000 | ___PPC_RA(a) | IMM_L(i)) 52062306a36Sopenharmony_ci#define PPC_RAW_CMPW(a, b) (0x7c000000 | ___PPC_RA(a) | ___PPC_RB(b)) 52162306a36Sopenharmony_ci#define PPC_RAW_CMPD(a, b) (0x7c200000 | ___PPC_RA(a) | ___PPC_RB(b)) 52262306a36Sopenharmony_ci#define PPC_RAW_CMPLWI(a, i) (0x28000000 | ___PPC_RA(a) | IMM_L(i)) 52362306a36Sopenharmony_ci#define PPC_RAW_CMPLDI(a, i) (0x28200000 | ___PPC_RA(a) | IMM_L(i)) 52462306a36Sopenharmony_ci#define PPC_RAW_CMPLW(a, b) (0x7c000040 | ___PPC_RA(a) | ___PPC_RB(b)) 52562306a36Sopenharmony_ci#define PPC_RAW_CMPLD(a, b) (0x7c200040 | ___PPC_RA(a) | ___PPC_RB(b)) 52662306a36Sopenharmony_ci#define PPC_RAW_SUB(d, a, b) (0x7c000050 | ___PPC_RT(d) | ___PPC_RB(a) | ___PPC_RA(b)) 52762306a36Sopenharmony_ci#define PPC_RAW_SUBFC(d, a, b) (0x7c000010 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b)) 52862306a36Sopenharmony_ci#define PPC_RAW_SUBFE(d, a, b) (0x7c000110 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b)) 52962306a36Sopenharmony_ci#define PPC_RAW_SUBFIC(d, a, i) (0x20000000 | ___PPC_RT(d) | ___PPC_RA(a) | IMM_L(i)) 53062306a36Sopenharmony_ci#define PPC_RAW_SUBFZE(d, a) (0x7c000190 | ___PPC_RT(d) | ___PPC_RA(a)) 53162306a36Sopenharmony_ci#define PPC_RAW_MULD(d, a, b) (0x7c0001d2 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b)) 53262306a36Sopenharmony_ci#define PPC_RAW_MULW(d, a, b) (0x7c0001d6 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b)) 53362306a36Sopenharmony_ci#define PPC_RAW_MULHWU(d, a, b) (0x7c000016 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b)) 53462306a36Sopenharmony_ci#define PPC_RAW_MULI(d, a, i) (0x1c000000 | ___PPC_RT(d) | ___PPC_RA(a) | IMM_L(i)) 53562306a36Sopenharmony_ci#define PPC_RAW_DIVWU(d, a, b) (0x7c000396 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b)) 53662306a36Sopenharmony_ci#define PPC_RAW_DIVDU(d, a, b) (0x7c000392 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b)) 53762306a36Sopenharmony_ci#define PPC_RAW_DIVDE(t, a, b) (0x7c000352 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b)) 53862306a36Sopenharmony_ci#define PPC_RAW_DIVDE_DOT(t, a, b) (0x7c000352 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | 0x1) 53962306a36Sopenharmony_ci#define PPC_RAW_DIVDEU(t, a, b) (0x7c000312 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b)) 54062306a36Sopenharmony_ci#define PPC_RAW_DIVDEU_DOT(t, a, b) (0x7c000312 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | 0x1) 54162306a36Sopenharmony_ci#define PPC_RAW_AND(d, a, b) (0x7c000038 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(b)) 54262306a36Sopenharmony_ci#define PPC_RAW_ANDI(d, a, i) (0x70000000 | ___PPC_RA(d) | ___PPC_RS(a) | IMM_L(i)) 54362306a36Sopenharmony_ci#define PPC_RAW_ANDIS(d, a, i) (0x74000000 | ___PPC_RA(d) | ___PPC_RS(a) | IMM_L(i)) 54462306a36Sopenharmony_ci#define PPC_RAW_AND_DOT(d, a, b) (0x7c000039 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(b)) 54562306a36Sopenharmony_ci#define PPC_RAW_OR(d, a, b) (0x7c000378 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(b)) 54662306a36Sopenharmony_ci#define PPC_RAW_MR(d, a) PPC_RAW_OR(d, a, a) 54762306a36Sopenharmony_ci#define PPC_RAW_ORI(d, a, i) (0x60000000 | ___PPC_RA(d) | ___PPC_RS(a) | IMM_L(i)) 54862306a36Sopenharmony_ci#define PPC_RAW_ORIS(d, a, i) (0x64000000 | ___PPC_RA(d) | ___PPC_RS(a) | IMM_L(i)) 54962306a36Sopenharmony_ci#define PPC_RAW_NOR(d, a, b) (0x7c0000f8 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(b)) 55062306a36Sopenharmony_ci#define PPC_RAW_XOR(d, a, b) (0x7c000278 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(b)) 55162306a36Sopenharmony_ci#define PPC_RAW_XORI(d, a, i) (0x68000000 | ___PPC_RA(d) | ___PPC_RS(a) | IMM_L(i)) 55262306a36Sopenharmony_ci#define PPC_RAW_XORIS(d, a, i) (0x6c000000 | ___PPC_RA(d) | ___PPC_RS(a) | IMM_L(i)) 55362306a36Sopenharmony_ci#define PPC_RAW_EXTSW(d, a) (0x7c0007b4 | ___PPC_RA(d) | ___PPC_RS(a)) 55462306a36Sopenharmony_ci#define PPC_RAW_SLW(d, a, s) (0x7c000030 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(s)) 55562306a36Sopenharmony_ci#define PPC_RAW_SLD(d, a, s) (0x7c000036 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(s)) 55662306a36Sopenharmony_ci#define PPC_RAW_SRW(d, a, s) (0x7c000430 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(s)) 55762306a36Sopenharmony_ci#define PPC_RAW_SRAW(d, a, s) (0x7c000630 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(s)) 55862306a36Sopenharmony_ci#define PPC_RAW_SRAWI(d, a, i) (0x7c000670 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH(i)) 55962306a36Sopenharmony_ci#define PPC_RAW_SRD(d, a, s) (0x7c000436 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(s)) 56062306a36Sopenharmony_ci#define PPC_RAW_SRAD(d, a, s) (0x7c000634 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(s)) 56162306a36Sopenharmony_ci#define PPC_RAW_SRADI(d, a, i) (0x7c000674 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH64(i)) 56262306a36Sopenharmony_ci#define PPC_RAW_RLWINM(d, a, i, mb, me) (0x54000000 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH(i) | __PPC_MB(mb) | __PPC_ME(me)) 56362306a36Sopenharmony_ci#define PPC_RAW_RLWINM_DOT(d, a, i, mb, me) \ 56462306a36Sopenharmony_ci (0x54000001 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH(i) | __PPC_MB(mb) | __PPC_ME(me)) 56562306a36Sopenharmony_ci#define PPC_RAW_RLWIMI(d, a, i, mb, me) (0x50000000 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH(i) | __PPC_MB(mb) | __PPC_ME(me)) 56662306a36Sopenharmony_ci#define PPC_RAW_RLDICL(d, a, i, mb) (0x78000000 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH64(i) | __PPC_MB64(mb)) 56762306a36Sopenharmony_ci#define PPC_RAW_RLDICR(d, a, i, me) (0x78000004 | ___PPC_RA(d) | ___PPC_RS(a) | __PPC_SH64(i) | __PPC_ME64(me)) 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ci/* slwi = rlwinm Rx, Ry, n, 0, 31-n */ 57062306a36Sopenharmony_ci#define PPC_RAW_SLWI(d, a, i) PPC_RAW_RLWINM(d, a, i, 0, 31-(i)) 57162306a36Sopenharmony_ci/* srwi = rlwinm Rx, Ry, 32-n, n, 31 */ 57262306a36Sopenharmony_ci#define PPC_RAW_SRWI(d, a, i) PPC_RAW_RLWINM(d, a, 32-(i), i, 31) 57362306a36Sopenharmony_ci/* sldi = rldicr Rx, Ry, n, 63-n */ 57462306a36Sopenharmony_ci#define PPC_RAW_SLDI(d, a, i) PPC_RAW_RLDICR(d, a, i, 63-(i)) 57562306a36Sopenharmony_ci/* sldi = rldicl Rx, Ry, 64-n, n */ 57662306a36Sopenharmony_ci#define PPC_RAW_SRDI(d, a, i) PPC_RAW_RLDICL(d, a, 64-(i), i) 57762306a36Sopenharmony_ci 57862306a36Sopenharmony_ci#define PPC_RAW_NEG(d, a) (0x7c0000d0 | ___PPC_RT(d) | ___PPC_RA(a)) 57962306a36Sopenharmony_ci 58062306a36Sopenharmony_ci#define PPC_RAW_MFSPR(d, spr) (0x7c0002a6 | ___PPC_RT(d) | __PPC_SPR(spr)) 58162306a36Sopenharmony_ci#define PPC_RAW_MTSPR(spr, d) (0x7c0003a6 | ___PPC_RS(d) | __PPC_SPR(spr)) 58262306a36Sopenharmony_ci#define PPC_RAW_EIEIO() (0x7c0006ac) 58362306a36Sopenharmony_ci 58462306a36Sopenharmony_ci#define PPC_RAW_BRANCH(offset) (0x48000000 | PPC_LI(offset)) 58562306a36Sopenharmony_ci#define PPC_RAW_BL(offset) (0x48000001 | PPC_LI(offset)) 58662306a36Sopenharmony_ci#define PPC_RAW_TW(t0, a, b) (0x7c000008 | ___PPC_RS(t0) | ___PPC_RA(a) | ___PPC_RB(b)) 58762306a36Sopenharmony_ci#define PPC_RAW_TRAP() PPC_RAW_TW(31, 0, 0) 58862306a36Sopenharmony_ci#define PPC_RAW_SETB(t, bfa) (0x7c000100 | ___PPC_RT(t) | ___PPC_RA((bfa) << 2)) 58962306a36Sopenharmony_ci 59062306a36Sopenharmony_ci/* Deal with instructions that older assemblers aren't aware of */ 59162306a36Sopenharmony_ci#define PPC_BCCTR_FLUSH stringify_in_c(.long PPC_INST_BCCTR_FLUSH) 59262306a36Sopenharmony_ci#define PPC_CP_ABORT stringify_in_c(.long PPC_RAW_CP_ABORT) 59362306a36Sopenharmony_ci#define PPC_COPY(a, b) stringify_in_c(.long PPC_RAW_COPY(a, b)) 59462306a36Sopenharmony_ci#define PPC_DARN(t, l) stringify_in_c(.long PPC_RAW_DARN(t, l)) 59562306a36Sopenharmony_ci#define PPC_DCBAL(a, b) stringify_in_c(.long PPC_RAW_DCBAL(a, b)) 59662306a36Sopenharmony_ci#define PPC_DCBZL(a, b) stringify_in_c(.long PPC_RAW_DCBZL(a, b)) 59762306a36Sopenharmony_ci#define PPC_DIVDE(t, a, b) stringify_in_c(.long PPC_RAW_DIVDE(t, a, b)) 59862306a36Sopenharmony_ci#define PPC_DIVDEU(t, a, b) stringify_in_c(.long PPC_RAW_DIVDEU(t, a, b)) 59962306a36Sopenharmony_ci#define PPC_DSSALL stringify_in_c(.long PPC_INST_DSSALL) 60062306a36Sopenharmony_ci#define PPC_LQARX(t, a, b, eh) stringify_in_c(.long PPC_RAW_LQARX(t, a, b, eh)) 60162306a36Sopenharmony_ci#define PPC_STQCX(t, a, b) stringify_in_c(.long PPC_RAW_STQCX(t, a, b)) 60262306a36Sopenharmony_ci#define PPC_MADDHD(t, a, b, c) stringify_in_c(.long PPC_RAW_MADDHD(t, a, b, c)) 60362306a36Sopenharmony_ci#define PPC_MADDHDU(t, a, b, c) stringify_in_c(.long PPC_RAW_MADDHDU(t, a, b, c)) 60462306a36Sopenharmony_ci#define PPC_MADDLD(t, a, b, c) stringify_in_c(.long PPC_RAW_MADDLD(t, a, b, c)) 60562306a36Sopenharmony_ci#define PPC_MSGSND(b) stringify_in_c(.long PPC_RAW_MSGSND(b)) 60662306a36Sopenharmony_ci#define PPC_MSGSYNC stringify_in_c(.long PPC_RAW_MSGSYNC) 60762306a36Sopenharmony_ci#define PPC_MSGCLR(b) stringify_in_c(.long PPC_RAW_MSGCLR(b)) 60862306a36Sopenharmony_ci#define PPC_MSGSNDP(b) stringify_in_c(.long PPC_RAW_MSGSNDP(b)) 60962306a36Sopenharmony_ci#define PPC_MSGCLRP(b) stringify_in_c(.long PPC_RAW_MSGCLRP(b)) 61062306a36Sopenharmony_ci#define PPC_PASTE(a, b) stringify_in_c(.long PPC_RAW_PASTE(a, b)) 61162306a36Sopenharmony_ci#define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_RAW_POPCNTB(a, s)) 61262306a36Sopenharmony_ci#define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_RAW_POPCNTD(a, s)) 61362306a36Sopenharmony_ci#define PPC_POPCNTW(a, s) stringify_in_c(.long PPC_RAW_POPCNTW(a, s)) 61462306a36Sopenharmony_ci#define PPC_RFCI stringify_in_c(.long PPC_RAW_RFCI) 61562306a36Sopenharmony_ci#define PPC_RFDI stringify_in_c(.long PPC_RAW_RFDI) 61662306a36Sopenharmony_ci#define PPC_RFMCI stringify_in_c(.long PPC_RAW_RFMCI) 61762306a36Sopenharmony_ci#define PPC_TLBILX(t, a, b) stringify_in_c(.long PPC_RAW_TLBILX(t, a, b)) 61862306a36Sopenharmony_ci#define PPC_TLBILX_ALL(a, b) PPC_TLBILX(0, a, b) 61962306a36Sopenharmony_ci#define PPC_TLBILX_PID(a, b) PPC_TLBILX(1, a, b) 62062306a36Sopenharmony_ci#define PPC_TLBILX_LPID stringify_in_c(.long PPC_RAW_TLBILX_LPID) 62162306a36Sopenharmony_ci#define PPC_TLBILX_VA(a, b) PPC_TLBILX(3, a, b) 62262306a36Sopenharmony_ci#define PPC_WAIT_v203 stringify_in_c(.long PPC_RAW_WAIT_v203) 62362306a36Sopenharmony_ci#define PPC_WAIT(w, p) stringify_in_c(.long PPC_RAW_WAIT(w, p)) 62462306a36Sopenharmony_ci#define PPC_TLBIE(lp, a) stringify_in_c(.long PPC_RAW_TLBIE(lp, a)) 62562306a36Sopenharmony_ci#define PPC_TLBIE_5(rb, rs, ric, prs, r) \ 62662306a36Sopenharmony_ci stringify_in_c(.long PPC_RAW_TLBIE_5(rb, rs, ric, prs, r)) 62762306a36Sopenharmony_ci#define PPC_TLBIEL(rb,rs,ric,prs,r) \ 62862306a36Sopenharmony_ci stringify_in_c(.long PPC_RAW_TLBIEL(rb, rs, ric, prs, r)) 62962306a36Sopenharmony_ci#define PPC_TLBIEL_v205(rb, l) stringify_in_c(.long PPC_RAW_TLBIEL_v205(rb, l)) 63062306a36Sopenharmony_ci#define PPC_TLBSRX_DOT(a, b) stringify_in_c(.long PPC_RAW_TLBSRX_DOT(a, b)) 63162306a36Sopenharmony_ci#define PPC_TLBIVAX(a, b) stringify_in_c(.long PPC_RAW_TLBIVAX(a, b)) 63262306a36Sopenharmony_ci 63362306a36Sopenharmony_ci#define PPC_ERATWE(s, a, w) stringify_in_c(.long PPC_RAW_ERATWE(s, a, w)) 63462306a36Sopenharmony_ci#define PPC_ERATRE(s, a, w) stringify_in_c(.long PPC_RAW_ERATRE(a, a, w)) 63562306a36Sopenharmony_ci#define PPC_ERATILX(t, a, b) stringify_in_c(.long PPC_RAW_ERATILX(t, a, b)) 63662306a36Sopenharmony_ci#define PPC_ERATIVAX(s, a, b) stringify_in_c(.long PPC_RAW_ERATIVAX(s, a, b)) 63762306a36Sopenharmony_ci#define PPC_ERATSX(t, a, w) stringify_in_c(.long PPC_RAW_ERATSX(t, a, w)) 63862306a36Sopenharmony_ci#define PPC_ERATSX_DOT(t, a, w) stringify_in_c(.long PPC_RAW_ERATSX_DOT(t, a, w)) 63962306a36Sopenharmony_ci#define PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_RAW_SLBFEE_DOT(t, b)) 64062306a36Sopenharmony_ci#define __PPC_SLBFEE_DOT(t, b) stringify_in_c(.long __PPC_RAW_SLBFEE_DOT(t, b)) 64162306a36Sopenharmony_ci#define PPC_ICBT(c, a, b) stringify_in_c(.long PPC_RAW_ICBT(c, a, b)) 64262306a36Sopenharmony_ci/* PASemi instructions */ 64362306a36Sopenharmony_ci#define LBZCIX(t, a, b) stringify_in_c(.long PPC_RAW_LBZCIX(t, a, b)) 64462306a36Sopenharmony_ci#define STBCIX(s, a, b) stringify_in_c(.long PPC_RAW_STBCIX(s, a, b)) 64562306a36Sopenharmony_ci#define PPC_DCBFPS(a, b) stringify_in_c(.long PPC_RAW_DCBFPS(a, b)) 64662306a36Sopenharmony_ci#define PPC_DCBSTPS(a, b) stringify_in_c(.long PPC_RAW_DCBSTPS(a, b)) 64762306a36Sopenharmony_ci#define PPC_PHWSYNC stringify_in_c(.long PPC_RAW_PHWSYNC) 64862306a36Sopenharmony_ci#define PPC_PLWSYNC stringify_in_c(.long PPC_RAW_PLWSYNC) 64962306a36Sopenharmony_ci#define STXVD2X(s, a, b) stringify_in_c(.long PPC_RAW_STXVD2X(s, a, b)) 65062306a36Sopenharmony_ci#define LXVD2X(s, a, b) stringify_in_c(.long PPC_RAW_LXVD2X(s, a, b)) 65162306a36Sopenharmony_ci#define MFVRD(a, t) stringify_in_c(.long PPC_RAW_MFVRD(a, t)) 65262306a36Sopenharmony_ci#define MTVRD(t, a) stringify_in_c(.long PPC_RAW_MTVRD(t, a)) 65362306a36Sopenharmony_ci#define VPMSUMW(t, a, b) stringify_in_c(.long PPC_RAW_VPMSUMW(t, a, b)) 65462306a36Sopenharmony_ci#define VPMSUMD(t, a, b) stringify_in_c(.long PPC_RAW_VPMSUMD(t, a, b)) 65562306a36Sopenharmony_ci#define XXLOR(t, a, b) stringify_in_c(.long PPC_RAW_XXLOR(t, a, b)) 65662306a36Sopenharmony_ci#define XXSWAPD(t, a) stringify_in_c(.long PPC_RAW_XXSWAPD(t, a)) 65762306a36Sopenharmony_ci#define XVCPSGNDP(t, a, b) stringify_in_c(.long (PPC_RAW_XVCPSGNDP(t, a, b))) 65862306a36Sopenharmony_ci 65962306a36Sopenharmony_ci#define VPERMXOR(vrt, vra, vrb, vrc) \ 66062306a36Sopenharmony_ci stringify_in_c(.long (PPC_RAW_VPERMXOR(vrt, vra, vrb, vrc))) 66162306a36Sopenharmony_ci 66262306a36Sopenharmony_ci#define PPC_NAP stringify_in_c(.long PPC_RAW_NAP) 66362306a36Sopenharmony_ci#define PPC_SLEEP stringify_in_c(.long PPC_RAW_SLEEP) 66462306a36Sopenharmony_ci#define PPC_WINKLE stringify_in_c(.long PPC_RAW_WINKLE) 66562306a36Sopenharmony_ci 66662306a36Sopenharmony_ci#define PPC_STOP stringify_in_c(.long PPC_RAW_STOP) 66762306a36Sopenharmony_ci 66862306a36Sopenharmony_ci/* BHRB instructions */ 66962306a36Sopenharmony_ci#define PPC_CLRBHRB stringify_in_c(.long PPC_RAW_CLRBHRB) 67062306a36Sopenharmony_ci#define PPC_MFBHRBE(r, n) stringify_in_c(.long PPC_RAW_MFBHRBE(r, n)) 67162306a36Sopenharmony_ci 67262306a36Sopenharmony_ci/* Transactional memory instructions */ 67362306a36Sopenharmony_ci#define TRECHKPT stringify_in_c(.long PPC_RAW_TRECHKPT) 67462306a36Sopenharmony_ci#define TRECLAIM(r) stringify_in_c(.long PPC_RAW_TRECLAIM(r)) 67562306a36Sopenharmony_ci#define TABORT(r) stringify_in_c(.long PPC_RAW_TABORT(r)) 67662306a36Sopenharmony_ci 67762306a36Sopenharmony_ci/* book3e thread control instructions */ 67862306a36Sopenharmony_ci#define MTTMR(tmr, r) stringify_in_c(.long PPC_RAW_MTTMR(tmr, r)) 67962306a36Sopenharmony_ci#define MFTMR(tmr, r) stringify_in_c(.long PPC_RAW_MFTMR(tmr, r)) 68062306a36Sopenharmony_ci 68162306a36Sopenharmony_ci/* Coprocessor instructions */ 68262306a36Sopenharmony_ci#define PPC_ICSWX(s, a, b) stringify_in_c(.long PPC_RAW_ICSWX(s, a, b)) 68362306a36Sopenharmony_ci#define PPC_ICSWEPX(s, a, b) stringify_in_c(.long PPC_RAW_ICSWEPX(s, a, b)) 68462306a36Sopenharmony_ci 68562306a36Sopenharmony_ci#define PPC_SLBIA(IH) stringify_in_c(.long PPC_RAW_SLBIA(IH)) 68662306a36Sopenharmony_ci 68762306a36Sopenharmony_ci/* 68862306a36Sopenharmony_ci * These may only be used on ISA v3.0 or later (aka. CPU_FTR_ARCH_300, radix 68962306a36Sopenharmony_ci * implies CPU_FTR_ARCH_300). USER/GUEST invalidates may only be used by radix 69062306a36Sopenharmony_ci * mode (on HPT these would also invalidate various SLBEs which may not be 69162306a36Sopenharmony_ci * desired). 69262306a36Sopenharmony_ci */ 69362306a36Sopenharmony_ci#define PPC_ISA_3_0_INVALIDATE_ERAT PPC_SLBIA(7) 69462306a36Sopenharmony_ci#define PPC_RADIX_INVALIDATE_ERAT_USER PPC_SLBIA(3) 69562306a36Sopenharmony_ci#define PPC_RADIX_INVALIDATE_ERAT_GUEST PPC_SLBIA(6) 69662306a36Sopenharmony_ci 69762306a36Sopenharmony_ci#define VCMPEQUD_RC(vrt, vra, vrb) stringify_in_c(.long PPC_RAW_VCMPEQUD_RC(vrt, vra, vrb)) 69862306a36Sopenharmony_ci 69962306a36Sopenharmony_ci#define VCMPEQUB_RC(vrt, vra, vrb) stringify_in_c(.long PPC_RAW_VCMPEQUB_RC(vrt, vra, vrb)) 70062306a36Sopenharmony_ci 70162306a36Sopenharmony_ci#endif /* _ASM_POWERPC_PPC_OPCODE_H */ 702