util: Move util_is_power_of_two to bitscan.h and rename to util_is_power_of_two_or_zero

The new name make the zero-input behavior more obvious.  The next
patch adds a new function with different zero-input behavior.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Suggested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
This commit is contained in:
Ian Romanick
2017-11-13 11:17:41 -08:00
parent a3a16d4aa7
commit d76c204d05
37 changed files with 79 additions and 73 deletions

View File

@@ -313,7 +313,7 @@ static struct qreg
ntq_get_alu_src(struct vc4_compile *c, nir_alu_instr *instr,
unsigned src)
{
assert(util_is_power_of_two(instr->dest.write_mask));
assert(util_is_power_of_two_or_zero(instr->dest.write_mask));
unsigned chan = ffs(instr->dest.write_mask) - 1;
struct qreg r = ntq_get_src(c, instr->src[src].src,
instr->src[src].swizzle[chan]);
@@ -1363,7 +1363,7 @@ ntq_emit_alu(struct vc4_compile *c, nir_alu_instr *instr)
/* We have a scalar result, so the instruction should only have a
* single channel written to.
*/
assert(util_is_power_of_two(instr->dest.write_mask));
assert(util_is_power_of_two_or_zero(instr->dest.write_mask));
ntq_store_dest(c, &instr->dest.dest,
ffs(instr->dest.write_mask) - 1, result);
}