From: Sebastian Dröge Date: Thu, 30 Sep 2010 21:07:57 +0000 (+0200) Subject: Add mergelq/select0ql/select1ql opcodes X-Git-Tag: orc-0.4.10~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e93561bf91f9259c1808e6bbe4e8335326cd3e80;p=platform%2Fupstream%2Forc.git Add mergelq/select0ql/select1ql opcodes --- diff --git a/orc/opcodes.h b/orc/opcodes.h index 9581e1f..f411f00 100644 --- a/orc/opcodes.h +++ b/orc/opcodes.h @@ -126,12 +126,15 @@ BINARY_BW(mulubw, "(orc_uint8)%s * (orc_uint8)%s") BINARY_WL(mulswl, "%s * %s") BINARY_WL(muluwl, "(orc_uint16)%s * (orc_uint16)%s") +BINARY_LQ(mergelq, "((orc_uint64)%s & ORC_UINT64_C(0xffffffff)) | ((orc_uint64)%s << 32)") BINARY_WL(mergewl, "((orc_uint16)%s) | ((orc_uint16)%s << 16)") BINARY_BW(mergebw, "((orc_uint8)%s) | ((orc_uint8)%s << 8)") UNARY_WB(select0wb, "(orc_uint16)%s & 0xff") UNARY_WB(select1wb, "((orc_uint16)%s >> 8)&0xff") UNARY_LW(select0lw, "(orc_uint32)%s & 0xffff") UNARY_LW(select1lw, "((orc_uint32)%s >> 16)&0xffff") +UNARY_QL(select0ql, "(orc_uint64)%s & 0xffffffff") +UNARY_QL(select1ql, "((orc_uint64)%s >> 32)&0xffffffff") UNARY_UW(swapw, "ORC_SWAP_W(%s)") UNARY_UL(swapl, "ORC_SWAP_L(%s)") UNARY_UQ(swapq, "ORC_SWAP_Q(%s)") diff --git a/orc/orcemulateopcodes.c b/orc/orcemulateopcodes.c index 8ad7474..3022304 100644 --- a/orc/orcemulateopcodes.c +++ b/orc/orcemulateopcodes.c @@ -4158,6 +4158,83 @@ emulate_select1lw (OrcOpcodeExecutor *ex, int offset, int n) } void +emulate_select0ql (OrcOpcodeExecutor *ex, int offset, int n) +{ + int i; + orc_union32 * ORC_RESTRICT ptr0; + const orc_union64 * ORC_RESTRICT ptr4; + orc_union64 var32; + orc_union32 var33; + + ptr0 = (orc_union32 *)ex->dest_ptrs[0]; + ptr4 = (orc_union64 *)ex->src_ptrs[0]; + + + for (i = 0; i < n; i++) { + /* 0: loadq */ + var32 = ptr4[i]; + /* 1: select0ql */ + var33.i = (orc_uint64)var32.i & 0xffffffff; + /* 2: storel */ + ptr0[i] = var33; + } + +} + +void +emulate_select1ql (OrcOpcodeExecutor *ex, int offset, int n) +{ + int i; + orc_union32 * ORC_RESTRICT ptr0; + const orc_union64 * ORC_RESTRICT ptr4; + orc_union64 var32; + orc_union32 var33; + + ptr0 = (orc_union32 *)ex->dest_ptrs[0]; + ptr4 = (orc_union64 *)ex->src_ptrs[0]; + + + for (i = 0; i < n; i++) { + /* 0: loadq */ + var32 = ptr4[i]; + /* 1: select1ql */ + var33.i = ((orc_uint64)var32.i >> 32)&0xffffffff; + /* 2: storel */ + ptr0[i] = var33; + } + +} + +void +emulate_mergelq (OrcOpcodeExecutor *ex, int offset, int n) +{ + int i; + orc_union64 * ORC_RESTRICT ptr0; + const orc_union32 * ORC_RESTRICT ptr4; + const orc_union32 * ORC_RESTRICT ptr5; + orc_union32 var32; + orc_union32 var33; + orc_union64 var34; + + ptr0 = (orc_union64 *)ex->dest_ptrs[0]; + ptr4 = (orc_union32 *)ex->src_ptrs[0]; + ptr5 = (orc_union32 *)ex->src_ptrs[1]; + + + for (i = 0; i < n; i++) { + /* 0: loadl */ + var32 = ptr4[i]; + /* 1: loadl */ + var33 = ptr5[i]; + /* 2: mergelq */ + var34.i = ((orc_uint64)var32.i & ORC_UINT64_C(0xffffffff)) | ((orc_uint64)var33.i << 32); + /* 3: storeq */ + ptr0[i] = var34; + } + +} + +void emulate_mergewl (OrcOpcodeExecutor *ex, int offset, int n) { int i; diff --git a/orc/orcemulateopcodes.h b/orc/orcemulateopcodes.h index e0d6fd1..df84191 100644 --- a/orc/orcemulateopcodes.h +++ b/orc/orcemulateopcodes.h @@ -162,6 +162,9 @@ void emulate_select0wb (OrcOpcodeExecutor *ex, int i, int n); void emulate_select1wb (OrcOpcodeExecutor *ex, int i, int n); void emulate_select0lw (OrcOpcodeExecutor *ex, int i, int n); void emulate_select1lw (OrcOpcodeExecutor *ex, int i, int n); +void emulate_select0ql (OrcOpcodeExecutor *ex, int i, int n); +void emulate_select1ql (OrcOpcodeExecutor *ex, int i, int n); +void emulate_mergelq (OrcOpcodeExecutor *ex, int i, int n); void emulate_mergewl (OrcOpcodeExecutor *ex, int i, int n); void emulate_mergebw (OrcOpcodeExecutor *ex, int i, int n); void emulate_splitql (OrcOpcodeExecutor *ex, int i, int n); diff --git a/orc/orcopcodes.c b/orc/orcopcodes.c index 8201083..113d342 100644 --- a/orc/orcopcodes.c +++ b/orc/orcopcodes.c @@ -462,6 +462,9 @@ static OrcStaticOpcode opcodes[] = { { "select1wb", 0, { 1 }, { 2 }, emulate_select1wb }, { "select0lw", 0, { 2 }, { 4 }, emulate_select0lw }, { "select1lw", 0, { 2 }, { 4 }, emulate_select1lw }, + { "select0ql", 0, { 4 }, { 8 }, emulate_select0ql }, + { "select1ql", 0, { 4 }, { 8 }, emulate_select1ql }, + { "mergelq", 0, { 8 }, { 4, 4 }, emulate_mergelq }, { "mergewl", 0, { 4 }, { 2, 2 }, emulate_mergewl }, { "mergebw", 0, { 2 }, { 1, 1 }, emulate_mergebw }, { "splitql", 0, { 4, 4 }, { 8 }, emulate_splitql }, diff --git a/orc/orcprogram-c.c b/orc/orcprogram-c.c index 7c49ab4..dfed3fe 100644 --- a/orc/orcprogram-c.c +++ b/orc/orcprogram-c.c @@ -685,6 +685,8 @@ c_rule_ ## name (OrcCompiler *p, void *user, OrcInstruction *insn) \ #define UNARY_UQ(a,b) UNARY(a,b) #define BINARY_BW(a,b) BINARY(a,b) #define BINARY_WL(a,b) BINARY(a,b) +#define BINARY_LQ(a,b) BINARY(a,b) +#define BINARY_QL(a,b) BINARY(a,b) #define BINARY_LW(a,b) BINARY(a,b) #define BINARY_WB(a,b) BINARY(a,b) #define UNARY_BW(a,b) UNARY(a,b) @@ -732,6 +734,8 @@ c_rule_ ## name (OrcCompiler *p, void *user, OrcInstruction *insn) \ #undef UNARY_D #undef BINARY_BW #undef BINARY_WL +#undef BINARY_LQ +#undef BINARY_QL #undef BINARY_LW #undef BINARY_WB #undef UNARY_BW @@ -1327,6 +1331,8 @@ orc_c_init (void) #define UNARY_D(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL); #define BINARY_BW(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL); #define BINARY_WL(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL); +#define BINARY_LQ(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL); +#define BINARY_QL(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL); #define BINARY_LW(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL); #define BINARY_WB(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL); #define UNARY_BW(a,b) orc_rule_register (rule_set, #a , c_rule_ ## a, NULL);