summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2019-02-19 20:55:59 -0800
committerIan Romanick <ian.d.romanick@intel.com>2019-03-26 10:29:22 -0700
commit6b5a58863c5a4581e7780ad34eaac04b1b910cf1 (patch)
treeb90a471a22d5544a74b30dc25d7779c244dceaf7
parent2aeb95135e88bccb1be15f3e86d4de0e5202d811 (diff)
WIP: intel/compiler: Begin using code generator generator for Gen8 and Gen9
-rw-r--r--src/intel/compiler/brw_fs_nir.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
index 747529e72d81..4eaebc945c45 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -26,6 +26,8 @@
#include "brw_nir.h"
#include "util/u_math.h"
#include "util/bitscan.h"
+#include "compiler/nir/nir_search.h"
+#include "codegen_builder.h"
using namespace brw;
@@ -808,12 +810,74 @@ fs_visitor::try_emit_b2fi_of_inot(const fs_builder &bld,
return true;
}
+static bool
+front_face(nir_alu_instr *instr, unsigned src, unsigned, const uint8_t *)
+{
+ if (!instr->src[src].src.is_ssa ||
+ instr->src[src].src.ssa->parent_instr->type != nir_instr_type_intrinsic)
+ return false;
+
+ nir_intrinsic_instr *const src0 =
+ nir_instr_as_intrinsic(instr->src[src].src.ssa->parent_instr);
+
+ return src0->intrinsic == nir_intrinsic_load_front_face;
+}
+
+static bool
+no_src_mod(nir_alu_instr *instr, unsigned src, unsigned, const uint8_t *)
+{
+ return !instr->src[src].abs && !instr->src[src].negate;
+}
+
+static bool
+abs_src_mod(nir_alu_instr *instr, unsigned src, unsigned, const uint8_t *)
+{
+ return instr->src[src].abs && !instr->src[src].negate;
+}
+
+static bool
+neg_or_abs_src_mod(nir_alu_instr *instr, unsigned src, unsigned, const uint8_t *)
+{
+ return instr->src[src].abs || instr->src[src].negate;
+}
+
+static bool
+neg_abs_src_mod(nir_alu_instr *instr, unsigned src, unsigned, const uint8_t *)
+{
+ return instr->src[src].abs && instr->src[src].negate;
+}
+
+static bool
+neg_src_mod(nir_alu_instr *instr, unsigned src, unsigned, const uint8_t *)
+{
+ return instr->src[src].negate;
+}
+
+#include "gen8_md.h"
+
void
fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
{
struct brw_wm_prog_key *fs_key = (struct brw_wm_prog_key *) this->key;
fs_inst *inst;
+ switch (devinfo->gen) {
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ break;
+
+ case 8:
+ case 9:
+ if (nir_emit_alu_gen8(this, devinfo, bld, instr))
+ return;
+ break;
+
+ default:
+ break;
+ }
+
fs_reg op[4];
fs_reg result = prepare_alu_destination_and_sources(bld, instr, op, true);