ppc: vmx.lisp

the PPU's VMX (AltiVec) unit.

0/1 a fixed bit, name a field,   a bit the decoder ignores

vaddubm source

Vector Add Unsigned Byte Modulo

313029282726252423222120191817161514131211109876543210
000100vdvavb00000000000
(defvx3 vaddubm 0 "Vector Add Unsigned Byte Modulo" (vmap 8 (lambda (x y) (wrap 8 (+ x y))) a b))

vadduhm source

Vector Add Unsigned Halfword Modulo

313029282726252423222120191817161514131211109876543210
000100vdvavb00001000000
(defvx3 vadduhm 64 "Vector Add Unsigned Halfword Modulo" (vmap 16 (lambda (x y) (wrap 16 (+ x y))) a b))

vadduwm source

Vector Add Unsigned Word Modulo

313029282726252423222120191817161514131211109876543210
000100vdvavb00010000000
(defvx3 vadduwm 128 "Vector Add Unsigned Word Modulo" (vmap 32 (lambda (x y) (wrap 32 (+ x y))) a b))

vsububm source

Vector Subtract Unsigned Byte Modulo

313029282726252423222120191817161514131211109876543210
000100vdvavb10000000000
(defvx3 vsububm 1024 "Vector Subtract Unsigned Byte Modulo" (vmap 8 (lambda (x y) (wrap 8 (- x y))) a b))

vsubuhm source

Vector Subtract Unsigned Halfword Modulo

313029282726252423222120191817161514131211109876543210
000100vdvavb10001000000
(defvx3 vsubuhm 1088 "Vector Subtract Unsigned Halfword Modulo" (vmap 16 (lambda (x y) (wrap 16 (- x y))) a b))

vsubuwm source

Vector Subtract Unsigned Word Modulo

313029282726252423222120191817161514131211109876543210
000100vdvavb10010000000
(defvx3 vsubuwm 1152 "Vector Subtract Unsigned Word Modulo" (vmap 32 (lambda (x y) (wrap 32 (- x y))) a b))

vaddcuw source

Vector Add and Write Carry-Out Unsigned Word

313029282726252423222120191817161514131211109876543210
000100vdvavb00110000000
(defvx3 vaddcuw 384 "Vector Add and Write Carry-Out Unsigned Word"
  (vmap 32 (lambda (x y) (carry-out 32 x y)) a b))

vsubcuw source

Vector Subtract and Write Carry-Out Unsigned Word

313029282726252423222120191817161514131211109876543210
000100vdvavb10110000000
(defvx3 vsubcuw 1408 "Vector Subtract and Write Carry-Out Unsigned Word"
  (vmap 32 (lambda (x y) (carry-out 32 x (wrap 32 (lognot y)) 1)) a b))

vaddubs source

Vector Add Unsigned Byte Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb01000000000
(defvx3 vaddubs 512 "Vector Add Unsigned Byte Saturate" (vmap-sat 8 0 255 (lambda (x y) (+ x y)) a b))

vadduhs source

