#542
Decoded SQRTSS xmm1, xmm2 appears to read from xmm1
Reproduced with this disasm-sqrtss.c:
#include <assert.h>
#include <stdio.h>
#include <Zydis/Zydis.h>
int main(void)
{
const ZyanU8 data[] = {0xF3, 0x0F, 0x51, 0xCA};
ZydisDisassembledInstruction instruction;
assert(ZYAN_SUCCESS(ZydisDisassembleIntel(ZYDIS_MACHINE_MODE_LONG_64,
0,
data,
sizeof(data),
&instruction)));
printf("%s\n", instruction.text);
printf("first operand action read: %d\n",
instruction.operands[0].actions & ZYDIS_OPERAND_ACTION_READ);
return 0;
}$ gcc -lZydis disasm-sqrtss.c
$ ./a.out
sqrtss xmm1, xmm2
first operand action read: 1From the x86 manual, vol. 2B 4-665 (page 1891), xmm1 should be write-only.
Activity
2This sounds like the same as #585, if it is a partial write then it should mark it as read since it needs the previous value, this is in my opinion more correct than just having it marked as write.
"remain unchanged" means the result depends on the incoming value in that register. I'd count that as a read, though it certainly is debatable.
And I do agree there's a bug somewhere.
Either 'leaves bits unchanged' is a read, in which case cmovl is wrong, or it's not a read, in which case sqrtss (and rcpss, roundss, and probably a few others) are wrong.
And in both cases, movss being different from sqrtss is a baffling result.