This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to get 4 values from a table once ?

hi, guys:

let me set an example:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

int table[256]={......};

int lookup_tbl(int index)

{

   return table[index];

}

int main()

{

   int idx0, idx1, idx2, idx3;

   int tbl0, tbl1, tbl2, tbl3;

   idx0 = 2;

   idx1 = 36;

   idx2 = 111;

   idx3 = 204;

    tbl0 = lookup_tbl(idx0);

    tbl1 = lookup_tbl(idx1);

    tbl2 = lookup_tbl(idx2);

    tbl3 = lookup_tbl(idx3);

}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

my question is:

Could I use some neon intrinsic(maybe VTBL) to get the 4 values once? if I have set the index into a 32x4_t variable ?

thank you very much.

Parents
  • Hi,

    VTBL is byte wise look up instruction that we can't use for 32-bit values.

    The other option is (you might already know this) rearrage the table if you know indexes ahead...In this case arrange the table elements with indexes 2, 36, 111 and 204 in consecutive locations so you can use VLD1.32 {d0,d1},[table]......this is not a good technique when you dont know indexes ahead...

Reply
  • Hi,

    VTBL is byte wise look up instruction that we can't use for 32-bit values.

    The other option is (you might already know this) rearrage the table if you know indexes ahead...In this case arrange the table elements with indexes 2, 36, 111 and 204 in consecutive locations so you can use VLD1.32 {d0,d1},[table]......this is not a good technique when you dont know indexes ahead...

Children
No data