Vector Add Unsigned Halfword Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb01001000000
(defvx3 vadduhs 576 "Vector Add Unsigned Halfword Saturate" (vmap-sat 16 0 #xFFFF (lambda (x y) (+ x y)) a b))

vadduws source

Vector Add Unsigned Word Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb01010000000
(defvx3 vadduws 640 "Vector Add Unsigned Word Saturate" (vmap-sat 32 0 #xFFFFFFFF (lambda (x y) (+ x y)) a b))

vaddsbs source

Vector Add Signed Byte Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb01100000000
(defvx3 vaddsbs 768 "Vector Add Signed Byte Saturate"
  (vmap-sat 8 -128 127 (lambda (x y) (+ (sext 8 x) (sext 8 y))) a b))

vaddshs source

Vector Add Signed Halfword Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb01101000000
(defvx3 vaddshs 832 "Vector Add Signed Halfword Saturate"
  (vmap-sat 16 -32768 32767 (lambda (x y) (+ (sext 16 x) (sext 16 y))) a b))

vaddsws source

Vector Add Signed Word Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb01110000000
(defvx3 vaddsws 896 "Vector Add Signed Word Saturate"
  (vmap-sat 32 #x-80000000 #x7FFFFFFF (lambda (x y) (+ (sext 32 x) (sext 32 y))) a b))

vsububs source

Vector Subtract Unsigned Byte Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb11000000000
(defvx3 vsububs 1536 "Vector Subtract Unsigned Byte Saturate" (vmap-sat 8 0 255 (lambda (x y) (- x y)) a b))

vsubuhs source

Vector Subtract Unsigned Halfword Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb11001000000
(defvx3 vsubuhs 1600 "Vector Subtract Unsigned Halfword Saturate"
  (vmap-sat 16 0 #xFFFF (lambda (x y) (- x y)) a b))

vsubuws source

Vector Subtract Unsigned Word Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb11010000000
(defvx3 vsubuws 1664 "Vector Subtract Unsigned Word Saturate"
  (vmap-sat 32 0 #xFFFFFFFF (lambda (x y) (- x y)) a b))

vsubsbs source

Vector Subtract Signed Byte Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb11100000000
(defvx3 vsubsbs 1792 "Vector Subtract Signed Byte Saturate"
  (vmap-sat 8 -128 127 (lambda (x y) (- (sext 8 x) (sext 8 y))) a b))

vsubshs source

Vector Subtract Signed Halfword Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb11101000000
(defvx3 vsubshs 1856 "Vector Subtract Signed Halfword Saturate"
  (vmap-sat 16 -32768 32767 (lambda (x y) (- (sext 16 x) (sext 16 y))) a b))

vsubsws source

Vector Subtract Signed Word Saturate

313029282726252423222120191817161514131211109876543210
000100vdvavb11110000000
(defvx3 vsubsws 1920 "Vector Subtract Signed Word Saturate"
  (vmap-sat 32 #x-80000000 #x7FFFFFFF (lambda (x y) (- (sext 32 x) (sext 32 y))) a b))

vavgub source

Vector Average Unsigned Byte

313029282726252423222120191817161514131211109876543210
000100vdvavb10000000010
(defvx3 vavgub 1026 "Vector Average Unsigned Byte" (vmap 8 (lambda (x y) (ash (+ x y 1) -1)) a b))

vavguh source

Vector Average Unsigned Halfword

313029282726252423222120191817161514131211109876543210
000100vdvavb10001000010
(defvx3 vavguh 1090 "Vector Average Unsigned Halfword" (vmap 16 (lambda (x y) (ash (+ x y 1) -1)) a b))

vavguw source

Vector Average Unsigned Word

313029282726252423222120191817161514131211109876543210
000100vdvavb10010000010
(defvx3 vavguw 1154 "Vector Average Unsigned Word" (vmap 32 (lambda (x y) (ash (+ x y 1) -1)) a b))

vavgsb source

Vector Average Signed Byte

313029282726252423222120191817161514131211109876543210
000100vdvavb10100000010
(defvx3 vavgsb 1282 "Vector Average Signed Byte"
  (vmap 8 (lambda (x y) (ash (+ (sext 8 x) (sext 8 y) 1) -1)) a b))

vavgsh source

Vector Average Signed Halfword

313029282726252423222120191817161514131211109876543210
000100vdvavb10101000010
(defvx3 vavgsh 1346 "Vector Average Signed Halfword"
  (vmap 16 (lambda (x y) (ash (+ (sext 16 x) (sext 16 y) 1) -1)) a b))

vavgsw source

Vector Average Signed Word

313029282726252423222120191817161514131211109876543210
000100vdvavb10110000010
(defvx3 vavgsw 1410 "Vector Average Signed Word"
  (vmap 32 (lambda (x y) (ash (+ (sext 32 x) (sext 32 y) 1) -1)) a b))

vand source

Vector Logical AND

313029282726252423222120191817161514131211109876543210
000100vdvavb10000000100
(defvx3 vand 1028 "Vector Logical AND" (logand a b))

vandc source

Vector Logical AND with Complement

313029282726252423222120191817161514131211109876543210
000100vdvavb10001000100
(defvx3 vandc 1092 "Vector Logical AND with Complement" (logand a (wrap 128 (lognot b))))

vor source

Vector Logical OR

313029282726252423222120191817161514131211109876543210
000100vdvavb10010000100
(defvx3 vor 1156 "Vector Logical OR" (logior a b))

vxor source

Vector Logical XOR

313029282726252423222120191817161514131211109876543210
000100vdvavb10011000100
(defvx3 vxor 1220 "Vector Logical XOR" (logxor a b))

vnor source

Vector Logical NOR

313029282726252423222120191817161514131211109876543210
000100vdvavb10100000100
(defvx3 vnor 1284 "Vector Logical NOR" (wrap 128 (lognot (logior a b))))

vsel source

Vector Select

313029282726252423222120191817161514131211109876543210
000100vdvavbvc101010
(defva vsel 42 "Vector Select"
  (let ((c (vr vc))) (setf (vr vd) (logior (logand (vr vb) c) (logand (vr va) (wrap 128 (lognot c)))))))

vrlb source

Vector Rotate Left Byte

313029282726252423222120191817161514131211109876543210
000100vdvavb00000000100
(defvx3 vrlb 4 "Vector Rotate Left Byte" (vmap 8 (lambda (x y) (rotl 8 x y)) a b))

vrlh source

Vector Rotate Left Halfword

313029282726252423222120191817161514131211109876543210
000100vdvavb00001000100
(defvx3 vrlh 68 "Vector Rotate Left Halfword" (vmap 16 (lambda (x y) (rotl 16 x y)) a b))

vrlw source

Vector Rotate Left Word

313029282726252423222120191817161514131211109876543210
000100vdvavb00010000100
(defvx3 vrlw 132 "Vector Rotate Left Word" (vmap 32 (lambda (x y) (rotl 32 x y)) a b))

vslb source

Vector Shift Left Byte

313029282726252423222120191817161514131211109876543210
000100vdvavb00100000100
(defvx3 vslb 260 "Vector Shift Left Byte" (vmap 8 (lambda (x y) (wrap 8 (ash x (bit-field y 0 3)))) a b))

vslh source

Vector Shift Left Halfword

313029282726252423222120191817161514131211109876543210
000100vdvavb00101000100
(defvx3 vslh 324 "Vector Shift Left Halfword" (vmap 16 (lambda (x y) (wrap 16 (ash x (bit-field y 0 4)))) a b))

vslw source

Vector Shift Left Word

313029282726252423222120191817161514131211109876543210
000100vdvavb00110000100
(defvx3 vslw 388 "Vector Shift Left Word" (vmap 32 (lambda (x y) (wrap 32 (ash x (bit-field y 0 5)))) a b))

vsrb source

Vector Shift Right Byte

313029282726252423222120191817161514131211109876543210
000100vdvavb01000000100
(defvx3 vsrb 516 "Vector Shift Right Byte" (vmap 8 (lambda (x y) (ash x (- (bit-field y 0 3)))) a b))

vsrh source

Vector Shift Right Halfword

313029282726252423222120191817161514131211109876543210
000100vdvavb01001000100
(defvx3 vsrh 580 "Vector Shift Right Halfword" (vmap 16 (lambda (x y) (ash x (- (bit-field y 0 4)))) a b))

vsrw source

Vector Shift Right Word

313029282726252423222120191817161514131211109876543210
000100vdvavb01010000100
(defvx3 vsrw 644 "Vector Shift Right Word" (vmap 32 (lambda (x y) (ash x (- (bit-field y 0 5)))) a b))

vsrab source

Vector Shift Right Algebraic Byte

313029282726252423222120191817161514131211109876543210
000100vdvavb01100000100
(defvx3 vsrab 772 "Vector Shift Right Algebraic Byte"
  (vmap 8 (lambda (x y) (ash (sext 8 x) (- (bit-field y 0 3)))) a b))

vsrah source

Vector Shift Right Algebraic Halfword

313029282726252423222120191817161514131211109876543210
000100vdvavb01101000100
(defvx3 vsrah 836 "Vector Shift Right Algebraic Halfword"
  (vmap 16 (lambda (x y) (ash (sext 16 x) (- (bit-field y 0 4)))) a b))

vsraw source

Vector Shift Right Algebraic Word

313029282726252423222120191817161514131211109876543210
000100vdvavb01110000100
(defvx3 vsraw 900 "Vector Shift Right Algebraic Word"
  (vmap 32 (lambda (x y) (ash (sext 32 x) (- (bit-field y 0 5)))) a b))

Made from xspe at b2fac33349db by tools/gen-xspe.py. xspe is GPL-3.0-or-later.