vec4: use DIM instruction when loading DF immediates in HSW
authorSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Wed, 7 Dec 2016 09:32:38 +0000 (10:32 +0100)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Thu, 5 Jan 2017 06:29:13 +0000 (07:29 +0100)
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp

index 065e3170f10f10f76c89bd429f7b09b0d7456b17..98e023a66d9631da6f9571c7fb4569ac3e539964 100644 (file)
@@ -1208,6 +1208,15 @@ vec4_visitor::setup_imm_df(double v)
    if (devinfo->gen >= 8)
       return brw_imm_df(v);
 
+   /* gen7.5 does not support DF immediates straighforward but the DIM
+    * instruction allows to set the 64-bit immediate value.
+    */
+   if (devinfo->is_haswell) {
+      dst_reg dst = retype(dst_reg(VGRF, alloc.allocate(2)), BRW_REGISTER_TYPE_DF);
+      emit(DIM(dst, brw_imm_df(v)))->force_writemask_all = true;
+      return swizzle(src_reg(retype(dst, BRW_REGISTER_TYPE_DF)), BRW_SWIZZLE_XXXX);
+   }
+
    /* gen7 does not support DF immediates */
    union {
       double d;