summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-04-24 04:28:02 +0000
committerCraig Topper <craig.topper@intel.com>2018-04-24 04:28:02 +0000
commit19b85103a3266bebbd762244d6c00afdcaaaec09 (patch)
tree581755990f6f9d7a34e4489d8d7500cc8f7d33bd /llvm/lib/Target
parentce281a41b5244fae305a2fe202c75e6809b13d67 (diff)
downloadbcm5719-llvm-19b85103a3266bebbd762244d6c00afdcaaaec09.tar.gz
bcm5719-llvm-19b85103a3266bebbd762244d6c00afdcaaaec09.zip
[X86] Add a BSWAP16 instruction using the 32-bit encoding plus a 0x66 prefix.
This encoding is recognized by the CPU, but the behavior is undefined. This makes the disassembler handle it correctly so we don't print bswapl with a 16-bit register. llvm-svn: 330682
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86InstrInfo.td8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.td b/llvm/lib/Target/X86/X86InstrInfo.td
index 507746218ec..27695eb3562 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.td
+++ b/llvm/lib/Target/X86/X86InstrInfo.td
@@ -1326,9 +1326,13 @@ def PUSHA16 : I<0x60, RawFrm, (outs), (ins), "pushaw", []>,
}
let Constraints = "$src = $dst", SchedRW = [WriteALU] in {
+// This instruction is a consequence of BSWAP32r observing operand size. The
+// encoding is valid, but the behavior is undefined.
+let isCodeGenOnly = 1, ForceDisassemble = 1, hasSideEffects = 0 in
+def BSWAP16r_BAD : I<0xC8, AddRegFrm, (outs GR16:$dst), (ins GR16:$src),
+ "bswap{w}\t$dst", []>, OpSize16, TB;
// GR32 = bswap GR32
-def BSWAP32r : I<0xC8, AddRegFrm,
- (outs GR32:$dst), (ins GR32:$src),
+def BSWAP32r : I<0xC8, AddRegFrm, (outs GR32:$dst), (ins GR32:$src),
"bswap{l}\t$dst",
[(set GR32:$dst, (bswap GR32:$src))]>, OpSize32, TB;
OpenPOWER on IntegriCloud