8 #include <orc/orcdebug.h>
13 void test_opcode (OrcStaticOpcode *opcode);
15 orc_uint8 array1[100];
16 orc_uint8 array2[100];
18 int orc_sad_u8 (orc_uint8 *s1, orc_uint8 *s2, int n);
21 main (int argc, char *argv[])
34 sum += abs(array1[i] - array2[i]);
36 if (sum != orc_sad_u8 (array1, array2, n)) {
38 printf("%d: %d %d -> %d\n", i, array1[i], array2[i],
39 abs(array1[i] - array2[i]));
42 printf("sum %d %d\n", sum, orc_sad_u8 (array1, array2, n));
53 orc_sad_u8 (orc_uint8 *s1, orc_uint8 *s2, int n)
55 static OrcProgram *p = NULL;
58 OrcCompileResult result;
61 p = orc_program_new ();
62 orc_program_add_accumulator (p, 4, "a1");
63 orc_program_add_source (p, 1, "s1");
64 orc_program_add_source (p, 1, "s2");
66 orc_program_append_str (p, "accsadubl", "a1", "s1", "s2");
68 result = orc_program_compile (p);
69 if (!ORC_COMPILE_RESULT_IS_SUCCESSFUL(result)) {
73 //printf("%s\n", orc_program_get_asm_code (p));
76 ex = orc_executor_new (p);
77 orc_executor_set_n (ex, n);
78 orc_executor_set_array_str (ex, "s1", s1);
79 orc_executor_set_array_str (ex, "s2", s2);
81 orc_executor_run (ex);
83 //sum = orc_executor_get_accumulator (ex, "a1");
84 sum = ex->accumulators[0];
86 orc_executor_free (ex);