<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 13, 2018 at 2:39 PM, Rob Clark <span dir="ltr"><<a href="mailto:robdclark@gmail.com" target="_blank">robdclark@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Rob Clark <<a href="mailto:robdclark@gmail.com">robdclark@gmail.com</a>><br>
---<br>
Now with switch (and also u64<-u64 copy instead of f64<-f64 for 64b)..<br>
<br>
src/compiler/nir/nir_lower_<wbr>load_const_to_scalar.c | 19 +++++++++++++++----<br>
1 file changed, 15 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_lower_<wbr>load_const_to_scalar.c b/src/compiler/nir/nir_lower_<wbr>load_const_to_scalar.c<br>
index e494facfd21..39447d42c23 100644<br>
--- a/src/compiler/nir/nir_lower_<wbr>load_const_to_scalar.c<br>
+++ b/src/compiler/nir/nir_lower_<wbr>load_const_to_scalar.c<br>
@@ -50,11 +50,22 @@ lower_load_const_instr_scalar(<wbr>nir_load_const_instr *lower)<br>
for (unsigned i = 0; i < lower->def.num_components; i++) {<br>
nir_load_const_instr *load_comp =<br>
nir_load_const_instr_create(b.<wbr>shader, 1, lower->def.bit_size);<br>
- if (lower->def.bit_size == 64)<br>
- load_comp->value.f64[0] = lower->value.f64[i];<br>
- else<br>
+ switch (lower->def.bit_size) {<br>
+ case 64:<br>
+ load_comp->value.u64[0] = lower->value.u64[i];<br>
+ break;<br>
+ case 32:<br>
load_comp->value.u32[0] = lower->value.u32[i];<br>
- assert(lower->def.bit_size == 64 || lower->def.bit_size == 32);<br>
+ break;<br>
+ case 16:<br>
+ load_comp->value.u16[0] = lower->value.u16[i];<br>
+ break;<br>
+ case 8:<br>
+ load_comp->value.u8[0] = lower->value.u8[i];<br>
+ break;<br>
+ default:<br>
+ assert(!"invalid bit size");<br>
+ }<br>
nir_builder_instr_insert(&b, &load_comp->instr);<br>
loads[i] = &load_comp->def;<br>
}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.3<br>
<br>
</font></span></blockquote></div><br></div></div></div>