TriCore
®
TC1.6P & TC1.6E
32-bit Unified Processor Core
Instruction Set
V1.0 2013-07
User Manual (Volume 2) 3-5
ABSDIF
Absolute Value of Difference
Description
Put the absolute value of the difference between D[a] and either D[b] (instruction format RR) or const9 (instruction
format RC) in D[c]; i.e. if the contents of data register D[a] are greater than either D[b] (format RR) or const9 (format
RC), then subtract D[b] (format RR) or const9 (format RC) from D[a] and put the result in data register D[c];
otherwise subtract D[a] from either D[b] (format RR) or const9 (format RC) and put the result in D[c]. The operands
are treated as signed 32-bit integers, and the const9 value is sign-extended.
ABSDIFD[c], D[a], const9 (RC)
result = (D[a] > sign_ext(const9)) ? D[a] - sign_ext(const9) : sign_ext(const9) - D[a];
D[c] = result[31:0];
ABSDIFD[c], D[a], D[b] (RR)
result = (D[a] > D[b]) ? D[a] - D[b] : D[b] - D[a];
D[c] = result[31:0];
Status Flags
Examples
absdif d3, d1, d2
absdif d3, d1, #126
See Also
ABS, ABSS, ABSDIFS
C Not set by this instruction.
V overflow = (result > 7FFFFFFF
H
) OR (result < -80000000
H
);
if (overflow) then PSW.V = 1 else PSW.V = 0;
SV if (overflow) then PSW.SV = 1 else PSW.SV = PSW.SV;
AV advanced_overflow = result[31] ^ result[30];
if (advanced_overflow) then PSW.AV = 1 else PSW.AV = PSW.0;
SAV if (advanced_overflow) then PSW.SAV = 1 else PSW.SAV = PSW.SAV;
31
c
28 27
0E
H
21 20
const9
12 11
a
8 7
8B
H
0
31
c
28 27
0E
H
20 19
-
18 17
-
16 15
b
12 11
a
8 7
0B
H
0