This is sort of intriguing for me. I couldn't find any saturation instructions using general purpose register in ARMv8. However, there are saturation instructions for Neon registers I couldn't find the same involving general purpose register. Can anyone suggest the alternative of implementing such instructions such as QSUB in ARMv8 architecture?
All the saturating and DSP type instructions using the general registers were dropped in the 64 bit ARMv8 instruction set, anything like that has to be done using the SIMD facility or a sequence of instructions. There's been a few queries about that if you search for 'saturating'.
In C you can use __builtin_ssub_overflow to check for overflow and set the result appropriately without needing strange sequences of logical operations.
Thanks a lot for the answer. Don't you think that involving SIMD registers will increase the number of instructions as well as the cycles required for executing the code? What was being achieved by only a single instruction requires three to four instruction. Isn't that a sort of overhead or am I missing something?
Those operations were mostly used for DSP type work like mixing audio, and the SIMD is good for that as it can do a number of the operations in parallel. Do you have some idea in mind where it would only deal with one value at at time and the job is big?