vbcdadd
Vector BCD Add
vbcdadd vD, vA, vB, PS
Adds two BCD (Binary Coded Decimal) vectors.
Encoding
Binary Layout
4
0:5
vD
6:10
vA
11:15
vB
16:20
1
21:31
Operands
-
vD
Target -
vA
Src A -
vB
Src B -
PS
Sign
Example
vbcdadd vd, va, vb, 0
Related
More in Vector Crypto
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
Adds two Binary Coded Decimal (BCD) vectors element-wise and stores the result in the destination vector. The PS field specifies the preferred sign convention for the result. This instruction requires the Vector Crypto extension and does not directly affect condition registers.
Operation
for i in 0 to 15 do
BCD_digit_A ← vA[i*4:i*4+3]
BCD_digit_B ← vB[i*4:i*4+3]
sum ← BCD_digit_A + BCD_digit_B
if sum > 9 then
sum ← sum + 6
vD[i*4:i*4+3] ← sum[3:0]
end
if PS then
apply_sign_to_vD()
end