diff options
author | David Schleef <ds@schleef.org> | 2010-08-20 12:15:14 -0700 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2010-08-20 12:15:14 -0700 |
commit | 02ec311f66e21d23541830424bdb735a4d2df484 (patch) | |
tree | 022db8ec4ac72884074c4281dd478343f71af1c6 /orc-test | |
parent | 241a7ad309ee2969672500792933f6c0afe330ee (diff) |
Update documentation, add tutorial
Diffstat (limited to 'orc-test')
-rw-r--r-- | orc-test/orctest.c | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/orc-test/orctest.c b/orc-test/orctest.c index 547a8aa..2c76d24 100644 --- a/orc-test/orctest.c +++ b/orc-test/orctest.c @@ -725,19 +725,40 @@ orc_test_get_program_for_opcode (OrcStaticOpcode *opcode) OrcProgram *p; char s[40]; int flags = 0; + int args[4] = { -1, -1, -1, -1 }; + int n_args = 0; p = orc_program_new (); if (opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR) { - orc_program_add_accumulator (p, opcode->dest_size[0], "d1"); + args[n_args++] = + orc_program_add_accumulator (p, opcode->dest_size[0], "d1"); } else { - orc_program_add_destination (p, opcode->dest_size[0], "d1"); + args[n_args++] = + orc_program_add_destination (p, opcode->dest_size[0], "d1"); } if (opcode->dest_size[1] != 0) { - orc_program_add_destination (p, opcode->dest_size[1], "d2"); + args[n_args++] = + orc_program_add_destination (p, opcode->dest_size[1], "d2"); } - orc_program_add_source (p, opcode->src_size[0], "s1"); - if (opcode->src_size[1] != 0) { - orc_program_add_source (p, opcode->src_size[1], "s2"); + if (opcode->flags & ORC_STATIC_OPCODE_SCALAR) { + if (opcode->src_size[1] == 0) { + args[n_args++] = + orc_program_add_constant (p, opcode->src_size[0], 1, "c1"); + } else { + args[n_args++] = + orc_program_add_source (p, opcode->src_size[0], "s1"); + args[n_args++] = + orc_program_add_constant (p, opcode->src_size[1], 1, "c1"); + if (opcode->src_size[2] != 0) { + args[n_args++] = + orc_program_add_constant (p, opcode->src_size[1], 1, "c1"); + } + } + } else { + args[n_args++] = + orc_program_add_source (p, opcode->src_size[0], "s1"); + args[n_args++] = + orc_program_add_source (p, opcode->src_size[1], "s2"); } if ((opcode->flags & ORC_STATIC_OPCODE_FLOAT_SRC) || @@ -747,13 +768,9 @@ orc_test_get_program_for_opcode (OrcStaticOpcode *opcode) sprintf(s, "test_%s", opcode->name); orc_program_set_name (p, s); - orc_program_set_2d (p); - if (opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR) { - orc_program_append_str (p, opcode->name, "a1", "s1", "s2"); - } else { - orc_program_append_str (p, opcode->name, "d1", "s1", "s2"); - } + orc_program_append_2 (p, opcode->name, 0, args[0], args[1], + args[2], args[3]); return p; } @@ -767,10 +784,6 @@ orc_test_get_program_for_opcode_const (OrcStaticOpcode *opcode) int flags; int n_args = 0; - if (opcode->src_size[1] == 0) { - return NULL; - } - p = orc_program_new (); if (opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR) { args[n_args++] = @@ -783,13 +796,18 @@ orc_test_get_program_for_opcode_const (OrcStaticOpcode *opcode) args[n_args++] = orc_program_add_destination (p, opcode->dest_size[1], "d2"); } - args[n_args++] = - orc_program_add_source (p, opcode->src_size[0], "s1"); - args[n_args++] = - orc_program_add_constant (p, opcode->src_size[1], 1, "c1"); - if (opcode->src_size[2]) { + if (opcode->src_size[1] == 0) { args[n_args++] = - orc_program_add_constant (p, opcode->src_size[2], 1, "c2"); + orc_program_add_constant (p, opcode->src_size[0], 1, "c1"); + } else { + args[n_args++] = + orc_program_add_source (p, opcode->src_size[0], "s1"); + args[n_args++] = + orc_program_add_constant (p, opcode->src_size[1], 1, "c1"); + if (opcode->src_size[2]) { + args[n_args++] = + orc_program_add_constant (p, opcode->src_size[2], 1, "c2"); + } } if ((opcode->flags & ORC_STATIC_OPCODE_FLOAT_SRC) || |