1 /* $NetBSD: instr.h,v 1.4 2005/12/11 12:18:43 christos Exp $ */
5 * SPDX-License-Identifier: BSD-3-Clause
7 * Copyright (c) 1992, 1993
8 * The Regents of the University of California. All rights reserved.
10 * This software was developed by the Computer Systems Engineering group
11 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
12 * contributed to Berkeley.
14 * All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by the University of
17 * California, Lawrence Berkeley Laboratory.
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution.
27 * 3. Neither the name of the University nor the names of its contributors
28 * may be used to endorse or promote products derived from this software
29 * without specific prior written permission.
31 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
32 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 * @(#)instr.h 8.1 (Berkeley) 6/11/93
50 int i_int; /* as a whole */
53 * Any instruction type.
56 u_int i_opcd:6; /* first-level decode */
234 * Primary opcode numbers:
239 #define OPC_MULLI 0x07
240 #define OPC_SUBFIC 0x08
242 #define OPC_CMPLI 0x0a
243 #define OPC_CMPI 0x0b
244 #define OPC_ADDIC 0x0c
245 #define OPC_ADDIC_DOT 0x0d
246 #define OPC_ADDI 0x0e
247 #define OPC_ADDIS 0x0f
251 #define OPC_branch_19 0x13
252 #define OPC_RLWIMI 0x14
253 #define OPC_RLWINM 0x15
255 #define OPC_RLWNM 0x17
257 #define OPC_ORIS 0x19
258 #define OPC_XORI 0x1a
259 #define OPC_XORIS 0x1b
260 #define OPC_ANDI 0x1c
261 #define OPC_ANDIS 0x1d
262 #define OPC_dwe_rot_30 0x1e
263 #define OPC_integer_31 0x1f
265 #define OPC_LWZU 0x21
267 #define OPC_LBZU 0x23
269 #define OPC_STWU 0x25
271 #define OPC_STBU 0x27
273 #define OPC_LHZU 0x29
275 #define OPC_LHAU 0x2b
277 #define OPC_STHU 0x2d
279 #define OPC_STMW 0x2f
281 #define OPC_LFSU 0x31
283 #define OPC_LFDU 0x33
284 #define OPC_STFS 0x34
285 #define OPC_STFSU 0x35
286 #define OPC_STFD 0x36
287 #define OPC_STFDU 0x37
288 #define OPC_load_st_58 0x3a
289 #define OPC_sp_fp_59 0x3b
290 #define OPC_load_st_62 0x3e
291 #define OPC_dp_fp_63 0x3f
294 * Opcode 31 sub-types (FP only)
296 #define OPC31_TW 0x004
297 #define OPC31_LFSX 0x217
298 #define OPC31_LFSUX 0x237
299 #define OPC31_LFDX 0x257
300 #define OPC31_LFDUX 0x277
301 #define OPC31_STFSX 0x297
302 #define OPC31_STFSUX 0x2b7
303 #define OPC31_STFDX 0x2d7
304 #define OPC31_STFDUX 0x2f7
305 #define OPC31_STFIWX 0x3d7
307 /* Mask for all valid indexed FP load/store ops (except stfiwx) */
308 #define OPC31_FPMASK 0x31f
309 #define OPC31_FPOP 0x217
312 * Opcode 59 sub-types:
315 #define OPC59_FDIVS 0x12
316 #define OPC59_FSUBS 0x14
317 #define OPC59_FADDS 0x15
318 #define OPC59_FSQRTS 0x16
319 #define OPC59_FRES 0x18
320 #define OPC59_FMULS 0x19
321 #define OPC59_FMSUBS 0x1c
322 #define OPC59_FMADDS 0x1d
323 #define OPC59_FNMSUBS 0x1e
324 #define OPC59_FNMADDS 0x1f
327 * Opcode 62 sub-types:
329 #define OPC62_LDE 0x0
330 #define OPC62_LDEU 0x1
331 #define OPC62_LFSE 0x4
332 #define OPC62_LFSEU 0x5
333 #define OPC62_LFDE 0x6
334 #define OPC62_LFDEU 0x7
335 #define OPC62_STDE 0x8
336 #define OPC62_STDEU 0x9
337 #define OPC62_STFSE 0xc
338 #define OPC62_STFSEU 0xd
339 #define OPC62_STFDE 0xe
340 #define OPC62_STFDEU 0xf
343 * Opcode 63 sub-types:
345 * (The first group are masks....)
348 #define OPC63M_MASK 0x10
349 #define OPC63M_FDIV 0x12
350 #define OPC63M_FSUB 0x14
351 #define OPC63M_FADD 0x15
352 #define OPC63M_FSQRT 0x16
353 #define OPC63M_FSEL 0x17
354 #define OPC63M_FMUL 0x19
355 #define OPC63M_FRSQRTE 0x1a
356 #define OPC63M_FMSUB 0x1c
357 #define OPC63M_FMADD 0x1d
358 #define OPC63M_FNMSUB 0x1e
359 #define OPC63M_FNMADD 0x1f
361 #define OPC63_FCMPU 0x00
362 #define OPC63_FRSP 0x0c
363 #define OPC63_FCTIW 0x0e
364 #define OPC63_FCTIWZ 0x0f
365 #define OPC63_FCMPO 0x20
366 #define OPC63_MTFSB1 0x26
367 #define OPC63_FNEG 0x28
368 #define OPC63_MCRFS 0x40
369 #define OPC63_MTFSB0 0x46
370 #define OPC63_FMR 0x48
371 #define OPC63_MTFSFI 0x86
372 #define OPC63_FNABS 0x88
373 #define OPC63_FABS 0x108
374 #define OPC63_MFFS 0x247
375 #define OPC63_MTFSF 0x2c7
376 #define OPC63_FCTID 0x32e
377 #define OPC63_FCTIDZ 0x32f
378 #define OPC63_FCFID 0x34e
383 #define FTYPE_LNG -1 /* data = 64-bit signed long integer */
384 #define FTYPE_INT 0 /* data = 32-bit signed integer */
385 #define FTYPE_SNG 1 /* data = 32-bit float */
386 #define FTYPE_DBL 2 /* data = 64-bit double */