diff options
| author | Wunkolo <Wunkolo@gmail.com> | 2023-02-05 17:00:43 -0800 |
|---|---|---|
| committer | Rick Gibbed <rick@gibbed.us> | 2023-05-29 14:56:00 -0500 |
| commit | 93b77fb775c46dc56c8612cb9f4ac3fdc7cc973b (patch) | |
| tree | e5fbefa4b0414bd6cab3f66e52e8bbaa3505c01a /src | |
| parent | ed64e3072bde74955c79b9f3b0030c133648d702 (diff) | |
[PPC] Implement `vaddcuw`
I don't know of any title that utilizes this instruction, but I went
ahead and implemented it for completeness.
Verified the implementation with `instr__gen_vaddcuw` from #1348. Can be
grabbed with:
```
git checkout origin/gen_tests -- src\xenia\cpu\ppc\testing\*vaddcuw.s
```
Diffstat (limited to 'src')
| -rw-r--r-- | src/xenia/cpu/ppc/ppc_emit_altivec.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/xenia/cpu/ppc/ppc_emit_altivec.cc b/src/xenia/cpu/ppc/ppc_emit_altivec.cc index 3ca5bc40f..b8257c1bc 100644 --- a/src/xenia/cpu/ppc/ppc_emit_altivec.cc +++ b/src/xenia/cpu/ppc/ppc_emit_altivec.cc @@ -358,8 +358,13 @@ int InstrEmit_mtvscr(PPCHIRBuilder& f, const InstrData& i) { } int InstrEmit_vaddcuw(PPCHIRBuilder& f, const InstrData& i) { - XEINSTRNOTIMPLEMENTED(); - return 1; + Value* sum = f.VectorAdd(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT32_TYPE, + ARITHMETIC_UNSIGNED); + Value* overflow = f.VectorCompareUGT(f.LoadVR(i.VX.VA), sum, INT32_TYPE); + Value* carry = + f.VectorShr(overflow, f.LoadConstantVec128(vec128i(31)), INT32_TYPE); + f.StoreVR(i.VX.VD, carry); + return 0; } int InstrEmit_vaddfp_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb) { |
