Re: [Mesa-dev] [PATCH 1/3] nir: support converting to 8-bit integers in nir_type_conversion_op

2018-04-25 Thread Jason Ekstrand



On April 25, 2018 05:14:17 Karol Herbst  wrote:

Signed-off-by: Karol Herbst 
---
src/compiler/nir/nir_opcodes_c.py | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opcodes_c.py 
b/src/compiler/nir/nir_opcodes_c.py

index c19185534af..8afccca9504 100644
--- a/src/compiler/nir/nir_opcodes_c.py
+++ b/src/compiler/nir/nir_opcodes_c.py
@@ -62,7 +62,12 @@ nir_type_conversion_op(nir_alu_type src, nir_alu_type 
dst, nir_rounding_mode rnd

% endif
%  endif
switch (dst_bit_size) {
-% for dst_bits in [16, 32, 64]:
+% if dst_t == 'float':
+<%bit_sizes = [16, 32, 64] %>

The <% can be indented. It doesn't have to be at the start of the line.  
Doesn't really matter that much though.



+% else:
+<%bit_sizes = [8, 16, 32, 64] %>
+% endif
+% for dst_bits in bit_sizes:

You could also do
%if dst_t == 'float' and dst_bits == 8:
<% continue %>

I'm not sure which is better.  What you did is fine.  Rb


case ${dst_bits}:
%if src_t == 'float' and dst_t == 'float' and dst_bits 
== 16:

switch(rnd) {
--
2.14.3



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] nir: support converting to 8-bit integers in nir_type_conversion_op

2018-04-25 Thread Chema Casanova
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_opcodes_c.py | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compiler/nir/nir_opcodes_c.py 
> b/src/compiler/nir/nir_opcodes_c.py
> index c19185534af..8afccca9504 100644
> --- a/src/compiler/nir/nir_opcodes_c.py
> +++ b/src/compiler/nir/nir_opcodes_c.py
> @@ -62,7 +62,12 @@ nir_type_conversion_op(nir_alu_type src, nir_alu_type dst, 
> nir_rounding_mode rnd
>  % endif
>  %  endif
> switch (dst_bit_size) {
> -% for dst_bits in [16, 32, 64]:
> +% if dst_t == 'float':
> +<%bit_sizes = [16, 32, 64] %>
> +% else:
> +<%bit_sizes = [8, 16, 32, 64] %>
> +% endif
> +% for dst_bits in bit_sizes:
>case ${dst_bits}:
>  %if src_t == 'float' and dst_t == 'float' and dst_bits 
> == 16:
>   switch(rnd) {
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] nir: support converting to 8-bit integers in nir_type_conversion_op

2018-04-25 Thread Karol Herbst
Signed-off-by: Karol Herbst 
---
 src/compiler/nir/nir_opcodes_c.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opcodes_c.py 
b/src/compiler/nir/nir_opcodes_c.py
index c19185534af..8afccca9504 100644
--- a/src/compiler/nir/nir_opcodes_c.py
+++ b/src/compiler/nir/nir_opcodes_c.py
@@ -62,7 +62,12 @@ nir_type_conversion_op(nir_alu_type src, nir_alu_type dst, 
nir_rounding_mode rnd
 % endif
 %  endif
switch (dst_bit_size) {
-% for dst_bits in [16, 32, 64]:
+% if dst_t == 'float':
+<%bit_sizes = [16, 32, 64] %>
+% else:
+<%bit_sizes = [8, 16, 32, 64] %>
+% endif
+% for dst_bits in bit_sizes:
   case ${dst_bits}:
 %if src_t == 'float' and dst_t == 'float' and dst_bits == 
16:
  switch(rnd) {
-- 
2.14.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev