Home | History | Annotate | Line # | Download | only in dev
sxreg.h revision 1.16.4.1
      1  1.16.4.1  christos /*	$NetBSD: sxreg.h,v 1.16.4.1 2019/06/10 22:06:46 christos Exp $	*/
      2       1.1  macallan 
      3       1.1  macallan /*-
      4       1.1  macallan  * Copyright (c) 2013 The NetBSD Foundation, Inc.
      5       1.1  macallan  * All rights reserved.
      6       1.1  macallan  *
      7       1.1  macallan  * This code is derived from software contributed to The NetBSD Foundation
      8       1.1  macallan  * by Michael Lorenz.
      9       1.1  macallan  *
     10       1.1  macallan  * Redistribution and use in source and binary forms, with or without
     11       1.1  macallan  * modification, are permitted provided that the following conditions
     12       1.1  macallan  * are met:
     13       1.1  macallan  * 1. Redistributions of source code must retain the above copyright
     14       1.1  macallan  *    notice, this list of conditions and the following disclaimer.
     15       1.1  macallan  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.1  macallan  *    notice, this list of conditions and the following disclaimer in the
     17       1.1  macallan  *    documentation and/or other materials provided with the distribution.
     18       1.1  macallan  *
     19       1.1  macallan  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20       1.1  macallan  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21       1.1  macallan  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22       1.1  macallan  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23       1.1  macallan  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24       1.1  macallan  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25       1.1  macallan  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26       1.1  macallan  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27       1.1  macallan  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28       1.1  macallan  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29       1.1  macallan  * POSSIBILITY OF SUCH DAMAGE.
     30       1.1  macallan  */
     31       1.1  macallan 
     32       1.1  macallan /* register definitions for Sun's SX / SPAM rendering engine */
     33       1.1  macallan 
     34       1.1  macallan #ifndef SXREG_H
     35       1.1  macallan #define SXREG_H
     36       1.1  macallan 
     37       1.1  macallan /* SX control registers */
     38       1.1  macallan #define SX_CONTROL_STATUS	0x00000000
     39       1.1  macallan #define SX_ERROR		0x00000004
     40       1.1  macallan #define SX_PAGE_BOUND_LOWER	0x00000008
     41       1.1  macallan #define SX_PAGE_BOUND_UPPER	0x0000000c
     42       1.1  macallan #define SX_PLANEMASK		0x00000010
     43       1.1  macallan #define SX_ROP_CONTROL		0x00000014	/* 8 bit ROP */
     44       1.1  macallan #define SX_IQ_OVERFLOW_COUNTER	0x00000018
     45       1.1  macallan #define SX_DIAGNOSTICS		0x0000001c
     46       1.1  macallan #define SX_INSTRUCTIONS		0x00000020
     47       1.1  macallan #define SX_ID			0x00000028
     48       1.1  macallan #define SX_R0_INIT		0x0000002c
     49       1.1  macallan #define SX_SOFTRESET		0x00000030
     50  1.16.4.1  christos #define SX_SYNC			0x00000034	/* write will stall CPU until */
     51  1.16.4.1  christos 						/* SX is idle		      */
     52       1.1  macallan /* write registers directly, only when processor is stopped */
     53       1.1  macallan #define SX_DIRECT_R0		0x00000100
     54       1.1  macallan #define SX_DIRECT_R1		0x00000104	/* and so on until R127 */
     55       1.1  macallan /* write registers via pseudo instructions */
     56       1.1  macallan #define SX_QUEUED_R0		0x00000300
     57       1.1  macallan #define SX_QUEUED_R1		0x00000304	/* and so on until R127 */
     58      1.12  macallan #define SX_QUEUED(r)		(0x300 + ((r) << 2))
     59       1.2  macallan 
     60       1.2  macallan /* special purpose registers */
     61       1.2  macallan #define R_ZERO	0
     62       1.2  macallan #define R_SCAM	1
     63       1.2  macallan #define R_MASK	2	/* bitmask for SX_STORE_SELECT */
     64       1.1  macallan 
     65       1.1  macallan /*
     66       1.1  macallan  * registers are repeated at 0x1000 with certain parts read only
     67       1.4  macallan  * ( like the PAGE_BOUND registers ) which userland has no business writing to
     68       1.1  macallan  */
     69       1.1  macallan 
     70       1.1  macallan /* SX_CONTROL_STATUS */
     71       1.1  macallan #define SX_EE1		0x00000001	/* illegal instruction */
     72       1.1  macallan #define SX_EE2		0x00000002	/* page bound error */
     73       1.1  macallan #define SX_EE3		0x00000004	/* illegal memory access */
     74       1.1  macallan #define SX_EE4		0x00000008	/* illegal register access */
     75       1.1  macallan #define SX_EE5		0x00000010	/* alignment violation */
     76       1.1  macallan #define SX_EE6		0x00000020	/* illegal instruction queue write */
     77       1.1  macallan #define SX_EI		0x00000080	/* interrupt on error */
     78  1.16.4.1  christos /*
     79  1.16.4.1  christos  * XXX
     80  1.16.4.1  christos  * the following bit definitions are from the SX manual. They're defined in a
     81  1.16.4.1  christos  * different way in SunOS's sxreg.h, the hardware seems to follow the latter.
     82  1.16.4.1  christos  */
     83  1.16.4.1  christos #if 0
     84       1.1  macallan #define SX_PB		0x00001000	/* enable page bound checking */
     85       1.1  macallan #define SX_WO		0x00002000	/* write occured ( by SX ) */
     86       1.1  macallan #define SX_GO		0x00004000	/* start/stop the processor */
     87       1.1  macallan #define SX_MT		0x00008000	/* instruction queue is empty */
     88  1.16.4.1  christos #endif
     89  1.16.4.1  christos 
     90  1.16.4.1  christos #define SX_PB		0x00000400	/* enable page bound checking */
     91  1.16.4.1  christos #define SX_WO		0x00000800	/* write occured ( by SX ) */
     92  1.16.4.1  christos #define SX_GO		0x00001000	/* start/stop the processor */
     93  1.16.4.1  christos #define SX_JB		0x00002000	/* Jammed/Busy specifies the type of events */
     94  1.16.4.1  christos 					/* which increment the SX timer */
     95  1.16.4.1  christos #define SX_MT		0x00004000	/* instruction queue is empty */
     96  1.16.4.1  christos #define SX_BZ		0x00008000	/* Busy bit. When set it indicates that SX */
     97  1.16.4.1  christos 					/* is processing an instruction or an */
     98  1.16.4.1  christos 					/* instruction is pending in the Q      */
     99  1.16.4.1  christos #define SX_B0MOD	0x00010000	/* When set by SX it indicates that a write */
    100  1.16.4.1  christos 					/* to bank zero of the SX registers (0-31) */
    101  1.16.4.1  christos 					/* occured */
    102  1.16.4.1  christos #define SX_B1MOD	0x00020000	/* When set by SX it indicates that a write */
    103  1.16.4.1  christos 					/* to bank 1 of the SX registers (32-63) */
    104  1.16.4.1  christos 					/* occured */
    105  1.16.4.1  christos #define SX_B2MOD	0x00040000	/* When set by SX it indicates that a write */
    106  1.16.4.1  christos 					/* to bank 2 of the SX registers (64-95) */
    107  1.16.4.1  christos 					/* occured */
    108  1.16.4.1  christos #define SX_B3MOD	0x00080000	/* When set by SX it indicates that a write */
    109  1.16.4.1  christos 					/* to bank 3 of the SX registers (96-127) */
    110  1.16.4.1  christos 					/* occured */
    111       1.1  macallan 
    112       1.1  macallan /* SX_ERROR */
    113       1.1  macallan #define SX_SE1		0x00000001	/* illegal instruction */
    114       1.1  macallan #define SX_SE2		0x00000002	/* page bound error */
    115       1.1  macallan #define SX_SE3		0x00000004	/* illegal memory access */
    116       1.1  macallan #define SX_SE4		0x00000008	/* illegal register access */
    117       1.1  macallan #define SX_SE5		0x00000010	/* alignment violation */
    118       1.1  macallan #define SX_SE6		0x00000020	/* illegal instruction queue write */
    119       1.1  macallan #define SX_SI		0x00000080	/* interrupt on error */
    120       1.1  macallan 
    121  1.16.4.1  christos /* SX_ID from the manual */
    122  1.16.4.1  christos #if 0
    123       1.1  macallan #define SX_ARCHITECTURE_MASK	0x000000ff
    124       1.1  macallan #define SX_CHIP_REVISION	0x0000ff00
    125  1.16.4.1  christos #endif
    126  1.16.4.1  christos 
    127  1.16.4.1  christos #define SX_ARCHITECTURE_MASK	0x00000003
    128  1.16.4.1  christos #define SX_CHIP_REVISION	0x000000f8
    129       1.1  macallan 
    130       1.1  macallan /* SX_DIAGNOSTICS */
    131       1.1  macallan #define SX_IQ_FIFO_ACCESS	0x00000001	/* allow memory instructions
    132       1.1  macallan 						 * in SX_INSTRUCTIONS */
    133  1.16.4.1  christos #define SX_SERIAL_INSTRUCTIONS	0x00000002	/* force inst. serializing */
    134  1.16.4.1  christos #define SX_RAM_PAGE_CROSS	0x00000004	/* indicates page crossing */
    135  1.16.4.1  christos #define SX_ARRAY_CONSTRAINING	0x00000008	/* When set constrains VRAM */
    136  1.16.4.1  christos 						/* array offset effective */
    137  1.16.4.1  christos 						/* address calculation  */
    138  1.16.4.1  christos #define SX_UPG_MPG_DISABLE	0x00000010	/* When set, disables page */
    139  1.16.4.1  christos 						/* cross input into ld/st */
    140  1.16.4.1  christos 						/* state machines */
    141  1.16.4.1  christos #define SX_DIAG_INIT		0x4804		/* Setting of the diag reg */
    142  1.16.4.1  christos 						/* upon reset */
    143  1.16.4.1  christos 
    144       1.1  macallan 
    145       1.1  macallan /*
    146       1.1  macallan  * memory referencing instructions are written to 0x800000000 + PA
    147       1.1  macallan  * so we have to go through ASI 0x28 ( ASI_BYPASS + 8 )
    148       1.1  macallan  */
    149       1.1  macallan #define ASI_SX	0x28
    150       1.1  macallan 
    151       1.1  macallan /* load / store instructions */
    152       1.1  macallan #define SX_STORE_COND	(0x4 << 19)	/* conditional write with mask */
    153       1.1  macallan #define SX_STORE_CLAMP	(0x2 << 19)
    154       1.1  macallan #define SX_STORE_MASK	(0x1 << 19)	/* apply plane mask */
    155       1.2  macallan #define SX_STORE_SELECT	(0x8 << 19)	/* expand with plane reg dest[0]/dest[1] */
    156       1.1  macallan #define SX_LOAD		(0xa << 19)
    157       1.1  macallan #define SX_STORE	(0x0 << 19)
    158       1.1  macallan 
    159       1.1  macallan /* data type */
    160       1.1  macallan #define SX_UBYTE_0	(0x00 << 14)
    161       1.1  macallan #define SX_UBYTE_8	(0x01 << 14)
    162       1.1  macallan #define SX_UBYTE_16	(0x02 << 14)
    163       1.1  macallan #define SX_UBYTE_24	(0x03 << 14)
    164       1.1  macallan #define SX_SBYTE_0	(0x04 << 14)
    165       1.1  macallan #define SX_SBYTE_8	(0x05 << 14)
    166       1.1  macallan #define SX_SBYTE_16	(0x06 << 14)
    167       1.1  macallan #define SX_SBYTE_24	(0x07 << 14)
    168       1.1  macallan #define SX_UQUAD_0	(0x08 << 14)
    169       1.1  macallan #define SX_UQUAD_8	(0x09 << 14)
    170       1.1  macallan #define SX_UQUAD_16	(0x0a << 14)
    171       1.1  macallan #define SX_UQUAD_24	(0x0b << 14)
    172       1.1  macallan #define SX_SQUAD_0	(0x0c << 14)
    173       1.1  macallan #define SX_SQUAD_8	(0x0d << 14)
    174       1.1  macallan #define SX_SQUAD_16	(0x0e << 14)
    175       1.1  macallan #define SX_SQUAD_24	(0x0f << 14)
    176       1.1  macallan #define SX_UCHAN_0	(0x10 << 14)
    177       1.1  macallan #define SX_UCHAN_8	(0x11 << 14)
    178       1.1  macallan #define SX_UCHAN_16	(0x12 << 14)
    179       1.1  macallan #define SX_UCHAN_24	(0x13 << 14)
    180       1.1  macallan #define SX_SCHAN_0	(0x14 << 14)
    181       1.1  macallan #define SX_SCHAN_8	(0x15 << 14)
    182       1.1  macallan #define SX_SCHAN_16	(0x16 << 14)
    183       1.1  macallan #define SX_SCHAN_24	(0x17 << 14)
    184       1.1  macallan #define SX_USHORT_0	(0x18 << 14)
    185       1.1  macallan #define SX_USHORT_8	(0x19 << 14)
    186       1.1  macallan #define SX_USHORT_16	(0x1a << 14)
    187       1.1  macallan #define SX_SSHORT_0	(0x1c << 14)
    188       1.1  macallan #define SX_SSHORT_8	(0x1d << 14)
    189       1.1  macallan #define SX_SSHORT_16	(0x1e << 14)
    190       1.1  macallan #define SX_LONG		(0x1b << 14)
    191       1.1  macallan #define SX_PACKED	(0x1f << 14)
    192       1.1  macallan 
    193       1.1  macallan 
    194       1.2  macallan #define SX_LD(dreg, cnt, o)  (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    195       1.2  macallan 				SX_LONG | (dreg << 7) | (o))
    196       1.2  macallan #define SX_LDB(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    197       1.2  macallan 				SX_UBYTE_0 | (dreg << 7) | (o))
    198       1.2  macallan #define SX_LDP(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    199       1.2  macallan 				SX_PACKED | (dreg << 7) | (o))
    200       1.7  macallan #define SX_LDUQ0(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    201       1.7  macallan 				SX_UQUAD_0 | (dreg << 7) | (o))
    202       1.7  macallan #define SX_LDUQ8(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    203       1.7  macallan 				SX_UQUAD_8 | (dreg << 7) | (o))
    204       1.7  macallan #define SX_LDUQ16(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    205       1.7  macallan 				SX_UQUAD_16 | (dreg << 7) | (o))
    206       1.7  macallan #define SX_LDUQ24(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    207       1.7  macallan 				SX_UQUAD_24 | (dreg << 7) | (o))
    208      1.14  macallan #define SX_LDUC0(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    209      1.14  macallan 				SX_UCHAN_0 | (dreg << 7) | (o))
    210      1.14  macallan #define SX_LDUC8(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    211      1.14  macallan 				SX_UCHAN_8 | (dreg << 7) | (o))
    212      1.14  macallan #define SX_LDUC16(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    213      1.14  macallan 				SX_UCHAN_16 | (dreg << 7) | (o))
    214      1.14  macallan #define SX_LDUC24(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    215      1.14  macallan 				SX_UCHAN_24 | (dreg << 7) | (o))
    216       1.2  macallan #define SX_ST(sreg, cnt, o)  (0x80000000 | ((cnt) << 23) | SX_STORE | \
    217       1.2  macallan 				SX_LONG | (sreg << 7) | (o))
    218       1.6  macallan #define SX_STM(sreg, cnt, o)  (0x80000000 | ((cnt) << 23) | SX_STORE_MASK | \
    219       1.6  macallan 				SX_LONG | (sreg << 7) | (o))
    220       1.2  macallan #define SX_STB(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    221       1.2  macallan 				SX_UBYTE_0 | (sreg << 7) | (o))
    222      1.13  macallan #define SX_STBM(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_MASK | \
    223      1.13  macallan 				SX_UBYTE_0 | (sreg << 7) | (o))
    224      1.11  macallan #define SX_STBC(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_CLAMP | \
    225      1.11  macallan 				SX_UBYTE_0 | (sreg << 7) | (o))
    226       1.2  macallan #define SX_STP(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    227       1.2  macallan 				SX_PACKED | (sreg << 7) | (o))
    228       1.2  macallan #define SX_STS(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_SELECT \
    229       1.2  macallan 				| SX_LONG | (sreg << 7) | (o))
    230       1.2  macallan #define SX_STBS(reg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_SELECT \
    231       1.2  macallan 				| SX_UBYTE_0 | (reg << 7) | (o))
    232       1.7  macallan #define SX_STUQ0(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    233       1.7  macallan 				SX_UQUAD_0 | (sreg << 7) | (o))
    234      1.11  macallan #define SX_STUQ0C(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_CLAMP | \
    235      1.11  macallan 				SX_UQUAD_0 | (sreg << 7) | (o))
    236       1.7  macallan #define SX_STUQ8(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    237       1.7  macallan 				SX_UQUAD_8 | (sreg << 7) | (o))
    238       1.7  macallan #define SX_STUQ16(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    239       1.7  macallan 				SX_UQUAD_16 | (sreg << 7) | (o))
    240       1.7  macallan #define SX_STUQ24(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    241       1.7  macallan 				SX_UQUAD_24 | (sreg << 7) | (o))
    242      1.14  macallan #define SX_STUC0(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    243      1.14  macallan 				SX_UCHAN_0 | (sreg << 7) | (o))
    244      1.14  macallan #define SX_STUC0C(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_CLAMP | \
    245      1.14  macallan 				SX_UCHAN_0 | (sreg << 7) | (o))
    246      1.14  macallan #define SX_STUC8(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    247      1.14  macallan 				SX_UCHAN_8 | (sreg << 7) | (o))
    248      1.14  macallan #define SX_STUC16(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    249      1.14  macallan 				SX_UCHAN_16 | (sreg << 7) | (o))
    250      1.14  macallan #define SX_STUC24(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    251      1.14  macallan 				SX_UCHAN_24 | (sreg << 7) | (o))
    252       1.1  macallan 
    253       1.7  macallan /* ROP and SELECT instructions */
    254       1.3  macallan #define SX_ROPB	(0x0 << 21)	/* mask bits apply to bytes */
    255       1.3  macallan #define SX_ROPM	(0x1 << 21)	/* mask bits apply to each bit */
    256       1.3  macallan #define SX_ROPL	(0x2 << 21)	/* mask bits apply per register */
    257       1.3  macallan #define SX_SELB	(0x4 << 21)	/* byte select scalar */
    258       1.3  macallan #define SX_SELV (0x6 << 21)	/* register select vector */
    259       1.3  macallan #define SX_SELS (0x7 << 21)	/* register select scalar */
    260       1.3  macallan 
    261       1.3  macallan #define SX_ROP(sa, sb, d, cnt) (0x90000000 | ((cnt) << 24) | SX_ROPL | \
    262       1.3  macallan 		((sa) << 14) | (sb) | ((d) << 7))
    263       1.5  macallan #define SX_SELECT_S(sa, sb, d, cnt) (0x90000000 | ((cnt) << 24) | SX_SELS | \
    264       1.5  macallan 		((sa) << 14) | (sb) | ((d) << 7))
    265       1.7  macallan 
    266       1.7  macallan /* multiply group */
    267       1.7  macallan #define SX_M16X16SR0	(0x0 << 28)	/* 16bit multiply, no shift */
    268       1.7  macallan #define SX_M16X16SR8	(0x1 << 28)	/* 16bit multiply, shift right 8 */
    269       1.7  macallan #define SX_M16X16SR16	(0x2 << 28)	/* 16bit multiply, shift right 16 */
    270       1.7  macallan #define SX_M32X16SR0	(0x4 << 28)	/* 32x16bit multiply, no shift */
    271       1.7  macallan #define SX_M32X16SR8	(0x5 << 28)	/* 32x16bit multiply, shift right 8 */
    272       1.7  macallan #define SX_M32X16SR16	(0x6 << 28)	/* 32x16bit multiply, shift right 16 */
    273       1.7  macallan 
    274       1.7  macallan #define SX_MULTIPLY	(0x0 << 21)	/* normal multiplication */
    275       1.7  macallan #define SX_DOT		(0x1 << 21)	/* dot product of A and B */
    276       1.7  macallan #define SX_SAXP		(0x2 << 21)	/* A * SCAM + B */
    277       1.7  macallan 
    278       1.7  macallan #define SX_ROUND	(0x1 << 23)	/* round results */
    279       1.7  macallan 
    280       1.7  macallan #define SX_MUL16X16(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt) << 24) | \
    281       1.8  macallan 		SX_MULTIPLY | ((sa) << 14) | ((d) << 7) | (sb))
    282       1.7  macallan #define SX_MUL16X16R(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt) << 24) | \
    283       1.8  macallan 		SX_MULTIPLY | ((sa) << 14) | ((d) << 7) | (sb) | SX_ROUND)
    284       1.7  macallan #define SX_MUL16X16SR8(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt) << 24) | \
    285       1.8  macallan 		SX_MULTIPLY | ((sa) << 14) | ((d) << 7) | (sb))
    286       1.7  macallan #define SX_MUL16X16SR8R(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt) << 24) | \
    287       1.8  macallan 		SX_MULTIPLY | ((sa) << 14) | ((d) << 7) | (sb) | SX_ROUND)
    288       1.7  macallan 
    289       1.7  macallan #define SX_SAXP16X16(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt) << 24) | \
    290       1.8  macallan 		SX_SAXP | ((sa) << 14) | ((d) << 7) | (sb))
    291       1.7  macallan #define SX_SAXP16X16R(sa, sb, d, cnt) (SX_M16X16SR0 | ((cnt) << 24) | \
    292       1.8  macallan 		SX_SAXP | ((sa) << 14) | ((d) << 7) | (sb) | SX_ROUND)
    293       1.7  macallan #define SX_SAXP16X16SR8(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt) << 24) | \
    294       1.8  macallan 		SX_SAXP | ((sa) << 14) | ((d) << 7) | (sb))
    295       1.7  macallan #define SX_SAXP16X16SR8R(sa, sb, d, cnt) (SX_M16X16SR8 | ((cnt) << 24) | \
    296       1.8  macallan 		SX_SAXP | ((sa) << 14) | ((d) << 7) | (sb) | SX_ROUND)
    297       1.7  macallan 
    298       1.7  macallan /* logic group */
    299       1.7  macallan #define SX_AND_V	(0x0 << 21)	/* vector AND vector */
    300       1.7  macallan #define SX_AND_S	(0x1 << 21)	/* vector AND scalar */
    301       1.7  macallan #define SX_AND_I	(0x2 << 21)	/* vector AND immediate */
    302       1.7  macallan #define SX_XOR_V	(0x3 << 21)	/* vector XOR vector */
    303       1.7  macallan #define SX_XOR_S	(0x4 << 21)	/* vector XOR scalar */
    304       1.7  macallan #define SX_XOR_I	(0x5 << 21)	/* vector XOR immediate */
    305       1.7  macallan #define SX_OR_V		(0x6 << 21)	/* vector OR vector */
    306       1.7  macallan #define SX_OR_S		(0x7 << 21)	/* vector OR scalar */
    307       1.7  macallan /* immediates are 7bit sign extended to 32bit */
    308       1.7  macallan 
    309       1.7  macallan #define SX_ANDV(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_AND_V | \
    310       1.8  macallan 		((sa) << 14) | ((d) << 7) | (sb))
    311       1.7  macallan #define SX_ANDS(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_AND_S | \
    312       1.8  macallan 		((sa) << 14) | ((d) << 7) | (sb))
    313       1.7  macallan #define SX_ANDI(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_AND_I | \
    314       1.8  macallan 		((sa) << 14) | ((d) << 7) | (sb))
    315       1.7  macallan #define SX_XORV(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_XOR_V | \
    316       1.8  macallan 		((sa) << 14) | ((d) << 7) | (sb))
    317       1.7  macallan #define SX_XORS(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_XOR_S | \
    318       1.8  macallan 		((sa) << 14) | ((d) << 7) | (sb))
    319       1.7  macallan #define SX_XORI(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_XOR_I | \
    320       1.8  macallan 		((sa) << 14) | ((d) << 7) | (sb))
    321       1.7  macallan #define SX_ORV(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_OR_V | \
    322       1.8  macallan 		((sa) << 14) | ((d) << 7) | (sb))
    323       1.7  macallan #define SX_ORS(sa, sb, d, cnt) (0xb0000000 | ((cnt) << 24) | SX_OR_S | \
    324       1.8  macallan 		((sa) << 14) | ((d) << 7) | (sb))
    325       1.8  macallan 
    326       1.8  macallan /* arithmetic group */
    327       1.9  macallan #define SX_ADD_V	(0x00 << 21)	/* vector + vector */
    328       1.9  macallan #define SX_ADD_S	(0x01 << 21)	/* vector + scalar */
    329       1.9  macallan #define SX_ADD_I	(0x02 << 21)	/* vector + immediate */
    330       1.9  macallan #define SX_SUM		(0x03 << 21)	/* sum of vector and scalar */
    331      1.10  macallan #define SX_SUB_V	(0x04 << 21)	/* vector - vector */
    332       1.9  macallan #define SX_SUB_S	(0x05 << 21)	/* vector - scalar */
    333       1.9  macallan #define SX_SUB_I	(0x06 << 21)	/* vector - immediate */
    334       1.9  macallan #define SX_ABS		(0x07 << 21)	/* abs(sb) with sa=R0 */
    335       1.9  macallan /* hardware does sa - sb for sb < 0 and sa + sb if sb > 0 */
    336       1.8  macallan 
    337       1.8  macallan #define SX_ADDV(sa, sb, d, cnt) (0xa0000000 | ((cnt) << 24) | SX_ADD_V | \
    338       1.8  macallan 		((sa) << 14) | ((d) << 7) | (sb))
    339       1.7  macallan 
    340      1.15  macallan /* MISC group */
    341      1.15  macallan #define SX_GTHR		(3 << 21)	/* sa with spacing sb -> d */
    342      1.15  macallan #define SX_SCTR		(2 << 21)	/* sa -> d with spacing sb */
    343      1.16  macallan #define SX_GATHER(sa, sb, d, cnt) (0xe0000000 | ((cnt) << 24) | SX_GTHR | \
    344      1.16  macallan 		 ((sa) << 14) | ((d) << 7) | (sb))
    345      1.16  macallan #define SX_SCATTER(sa, sb, d, cnt) (0xe0000000 | ((cnt) << 24) | SX_SCTR | \
    346      1.16  macallan 		 ((sa) << 14) | ((d) << 7) | (sb))
    347      1.15  macallan 
    348       1.1  macallan #endif /* SXREG_H */
    349