PTX ISA v9.4

9.7.1.8. Integer Arithmetic Instructions: sad

sad

Sum of absolute differences.

Syntax

ptx
sad.type  d, a, b, c;

.type = { .u16, .u32, .u64,
          .s16, .s32, .s64 };

Description

Adds the absolute value of a-b to c and writes the resulting value into d.

Semantics

ptx
d = c + ((a<b) ? b-a : a-b);

PTX ISA Notes

Introduced in PTX ISA version 1.0.

Target ISA Notes

Supported on all target architectures.

Examples

ptx
sad.s32  d,a,b,c;
sad.u32  d,a,b,d;  // running sum
esc
Type to search across all documentation