mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-14 08:00:50 +02:00
VectorOps: Handle 256-bit VectorImm
Extends VectorImm to be capable of using SVE to handle 256-bit length vectors.
This commit is contained in:
1 parent
d03b6a9382
commit
70efdbba5d
3 files changed
+42
-15
No files matched your search
@@ -23,7 +23,7 @@ DEF_OP(VectorImm) {
|
||||
auto Op = IROp->C<IR::IROp_VectorImm>();
|
||||
uint8_t OpSize = IROp->Size;
|
||||
|
||||
uint8_t Tmp[16];
|
||||
uint8_t Tmp[32];
|
||||
|
||||
uint8_t Elements = OpSize / Op->Header.ElementSize;
|
||||
uint8_t Imm = Op->Immediate;
|
||||
|
||||
@@ -40,15 +40,37 @@ DEF_OP(VectorImm) {
|
||||
auto Op = IROp->C<IR::IROp_VectorImm>();
|
||||
|
||||
const uint8_t OpSize = IROp->Size;
|
||||
const uint8_t Elements = OpSize / Op->Header.ElementSize;
|
||||
const uint8_t ElementSize = Op->Header.ElementSize;
|
||||
const uint8_t Elements = OpSize / ElementSize;
|
||||
|
||||
if (Op->Header.ElementSize == 8) {
|
||||
// movi with 64bit element size doesn't do what we want here
|
||||
LoadConstant(TMP1.X(), Op->Immediate);
|
||||
dup(GetDst(Node).V2D(), TMP1.X());
|
||||
}
|
||||
else {
|
||||
movi(GetDst(Node).VCast(OpSize * 8, Elements), Op->Immediate);
|
||||
if (CanUseSVE) {
|
||||
const auto Dst = [&] {
|
||||
const auto Tmp = GetDst(Node).Z();
|
||||
switch (ElementSize) {
|
||||
case 1:
|
||||
return Tmp.VnB();
|
||||
case 2:
|
||||
return Tmp.VnH();
|
||||
case 4:
|
||||
return Tmp.VnS();
|
||||
case 8:
|
||||
return Tmp.VnD();
|
||||
default:
|
||||
LOGMAN_MSG_A_FMT("Unhandled element size: {}", ElementSize);
|
||||
return Tmp;
|
||||
}
|
||||
}();
|
||||
|
||||
dup(Dst, Op->Immediate);
|
||||
} else {
|
||||
if (ElementSize == 8) {
|
||||
// movi with 64bit element size doesn't do what we want here
|
||||
LoadConstant(TMP1.X(), Op->Immediate);
|
||||
dup(GetDst(Node).V2D(), TMP1.X());
|
||||
}
|
||||
else {
|
||||
movi(GetDst(Node).VCast(OpSize * 8, Elements), Op->Immediate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,11 @@ DEF_OP(VectorZero) {
|
||||
|
||||
DEF_OP(VectorImm) {
|
||||
auto Op = IROp->C<IR::IROp_VectorImm>();
|
||||
uint8_t OpSize = IROp->Size;
|
||||
|
||||
auto Dst = GetDst(Node);
|
||||
uint64_t Imm = Op->Immediate;
|
||||
const uint8_t OpSize = IROp->Size;
|
||||
const uint64_t Imm = Op->Immediate;
|
||||
|
||||
const auto Dst = GetDst(Node);
|
||||
|
||||
uint64_t Element{};
|
||||
switch (Op->Header.ElementSize) {
|
||||
@@ -61,9 +62,13 @@ DEF_OP(VectorImm) {
|
||||
|
||||
mov(TMP1, Element);
|
||||
vmovq(Dst, TMP1);
|
||||
if (OpSize == 16) {
|
||||
// Duplicate to the upper 64bits if we are 128bits
|
||||
movddup(Dst, Dst);
|
||||
|
||||
if (OpSize >= 16) {
|
||||
LOGMAN_THROW_AA_FMT(OpSize == 16 || OpSize == 32,
|
||||
"Can't handle a vector of size: {}", OpSize);
|
||||
|
||||
// Duplicate into upper elements
|
||||
vbroadcastsd(ToYMM(Dst), Dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user