Adding vector add tests and fixing bugs found (still broken).
This commit is contained in:
@@ -2630,7 +2630,7 @@ uint32_t Translate_VECTOR_ADD_I32(IntCodeState& ics, const IntCode* i) {
|
||||
if (arithmetic_flags & ARITHMETIC_SATURATE) {
|
||||
if (arithmetic_flags & ARITHMETIC_UNSIGNED) {
|
||||
for (int n = 0; n < 4; n++) {
|
||||
uint64_t v = VECI4(src1, n) + VECI4(src2, n);
|
||||
uint64_t v = (uint64_t)VECI4(src1, n) + (uint64_t)VECI4(src2, n);
|
||||
if (v > 0xFFFFFFFF) {
|
||||
VECI4(dest, n) = 0xFFFFFFFF;
|
||||
ics.did_saturate = 1;
|
||||
@@ -2640,7 +2640,7 @@ uint32_t Translate_VECTOR_ADD_I32(IntCodeState& ics, const IntCode* i) {
|
||||
}
|
||||
} else {
|
||||
for (int n = 0; n < 4; n++) {
|
||||
int64_t v = (int32_t)VECI4(src1, n) + (int32_t)VECI4(src2, n);
|
||||
int64_t v = (int64_t)(int32_t)VECI4(src1, n) + (int64_t)(int32_t)VECI4(src2, n);
|
||||
if (v > 0x7FFFFFFF) {
|
||||
VECI4(dest, n) = 0x7FFFFFFF;
|
||||
ics.did_saturate = 1;
|
||||
|
||||
@@ -2749,7 +2749,7 @@ EMITTER(VECTOR_ADD, MATCH(I<OPCODE_VECTOR_ADD, V128<>, V128<>, V128<>>)) {
|
||||
e.vblendvps(e.xmm2, e.xmm0, e.GetXmmConstPtr(XMMSignMaskPS), e.xmm2);
|
||||
e.vpor(e.xmm1, src1, src2); // sign_or
|
||||
e.vpandn(e.xmm1, e.xmm0); // max_sat_mask
|
||||
e.vblendvps(e.xmm2, e.GetXmmConstPtr(XMMAbsMaskPS), e.xmm1);
|
||||
e.vblendvps(dest, e.GetXmmConstPtr(XMMAbsMaskPS), e.xmm1);
|
||||
}
|
||||
} else {
|
||||
e.vpaddd(dest, src1, src2);
|
||||
|
||||
Reference in New Issue
Block a user