i965/eu: Take into account the target cache argument in brw_set_dp_read_message.
[mesa.git] / src / mesa / drivers / dri / i965 / test_eu_compact.c
index 71631dc56e44ad270480f08e978b4809969e9e11..59d58a7c6de816ea89fbe964d819f5c8cd339248 100644 (file)
 #include "brw_eu.h"
 
 static bool
-test_compact_instruction(struct brw_compile *p, brw_inst src)
+test_compact_instruction(struct brw_codegen *p, brw_inst src)
 {
-   struct brw_context *brw = p->brw;
-
    brw_compact_inst dst;
    memset(&dst, 0xd0, sizeof(dst));
 
-   if (brw_try_compact_instruction(brw, &dst, &src)) {
+   if (brw_try_compact_instruction(p->devinfo, &dst, &src)) {
       brw_inst uncompacted;
 
-      brw_uncompact_instruction(brw, &uncompacted, &dst);
+      brw_uncompact_instruction(p->devinfo, &uncompacted, &dst);
       if (memcmp(&uncompacted, &src, sizeof(src))) {
-        brw_debug_compact_uncompact(brw, &src, &uncompacted);
+        brw_debug_compact_uncompact(p->devinfo, &src, &uncompacted);
         return false;
       }
    } else {
@@ -51,7 +49,7 @@ test_compact_instruction(struct brw_compile *p, brw_inst src)
       if (memcmp(&unchanged, &dst, sizeof(dst))) {
         fprintf(stderr, "Failed to compact, but dst changed\n");
         fprintf(stderr, "  Instruction: ");
-        brw_disassemble_inst(stderr, brw, &src, false);
+        brw_disassemble_inst(stderr, p->devinfo, &src, false);
         return false;
       }
    }
@@ -113,7 +111,7 @@ skip_bit(const struct brw_device_info *devinfo, brw_inst *src, int bit)
 }
 
 static bool
-test_fuzz_compact_instruction(struct brw_compile *p, brw_inst src)
+test_fuzz_compact_instruction(struct brw_codegen *p, brw_inst src)
 {
    for (int bit0 = 0; bit0 < 128; bit0++) {
       if (skip_bit(p->devinfo, &src, bit0))
@@ -142,7 +140,7 @@ test_fuzz_compact_instruction(struct brw_compile *p, brw_inst src)
 }
 
 static void
-gen_ADD_GRF_GRF_GRF(struct brw_compile *p)
+gen_ADD_GRF_GRF_GRF(struct brw_codegen *p)
 {
    struct brw_reg g0 = brw_vec8_grf(0, 0);
    struct brw_reg g2 = brw_vec8_grf(2, 0);
@@ -152,7 +150,7 @@ gen_ADD_GRF_GRF_GRF(struct brw_compile *p)
 }
 
 static void
-gen_ADD_GRF_GRF_IMM(struct brw_compile *p)
+gen_ADD_GRF_GRF_IMM(struct brw_codegen *p)
 {
    struct brw_reg g0 = brw_vec8_grf(0, 0);
    struct brw_reg g2 = brw_vec8_grf(2, 0);
@@ -161,7 +159,7 @@ gen_ADD_GRF_GRF_IMM(struct brw_compile *p)
 }
 
 static void
-gen_ADD_GRF_GRF_IMM_d(struct brw_compile *p)
+gen_ADD_GRF_GRF_IMM_d(struct brw_codegen *p)
 {
    struct brw_reg g0 = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_D);
    struct brw_reg g2 = retype(brw_vec8_grf(2, 0), BRW_REGISTER_TYPE_D);
@@ -170,7 +168,7 @@ gen_ADD_GRF_GRF_IMM_d(struct brw_compile *p)
 }
 
 static void
-gen_MOV_GRF_GRF(struct brw_compile *p)
+gen_MOV_GRF_GRF(struct brw_codegen *p)
 {
    struct brw_reg g0 = brw_vec8_grf(0, 0);
    struct brw_reg g2 = brw_vec8_grf(2, 0);
@@ -179,7 +177,7 @@ gen_MOV_GRF_GRF(struct brw_compile *p)
 }
 
 static void
-gen_ADD_MRF_GRF_GRF(struct brw_compile *p)
+gen_ADD_MRF_GRF_GRF(struct brw_codegen *p)
 {
    struct brw_reg m6 = brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, 6, 0);
    struct brw_reg g2 = brw_vec8_grf(2, 0);
@@ -189,7 +187,7 @@ gen_ADD_MRF_GRF_GRF(struct brw_compile *p)
 }
 
 static void
