TriCore
®
TC1.6P & TC1.6E
32-bit Unified Processor Core
Instruction Set
V1.0 2013-07
User Manual (Volume 2) 3-370
SUB.B
Subtract Packed Byte
SUB.H
Subtract Packed Half-word
Description
Subtract the contents of each byte or half-word of data register D[b] from the contents of data register D[a]. Put
the result in each corresponding byte or half-word of data register D[c].
SUB.BD[c], D[a], D[b] (RR)
result_byte3 = D[a][31:24] - D[b][31:24];
result_byte2 = D[a][23:16] - D[b][23:16];
result_byte1 = D[a][15:8] - D[b][15:8];
result_byte0 = D[a][7:0] - D[b][7:0];
D[c] = {result_byte3[7:0], result_byte2[7:0], result_byte1[7:0], result_byte0[7:0]};
SUB.HD[c], D[a], D[b] (RR)
result_halfword1 = D[a][31:16] - D[b][31:16];
result_halfword0 = D[a][15:0] - D[b][15:0];
D[c] = {result_halfword1[15:0], result_halfword0[15:0]};
Status Flags
C Not set by these instructions.
VSUB.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;
SUB.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
48
H
20 19
-
18 17
-
16 15
b
12 11
a
8 7
0B
H
0
31
c
28 27
68
H
20 19
-
18 17
-
16 15
b
12 11
a
8 7
0B
H
0