This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NEON conditional execution

Note: This was originally posted on 17th February 2012 at http://forums.arm.com

Hi, I would like to perform the following operation simultaneously on 8x16bits registers:

Q0 = Q0 + Q1
if (Q0 >= Q2) Q0 = Q3

I am not clear if this is possible to do that ?
In normal mode, I know it is since the mov can be conditional, but in SIMD I don't know.
Parents
  • Note: This was originally posted on 23rd February 2012 at http://forums.arm.com


    Does my sample too easy or is it always possible to eval a conditional expression without any branch (only with conditional instruction) ?

    You can generate all other boolean operations from AND and NOT (just do a truth table to quickly verify)
    The only issue I see could be code readability when you have only AND and NOT.

    If you saw   if (!(!A && !B )) in your code instead of your original  if ( A || B ), it's not very good looking.
    When I write asm code, I always put a comment on each line to describe what it does, so it's not really an issue...

    So yes, I think it is always possible to evaluate a boolean expression, without having to do any branch to perform that evaluation and generate the final 1bit result. From experience, most tests and most operations related to that test are fairly simple in DSP algorithms, that is where I find NEON not super efficient with its VCxx and VBIT instructions. The worse thing being the use of whole registers that are often very precious.

    All that said, I prefer to have something that is not the best but does the job, than nothing at all ...
    So I'm happy we can at least do some form of conditional execution with NEON !
Reply
  • Note: This was originally posted on 23rd February 2012 at http://forums.arm.com


    Does my sample too easy or is it always possible to eval a conditional expression without any branch (only with conditional instruction) ?

    You can generate all other boolean operations from AND and NOT (just do a truth table to quickly verify)
    The only issue I see could be code readability when you have only AND and NOT.

    If you saw   if (!(!A && !B )) in your code instead of your original  if ( A || B ), it's not very good looking.
    When I write asm code, I always put a comment on each line to describe what it does, so it's not really an issue...

    So yes, I think it is always possible to evaluate a boolean expression, without having to do any branch to perform that evaluation and generate the final 1bit result. From experience, most tests and most operations related to that test are fairly simple in DSP algorithms, that is where I find NEON not super efficient with its VCxx and VBIT instructions. The worse thing being the use of whole registers that are often very precious.

    All that said, I prefer to have something that is not the best but does the job, than nothing at all ...
    So I'm happy we can at least do some form of conditional execution with NEON !
Children
No data