-gen_ADD_vec1_GRF_GRF_GRF(struct brw_compile *p)
+gen_ADD_vec1_GRF_GRF_GRF(struct brw_codegen *p)
 {
    struct brw_reg g0 = brw_vec1_grf(0, 0);
    struct brw_reg g2 = brw_vec1_grf(2, 0);
@@ -199,7 +197,7 @@ gen_ADD_vec1_GRF_GRF_GRF(struct brw_compile *p)
 }
 
 static void
-gen_PLN_MRF_GRF_GRF(struct brw_compile *p)
+gen_PLN_MRF_GRF_GRF(struct brw_codegen *p)
 {
    struct brw_reg m6 = brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, 6, 0);
    struct brw_reg interp = brw_vec1_grf(2, 0);
@@ -209,7 +207,7 @@ gen_PLN_MRF_GRF_GRF(struct brw_compile *p)
 }
 
 static void
-gen_f0_0_MOV_GRF_GRF(struct brw_compile *p)
+gen_f0_0_MOV_GRF_GRF(struct brw_codegen *p)
 {
    struct brw_reg g0 = brw_vec8_grf(0, 0);
    struct brw_reg g2 = brw_vec8_grf(2, 0);
@@ -225,7 +223,7 @@ gen_f0_0_MOV_GRF_GRF(struct brw_compile *p)
  * interact with it.
  */
 static void
-gen_f0_1_MOV_GRF_GRF(struct brw_compile *p)
+gen_f0_1_MOV_GRF_GRF(struct brw_codegen *p)
 {
    struct brw_reg g0 = brw_vec8_grf(0, 0);
    struct brw_reg g2 = brw_vec8_grf(2, 0);
@@ -238,7 +236,7 @@ gen_f0_1_MOV_GRF_GRF(struct brw_compile *p)
 }
 
 struct {
-   void (*func)(struct brw_compile *p);
+   void (*func)(struct brw_codegen *p);
 } tests[] = {
    { gen_MOV_GRF_GRF },
    { gen_ADD_GRF_GRF_GRF },
@@ -252,14 +250,14 @@ struct {
 };
 
 static bool
-run_tests(struct brw_context *brw)
+run_tests(const struct brw_device_info *devinfo)
 {
    bool fail = false;
 
    for (int i = 0; i < ARRAY_SIZE(tests); i++) {
       for (int align_16 = 0; align_16 <= 1; align_16++) {
-        struct brw_compile *p = rzalloc(NULL, struct brw_compile);
-        brw_init_compile(brw, p, p);
+        struct brw_codegen *p = rzalloc(NULL, struct brw_codegen);
+        brw_init_codegen(devinfo, p, p);
 
         brw_set_default_predicate_control(p, BRW_PREDICATE_NONE);
         if (align_16)
@@ -290,15 +288,12 @@ run_tests(struct brw_context *brw)
 int
 main(int argc, char **argv)
 {
-   struct brw_context *brw = calloc(1, sizeof(*brw));
    struct brw_device_info *devinfo = calloc(1, sizeof(*devinfo));
-   brw->intelScreen = calloc(1, sizeof(*brw->intelScreen));
-   brw->intelScreen->devinfo = devinfo;
-   brw->gen = devinfo->gen = 6;
+   devinfo->gen = 6;
    bool fail = false;
 
-   for (brw->gen = 6; brw->gen <= 7; brw->gen++) {
-      fail |= run_tests(brw);
+   for (devinfo->gen = 6; devinfo->gen <= 7; devinfo->gen++) {
+      fail |= run_tests(devinfo);
    }
 
    return fail;