Jump to content

IF-free conception.


SarK0Y

Recommended Posts

Good Time to all, Amici(Friends).

Here, i'd like to discuss how to reduce conditional branches in the code. 1st of the all, i would like to share some tricks. Their description is here smile.png
-----------------------
Thanks in Advance for attention of Yours.

Link to comment
Share on other sites

It is sometimes useful to suppress IF, and is accordingly already done. Essentially in vector processors, which have one instruction unit hence can't reasonably branch depending on tests on every data processed in parallel.

 

Programmers used similar tricks very early, but now these processors have conditional instructions, dispatched once by the single instruction unit to all processing units, to act differently on data based on idividual conditions. A typical such instruction is a conditional store.

Link to comment
Share on other sites

It is sometimes useful to suppress IF, and is accordingly already done. Essentially in vector processors, which have one instruction unit hence can't reasonably branch depending on tests on every data processed in parallel.

 

Programmers used similar tricks very early, but now these processors have conditional instructions, dispatched once by the single instruction unit to all processing units, to act differently on data based on idividual conditions. A typical such instruction is a conditional store.

Nothing is new at all under Moon wink.png Actually, it'd be useful, if IF-structure could be converted into such forms with compilers smile.png however, in many cases, it's quite tricky to overcome IFs.

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.