vbcdsub
Vector BCD Subtract
vbcdsub vD, vA, vB, PS
Subtracts two BCD vectors.
Details
Subtracts the second BCD vector from the first 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.
Pseudocode 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]
diff ← BCD_digit_A - BCD_digit_B
if diff < 0 then
diff ← diff + 10
vD[i*4:i*4+3] ← diff[3:0]
end
if PS then
apply_sign_to_vD()
end
Example
vbcdsub vd, va, vb, 0
Encoding
Binary Layout
4
0
vD
6
vA
11
vB
16
65
21
Operands
-
vD
Target -
vA
Src A -
vB
Src B -
PS
Sign