Liboil -> Orc

Pierre-Alexandre Voye ontologiae at gmail.com
Fri Mar 5 16:32:35 UTC 2010


Example of code (from Dirac) using orc :

void
orc_add2_rshift_add_s16_22_op (int16_t * d1, const int16_t * s1, const
int16_t * s2, const int16_t * s3, int n)
{
  OrcExecutor _ex, *ex = &_ex;
  static int p_inited = 0;
  static OrcProgram *p = 0;

  if (!p_inited) {
    orc_once_mutex_lock ();
    if (!p_inited) {
      OrcCompileResult result;

      p = orc_program_new ();
      orc_program_set_name (p, "orc_add2_rshift_add_s16_22_op");
      orc_program_set_backup_function (p,
_backup_orc_add2_rshift_add_s16_22_op);
      orc_program_add_destination (p, 2, "d1");
      orc_program_add_source (p, 2, "s1");
      orc_program_add_source (p, 2, "s2");
      orc_program_add_source (p, 2, "s3");
      orc_program_add_constant (p, 2, 2, "c1");
      orc_program_add_constant (p, 2, 2, "c2");
      orc_program_add_temporary (p, 2, "t1");

      orc_program_append (p, "addw", ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3);
      orc_program_append (p, "addw", ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1);
      orc_program_append (p, "shrsw", ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2);
      orc_program_append (p, "addw", ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_T1);

      result = orc_program_compile (p);
    }
    p_inited = TRUE;
    orc_once_mutex_unlock ();
  }
  ex->program = p;

  ex->n = n;
  ex->arrays[ORC_VAR_D1] = d1;
  ex->arrays[ORC_VAR_S1] = (void *)s1;
  ex->arrays[ORC_VAR_S2] = (void *)s2;
  ex->arrays[ORC_VAR_S3] = (void *)s3;

  orc_executor_run (ex);
}

2010/3/5 Pierre-Alexandre Voye <ontologiae at gmail.com>

> So orc is an assembler with speciifc language which produce code at compile
> time, or at runtime for ARM, SSE, MMX, Altivec, etc...:
> http://www.schleef.org/orc/documentation/orc-concepts.html
>
> Its language is a sort of special assembler :
> http://www.schleef.org/orc/documentation/orc-opcodes.html
>
> 2010/3/5 Nicolas Boulay <nicolas.boulay at gmail.com>
>
> The liboil C library project have change to a generic vectorised
>> assembler (at runtime or static).
>>
>> http://www.schleef.org/blog/category/orc/
>> http://code.entropywave.com/projects/orc/
>>
>> This is more generic than liboil but need more work to generate the
>> pattern.
>>
>> Regards,
>> Nicolas
>>
>>

-- 
---------------------
Isaac Project - http://www.lisaac.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/lisaac-devel/attachments/20100305/2dae50a6/attachment.htm>


More information about the Lisaac-devel mailing list