SPU LLVM: Handle SHUFB special cases with a lookup table

- Needs 3 instructions to handle the special cases, since x86 lacks an 8 bit simd shift instruction
This commit is contained in:
Malcolm Jestadt 2021-12-14 18:29:36 -05:00 committed by Elad Ashkenazi
parent ba988f1d3f
commit ee7475a9d4

View File

@ -8599,7 +8599,7 @@ public:
return;
}
const auto x = avg(noncast<u8[16]>(sext<s8[16]>((c & 0xc0) == 0xc0)), noncast<u8[16]>(sext<s8[16]>((c & 0xe0) == 0xc0)));
const auto x = pshufb(build<u8[16]>(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x80), (c >> 4));
const auto ax = pshufb(as, c);
const auto bx = pshufb(bs, c);
@ -8615,7 +8615,7 @@ public:
if (data == v128::from8p(data._u8[0]))
{
// See above
const auto x = avg(noncast<u8[16]>(sext<s8[16]>((c & 0xc0) == 0xc0)), noncast<u8[16]>(sext<s8[16]>((c & 0xe0) == 0xc0)));
const auto x = pshufb(build<u8[16]>(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x80), (c >> 4));
const auto ax = pshufb(as, c);
if (perm_only)
@ -8634,7 +8634,7 @@ public:
if (data == v128::from8p(data._u8[0]))
{
// See above
const auto x = avg(noncast<u8[16]>(sext<s8[16]>((c & 0xc0) == 0xc0)), noncast<u8[16]>(sext<s8[16]>((c & 0xe0) == 0xc0)));
const auto x = pshufb(build<u8[16]>(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x80), (c >> 4));
const auto bx = pshufb(bs, c);
if (perm_only)
@ -8662,7 +8662,7 @@ public:
return;
}
const auto x = avg(noncast<u8[16]>(sext<s8[16]>((c & 0xc0) == 0xc0)), noncast<u8[16]>(sext<s8[16]>((c & 0xe0) == 0xc0)));
const auto x = pshufb(build<u8[16]>(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x80), (c >> 4));
const auto cr = eval(c ^ 0xf);
const auto ax = pshufb(a, cr);
const auto bx = pshufb(b, cr);