golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
121.16k stars 17.37k forks source link

x/arch/x86/x86asm: 64-bit CMOV is disassembled as 32-bit CMOV #20111

Open rasky opened 7 years ago

rasky commented 7 years ago

These two sequences are disassembled by x86asm with the same string:

0f4dd0        CMOVGE AX, DX
480f4dd0      CMOVGE AX, DX

If I'm not mistaken, the second is the 64-bit version and should probably use a mnemonic like CMOVQGE (or the other one should use CMOVLGE).

bradfitz commented 7 years ago

/cc @cherrymui @randall77

quasilyte commented 6 years ago

This is not the only case.

I have no concrete examples yet, but quite recently I assembled hand-coded file and disassembled listing had different mnemonics. The disasm output was acquired by go tool objdump, so it may be unrelated.

When this will pop up again, I will post them here.

rsc commented 6 years ago

If the decision is whether to make a fix, then I think the answer is yes: CMOVGE is not an instruction, it should have an L or Q in both cases.