halide/Halide — pull request #445 by DanielHeck (2014-09-02 13:09:02+00:00)
Title: Change Target::Features from bit masks to a plain enumeration.

A dedicated BitSet class is used to store the set of active features (currently using a uint64).
- it's much easier to add or remove features, or to bring them in a more logical order
- has_feature(...) arguably easier to read and harder to get wrong than equivalent code using bit manipulation

Case in point: the following bug in CodeGen_X86.cpp effectively prevented packusdw instructions from being generated (fixed in this PR):

if (!(target.features | Target::SSE41) && pattern.needs_sse_41) continue;

Operators | and |= are overloaded to make it easier to specify multiple features. I'm undecided whether this is a good idea or a more explicit API using methods such as "set" or "add_feature" would be better.