intel/compiler: Lower flrp32 on Gen11+
authorMatt Turner <mattst88@gmail.com>
Wed, 14 Jun 2017 23:20:41 +0000 (16:20 -0700)
committerMatt Turner <mattst88@gmail.com>
Wed, 28 Feb 2018 19:15:47 +0000 (11:15 -0800)
The LRP instruction is no more.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_compiler.c
src/intel/compiler/brw_fs_builder.h
src/intel/compiler/brw_fs_generator.cpp
src/intel/compiler/brw_vec4_builder.h
src/intel/compiler/brw_vec4_visitor.cpp

index bb9df5e70136ea5a200f948fed9e20d3fd51c673..34be3b705fef04694ea1385cab6978c2225a00d9 100644 (file)
    .use_interpolated_input_intrinsics = true,                                 \
    .vertex_id_zero_based = true
 
+#define COMMON_SCALAR_OPTIONS                                                 \
+   .lower_pack_half_2x16 = true,                                              \
+   .lower_pack_snorm_2x16 = true,                                             \
+   .lower_pack_snorm_4x8 = true,                                              \
+   .lower_pack_unorm_2x16 = true,                                             \
+   .lower_pack_unorm_4x8 = true,                                              \
+   .lower_unpack_half_2x16 = true,                                            \
+   .lower_unpack_snorm_2x16 = true,                                           \
+   .lower_unpack_snorm_4x8 = true,                                            \
+   .lower_unpack_unorm_2x16 = true,                                           \
+   .lower_unpack_unorm_4x8 = true,                                            \
+   .max_unroll_iterations = 32
+
 static const struct nir_shader_compiler_options scalar_nir_options = {
    COMMON_OPTIONS,
-   .lower_pack_half_2x16 = true,
-   .lower_pack_snorm_2x16 = true,
-   .lower_pack_snorm_4x8 = true,
-   .lower_pack_unorm_2x16 = true,
-   .lower_pack_unorm_4x8 = true,
-   .lower_unpack_half_2x16 = true,
-   .lower_unpack_snorm_2x16 = true,
-   .lower_unpack_snorm_4x8 = true,
-   .lower_unpack_unorm_2x16 = true,
-   .lower_unpack_unorm_4x8 = true,
-   .vs_inputs_dual_locations = true,
-   .max_unroll_iterations = 32,
+   COMMON_SCALAR_OPTIONS,
+};
+
+static const struct nir_shader_compiler_options scalar_nir_options_gen11 = {
+   COMMON_OPTIONS,
+   COMMON_SCALAR_OPTIONS,
+   .lower_flrp32 = true,
 };
 
 static const struct nir_shader_compiler_options vector_nir_options = {
@@ -149,7 +157,8 @@ brw_compiler_create(void *mem_ctx, const struct gen_device_info *devinfo)
       compiler->glsl_compiler_options[i].OptimizeForAOS = !is_scalar;
 
       if (is_scalar) {
-         compiler->glsl_compiler_options[i].NirOptions = &scalar_nir_options;
+         compiler->glsl_compiler_options[i].NirOptions =
+            devinfo->gen < 11 ? &scalar_nir_options : &scalar_nir_options_gen11;
       } else {
          compiler->glsl_compiler_options[i].NirOptions =
             devinfo->gen < 6 ? &vector_nir_options : &vector_nir_options_gen6;
index 87394bc17b3fc29bedfafbd874ca6f126d30afb7..874272b7afd338e36b13b943d6d295a430379731 100644 (file)
@@ -540,7 +540,7 @@ namespace brw {
       LRP(const dst_reg &dst, const src_reg &x, const src_reg &y,
           const src_reg &a) const
       {
-         if (shader->devinfo->gen >= 6) {
+         if (shader->devinfo->gen >= 6 && shader->devinfo->gen <= 10) {
             /* The LRP instruction actually does op1 * op0 + op2 * (1 - op0), so
              * we need to reorder the operands.
              */
index 0dc0a695e4ecff241fb80f145d923d84c442bf8e..b59c09f46ec5f56133eb538b0c61e647ceb3c51a 100644 (file)
@@ -1826,7 +1826,7 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
         break;
 
       case BRW_OPCODE_LRP:
-         assert(devinfo->gen >= 6);
+         assert(devinfo->gen >= 6 && devinfo->gen <= 10);
          if (devinfo->gen < 10)
             brw_set_default_access_mode(p, BRW_ALIGN_16);
          brw_LRP(p, dst, src[0], src[1], src[2]);
index 4c3efe8457b16e21e1a5199ba938db2d6956b508..5c880c19f524ab4a6ee662382c82312f0fada013 100644 (file)
@@ -501,7 +501,7 @@ namespace brw {
       LRP(const dst_reg &dst, const src_reg &x, const src_reg &y,
           const src_reg &a) const
       {
-         if (shader->devinfo->gen >= 6) {
+         if (shader->devinfo->gen >= 6 && shader->devinfo->gen <= 10) {
             /* The LRP instruction actually does op1 * op0 + op2 * (1 - op0), so
              * we need to reorder the operands.
              */
index 53f6a5ed546ed6276484d37bea1294d778b707f8..e683a8c51db867f1c1f81546e79a6bfbac56d8b1 100644 (file)
@@ -735,7 +735,7 @@ vec4_instruction *
 vec4_visitor::emit_lrp(const dst_reg &dst,
                        const src_reg &x, const src_reg &y, const src_reg &a)
 {
-   if (devinfo->gen >= 6) {
+   if (devinfo->gen >= 6 && devinfo->gen <= 10) {
       /* Note that the instruction's argument order is reversed from GLSL
        * and the IR.
        */