The hand-written parts of the manual still described how the retired xenia-rs interpreter behaved: its snapshots, Rust casts and helpers. Each of those 490 statements is now either restated as what Canary's emitters and x64 backend actually do (at the pinned canary_experimental commit), or dropped where it only made sense for xenia-rs. Checking them turned up claims that were wrong, not just outdated: - VSCR[SAT] is never modelled in Canary (DID_SATURATE is a stub and mfvscr cannot see it); the pages said saturating ops set it stickily. - Canary does not implement lswi/lswx/stswi/stswx, dcbi, mtfsb0/mtfsb1, vmsum*, vmhaddshs, vupkhpx/vupklpx, and most SPRs; pages described them as working. - Traps evaluate TO in Canary; stvebx/stvehx/stvewx store one element, not 16 bytes; mtmsrd writes only EE; fres/frsqrte/vrsqrtefp precision claims and the stfs "rounds under RN / sets FPSCR" claim contradicted the spec. - Reservations are a 64 KiB block bitmap plus a value compare, not per-address tracking. Claims that neither Canary's source nor a public spec settles are marked unverified (NI at boot, vmaddcfp128 operand order, estimate bit-exactness). Generated regions are untouched; re-running the generator changes nothing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
5.5 KiB
5.5 KiB
vcfpuxws128 — Vector128 Convert From Floating-Point to Unsigned Fixed-Point Word Saturate
Assembler Mnemonics
| Mnemonic | XML entry | Flags | Description |
|---|---|---|---|
vcfpuxws128 |
vcfpuxws128 |
— | Vector128 Convert From Floating-Point to Unsigned Fixed-Point Word Saturate |
Syntax
vcfpuxws128 [VD], [VB], [UIMM]
Encoding
vcfpuxws128 — form VX128_3
- Opcode word:
0x18000270 - Primary opcode (bits 0–5):
6 - Extended opcode:
624 - Synchronising: no
| Bits | Field | Meaning |
|---|---|---|
| 0–5 | OPCD |
primary opcode (6) |
| 6–10 | VD128l |
destination low 5 bits |
| 11–15 | IMM |
5-bit immediate |
| 16–20 | VB128l |
source B low 5 bits |
| 21–27 | XO |
extended opcode |
| 28–29 | VD128h |
destination high 2 bits |
| 30–31 | VB128h |
source B high 2 bits |
Operands
| Field | Role | Description |
|---|---|---|
VB |
vcfpuxws128: read | Source B vector register. |
UIMM |
vcfpuxws128: read | 16-bit unsigned immediate. Zero-extended. |
VD |
vcfpuxws128: write | Destination vector register. |
VSCR |
vcfpuxws128: write | Vector Status and Control Register (NJ/SAT bits). |
Register Effects
vcfpuxws128
- Reads (always):
VB,UIMM - Reads (conditional): none
- Writes (always):
VD,VSCR - Writes (conditional): none
Status-Register Effects
vcfpuxws128: VSCR[SAT] may be stickied on saturating vector operations.
Operation (pseudocode)
; No hand-written pseudocode for this instruction yet.
; The authoritative semantics are the Canary emitter snapshot under
; Implementation References; about half of Canary's emitters open
; with the PPC-style definition as a comment (`RD <- (RA) + (RB)`).
; Every side effect is also enumerated in the Register Effects and
; Status-Register Effects tables above.
C Translation Example
/* No hand-written C yet. Translate the Canary emitter snapshot */
/* under Implementation References; its HIR maps directly: */
/* f.LoadGPR(n) / f.StoreGPR(n, v) -> r[n] / r[n] = v */
/* f.LoadFPR / StoreFPR, f.LoadVR / StoreVR -> f[n], v[n] */
/* f.Load(ea, T), f.Store(ea, v) -> raw read / write; emitters */
/* wrap them in f.ByteSwap for the big-endian guest value */
/* f.UpdateCR(n, v) -> CR field n from v's LOW 32 BITS vs 0 */
/* f.LoadCA / f.StoreCA -> xer.CA; f.StoreSAT -> vscr.SAT */
/* i.XO.RA, i.D.DS, ... -> the bit-fields listed under Operands */
/* The Register Effects and Status-Register Effects tables above */
/* enumerate every side effect a faithful translation must emit. */
Implementation References
vcfpuxws128
- Canary XML:
tools/ppc-instructions.xml— search formnem="vcfpuxws128" - Canary emitter:
src/xenia/cpu/ppc/ppc_emit_altivec.cc:557 - Sylpheed opcode:
crates/sylpheed-ppc/src/opcode.rs:318 - Sylpheed decoder:
crates/sylpheed-ppc/src/decoder.rs:772
Canary emitter (frozen snapshot @ f21ebd49e9)
int InstrEmit_vcfpuxws128(PPCHIRBuilder& f, const InstrData& i) {
return InstrEmit_vctuxs_(f, VX128_3_VD128, VX128_3_VB128, VX128_3_IMM);
}
// ── delegates to (src/xenia/cpu/ppc/ppc_emit_altivec.cc:543) ──
int InstrEmit_vctuxs_(PPCHIRBuilder& f, uint32_t vd, uint32_t vb,
uint32_t uimm) {
// (VD) <- int_sat(VB as unsigned * 2^uimm)
float fuimm = static_cast<float>(std::exp2(uimm));
Value* v =
f.Mul(f.LoadVR(vb), f.Splat(f.LoadConstantFloat32(fuimm), VEC128_TYPE));
v = f.VectorConvertF2I(v, ARITHMETIC_UNSIGNED);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(vd, v);
return 0;
}
Special Cases & Edge Conditions
- Float → unsigned fixed-point (uint32) with explicit scale. Each lane computes
VD.w[i] = sat_uint32(VB[i] * 2^UIMM), truncating toward zero and clamping to[0, 2^32−1].UIMMis a 5-bit unsigned bias (range 0..31). - Negative floats clamp to 0 and sticky-set
VSCR[SAT]. - NaN inputs → 0. Canary shares
vctuxs's body, whosevmaxpsagainst zero turns NaN into 0; it never recordsVSCR[SAT]. VSCR[NJ]honoured for denormal inputs.- VMX128 register-fusion applies to
VDandVB(7-bit IDs). - No IBM AIX entry — Xenon-only.
- No
Rc, no XER / FPSCR.
Related Instructions
vctuxs— the standard Altivec equivalent (uint32 clamp with scale).vcfpsxws128— signed variant.vcuxwfp128— the inverse (uint → float with scale).vrfiz— plain truncate-to-integer-float without scale.
IBM Reference
- No IBM AIX entry — this instruction is exclusive to the Xbox 360's VMX128 extension.
- Xbox 360 XDK, Altivec-128 (VMX128) extensions (Microsoft internal documentation); cross-referenced with IBM AltiVec Technology Programmer's Interface Manual §
vctuxs.