Replace "mov{d|q}" with "movq".
Details
Diff Detail
Event Timeline
test/CodeGen/X86/vector-pcmp.ll | ||
---|---|---|
2 | If you can please commit the conversion to update_llc_test_checks.py (with trailing ; line removal) as an NFC pre-commit - this patch is big already! |
This wasn't a mistake. We have aliases for movq for this instruction already. This was for compatibility with MacOS/Darwin's old assembler from the pre-clang days.
See this code
These are the correct encodings of the instructions so that we know how to
read correct assembly, even though we continue to emit the wrong ones for
// compatibility with Darwin's buggy assembler.
def : InstAlias<"movq\t{$src, $dst|$dst, $src}",
(MOV64toPQIrr VR128:$dst, GR64:$src), 0>;
def : InstAlias<"movq\t{$src, $dst|$dst, $src}",
(MOVPQIto64rr GR64:$dst, VR128:$src), 0>;
// Allow "vmovd" but print "vmovq" since we don't need compatibility for AVX.
def : InstAlias<"vmovd\t{$src, $dst|$dst, $src}",
(VMOV64toPQIrr VR128:$dst, GR64:$src), 0>;
def : InstAlias<"vmovd\t{$src, $dst|$dst, $src}",
(VMOVPQIto64rr GR64:$dst, VR128:$src), 0>;
@craig.topper is this still needed? Why would we insert a "bug" only to be compatible with MacOS?
What about the memory form instructions? InstAlias cannot solve this for them.
In the days before the MC layer of LLVM existed, clang would output assembly as text and feed it to the separate assembler tool. So it had to output what the MacOS assembler could parse.
I believe the assembler bug occurred around when 64-bit was introduced. There was already separate 64-bit movq to/from memory instruction before that. Then movd picked up a rex prefix that allowed it to access 64-bit registers and redudantly access 64-bit memory. I don't think there was ever a movq to memory issue because we never expect to use the rex encoded memory instruction since the older movq instruction is available.
We probably don't need to output that way anymore. But we should keep an alias around so we can process old assembly filed. So switch the instruction string to movq and change the alias to movd.
aliases is mispelled.