From: Jason Ekstrand Date: Wed, 27 Mar 2019 23:31:01 +0000 (-0500) Subject: nir/load_const_to_scalar: Get rid of a bit size switch statement X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c4b28d1730e9322821847a94bac2ee4ac60d8617;p=mesa.git nir/load_const_to_scalar: Get rid of a bit size switch statement Now that nir_const_value is a scalar, we don't need the switch on bit size in order to pluck off components properly. Reviewed-by: Karol Herbst --- diff --git a/src/compiler/nir/nir_lower_load_const_to_scalar.c b/src/compiler/nir/nir_lower_load_const_to_scalar.c index 47dc83613ef..a65dcb06d0c 100644 --- a/src/compiler/nir/nir_lower_load_const_to_scalar.c +++ b/src/compiler/nir/nir_lower_load_const_to_scalar.c @@ -50,25 +50,7 @@ lower_load_const_instr_scalar(nir_load_const_instr *lower) for (unsigned i = 0; i < lower->def.num_components; i++) { nir_load_const_instr *load_comp = nir_load_const_instr_create(b.shader, 1, lower->def.bit_size); - switch (lower->def.bit_size) { - case 64: - load_comp->value[0].u64 = lower->value[i].u64; - break; - case 32: - load_comp->value[0].u32 = lower->value[i].u32; - break; - case 16: - load_comp->value[0].u16 = lower->value[i].u16; - break; - case 8: - load_comp->value[0].u8 = lower->value[i].u8; - break; - case 1: - load_comp->value[0].b = lower->value[i].b; - break; - default: - assert(!"invalid bit size"); - } + load_comp->value[0] = lower->value[i]; nir_builder_instr_insert(&b, &load_comp->instr); loads[i] = &load_comp->def; }