Merge pull request #364 from wheremyfoodat/x64-shader-derp

Fix cmp in x64 shader JIT
This commit is contained in:
wheremyfoodat 2024-01-04 03:51:52 +02:00 committed by GitHub
commit 87ad45788d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -403,11 +403,18 @@ void ShaderEmitter::checkCmpRegister(const PICAShader& shader, u32 instruction)
switch (condition) {
case 0: // Either cmp register matches
// Z flag is 0 if at least 1 of them is set
test(word[statePointer + cmpRegXOffset], refX_refY_merged);
// Invert z flag
setz(al);
test(al, al);
// Check if X matches
cmp(byte[statePointer + cmpRegXOffset], refX);
sete(al);
// Or if Y matches
cmp(byte[statePointer + cmpRegYOffset], refY);
sete(cl);
or_(al, cl);
// If either of them matches, set Z to 1, else set it to 0
xor_(al, 1);
break;
case 1: // Both cmp registers match
cmp(word[statePointer + cmpRegXOffset], refX_refY_merged);