Generic intrinsics map to one or more assembly-language instructions, as a function of the type of its input parameters. Generic intrinsics are often implemented as compiler built-ins.
All of the generic intrinsics are prefixed by the string spu_. For example, the intrinsic that implements the stop assembly instruction is named spu_stop.
Generic intrinsics are provided for all SPU instructions, except for the following:
Many generic intrinsics accept scalars as one of their operands. These correspond to intrinsics that map to instructions with immediate values.
Intrinsic | Description |
---|---|
Constant Formation Intrinsics | |
d = spu_splats(a) | Replicate scalar a into all elements of vector d |
Conversion Intrinsics | |
d = spu_convtf(a, scale) | Convert integer vector to float vector |
d = spu_convts(a, scale) | Convert float vector to signed int vector |
d = spu_convtu(a, scale) | Convert float vector to unsigned float vector |
d = spu_extend(a) | Sign extend vector |
d = spu_rountf(a) | Round double vector to float vector |
Arithmetic Intrinsics | |
d = spu_add(a, b) | Vector add |
d = spu_addx(a, b, c) | Vector add extended |
d = spu_genb(a, b) | Vector generate borrow |
d = spu_genbx(a, b, c) | Vector generate borrow extended |
d = spu_genc(a, b) | Vector generate carry |
d = spu_gencx(a, b, c) | Vector generate carry extended |
d = spu_madd(a, b, c) | Vector multiply and add |
d = spu_mhhadd(a, b, c) | Vector multiply high high and add |
d = spu_msub(a, b, c) | Vector multiply and subtract |
d = spu_mul(a, b) | Vector multiply |
d = spu_mulh(a, b) | Vector multiply high |
d = spu_mulhh(a, b) | Vector multiply high high |
d = spu_mulo(a, b) | Vector multiply odd |
d = spu_mulsr(a, b) | Vector multiply and shift right |
d = spu_nmadd(a, b, c) | Negative vector multiply and add |
d = spu_nmsub(a, b, c) | Negative vector multiply and subtract |
d = spu_re(a) | Vector floating-point reciprocal estimate |
d = spu_rsqrte(a) | Vector floating-point reciprocal square root estimate |
d = spu_sub(a, b) | Vector subtract |
d = spu_subx(a, b, c) | Vector subtract extended |
Byte Operation Intrinsics | |
d = spu_absd(a, b) | Vector absolute difference |
d = spu_avg(a, b) | Vector average |
d = spu_sumb(a, b) | Vector sum bytes into shorts |
Compare, Branch, and Halt Intrinsics | |
d = spu_bisled(func) | Branch indirect and set link if external data |
d = spu_cmpabseq(a, b) | Vector compare absolute equal |
d = spu_cmpabsgt(a, b) | Vector compare absolute greater than |
d = spu_cmpeq(a, b) | Vector compare equal |
d = spu_cmpgt(a, b) | Vector compare greater than |
(void) spu_hcmpeq(a, b) | Halt if compare equal |
(void) spu_hcmpgt(a, b) | Halt if compare greater than |
d = spu_testsv(a, values) | Element-wise test for special value |
Bit and Mask Intrinsics | |
d = spu_cntb(a) | Vector count ones for bytes |
d = spu_cntlz(a) | Vector count leading zeros |
d = spu_gather(a) | Gather bits from elements |
d = spu_maskb(a) | Form select byte mask |
d = spu_maskh(a) | Form select halfword mask |
d = spu_maskw(a) | Form select word mask |
d = spu_sel(a, b, pattern) | Select bits |
d = spu_shuffle(a, b, pattern) | Shuffle bytes of a vector |
Logical Intrinsics | |
d = spu_and(a, b) | Vector bit-wise AND |
d = spu_andc(a, b) | Vector bit-wise AND with complement |
d = spu_eqv(a, b) | Vector bit-wise equivalent |
d = spu_nand(a, b) | Vector bit-wise complement of AND |
d = spu_nor(a, b) | Vector bit-wise complement of OR |
d = spu_or(a, b) | Vector bit-wise OR |
d = spu_orc(a, b) | Vector bit-wise OR with complement |
d = spu_orx(a) | Bit-wise OR word elements |
d = spu_xor(a, b) | Vector bit-wise exclusive OR |
Rotate Intrinsics | |
d = spu_rl(a, count) | Element-wise bit rotate left |
d = spu_rlmask(a, count) | Element-wise bit rotate left and mask |
d = spu_rlmaska(a, count) | Element-wise bit algebraic rotate and mask |
d = spu_rlmaskqw(a, count) | Bit rotate and mask quadword |
d = spu_rlmaskqwbyte(a, count) | Byte rotate and mask quadword |
d = spu_rlmaskqwbytebc(a, count) | Byte rotate and mask quadword using bit rotate count |
d = spu_rlqw(a, count) | Bit rotate quadword left |
d = spu_rlqwbyte(a, count) | Byte rotate quadword left |
d = spu_rlqwbytebc(a, count) | Byte rotate quadword left using bit rotate count |
Shift Intrinsics | |
d = spu_sl(a, count) | Element-wise bit shift left |
d = spu_slqw(a, count) | Bit shift quadword left |
d = spu_slqwbyte(a, count) | Byte shift quadword left |
d = spu_slqwbytebc(a, count) | Byte shift quadword left using bit shift count |
Control Intrinsics | |
(void) spu_idisable() | Disable interrupts |
(void) spu_ienable() | Enable interrupts |
(void) spu_mffpscr() | Move from floating-point status and control register |
(void) spu_mfspr(register) | Move from special-purpose register |
(void) spu_mtfpscr(a) | Move to floating-point status and control register |
(void) spu_mtspr(register, a) | Move to special-purpose register |
(void) spu_dsync() | Synchronize data |
(void) spu_stop(type) | Stop and signal |
(void) spu_sync() | Synchronize |
Scalar Intrinsics | |
d = spu_extract(a, element) | Extract vector element from vector |
d = spu_insert(a, b, element) | Insert scalar into specified vector element |
d = spu_promote(a, element) | Promote scalar to vector |
Channel Control Intrinsics | |
d = spu_readch(channel) | Read word channel |
d = spu_readchqw(channel) | Read quadword channel |
d = spu_readchcnt(channel) | Read channel count |
(void) spu_writech(channel, a) | Write word channel |
(void) spu_writechqw(channel, a) | Write quadword channel |