3 # Scalar OpenPOWER Audio and Video Opcodes
5 the fundamental principle of SV is a hardware for-loop. therefore the first (and in nearly 100% of cases only) place to put Vector operations is first and foremost in the *scalar* ISA. However only by analysing those scalar opcodes *in* a SV Vectorisation context does it become clear why they are needed and how they may be designed.
7 This page therefore has accompanying discussion at <https://bugs.libre-soc.org/show_bug.cgi?id=230> for evolution of suitable opcodes.
11 * <https://bugs.libre-soc.org/show_bug.cgi?id=915> add overflow to maxmin.
12 * <https://bugs.libre-soc.org/show_bug.cgi?id=863> add pseudocode etc.
13 * <https://bugs.libre-soc.org/show_bug.cgi?id=234> hardware implementation
14 * <https://bugs.libre-soc.org/show_bug.cgi?id=910> mins/maxs zero-option?
17 * [[openpower/isa/av]] pseudocode
18 * [[av_opcodes/analysis]]
19 * TODO review HP 1994-6 PA-RISC MAX <https://en.m.wikipedia.org/wiki/Multimedia_Acceleration_eXtensions>
20 * <https://en.m.wikipedia.org/wiki/Sum_of_absolute_differences>
21 * List of MMX instructions <https://cs.fit.edu/~mmahoney/cse3101/mmx.html>
25 In-advance, the summary of base scalar operations that need to be added is:
27 | instruction | pseudocode |
28 | ------------ | ------------------------ |
29 | average-add. | result = (src1 + src2 + 1) >> 1 |
30 | abs-diff | result = abs (src1-src2) |
31 | abs-accumulate| result += abs (src1-src2) |
32 | (un)signed min| result = (src1 < src2) ? src1 : src2 |
33 | (un)signed max| result = (src1 > src2) ? src1 : src2 |
34 | bitwise sel | (a ? b : c) - use [[sv/bitmanip]] ternary |
35 | int/fp move | covered by REMAP and Pack/Unpack |
37 Implemented at the [[openpower/isa/av]] pseudocode page.
39 All other capabilities (saturate in particular) are achieved with [[sv/svp64]] modes and swizzle. Note that minmax and ternary are added in bitmanip.
47 * avgadd RT,RA,RB (Rc=0)
48 * avgadd. RT,RA,RB (Rc=1)
59 Special Registers Altered:
63 ## Absolute Signed Difference
67 * absds RT,RA,RB (Rc=0)
68 * absds. RT,RA,RB (Rc=1)
72 if (RA) < (RB) then RT <- ¬(RA) + (RB) + 1
73 else RT <- ¬(RB) + (RA) + 1
75 Special Registers Altered:
79 ## Absolute Unsigned Difference
83 * absdu RT,RA,RB (Rc=0)
84 * absdu. RT,RA,RB (Rc=1)
88 if (RA) <u (RB) then RT <- ¬(RA) + (RB) + 1
89 else RT <- ¬(RB) + (RA) + 1
91 Special Registers Altered:
95 ## Absolute Accumulate Unsigned Difference
99 * absdacu RT,RA,RB (Rc=0)
100 * absdacu. RT,RA,RB (Rc=1)
104 if (RA) <u (RB) then r <- ¬(RA) + (RB) + 1
105 else r <- ¬(RB) + (RA) + 1
108 Special Registers Altered:
112 ## Absolute Accumulate Signed Difference
116 * absdacs RT,RA,RB (Rc=0)
117 * absdacs. RT,RA,RB (Rc=1)
121 if (RA) < (RB) then r <- ¬(RA) + (RB) + 1
122 else r <- ¬(RB) + (RA) + 1
125 Special Registers Altered: