Revert "i965/compiler: handle conversion to smaller type in the lowering pass for...
authorMark Janes <mark.a.janes@intel.com>
Thu, 3 May 2018 21:28:00 +0000 (14:28 -0700)
committerMark Janes <mark.a.janes@intel.com>
Thu, 3 May 2018 22:26:59 +0000 (15:26 -0700)
This reverts commit 96b51537908cd2aace85f54b437eeb72e6346b7e.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106393
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
src/intel/compiler/brw_fs_lower_conversions.cpp
src/intel/compiler/brw_fs_nir.cpp

index f95b39d3e86342175c46143234aa05110065148d..663c9674c494dd45500dc6504ae8e53f0fa7a19e 100644 (file)
@@ -54,7 +54,7 @@ fs_visitor::lower_conversions()
       bool saturate = inst->saturate;
 
       if (supports_type_conversion(inst)) {
-         if (type_sz(inst->dst.type) < get_exec_type_size(inst)) {
+         if (get_exec_type_size(inst) == 8 && type_sz(inst->dst.type) < 8) {
             /* From the Broadwell PRM, 3D Media GPGPU, "Double Precision Float to
              * Single Precision Float":
              *
@@ -64,9 +64,6 @@ fs_visitor::lower_conversions()
              * So we need to allocate a temporary that's two registers, and then do
              * a strided MOV to get the lower DWord of every Qword that has the
              * result.
-             *
-             * This restriction applies, in general, whenever we convert to
-             * a type with a smaller bit-size.
              */
             fs_reg temp = ibld.vgrf(get_exec_type(inst));
             fs_reg strided_temp = subscript(temp, dst.type, 0);
index 4c8bcc4ebc9da71ed3dc14c3ec5ea967b69ae4ce..f9fde145a16e7b3843b7de2eebaa32d351e583f3 100644 (file)
@@ -755,9 +755,19 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
        */
 
    case nir_op_f2f16_undef:
-      inst = bld.MOV(result, op[0]);
+   case nir_op_i2i16:
+   case nir_op_u2u16: {
+      /* TODO: Fixing aligment rules for conversions from 32-bits to
+       * 16-bit types should be moved to lower_conversions
+       */
+      fs_reg tmp = bld.vgrf(op[0].type, 1);
+      tmp = subscript(tmp, result.type, 0);
+      inst = bld.MOV(tmp, op[0]);
+      inst->saturate = instr->dest.saturate;
+      inst = bld.MOV(result, tmp);
       inst->saturate = instr->dest.saturate;
       break;
+   }
 
    case nir_op_f2f64:
    case nir_op_f2i64:
@@ -797,8 +807,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
    case nir_op_f2u16:
    case nir_op_i2i32:
    case nir_op_u2u32:
-   case nir_op_i2i16:
-   case nir_op_u2u16:
    case nir_op_i2f16:
    case nir_op_u2f16:
       inst = bld.MOV(result, op[0]);