From 4b0606e0a7c3260e761137246923f453dcf1efe1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 11 Jul 2016 11:20:02 -0700 Subject: [PATCH] glsl: Use _mesa_bitcount to implement constant ir_unop_bit_count Signed-off-by: Ian Romanick Reviewed-by: Matt Turner --- src/compiler/glsl/ir_constant_expression.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp index 2664fefbc45..01a7224f470 100644 --- a/src/compiler/glsl/ir_constant_expression.cpp +++ b/src/compiler/glsl/ir_constant_expression.cpp @@ -1500,15 +1500,8 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) break; case ir_unop_bit_count: - for (unsigned c = 0; c < components; c++) { - unsigned count = 0; - unsigned v = op[0]->value.u[c]; - - for (; v; count++) { - v &= v - 1; - } - data.u[c] = count; - } + for (unsigned c = 0; c < components; c++) + data.i[c] = _mesa_bitcount(op[0]->value.u[c]); break; case ir_unop_find_msb: -- 2.30.2