[Mesa-dev] [PATCH 3/3] nir/opt_constant_folding: fix folding of 8 and 16 bit ints
Signed-off-by: Karol Herbst --- src/compiler/nir/nir_opt_constant_folding.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c index d6be807b3dc..a848b145874 100644 --- a/src/compiler/nir/nir_opt_constant_folding.c +++ b/src/compiler/nir/nir_opt_constant_folding.c @@ -76,10 +76,20 @@ constant_fold_alu_instr(nir_alu_instr *instr, void *mem_ctx) for (unsigned j = 0; j < nir_ssa_alu_instr_src_components(instr, i); j++) { - if (load_const->def.bit_size == 64) + switch(load_const->def.bit_size) { + case 64: src[i].u64[j] = load_const->value.u64[instr->src[i].swizzle[j]]; - else +break; + case 32: src[i].u32[j] = load_const->value.u32[instr->src[i].swizzle[j]]; +break; + case 16: +src[i].u16[j] = load_const->value.u16[instr->src[i].swizzle[j]]; +break; + case 8: +src[i].u8[j] = load_const->value.u8[instr->src[i].swizzle[j]]; +break; + } } /* We shouldn't have any source modifiers in the optimization loop. */ -- 2.14.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] nir/opt_constant_folding: fix folding of 8 and 16 bit ints
I've already got to the same code addressing Jason feedback about "[PATCH 06/11] nir/constant_folding: support 16-bit constants." So this is: Reviewed-by: Jose Maria Casanova Crespo El 25/04/18 a las 11:14, Karol Herbst escribió: > Signed-off-by: Karol Herbst > --- > src/compiler/nir/nir_opt_constant_folding.c | 14 -- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/src/compiler/nir/nir_opt_constant_folding.c > b/src/compiler/nir/nir_opt_constant_folding.c > index d6be807b3dc..a848b145874 100644 > --- a/src/compiler/nir/nir_opt_constant_folding.c > +++ b/src/compiler/nir/nir_opt_constant_folding.c > @@ -76,10 +76,20 @@ constant_fold_alu_instr(nir_alu_instr *instr, void > *mem_ctx) > >for (unsigned j = 0; j < nir_ssa_alu_instr_src_components(instr, i); > j++) { > - if (load_const->def.bit_size == 64) > + switch(load_const->def.bit_size) { > + case 64: > src[i].u64[j] = load_const->value.u64[instr->src[i].swizzle[j]]; > - else > +break; > + case 32: > src[i].u32[j] = load_const->value.u32[instr->src[i].swizzle[j]]; > +break; > + case 16: > +src[i].u16[j] = load_const->value.u16[instr->src[i].swizzle[j]]; > +break; > + case 8: > +src[i].u8[j] = load_const->value.u8[instr->src[i].swizzle[j]]; > +break; > + } >} > >/* We shouldn't have any source modifiers in the optimization loop. */ > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] nir/opt_constant_folding: fix folding of 8 and 16 bit ints
On Wed, Apr 25, 2018 at 1:50 PM, Chema Casanova wrote: > I've already got to the same code addressing Jason feedback about > "[PATCH 06/11] nir/constant_folding: support 16-bit constants." > okay, will push then as soon as possible, so that you don't have to wait. > So this is: > > Reviewed-by: Jose Maria Casanova Crespo > > El 25/04/18 a las 11:14, Karol Herbst escribió: >> Signed-off-by: Karol Herbst >> --- >> src/compiler/nir/nir_opt_constant_folding.c | 14 -- >> 1 file changed, 12 insertions(+), 2 deletions(-) >> >> diff --git a/src/compiler/nir/nir_opt_constant_folding.c >> b/src/compiler/nir/nir_opt_constant_folding.c >> index d6be807b3dc..a848b145874 100644 >> --- a/src/compiler/nir/nir_opt_constant_folding.c >> +++ b/src/compiler/nir/nir_opt_constant_folding.c >> @@ -76,10 +76,20 @@ constant_fold_alu_instr(nir_alu_instr *instr, void >> *mem_ctx) >> >>for (unsigned j = 0; j < nir_ssa_alu_instr_src_components(instr, i); >> j++) { >> - if (load_const->def.bit_size == 64) >> + switch(load_const->def.bit_size) { >> + case 64: >> src[i].u64[j] = load_const->value.u64[instr->src[i].swizzle[j]]; >> - else >> +break; >> + case 32: >> src[i].u32[j] = load_const->value.u32[instr->src[i].swizzle[j]]; >> +break; >> + case 16: >> +src[i].u16[j] = load_const->value.u16[instr->src[i].swizzle[j]]; >> +break; >> + case 8: >> +src[i].u8[j] = load_const->value.u8[instr->src[i].swizzle[j]]; >> +break; >> + } >>} >> >>/* We shouldn't have any source modifiers in the optimization loop. */ >> ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] nir/opt_constant_folding: fix folding of 8 and 16 bit ints
Rb On April 25, 2018 05:14:20 Karol Herbst wrote: Signed-off-by: Karol Herbst --- src/compiler/nir/nir_opt_constant_folding.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c index d6be807b3dc..a848b145874 100644 --- a/src/compiler/nir/nir_opt_constant_folding.c +++ b/src/compiler/nir/nir_opt_constant_folding.c @@ -76,10 +76,20 @@ constant_fold_alu_instr(nir_alu_instr *instr, void *mem_ctx) for (unsigned j = 0; j < nir_ssa_alu_instr_src_components(instr, i); j++) { - if (load_const->def.bit_size == 64) + switch(load_const->def.bit_size) { + case 64: src[i].u64[j] = load_const->value.u64[instr->src[i].swizzle[j]]; - else +break; + case 32: src[i].u32[j] = load_const->value.u32[instr->src[i].swizzle[j]]; +break; + case 16: +src[i].u16[j] = load_const->value.u16[instr->src[i].swizzle[j]]; +break; + case 8: +src[i].u8[j] = load_const->value.u8[instr->src[i].swizzle[j]]; +break; + } } /* We shouldn't have any source modifiers in the optimization loop. */ -- 2.14.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev