<div dir="ltr"><div>Samuel sent out a patch to fix this already which I've reviewed.  Feel free to merge it.  I gave him comments on the second so maybe best to leave that one be.<br><br></div>That said, I do sort-of like your macro...<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 14, 2018 at 8:08 AM, 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">These opcodes don't care about src/dst type, only src/dst size.<br>
<br>
Signed-off-by: Rob Clark <<a href="mailto:robdclark@gmail.com">robdclark@gmail.com</a>><br>
---<br>
 src/compiler/spirv/vtn_alu.c | 14 ++++++++++----<br>
 1 file changed, 10 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c<br>
index f0b69b38f83..1ca1f951200 100644<br>
--- a/src/compiler/spirv/vtn_alu.c<br>
+++ b/src/compiler/spirv/vtn_alu.c<br>
@@ -349,11 +349,17 @@ vtn_nir_alu_op_for_spirv_<wbr>opcode(struct vtn_builder *b,<br>
<br>
    /* Conversions: */<br>
    case SpvOpQuantizeToF16:         return nir_op_fquantize2f16;<br>
+<br>
+#define nir_type_cast(type, basetype) (nir_alu_type_get_type_size(<wbr>type) | nir_type_ ## basetype)<br>
+#define typed_conversion_op(src, srctype, dst, dsttype) \<br>
+      nir_type_conversion_op(nir_<wbr>type_cast(src, srctype), nir_type_cast(dst, dsttype), nir_rounding_mode_undef)<br>
+<br>
+   case SpvOpConvertFToU:  return typed_conversion_op(src, float, dst,  uint);<br>
+   case SpvOpConvertFToS:  return typed_conversion_op(src, float, dst,   int);<br>
+   case SpvOpConvertSToF:  return typed_conversion_op(src,   int, dst, float);<br>
+   case SpvOpConvertUToF:  return typed_conversion_op(src,  uint, dst, float);<br>
+<br>
    case SpvOpUConvert:<br>
-   case SpvOpConvertFToU:<br>
-   case SpvOpConvertFToS:<br>
-   case SpvOpConvertSToF:<br>
-   case SpvOpConvertUToF:<br>
    case SpvOpSConvert:<br>
    case SpvOpFConvert:<br>
       return nir_type_conversion_op(src, dst, nir_rounding_mode_undef);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.3<br>
<br>
</font></span></blockquote></div><br></div>