TriCore
®
TC1.6P & TC1.6E
32-bit Unified Processor Core
Instruction Set
V1.0 2013-07
User Manual (Volume 2) 3-3
ABS.B
Absolute Value Packed Byte
ABS.H
Absolute Value Packed Half-word
Description
Put the absolute value of each byte (ABS.B) or half-word (ABS.H) in data register D[b] into the corresponding byte
or half-word of data register D[c]. The operands are treated as signed, 8-bit or 16-bit integers.
The overflow condition is calculated for each byte or half-word of the packed quantity.
ABS.BD[c], D[b] (RR)
result_byte3 = (D[b][31:24] >= 0) ? D[b][31:24] : (0 - D[b][31:24]);
result_byte2 = (D[b][23:16] >= 0) ? D[b][23:16] : (0 - D[b][23:16]);
result_byte1 = (D[b][15:8] >= 0) ? D[b][15:8] : (0 - D[b][15:8]);
result_byte0 = (D[b][7:0] >= 0) ? D[b][7:0] : (0 - D[b][7:0]);
D[c] = {result_byte3[7:0], result_byte2[7:0], result_byte1[7:0], result_byte0[7:0]};
ABS.HD[c], D[b] (RR)
result_halfword1 = (D[b][31:16] >= 0) ? D[b][31:16] : (0 - D[b][31:16]);
result_halfword0 = (D[b][15:0] >= 0) ? D[b][15:0] : (0 - D[b][15:0]);
D[c] = {result_halfword1[15:0], result_halfword0[15:0]};
Status Flags
C Not set by these instructions.
VABS.B
ov_byte3 = (result_byte3 > 7F
H
) OR (result_byte3 < -80
H
);
ov_byte2 = (result_byte2 > 7F
H
) OR (result_byte2 < -80
H
);
ov_byte1 = (result_byte1 > 7F
H
) OR (result_byte1 < -80
H
);
ov_byte0 = (result_byte0 > 7F
H
) OR (result_byte0 < -80
H
);
overflow = ov_byte3 OR ov_byte2 OR ov_byte1 OR ov_byte0;
if (overflow) then PSW.V = 1 else PSW.V = 0;
ABS.H
ov_halfword1 = (result_halfword1 > 7FFF
H
) OR (result_halfword1 < -8000
H
);
ov_halfword0 = (result_halfword0 > 7FFF
H
) OR (result_halfword0 < -8000
H
);
overflow = ov_halfword1 OR ov_halfword0;
if (overflow) then PSW.V = 1 else PSW.V = 0;
SV if (overflow) then PSW.SV = 1 else PSW.SV = PSW.SV;
31
c
28 27
5C
H
20 19
-
18 17
-
16 15
b
12 11
-
8 7
0B
H
0
31
c
28 27
7C
H
20 19
-
18 17
-
16 15
b
12 11
-
8 7
0B
H
0