diff --git a/bochs-performance/testcases/blur-opcode.c b/bochs-performance/testcases/blur-opcode.c index b3f98cdbe..223c2b81e 100644 --- a/bochs-performance/testcases/blur-opcode.c +++ b/bochs-performance/testcases/blur-opcode.c @@ -1,6 +1,6 @@ /* * - * $Id: blur-opcode.c,v 1.1 2002-04-17 02:31:36 bdenney Exp $ + * $Id: blur-opcode.c,v 1.2 2002-04-17 04:18:34 bdenney Exp $ * */ @@ -414,8 +414,8 @@ void blur_opcode_translated2 () #define BEFORE_EXEC() do { \ /* set up state */ \ accum = 0xfab28342; /* start with trash in accum */ \ - state->load_ptr = &array[x][y]; \ - state->store_ptr = &array2[x][y]; \ + load_ptr = &array[x][y]; \ + store_ptr = &array2[x][y]; \ } while (0) #define AFTER_EXEC() do { \ @@ -444,65 +444,65 @@ void blur_instructions_translated3 (State *state) // OP_MOVE_REL, -1, -1, x += -1; y += -1; - state->load_ptr = &array[x][y]; + load_ptr = &array[x][y]; // OP_SET_ACCUM, 0, accum = 0; // OP_ADD_DATA, - accum += *state->load_ptr++; + accum += *load_ptr++; // OP_MOVE_REL, 0, 1, x += 0; y += 1; - state->load_ptr = &array[x][y]; + load_ptr = &array[x][y]; // OP_ADD_DATA, - accum += *state->load_ptr++; + accum += *load_ptr++; // OP_MOVE_REL, 0, 1, x += 0; y += 1; - state->load_ptr = &array[x][y]; + load_ptr = &array[x][y]; // OP_ADD_DATA, - accum += *state->load_ptr++; + accum += *load_ptr++; // OP_MOVE_REL, 1, -2, x += 1; y += -2; - state->load_ptr = &array[x][y]; + load_ptr = &array[x][y]; // OP_ADD_DATA, - accum += *state->load_ptr++; + accum += *load_ptr++; // OP_MOVE_REL, 0, 1, x += 0; y += 1; - state->load_ptr = &array[x][y]; + load_ptr = &array[x][y]; // OP_ADD_DATA, - accum += *state->load_ptr++; + accum += *load_ptr++; // OP_MOVE_REL, 0, 1, x += 0; y += 1; - state->load_ptr = &array[x][y]; + load_ptr = &array[x][y]; // OP_ADD_DATA, - accum += *state->load_ptr++; + accum += *load_ptr++; // OP_MOVE_REL, 1, -2, x += 1; y += -2; - state->load_ptr = &array[x][y]; + load_ptr = &array[x][y]; // OP_ADD_DATA, - accum += *state->load_ptr++; + accum += *load_ptr++; // OP_MOVE_REL, 0, 1, x += 0; y += 1; - state->load_ptr = &array[x][y]; + load_ptr = &array[x][y]; // OP_ADD_DATA, - accum += *state->load_ptr++; + accum += *load_ptr++; // OP_MOVE_REL, 0, 1, x += 0; y += 1; - state->load_ptr = &array[x][y]; + load_ptr = &array[x][y]; // OP_ADD_DATA, - accum += *state->load_ptr++; + accum += *load_ptr++; // OP_STORE_DATA, - *(state->store_ptr++) = accum; + *(store_ptr++) = accum; // OP_MOVE_REL, -1, -1 x += -1; y += -1; - state->load_ptr = &array[state->x][y]; + load_ptr = &array[state->x][y]; // OP_END AFTER_EXEC(); } @@ -523,6 +523,82 @@ void blur_opcode_translated3 () #endif // ifdef BLUR_TRANSLATED3 +#ifdef BLUR_DYNAMIC_TRANSLATE1 + +static int unique_fn_id = 283473; + +void blur_dynamic_translate1 () +{ + // csrc is the main text file containing the translated code. + FILE *csrc = fopen ("translate1.c", "w"); + State state; + int done = 0; + int *pc; + assert (csrc!=NULL); + fprintf (csrc, "// code generated by blur-opcode.c, blur_dynamic_translate1()\n"); + fprintf (csrc, "#include \"translate1-defs.h\"\n"); + fprintf (csrc, "void translate%d (State *state) {\n", unique_fn_id); + fprintf (csrc, "TOP_OF_TRANSLATED_FUNCTION();\n"); + pc = &blur_instructions[0]; + while (!done) { + switch (*pc++) { + case OP_MOVE_REL: + fprintf (csrc, "DO_MOVE_REL(%d,%d);\n", *pc++, *pc++); + break; + case OP_SET_ACCUM: + fprintf (csrc, "DO_SET_ACCUM(%d);\n", *pc++); + break; + case OP_ADD_DATA: + fprintf (csrc, "DO_ADD_DATA();\n"); + break; + case OP_SUBTRACT_DATA: + fprintf (csrc, "DO_SUBTRACT_DATA();\n"); + break; + case OP_MULTIPLY_DATA: + fprintf (csrc, "DO_MULTIPLY_DATA();\n"); + break; + case OP_STORE_DATA: + fprintf (csrc, "DO_STORE_DATA();\n"); + break; + case OP_END: + done = 1; + break; + default: + assert (0); + } + } + fprintf (csrc, "BOTTOM_OF_TRANSLATED_FUNCTION();\n"); + fprintf (csrc, "} // end of translate%d\n", unique_fn_id); + unique_fn_id++; + fclose (csrc); +} +#endif + +#ifdef BLUR_DYNAMIC_TRANSLATE1_TEST +extern void translate284472 (State *state); + +void blur_dynamic_translate1_test () +{ + int sum; + int x,y,x2,y2; + State state; + for (x=1; x