translate/impl: Add Vpart

This commit is contained in:
MerryMage 2018-02-05 21:43:58 +00:00
parent cc9efd13c9
commit dd88cee15a
2 changed files with 24 additions and 0 deletions

View file

@ -161,6 +161,27 @@ void TranslatorVisitor::V_scalar(size_t /*bitsize*/, Vec vec, IR::UAny value) {
ir.SetQ(vec, ir.ZeroExtendToQuad(value)); ir.SetQ(vec, ir.ZeroExtendToQuad(value));
} }
IR::UAny TranslatorVisitor::Vpart(size_t bitsize, Vec vec, size_t part) {
ASSERT(part == 0 || part == 1);
if (part == 0) {
ASSERT(bitsize == 8 || bitsize == 16 || bitsize == 32 || bitsize == 64);
} else {
ASSERT(bitsize == 64);
}
return ir.VectorGetElement(bitsize, V(128, vec), part);
}
void TranslatorVisitor::Vpart(size_t bitsize, Vec vec, size_t part, IR::UAny value) {
ASSERT(part == 0 || part == 1);
if (part == 0) {
ASSERT(bitsize == 8 || bitsize == 16 || bitsize == 32 || bitsize == 64);
V(128, vec, ir.ZeroExtendToQuad(value));
} else {
ASSERT(bitsize == 64);
V(128, vec, ir.VectorSetElement(64, V(128, vec), 1, value));
}
}
IR::UAnyU128 TranslatorVisitor::Mem(IR::U64 address, size_t bytesize, AccType /*acctype*/) { IR::UAnyU128 TranslatorVisitor::Mem(IR::U64 address, size_t bytesize, AccType /*acctype*/) {
switch (bytesize) { switch (bytesize) {
case 1: case 1:

View file

@ -53,6 +53,9 @@ struct TranslatorVisitor final {
IR::UAny V_scalar(size_t bitsize, Vec vec); IR::UAny V_scalar(size_t bitsize, Vec vec);
void V_scalar(size_t bitsize, Vec vec, IR::UAny value); void V_scalar(size_t bitsize, Vec vec, IR::UAny value);
IR::UAny Vpart(size_t bitsize, Vec vec, size_t part);
void Vpart(size_t bitsize, Vec vec, size_t part, IR::UAny value);
IR::UAnyU128 Mem(IR::U64 address, size_t size, AccType acctype); IR::UAnyU128 Mem(IR::U64 address, size_t size, AccType acctype);
void Mem(IR::U64 address, size_t size, AccType acctype, IR::UAnyU128 value); void Mem(IR::U64 address, size_t size, AccType acctype, IR::UAnyU128 value);