VABSDIFF : Integer Byte/Short Absolute Difference

Format

SPA 5.0:
        {@{!}Pg}   VABSDIFF{.dfmt}{.safmt.sbfmt}{.SAT}{.op2}   Rd{.CC}, Ra{.partselA}, Rb{.partselB}, Rc   {&req_6}   {?sched}   ;   
        {@{!}Pg}   VABSDIFF{.dfmt}{.safmt.ifmt}{.SAT}{.op2}    Rd{.CC}, Ra{.partselA}, #imm16,        Rc   {&req_6}   {?sched}   ;   

 .dfmt:       { .UD*, .SD }
              Destination format (unsigned or signed)

 .safmt:      { .U32, .S32*, .U16, .S16, .U8, .S8 }
 .sbfmt:      { .U32, .S32*, .U16, .S16, .U8, .S8 } 
 .ifmt:       {              .U16, .S16*          } 
              Source formats

 .SAT:        Saturate destination based on .op2 and .dfmt

 .op2:        { .PASS*, .MRG_16H, .MRG_16L, .MRG_8B0, .MRG_8B2, .ACC, .MIN, .MAX}

 .CC:         Write condition codes

 .partselA:   if (.U8|.S8)   { .B0*, .B1, .B2, .B3 }
              if (.U16|.S16) { .H0*, .H1 }

 .partselB:   if (.U8|.S8)   { .B0*, .B1, .B2, .B3 } 
              if (.U16|.S16) { .H0*, .H1 }

Description

Calculate the absolute value of the difference between Ra and Sb with optional second stage operation and optional saturate.

Basic math operation:

Both inputs are are first promoted to S33 (based on their individual .S or .U format), then the absolute difference (tmp = |Ra - Sb|) is done, producing a U33 result. The intermediate result is promoted to S34 for subsequent processing.

Examples:

VABSDIFF.ACC         R0,  R1,     R2, R3;   # R0 = |R1    -  R2 | + R3
VABSDIFF.U16.S16.ACC R0,  R1, 0xfffe, R3;   # R0 = |R1.H0 - (-2)| + R3

Back to Index of Instructions