Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Risu PPC64 fixes #1

Open
wants to merge 22 commits into
base: ferst-next-next-base
Choose a base branch
from
Open

Risu PPC64 fixes #1

wants to merge 22 commits into from

Conversation

mferst
Copy link

@mferst mferst commented Oct 27, 2022

No description provided.

vcoracolombo and others added 4 commits October 28, 2022 17:06
Signed-off-by: Víctor Colombo <[email protected]>
[ferst: Ignore FPSCR[FR] for now; Rebase; ]
The current code can be used to test VSX instructions, but the lower
half of the first 32 VSRs are ignored. Add risugen code to
(conditionally) initialize the 128-bits of all VSX registers and C code
to compare the lower 64-bits of VSRs 0-31.
ppc64.risu Outdated
Comment on lines 3159 to 3163
# format:XX3 book:I page:673 v3.0 xvcmpnedp[.] VSX Vector Compare Not Equal Double-Precision
XVCMPNEDP PPC64LE 111100 t:5 a:5 b:5 01111011 ax:1 bx:1 tx:1
# format:XX3 book:I page:673 v3.0 xvcmpnedp[.] VSX Vector Compare Not Equal Double-Precision
XVCMPNEDPd PPC64LE 111100 t:5 a:5 b:5 11111011 ax:1 bx:1 tx:1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I just noticed I sent this in this patch.

The problem with these lines is that theses instructions were removed from Power ISA. I think they were introduced in 3.0 and removed in 3.0B. Do you think we should remove them from risu?
If we remove them, I'll have to send a separated patch, because it should not be in this commit

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also the case for LMDX, it was present in the first version of PowerISA v3.0 but removed on PowerISA v3.0b. I think we can keep them commented out, just like we do with other instructions that cannot be tested like SC[V], TRAP, etc.

vcoracolombo and others added 9 commits October 31, 2022 10:44
[ferst: LDMX; comment instead of removal]
ADDPCIS uses the program counter, which depends on where the image was
loaded. DARN is non-deterministic by definition, we can't compare the
results between executions.
Some instructions use a pair of fp registers, represented by fr*p
instead of just fr* (e.g. frap, frbp). These have the special property
that they have to be an even-odd pair, starting at the even one.
Otherwise, the instruction is malformed

This patch adds constraints to these instructions to garantee the
selected registers are even.

Signed-off-by: Víctor Colombo <[email protected]>
Also adds "$ra != $rb" and "$ra != 0" constraints to avoid the current
limitations of reg_plus_reg and reg_plus_imm implementations.
Unlike the other VSX instructions, the TX field of LVX is not the last
bit. Also, the immediate is multiplied by 16 to calculate EA.
EA is not calculated with "reg plus reg" for these instructions.
Instead, RA is the base register to access up to 16 bytes, according
to RB[0:7] value. Also, abuse the memory block to put a valid value in
RB.
--
Power ISA says that the results are "boundedly undefined" if the
contents of bits 8:63 of RB are not equal to zero. I'd expect the
hardware to ignore those bits, but we observed SIGSEGVs on hardware if
we use just reg($ra) and let any random value in RB.
If $ra is used as one of the source registers, we'll store a value that
depends on the stack pointer in the memory block. If a load instruction
later reads this value, the register comparison will fail mysteriously.
Currently, write_memblock_setup initializes 10000 bytes below the stack
pointer with zeros. However, reg_plus_reg and reg_plus_imm make the
instruction point to $r1+32 and $r1, respectively, causing access
outside the stack frame. Change write_memblock_setup to initialize the
memblock with random data, and use STDU to make $r1 point to the
beginning of the block at the end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants