The instruction registry document listed RCL and RCR among the forms
rejected on purpose. This branch implements them, so the list no longer
names them. SHLD and SHRD stay on it.
Signed-off-by: sahib453 <117431595+sahib453@users.noreply.github.com>
With the overflow exception unmasked, an overflow whose result is exact
before the exponent is bounded set the MXCSR precision flag as well as
the overflow flag. The Intel SDM (Vol. 1, D.4.2.3, Table D-16) reports
precision there only if rounding with an unbounded exponent is inexact.
- softfloat.rs: Control reads the overflow mask, and round() reports
precision on an unmasked overflow only when the result was rounded.
The masked response is unchanged.
- cpu_known_answers.rs: the five exact-overflow cases are no longer an
ignored defect, three more cover the other rounding modes, and the
scalar and conversion sweeps now compare the precision flag here.
- docs/cpu/instruction-registry.md: the behaviour is no longer listed
as unasserted.
Signed-off-by: sahib453 <117431595+sahib453@users.noreply.github.com>
Declare MOVS and STOS for 8- to 64-bit elements through a new string
encoding that accepts REP, and add the direction flag with CLD and STD.
A REP form runs one element per step and stays on the instruction until
RCX is zero. Every element therefore counts against the step budget, a
repeat can stop part-way and resume, and a fault keeps the elements
already done. FS and GS apply to the MOVS source only. Both engines use
the shared semantics; there is no bulk-copy path.
Fourteen SDM-derived cases already in cpu_known_answers.rs move from
refused to verified, and ten more are now refused at their second
instruction because CLD runs. tests/cpu_rep.rs adds a byte-array model
over every form, direction and count.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
CPUID returns a fixed table that never reads the host: a synthetic
vendor, and a feature bit only when every instruction of that feature
is implemented. Today that is CMOV, POPCNT, LZCNT and long mode. SSE
and SSE2 stay unreported while parts of them are rejected. Unlisted
leaves return zeros.
tests/cpu_features.rs pins every leaf in both engines, requires each
reported feature's instruction set among the executed fixtures, and
holds a refused witness instruction for each unreported feature, so a
bit cannot be set early or forgotten later.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
Declare XADD and CMPXCHG in the instruction registry for 8- to 64-bit
register and memory destinations. The LOCK prefix is accepted on the
forms the registry marks lockable and only with a memory destination;
every other use stays an illegal instruction.
Both engines run the new forms on the shared semantics. A failed
CMPXCHG still writes its destination, so it faults on memory that
cannot be written, and a fault changes nothing. The registry document
states the ordering, alignment, compare-failure and fault rules a guest
scheduler has to preserve. Nothing is lowered to ARM64 atomics.
Fourteen SDM-derived cases already in cpu_known_answers.rs move from
refused to verified. Adds 62 LLVM-assembled fixtures with reference
arms, generator checks for the lock key and tests/x86_atomic.rs.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
Keep every upstream test and the new assembler forms. Keep the shared
decoder and lowering, which already cover the merged MOVZX, MOVSX and
segment fixes, and adopt upstream's rule that GS applies when FS and GS
overrides are combined. Add segment regressions for RIP-relative operands,
negative displacements and fault addresses in both engines.
Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.com>
Add the scalar and packed binary32 and binary64 arithmetic, compares and
conversions, computed exactly and rounded once in software. Follow MXCSR
rounding, sticky flags, denormals-are-zero, flush-to-zero, tininess after
rounding and x86 NaN selection. Stop on unmasked exceptions without a
result. Host floating point is not used, and no form is lowered to NEON.
Verify 6,824 vectors computed with exact fractions by an independent Python
reference in both engines, and round-to-nearest results against the host.
List the behaviour that is implemented but left unasserted.
Refs #127, #128
Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.com>
Add XMM0-XMM15 and MXCSR to the guest state and extend the registry with
mandatory prefixes, so the shared decoder covers the SSE and SSE2 moves and
packed integer operations. Reject opcodes where 0x66 could be both an
operand size and a mandatory prefix.
Translate operations with identical NEON lane semantics to ARM64; other
forms call the shared semantics and are counted. Raise a distinct
general-protection exit for misaligned 16-byte operands and reserved MXCSR
bits. Floating-point arithmetic is not implemented.
Verify 374 LLVM-assembled instructions against a byte-array reference that
reads only their assembly text, and mixed sequences between the engines.
Refs #124, #125, #126, #128
Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.com>
Add a declarative x86-64 instruction registry with a validating generator,
and decode through its tables in the static probe, the interpreter and the
native DBT. Move integer semantics into shared reviewed primitives and
extend them to 8-, 16-, 32- and 64-bit register and memory operands.
Store all six arithmetic flags in the guest state so they survive helper
calls and block boundaries, and correct unsigned branch conditions. Lower
common forms to ARM64; other forms call the shared semantics and are
counted. Report probe support from the decoder that executes.
Verify 985 LLVM-assembled instructions against a bit-level reference that
reads only their assembly text, and random sequences between the engines.
Refs #64, #65, #66, #68, #70, #71, #73, #118, #119, #120, #121, #122,
Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.com>
#123, #194, #195, #196