2015-05-25 09:43:23 +08:00
|
|
|
//===-- X86InstComments.cpp - Generate verbose-asm comments for instrs ----===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-05-25 09:43:23 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This defines functionality used to emit comments about X86 instructions to
|
|
|
|
// an output stream for -fverbose-asm.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "X86InstComments.h"
|
2018-03-29 12:14:04 +08:00
|
|
|
#include "X86ATTInstPrinter.h"
|
2019-05-11 07:24:38 +08:00
|
|
|
#include "X86BaseInfo.h"
|
|
|
|
#include "X86MCTargetDesc.h"
|
2015-05-25 09:43:23 +08:00
|
|
|
#include "Utils/X86ShuffleDecode.h"
|
2017-06-06 19:49:48 +08:00
|
|
|
#include "llvm/MC/MCInst.h"
|
2018-03-10 11:12:00 +08:00
|
|
|
#include "llvm/MC/MCInstrInfo.h"
|
2015-05-25 09:43:23 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2016-05-11 19:55:12 +08:00
|
|
|
#define CASE_SSE_INS_COMMON(Inst, src) \
|
2016-02-07 01:02:15 +08:00
|
|
|
case X86::Inst##src:
|
|
|
|
|
2016-05-11 19:55:12 +08:00
|
|
|
#define CASE_AVX_INS_COMMON(Inst, Suffix, src) \
|
2016-02-07 01:02:15 +08:00
|
|
|
case X86::V##Inst##Suffix##src:
|
|
|
|
|
2016-05-11 19:55:12 +08:00
|
|
|
#define CASE_MASK_INS_COMMON(Inst, Suffix, src) \
|
|
|
|
case X86::V##Inst##Suffix##src##k:
|
|
|
|
|
|
|
|
#define CASE_MASKZ_INS_COMMON(Inst, Suffix, src) \
|
|
|
|
case X86::V##Inst##Suffix##src##kz:
|
|
|
|
|
|
|
|
#define CASE_AVX512_INS_COMMON(Inst, Suffix, src) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, Suffix, src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Suffix, src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Suffix, src)
|
|
|
|
|
|
|
|
#define CASE_MOVDUP(Inst, src) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z, r##src) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z256, r##src) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z128, r##src) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, , r##src) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, Y, r##src) \
|
2016-02-07 01:02:15 +08:00
|
|
|
CASE_SSE_INS_COMMON(Inst, r##src)
|
|
|
|
|
2016-07-03 21:08:29 +08:00
|
|
|
#define CASE_MASK_MOVDUP(Inst, src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z, r##src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z256, r##src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z128, r##src)
|
|
|
|
|
|
|
|
#define CASE_MASKZ_MOVDUP(Inst, src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z, r##src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z256, r##src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z128, r##src)
|
|
|
|
|
2016-05-11 19:55:12 +08:00
|
|
|
#define CASE_PMOVZX(Inst, src) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z, r##src) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z256, r##src) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z128, r##src) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, , r##src) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, Y, r##src) \
|
2016-02-07 03:51:21 +08:00
|
|
|
CASE_SSE_INS_COMMON(Inst, r##src)
|
|
|
|
|
2016-07-03 21:33:28 +08:00
|
|
|
#define CASE_MASK_PMOVZX(Inst, src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z, r##src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z256, r##src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z128, r##src)
|
|
|
|
|
|
|
|
#define CASE_MASKZ_PMOVZX(Inst, src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z, r##src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z256, r##src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z128, r##src)
|
|
|
|
|
2016-05-11 19:55:12 +08:00
|
|
|
#define CASE_UNPCK(Inst, src) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z, r##src) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z256, r##src) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z128, r##src) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, , r##src) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, Y, r##src) \
|
2016-02-07 01:02:15 +08:00
|
|
|
CASE_SSE_INS_COMMON(Inst, r##src)
|
|
|
|
|
2016-07-03 22:26:21 +08:00
|
|
|
#define CASE_MASK_UNPCK(Inst, src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z, r##src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z256, r##src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z128, r##src)
|
|
|
|
|
|
|
|
#define CASE_MASKZ_UNPCK(Inst, src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z, r##src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z256, r##src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z128, r##src)
|
|
|
|
|
|
|
|
#define CASE_SHUF(Inst, suf) \
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z, suf) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z256, suf) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z128, suf) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, , suf) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, Y, suf) \
|
|
|
|
CASE_SSE_INS_COMMON(Inst, suf)
|
2016-02-07 01:02:15 +08:00
|
|
|
|
2016-07-03 21:55:41 +08:00
|
|
|
#define CASE_MASK_SHUF(Inst, src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z, r##src##i) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z256, r##src##i) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z128, r##src##i)
|
|
|
|
|
|
|
|
#define CASE_MASKZ_SHUF(Inst, src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z, r##src##i) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z256, r##src##i) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z128, r##src##i)
|
|
|
|
|
2016-07-04 02:02:43 +08:00
|
|
|
#define CASE_VPERMILPI(Inst, src) \
|
2016-05-11 19:55:12 +08:00
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z, src##i) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z256, src##i) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z128, src##i) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, , src##i) \
|
2016-02-07 01:02:15 +08:00
|
|
|
CASE_AVX_INS_COMMON(Inst, Y, src##i)
|
|
|
|
|
2016-07-04 02:02:43 +08:00
|
|
|
#define CASE_MASK_VPERMILPI(Inst, src) \
|
2016-07-03 21:55:41 +08:00
|
|
|
CASE_MASK_INS_COMMON(Inst, Z, src##i) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z256, src##i) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z128, src##i)
|
|
|
|
|
2016-07-04 02:02:43 +08:00
|
|
|
#define CASE_MASKZ_VPERMILPI(Inst, src) \
|
2016-07-03 21:55:41 +08:00
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z, src##i) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z256, src##i) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z128, src##i)
|
|
|
|
|
2016-07-04 02:27:37 +08:00
|
|
|
#define CASE_VPERM(Inst, src) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z, src##i) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z256, src##i) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, Y, src##i)
|
|
|
|
|
2016-07-04 02:40:24 +08:00
|
|
|
#define CASE_MASK_VPERM(Inst, src) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z, src##i) \
|
|
|
|
CASE_MASK_INS_COMMON(Inst, Z256, src##i)
|
|
|
|
|
|
|
|
#define CASE_MASKZ_VPERM(Inst, src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z, src##i) \
|
|
|
|
CASE_MASKZ_INS_COMMON(Inst, Z256, src##i)
|
|
|
|
|
2016-02-07 01:02:15 +08:00
|
|
|
#define CASE_VSHUF(Inst, src) \
|
2016-05-11 19:55:12 +08:00
|
|
|
CASE_AVX512_INS_COMMON(SHUFF##Inst, Z, r##src##i) \
|
|
|
|
CASE_AVX512_INS_COMMON(SHUFI##Inst, Z, r##src##i) \
|
|
|
|
CASE_AVX512_INS_COMMON(SHUFF##Inst, Z256, r##src##i) \
|
|
|
|
CASE_AVX512_INS_COMMON(SHUFI##Inst, Z256, r##src##i)
|
2016-02-07 01:02:15 +08:00
|
|
|
|
2016-07-03 21:55:41 +08:00
|
|
|
#define CASE_MASK_VSHUF(Inst, src) \
|
|
|
|
CASE_MASK_INS_COMMON(SHUFF##Inst, Z, r##src##i) \
|
|
|
|
CASE_MASK_INS_COMMON(SHUFI##Inst, Z, r##src##i) \
|
|
|
|
CASE_MASK_INS_COMMON(SHUFF##Inst, Z256, r##src##i) \
|
|
|
|
CASE_MASK_INS_COMMON(SHUFI##Inst, Z256, r##src##i)
|
|
|
|
|
|
|
|
#define CASE_MASKZ_VSHUF(Inst, src) \
|
|
|
|
CASE_MASKZ_INS_COMMON(SHUFF##Inst, Z, r##src##i) \
|
|
|
|
CASE_MASKZ_INS_COMMON(SHUFI##Inst, Z, r##src##i) \
|
|
|
|
CASE_MASKZ_INS_COMMON(SHUFF##Inst, Z256, r##src##i) \
|
|
|
|
CASE_MASKZ_INS_COMMON(SHUFI##Inst, Z256, r##src##i)
|
|
|
|
|
2018-03-11 05:30:46 +08:00
|
|
|
#define CASE_AVX512_FMA(Inst, suf) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z, suf) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z256, suf) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst, Z128, suf)
|
|
|
|
|
|
|
|
#define CASE_FMA(Inst, suf) \
|
|
|
|
CASE_AVX512_FMA(Inst, suf) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, , suf) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst, Y, suf)
|
|
|
|
|
|
|
|
#define CASE_FMA_PACKED_REG(Inst) \
|
|
|
|
CASE_FMA(Inst##PD, r) \
|
|
|
|
CASE_FMA(Inst##PS, r)
|
|
|
|
|
|
|
|
#define CASE_FMA_PACKED_MEM(Inst) \
|
|
|
|
CASE_FMA(Inst##PD, m) \
|
|
|
|
CASE_FMA(Inst##PS, m) \
|
|
|
|
CASE_AVX512_FMA(Inst##PD, mb) \
|
|
|
|
CASE_AVX512_FMA(Inst##PS, mb)
|
|
|
|
|
|
|
|
#define CASE_FMA_SCALAR_REG(Inst) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SD, , r) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SS, , r) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SD, , r_Int) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SS, , r_Int) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SD, Z, r) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SS, Z, r) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst##SD, Z, r_Int) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst##SS, Z, r_Int)
|
|
|
|
|
|
|
|
#define CASE_FMA_SCALAR_MEM(Inst) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SD, , m) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SS, , m) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SD, , m_Int) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SS, , m_Int) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SD, Z, m) \
|
|
|
|
CASE_AVX_INS_COMMON(Inst##SS, Z, m) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst##SD, Z, m_Int) \
|
|
|
|
CASE_AVX512_INS_COMMON(Inst##SS, Z, m_Int)
|
|
|
|
|
2015-11-16 15:22:00 +08:00
|
|
|
static unsigned getVectorRegSize(unsigned RegNo) {
|
|
|
|
if (X86::ZMM0 <= RegNo && RegNo <= X86::ZMM31)
|
|
|
|
return 512;
|
|
|
|
if (X86::YMM0 <= RegNo && RegNo <= X86::YMM31)
|
|
|
|
return 256;
|
|
|
|
if (X86::XMM0 <= RegNo && RegNo <= X86::XMM31)
|
|
|
|
return 128;
|
2015-11-17 06:21:10 +08:00
|
|
|
if (X86::MM0 <= RegNo && RegNo <= X86::MM7)
|
|
|
|
return 64;
|
2015-11-16 15:22:00 +08:00
|
|
|
|
|
|
|
llvm_unreachable("Unknown vector reg!");
|
|
|
|
}
|
|
|
|
|
2018-03-13 00:43:11 +08:00
|
|
|
static unsigned getRegOperandNumElts(const MCInst *MI, unsigned ScalarSize,
|
|
|
|
unsigned OperandIndex) {
|
2015-11-16 15:22:00 +08:00
|
|
|
unsigned OpReg = MI->getOperand(OperandIndex).getReg();
|
2018-03-13 00:43:11 +08:00
|
|
|
return getVectorRegSize(OpReg) / ScalarSize;
|
2015-05-25 09:43:23 +08:00
|
|
|
}
|
|
|
|
|
2018-03-29 12:14:04 +08:00
|
|
|
static const char *getRegName(unsigned Reg) {
|
|
|
|
return X86ATTInstPrinter::getRegisterName(Reg);
|
|
|
|
}
|
|
|
|
|
2016-07-03 21:08:29 +08:00
|
|
|
/// Wraps the destination register name with AVX512 mask/maskz filtering.
|
2017-10-11 08:46:09 +08:00
|
|
|
static void printMasking(raw_ostream &OS, const MCInst *MI,
|
2018-03-29 12:14:04 +08:00
|
|
|
const MCInstrInfo &MCII) {
|
2018-03-10 11:12:00 +08:00
|
|
|
const MCInstrDesc &Desc = MCII.get(MI->getOpcode());
|
|
|
|
uint64_t TSFlags = Desc.TSFlags;
|
2016-07-03 21:08:29 +08:00
|
|
|
|
2018-03-10 11:12:00 +08:00
|
|
|
if (!(TSFlags & X86II::EVEX_K))
|
2017-10-11 08:46:09 +08:00
|
|
|
return;
|
2018-03-10 11:12:00 +08:00
|
|
|
|
|
|
|
bool MaskWithZero = (TSFlags & X86II::EVEX_Z);
|
|
|
|
unsigned MaskOp = Desc.getNumDefs();
|
|
|
|
|
|
|
|
if (Desc.getOperandConstraint(MaskOp, MCOI::TIED_TO) != -1)
|
|
|
|
++MaskOp;
|
|
|
|
|
|
|
|
const char *MaskRegName = getRegName(MI->getOperand(MaskOp).getReg());
|
2016-07-03 21:08:29 +08:00
|
|
|
|
|
|
|
// MASK: zmmX {%kY}
|
2017-10-11 08:46:09 +08:00
|
|
|
OS << " {%" << MaskRegName << "}";
|
2016-07-03 21:08:29 +08:00
|
|
|
|
|
|
|
// MASKZ: zmmX {%kY} {z}
|
|
|
|
if (MaskWithZero)
|
2017-10-11 08:46:09 +08:00
|
|
|
OS << " {z}";
|
2016-07-03 21:08:29 +08:00
|
|
|
}
|
|
|
|
|
2018-03-29 12:14:04 +08:00
|
|
|
static bool printFMA3Comments(const MCInst *MI, raw_ostream &OS) {
|
2018-03-11 05:30:46 +08:00
|
|
|
const char *Mul1Name = nullptr, *Mul2Name = nullptr, *AccName = nullptr;
|
|
|
|
unsigned NumOperands = MI->getNumOperands();
|
|
|
|
bool RegForm = false;
|
|
|
|
bool Negate = false;
|
|
|
|
StringRef AccStr = "+";
|
|
|
|
|
|
|
|
// The operands for FMA instructions without rounding fall into two forms.
|
|
|
|
// dest, src1, src2, src3
|
|
|
|
// dest, src1, mask, src2, src3
|
|
|
|
// Where src3 is either a register or 5 memory address operands. So to find
|
|
|
|
// dest and src1 we can index from the front. To find src2 and src3 we can
|
|
|
|
// index from the end by taking into account memory vs register form when
|
|
|
|
// finding src2.
|
|
|
|
|
|
|
|
switch (MI->getOpcode()) {
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
CASE_FMA_PACKED_REG(FMADD132)
|
|
|
|
CASE_FMA_SCALAR_REG(FMADD132)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMADD132)
|
|
|
|
CASE_FMA_SCALAR_MEM(FMADD132)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMADD213)
|
|
|
|
CASE_FMA_SCALAR_REG(FMADD213)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMADD213)
|
|
|
|
CASE_FMA_SCALAR_MEM(FMADD213)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul2Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMADD231)
|
|
|
|
CASE_FMA_SCALAR_REG(FMADD231)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMADD231)
|
|
|
|
CASE_FMA_SCALAR_MEM(FMADD231)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
AccName = getRegName(MI->getOperand(1).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMSUB132)
|
|
|
|
CASE_FMA_SCALAR_REG(FMSUB132)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMSUB132)
|
|
|
|
CASE_FMA_SCALAR_MEM(FMSUB132)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "-";
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMSUB213)
|
|
|
|
CASE_FMA_SCALAR_REG(FMSUB213)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMSUB213)
|
|
|
|
CASE_FMA_SCALAR_MEM(FMSUB213)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul2Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "-";
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMSUB231)
|
|
|
|
CASE_FMA_SCALAR_REG(FMSUB231)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMSUB231)
|
|
|
|
CASE_FMA_SCALAR_MEM(FMSUB231)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
AccName = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "-";
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FNMADD132)
|
|
|
|
CASE_FMA_SCALAR_REG(FNMADD132)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FNMADD132)
|
|
|
|
CASE_FMA_SCALAR_MEM(FNMADD132)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
Negate = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FNMADD213)
|
|
|
|
CASE_FMA_SCALAR_REG(FNMADD213)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FNMADD213)
|
|
|
|
CASE_FMA_SCALAR_MEM(FNMADD213)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul2Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
Negate = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FNMADD231)
|
|
|
|
CASE_FMA_SCALAR_REG(FNMADD231)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FNMADD231)
|
|
|
|
CASE_FMA_SCALAR_MEM(FNMADD231)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
AccName = getRegName(MI->getOperand(1).getReg());
|
|
|
|
Negate = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FNMSUB132)
|
|
|
|
CASE_FMA_SCALAR_REG(FNMSUB132)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FNMSUB132)
|
|
|
|
CASE_FMA_SCALAR_MEM(FNMSUB132)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "-";
|
|
|
|
Negate = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FNMSUB213)
|
|
|
|
CASE_FMA_SCALAR_REG(FNMSUB213)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FNMSUB213)
|
|
|
|
CASE_FMA_SCALAR_MEM(FNMSUB213)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul2Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "-";
|
|
|
|
Negate = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FNMSUB231)
|
|
|
|
CASE_FMA_SCALAR_REG(FNMSUB231)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FNMSUB231)
|
|
|
|
CASE_FMA_SCALAR_MEM(FNMSUB231)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
AccName = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "-";
|
|
|
|
Negate = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMADDSUB132)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMADDSUB132)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "+/-";
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMADDSUB213)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMADDSUB213)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul2Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "+/-";
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMADDSUB231)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMADDSUB231)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
AccName = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "+/-";
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMSUBADD132)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMSUBADD132)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "-/+";
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMSUBADD213)
|
|
|
|
AccName = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMSUBADD213)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
Mul2Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "-/+";
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_FMA_PACKED_REG(FMSUBADD231)
|
|
|
|
Mul2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_FMA_PACKED_MEM(FMSUBADD231)
|
|
|
|
Mul1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
|
|
|
AccName = getRegName(MI->getOperand(1).getReg());
|
|
|
|
AccStr = "-/+";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
|
|
|
|
if (!Mul1Name) Mul1Name = "mem";
|
|
|
|
if (!Mul2Name) Mul2Name = "mem";
|
|
|
|
if (!AccName) AccName = "mem";
|
|
|
|
|
|
|
|
OS << DestName << " = ";
|
|
|
|
// TODO: Print masking information?
|
|
|
|
|
|
|
|
if (Negate)
|
|
|
|
OS << '-';
|
|
|
|
|
|
|
|
OS << '(' << Mul1Name << " * " << Mul2Name << ") " << AccStr << ' '
|
|
|
|
<< AccName;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-25 09:43:23 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Top Level Entrypoint
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
/// EmitAnyX86InstComments - This function decodes x86 instructions and prints
|
|
|
|
/// newline terminated strings to the specified string if desired. This
|
|
|
|
/// information is shown in disassembly dumps when verbose assembly is enabled.
|
|
|
|
bool llvm::EmitAnyX86InstComments(const MCInst *MI, raw_ostream &OS,
|
2018-03-29 12:14:04 +08:00
|
|
|
const MCInstrInfo &MCII) {
|
2015-05-25 09:43:23 +08:00
|
|
|
// If this is a shuffle operation, the switch should fill in this state.
|
|
|
|
SmallVector<int, 8> ShuffleMask;
|
|
|
|
const char *DestName = nullptr, *Src1Name = nullptr, *Src2Name = nullptr;
|
2016-05-12 01:36:32 +08:00
|
|
|
unsigned NumOperands = MI->getNumOperands();
|
2016-06-10 12:48:05 +08:00
|
|
|
bool RegForm = false;
|
2015-05-25 09:43:23 +08:00
|
|
|
|
2018-03-29 12:14:04 +08:00
|
|
|
if (printFMA3Comments(MI, OS))
|
2018-03-11 05:30:46 +08:00
|
|
|
return true;
|
|
|
|
|
2015-05-25 09:43:23 +08:00
|
|
|
switch (MI->getOpcode()) {
|
|
|
|
default:
|
|
|
|
// Not an instruction for which we can decode comments.
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case X86::BLENDPDrri:
|
|
|
|
case X86::VBLENDPDrri:
|
2015-11-17 07:03:18 +08:00
|
|
|
case X86::VBLENDPDYrri:
|
2015-05-25 09:43:23 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::BLENDPDrmi:
|
|
|
|
case X86::VBLENDPDrmi:
|
|
|
|
case X86::VBLENDPDYrmi:
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeBLENDMask(getRegOperandNumElts(MI, 64, 0),
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::BLENDPSrri:
|
|
|
|
case X86::VBLENDPSrri:
|
2015-11-17 07:03:18 +08:00
|
|
|
case X86::VBLENDPSYrri:
|
2015-05-25 09:43:23 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::BLENDPSrmi:
|
|
|
|
case X86::VBLENDPSrmi:
|
|
|
|
case X86::VBLENDPSYrmi:
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeBLENDMask(getRegOperandNumElts(MI, 32, 0),
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::PBLENDWrri:
|
|
|
|
case X86::VPBLENDWrri:
|
2015-11-17 07:03:18 +08:00
|
|
|
case X86::VPBLENDWYrri:
|
2015-05-25 09:43:23 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::PBLENDWrmi:
|
|
|
|
case X86::VPBLENDWrmi:
|
|
|
|
case X86::VPBLENDWYrmi:
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeBLENDMask(getRegOperandNumElts(MI, 16, 0),
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::VPBLENDDrri:
|
|
|
|
case X86::VPBLENDDYrri:
|
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2015-11-17 07:03:18 +08:00
|
|
|
case X86::VPBLENDDrmi:
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::VPBLENDDYrmi:
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeBLENDMask(getRegOperandNumElts(MI, 32, 0),
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::INSERTPSrr:
|
|
|
|
case X86::VINSERTPSrr:
|
2016-07-19 09:26:19 +08:00
|
|
|
case X86::VINSERTPSZrr:
|
2015-05-25 09:43:23 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::INSERTPSrm:
|
|
|
|
case X86::VINSERTPSrm:
|
2016-07-19 09:26:19 +08:00
|
|
|
case X86::VINSERTPSZrm:
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
|
|
|
DecodeINSERTPSMask(MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::MOVLHPSrr:
|
|
|
|
case X86::VMOVLHPSrr:
|
2015-11-21 21:04:42 +08:00
|
|
|
case X86::VMOVLHPSZrr:
|
2015-05-25 09:43:23 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
DecodeMOVLHPSMask(2, ShuffleMask);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::MOVHLPSrr:
|
|
|
|
case X86::VMOVHLPSrr:
|
2015-11-21 21:04:42 +08:00
|
|
|
case X86::VMOVHLPSZrr:
|
2015-05-25 09:43:23 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
DecodeMOVHLPSMask(2, ShuffleMask);
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2016-02-07 23:39:22 +08:00
|
|
|
case X86::MOVHPDrm:
|
|
|
|
case X86::VMOVHPDrm:
|
|
|
|
case X86::VMOVHPDZ128rm:
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeInsertElementMask(2, 1, 1, ShuffleMask);
|
2016-02-07 23:39:22 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::MOVHPSrm:
|
|
|
|
case X86::VMOVHPSrm:
|
|
|
|
case X86::VMOVHPSZ128rm:
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeInsertElementMask(4, 2, 2, ShuffleMask);
|
2016-02-07 23:39:22 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::MOVLPDrm:
|
|
|
|
case X86::VMOVLPDrm:
|
|
|
|
case X86::VMOVLPDZ128rm:
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeInsertElementMask(2, 0, 1, ShuffleMask);
|
2016-02-07 23:39:22 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::MOVLPSrm:
|
|
|
|
case X86::VMOVLPSrm:
|
|
|
|
case X86::VMOVLPSZ128rm:
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeInsertElementMask(4, 0, 2, ShuffleMask);
|
2016-02-07 23:39:22 +08:00
|
|
|
break;
|
|
|
|
|
2015-11-16 15:22:00 +08:00
|
|
|
CASE_MOVDUP(MOVSLDUP, r)
|
2016-05-12 01:36:32 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-19 16:26:56 +08:00
|
|
|
CASE_MOVDUP(MOVSLDUP, m)
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeMOVSLDUPMask(getRegOperandNumElts(MI, 32, 0), ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-16 15:22:00 +08:00
|
|
|
CASE_MOVDUP(MOVSHDUP, r)
|
2016-05-12 01:36:32 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-19 16:26:56 +08:00
|
|
|
CASE_MOVDUP(MOVSHDUP, m)
|
2015-11-15 20:19:11 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeMOVSHDUPMask(getRegOperandNumElts(MI, 32, 0), ShuffleMask);
|
2015-11-15 20:19:11 +08:00
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-19 16:26:56 +08:00
|
|
|
CASE_MOVDUP(MOVDDUP, r)
|
2016-05-12 01:36:32 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-19 16:26:56 +08:00
|
|
|
CASE_MOVDUP(MOVDDUP, m)
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeMOVDDUPMask(getRegOperandNumElts(MI, 64, 0), ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::PSLLDQri:
|
|
|
|
case X86::VPSLLDQri:
|
|
|
|
case X86::VPSLLDQYri:
|
2016-06-10 06:03:15 +08:00
|
|
|
case X86::VPSLLDQZ128rr:
|
|
|
|
case X86::VPSLLDQZ256rr:
|
2017-12-11 01:42:39 +08:00
|
|
|
case X86::VPSLLDQZrr:
|
2015-05-25 09:43:23 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
2017-06-01 03:41:33 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2016-06-10 06:03:15 +08:00
|
|
|
case X86::VPSLLDQZ128rm:
|
|
|
|
case X86::VPSLLDQZ256rm:
|
2017-12-11 01:42:39 +08:00
|
|
|
case X86::VPSLLDQZrm:
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodePSLLDQMask(getRegOperandNumElts(MI, 8, 0),
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::PSRLDQri:
|
|
|
|
case X86::VPSRLDQri:
|
|
|
|
case X86::VPSRLDQYri:
|
2016-06-10 06:03:15 +08:00
|
|
|
case X86::VPSRLDQZ128rr:
|
|
|
|
case X86::VPSRLDQZ256rr:
|
2017-12-11 01:42:39 +08:00
|
|
|
case X86::VPSRLDQZrr:
|
2015-05-25 09:43:23 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
2017-06-01 03:41:33 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2016-06-10 06:03:15 +08:00
|
|
|
case X86::VPSRLDQZ128rm:
|
|
|
|
case X86::VPSRLDQZ256rm:
|
2017-12-11 01:42:39 +08:00
|
|
|
case X86::VPSRLDQZrm:
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodePSRLDQMask(getRegOperandNumElts(MI, 8, 0),
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
break;
|
|
|
|
|
2016-06-09 15:06:38 +08:00
|
|
|
CASE_SHUF(PALIGNR, rri)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-06-09 15:06:38 +08:00
|
|
|
CASE_SHUF(PALIGNR, rmi)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands-(RegForm?3:7)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodePALIGNRMask(getRegOperandNumElts(MI, 8, 0),
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
break;
|
|
|
|
|
2016-10-22 14:51:56 +08:00
|
|
|
CASE_AVX512_INS_COMMON(ALIGNQ, Z, rri)
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGNQ, Z256, rri)
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGNQ, Z128, rri)
|
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGNQ, Z, rmi)
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGNQ, Z256, rmi)
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGNQ, Z128, rmi)
|
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands-(RegForm?3:7)).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeVALIGNMask(getRegOperandNumElts(MI, 64, 0),
|
2016-10-22 14:51:56 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
|
|
|
ShuffleMask);
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGND, Z, rri)
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGND, Z256, rri)
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGND, Z128, rri)
|
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
|
|
|
RegForm = true;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGND, Z, rmi)
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGND, Z256, rmi)
|
|
|
|
CASE_AVX512_INS_COMMON(ALIGND, Z128, rmi)
|
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands-(RegForm?3:7)).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeVALIGNMask(getRegOperandNumElts(MI, 32, 0),
|
2016-10-22 14:51:56 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
|
|
|
ShuffleMask);
|
|
|
|
break;
|
|
|
|
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_SHUF(PSHUFD, ri)
|
2016-06-09 15:49:08 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_SHUF(PSHUFD, mi)
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodePSHUFMask(getRegOperandNumElts(MI, 32, 0), 32,
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
break;
|
|
|
|
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_SHUF(PSHUFHW, ri)
|
2016-06-09 15:49:08 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_SHUF(PSHUFHW, mi)
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodePSHUFHWMask(getRegOperandNumElts(MI, 16, 0),
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_SHUF(PSHUFLW, ri)
|
2016-06-09 15:49:08 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_SHUF(PSHUFLW, mi)
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodePSHUFLWMask(getRegOperandNumElts(MI, 16, 0),
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
break;
|
|
|
|
|
2015-09-13 19:28:45 +08:00
|
|
|
case X86::MMX_PSHUFWri:
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-09-13 19:28:45 +08:00
|
|
|
case X86::MMX_PSHUFWmi:
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodePSHUFMask(4, 16, MI->getOperand(NumOperands - 1).getImm(),
|
2015-09-13 19:28:45 +08:00
|
|
|
ShuffleMask);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::PSWAPDrr:
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-09-13 19:28:45 +08:00
|
|
|
case X86::PSWAPDrm:
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodePSWAPMask(2, ShuffleMask);
|
2015-09-13 19:28:45 +08:00
|
|
|
break;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKHBW, r)
|
2015-09-13 19:28:45 +08:00
|
|
|
case X86::MMX_PUNPCKHBWirr:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKHBW, m)
|
2015-11-17 06:21:10 +08:00
|
|
|
case X86::MMX_PUNPCKHBWirm:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKHMask(getRegOperandNumElts(MI, 8, 0), 8, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKHWD, r)
|
2015-11-17 06:21:10 +08:00
|
|
|
case X86::MMX_PUNPCKHWDirr:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKHWD, m)
|
2015-11-17 06:21:10 +08:00
|
|
|
case X86::MMX_PUNPCKHWDirm:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKHMask(getRegOperandNumElts(MI, 16, 0), 16, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKHDQ, r)
|
2015-11-17 06:21:10 +08:00
|
|
|
case X86::MMX_PUNPCKHDQirr:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKHDQ, m)
|
2015-11-17 06:21:10 +08:00
|
|
|
case X86::MMX_PUNPCKHDQirm:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKHMask(getRegOperandNumElts(MI, 32, 0), 32, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKHQDQ, r)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKHQDQ, m)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKHMask(getRegOperandNumElts(MI, 64, 0), 64, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
break;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKLBW, r)
|
2015-09-13 19:28:45 +08:00
|
|
|
case X86::MMX_PUNPCKLBWirr:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKLBW, m)
|
2015-11-17 06:21:10 +08:00
|
|
|
case X86::MMX_PUNPCKLBWirm:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKLMask(getRegOperandNumElts(MI, 8, 0), 8, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKLWD, r)
|
2015-11-17 06:21:10 +08:00
|
|
|
case X86::MMX_PUNPCKLWDirr:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKLWD, m)
|
2015-11-17 06:21:10 +08:00
|
|
|
case X86::MMX_PUNPCKLWDirm:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKLMask(getRegOperandNumElts(MI, 16, 0), 16, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKLDQ, r)
|
2015-11-17 06:21:10 +08:00
|
|
|
case X86::MMX_PUNPCKLDQirr:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKLDQ, m)
|
2015-11-17 06:21:10 +08:00
|
|
|
case X86::MMX_PUNPCKLDQirm:
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKLMask(getRegOperandNumElts(MI, 32, 0), 32, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKLQDQ, r)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(PUNPCKLQDQ, m)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKLMask(getRegOperandNumElts(MI, 64, 0), 64, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
break;
|
|
|
|
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_SHUF(SHUFPD, rri)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_SHUF(SHUFPD, rmi)
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSHUFPMask(getRegOperandNumElts(MI, 64, 0), 64,
|
|
|
|
MI->getOperand(NumOperands - 1).getImm(), ShuffleMask);
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?3:7)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_SHUF(SHUFPS, rri)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-06-03 13:31:00 +08:00
|
|
|
CASE_SHUF(SHUFPS, rmi)
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSHUFPMask(getRegOperandNumElts(MI, 32, 0), 32,
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?3:7)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-16 15:22:00 +08:00
|
|
|
CASE_VSHUF(64X2, r)
|
2016-06-11 19:18:38 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-16 15:22:00 +08:00
|
|
|
CASE_VSHUF(64X2, m)
|
2018-03-13 00:43:11 +08:00
|
|
|
decodeVSHUF64x2FamilyMask(getRegOperandNumElts(MI, 64, 0), 64,
|
2016-06-11 19:18:38 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
|
|
|
ShuffleMask);
|
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?3:7)).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
2015-11-16 15:22:00 +08:00
|
|
|
CASE_VSHUF(32X4, r)
|
2016-06-11 19:18:38 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-06-11 19:18:38 +08:00
|
|
|
CASE_VSHUF(32X4, m)
|
2018-03-13 00:43:11 +08:00
|
|
|
decodeVSHUF64x2FamilyMask(getRegOperandNumElts(MI, 32, 0), 32,
|
2016-06-11 19:18:38 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-10-15 21:29:07 +08:00
|
|
|
ShuffleMask);
|
2016-06-11 19:18:38 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?3:7)).getReg());
|
2015-10-15 21:29:07 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(UNPCKLPD, r)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(UNPCKLPD, m)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKLMask(getRegOperandNumElts(MI, 64, 0), 64, ShuffleMask);
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(UNPCKLPS, r)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(UNPCKLPS, m)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKLMask(getRegOperandNumElts(MI, 32, 0), 32, ShuffleMask);
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(UNPCKHPD, r)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(UNPCKHPD, m)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKHMask(getRegOperandNumElts(MI, 64, 0), 64, ShuffleMask);
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(UNPCKHPS, r)
|
2016-06-10 12:48:05 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
RegForm = true;
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-11-18 06:35:45 +08:00
|
|
|
CASE_UNPCK(UNPCKHPS, m)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeUNPCKHMask(getRegOperandNumElts(MI, 32, 0), 32, ShuffleMask);
|
2016-06-10 12:48:05 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2016-07-04 02:02:43 +08:00
|
|
|
CASE_VPERMILPI(PERMILPS, r)
|
2016-05-12 02:53:44 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-07-04 02:02:43 +08:00
|
|
|
CASE_VPERMILPI(PERMILPS, m)
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodePSHUFMask(getRegOperandNumElts(MI, 32, 0), 32,
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2016-07-04 02:02:43 +08:00
|
|
|
CASE_VPERMILPI(PERMILPD, r)
|
2016-05-12 02:53:44 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-07-04 02:02:43 +08:00
|
|
|
CASE_VPERMILPI(PERMILPD, m)
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodePSHUFMask(getRegOperandNumElts(MI, 64, 0), 64,
|
2016-05-12 01:36:32 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::VPERM2F128rr:
|
|
|
|
case X86::VPERM2I128rr:
|
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::VPERM2F128rm:
|
|
|
|
case X86::VPERM2I128rm:
|
|
|
|
// For instruction comments purpose, assume the 256-bit vector is v4i64.
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeVPERM2X128Mask(4, MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2016-07-04 02:27:37 +08:00
|
|
|
CASE_VPERM(PERMPD, r)
|
2016-06-10 13:12:40 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-07-04 02:27:37 +08:00
|
|
|
CASE_VPERM(PERMPD, m)
|
2016-05-12 01:36:32 +08:00
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeVPERMMask(getRegOperandNumElts(MI, 64, 0),
|
2016-07-04 02:27:37 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
|
|
|
ShuffleMask);
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_VPERM(PERMQ, r)
|
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 2).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2016-07-04 02:27:37 +08:00
|
|
|
CASE_VPERM(PERMQ, m)
|
|
|
|
if (MI->getOperand(NumOperands - 1).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeVPERMMask(getRegOperandNumElts(MI, 64, 0),
|
2016-07-04 02:27:37 +08:00
|
|
|
MI->getOperand(NumOperands - 1).getImm(),
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask);
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::MOVSDrr:
|
|
|
|
case X86::VMOVSDrr:
|
2016-02-02 06:26:28 +08:00
|
|
|
case X86::VMOVSDZrr:
|
2015-05-25 09:43:23 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2019-06-18 11:23:11 +08:00
|
|
|
case X86::MOVSDrm_alt:
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::MOVSDrm:
|
2019-06-18 11:23:11 +08:00
|
|
|
case X86::VMOVSDrm_alt:
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::VMOVSDrm:
|
2016-02-02 06:26:28 +08:00
|
|
|
case X86::VMOVSDZrm:
|
2019-06-18 11:23:11 +08:00
|
|
|
case X86::VMOVSDZrm_alt:
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeScalarMoveMask(2, nullptr == Src2Name, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-21 21:04:42 +08:00
|
|
|
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::MOVSSrr:
|
|
|
|
case X86::VMOVSSrr:
|
2016-02-02 06:26:28 +08:00
|
|
|
case X86::VMOVSSZrr:
|
2015-05-25 09:43:23 +08:00
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::MOVSSrm:
|
2019-06-18 11:23:11 +08:00
|
|
|
case X86::MOVSSrm_alt:
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::VMOVSSrm:
|
2019-06-18 11:23:11 +08:00
|
|
|
case X86::VMOVSSrm_alt:
|
2016-02-02 06:26:28 +08:00
|
|
|
case X86::VMOVSSZrm:
|
2019-06-18 11:23:11 +08:00
|
|
|
case X86::VMOVSSZrm_alt:
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeScalarMoveMask(4, nullptr == Src2Name, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::MOVPQI2QIrr:
|
2015-12-13 20:49:48 +08:00
|
|
|
case X86::MOVZPQILo2PQIrr:
|
|
|
|
case X86::VMOVPQI2QIrr:
|
2018-03-10 14:05:13 +08:00
|
|
|
case X86::VMOVPQI2QIZrr:
|
2015-12-13 20:49:48 +08:00
|
|
|
case X86::VMOVZPQILo2PQIrr:
|
|
|
|
case X86::VMOVZPQILo2PQIZrr:
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
|
2015-12-13 20:49:48 +08:00
|
|
|
case X86::MOVQI2PQIrm:
|
|
|
|
case X86::VMOVQI2PQIrm:
|
2016-02-02 21:32:56 +08:00
|
|
|
case X86::VMOVQI2PQIZrm:
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeZeroMoveLowMask(2, ShuffleMask);
|
2015-12-13 20:49:48 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2015-11-17 06:21:10 +08:00
|
|
|
|
2015-05-25 09:43:23 +08:00
|
|
|
case X86::MOVDI2PDIrm:
|
|
|
|
case X86::VMOVDI2PDIrm:
|
2016-02-02 07:04:05 +08:00
|
|
|
case X86::VMOVDI2PDIZrm:
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeZeroMoveLowMask(4, ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
2015-07-07 04:46:41 +08:00
|
|
|
case X86::EXTRQI:
|
|
|
|
if (MI->getOperand(2).isImm() &&
|
|
|
|
MI->getOperand(3).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeEXTRQIMask(16, 8, MI->getOperand(2).getImm(),
|
|
|
|
MI->getOperand(3).getImm(), ShuffleMask);
|
2015-07-07 04:46:41 +08:00
|
|
|
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case X86::INSERTQI:
|
|
|
|
if (MI->getOperand(3).isImm() &&
|
|
|
|
MI->getOperand(4).isImm())
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeINSERTQIMask(16, 8, MI->getOperand(3).getImm(),
|
|
|
|
MI->getOperand(4).getImm(), ShuffleMask);
|
2015-07-07 04:46:41 +08:00
|
|
|
|
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
Src1Name = getRegName(MI->getOperand(1).getReg());
|
|
|
|
Src2Name = getRegName(MI->getOperand(2).getReg());
|
|
|
|
break;
|
|
|
|
|
2016-07-14 20:07:43 +08:00
|
|
|
case X86::VBROADCASTF128:
|
|
|
|
case X86::VBROADCASTI128:
|
2016-10-16 00:26:07 +08:00
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTF64X2, Z128, rm)
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI64X2, Z128, rm)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSubVectorBroadcast(4, 2, ShuffleMask);
|
2016-07-14 20:07:43 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2016-10-16 00:26:07 +08:00
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTF64X2, , rm)
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI64X2, , rm)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSubVectorBroadcast(8, 2, ShuffleMask);
|
2016-10-16 00:26:07 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTF64X4, , rm)
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI64X4, , rm)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSubVectorBroadcast(8, 4, ShuffleMask);
|
2016-10-16 00:26:07 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTF32X4, Z256, rm)
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI32X4, Z256, rm)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSubVectorBroadcast(8, 4, ShuffleMask);
|
2016-10-16 00:26:07 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTF32X4, , rm)
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI32X4, , rm)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSubVectorBroadcast(16, 4, ShuffleMask);
|
2016-10-16 00:26:07 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTF32X8, , rm)
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI32X8, , rm)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSubVectorBroadcast(16, 8, ShuffleMask);
|
2016-10-16 00:26:07 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2017-10-11 08:11:53 +08:00
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI32X2, Z128, r)
|
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI32X2, Z128, m)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSubVectorBroadcast(4, 2, ShuffleMask);
|
2017-10-11 08:11:53 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2016-10-16 00:26:07 +08:00
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTF32X2, Z256, r)
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI32X2, Z256, r)
|
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
2017-06-01 03:41:33 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2016-10-16 00:26:07 +08:00
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTF32X2, Z256, m)
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI32X2, Z256, m)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSubVectorBroadcast(8, 2, ShuffleMask);
|
2016-10-16 00:26:07 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTF32X2, Z, r)
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI32X2, Z, r)
|
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
2017-06-01 03:41:33 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2016-10-16 00:26:07 +08:00
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTF32X2, Z, m)
|
|
|
|
CASE_AVX512_INS_COMMON(BROADCASTI32X2, Z, m)
|
2018-03-13 00:43:11 +08:00
|
|
|
DecodeSubVectorBroadcast(16, 2, ShuffleMask);
|
2016-10-16 00:26:07 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
2016-07-14 20:07:43 +08:00
|
|
|
|
2016-02-07 03:51:21 +08:00
|
|
|
CASE_PMOVZX(PMOVZXBW, r)
|
2016-05-12 01:36:32 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2016-02-07 03:51:21 +08:00
|
|
|
CASE_PMOVZX(PMOVZXBW, m)
|
2019-05-27 00:00:35 +08:00
|
|
|
DecodeZeroExtendMask(8, 16, getRegOperandNumElts(MI, 16, 0), false,
|
|
|
|
ShuffleMask);
|
2018-03-13 00:43:11 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_PMOVZX(PMOVZXBD, r)
|
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
LLVM_FALLTHROUGH;
|
2016-02-07 03:51:21 +08:00
|
|
|
CASE_PMOVZX(PMOVZXBD, m)
|
2019-05-27 00:00:35 +08:00
|
|
|
DecodeZeroExtendMask(8, 32, getRegOperandNumElts(MI, 32, 0), false,
|
|
|
|
ShuffleMask);
|
2018-03-13 00:43:11 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_PMOVZX(PMOVZXBQ, r)
|
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
LLVM_FALLTHROUGH;
|
2016-02-07 03:51:21 +08:00
|
|
|
CASE_PMOVZX(PMOVZXBQ, m)
|
2019-05-27 00:00:35 +08:00
|
|
|
DecodeZeroExtendMask(8, 64, getRegOperandNumElts(MI, 64, 0), false,
|
|
|
|
ShuffleMask);
|
2016-02-07 00:33:42 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
2016-02-07 03:51:21 +08:00
|
|
|
CASE_PMOVZX(PMOVZXWD, r)
|
2016-05-12 01:36:32 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2016-02-07 03:51:21 +08:00
|
|
|
CASE_PMOVZX(PMOVZXWD, m)
|
2019-05-27 00:00:35 +08:00
|
|
|
DecodeZeroExtendMask(16, 32, getRegOperandNumElts(MI, 32, 0), false,
|
|
|
|
ShuffleMask);
|
2018-03-13 00:43:11 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_PMOVZX(PMOVZXWQ, r)
|
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
|
|
|
LLVM_FALLTHROUGH;
|
2016-02-07 03:51:21 +08:00
|
|
|
CASE_PMOVZX(PMOVZXWQ, m)
|
2019-05-27 00:00:35 +08:00
|
|
|
DecodeZeroExtendMask(16, 64, getRegOperandNumElts(MI, 64, 0), false,
|
|
|
|
ShuffleMask);
|
2016-02-07 00:33:42 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
|
|
|
break;
|
|
|
|
|
2016-02-07 03:51:21 +08:00
|
|
|
CASE_PMOVZX(PMOVZXDQ, r)
|
2016-05-12 01:36:32 +08:00
|
|
|
Src1Name = getRegName(MI->getOperand(NumOperands - 1).getReg());
|
2016-08-18 04:30:52 +08:00
|
|
|
LLVM_FALLTHROUGH;
|
2016-02-07 03:51:21 +08:00
|
|
|
CASE_PMOVZX(PMOVZXDQ, m)
|
2019-05-27 00:00:35 +08:00
|
|
|
DecodeZeroExtendMask(32, 64, getRegOperandNumElts(MI, 64, 0), false,
|
|
|
|
ShuffleMask);
|
2015-05-25 09:43:23 +08:00
|
|
|
DestName = getRegName(MI->getOperand(0).getReg());
|
2016-02-07 00:33:42 +08:00
|
|
|
break;
|
2015-05-25 09:43:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// The only comments we decode are shuffles, so give up if we were unable to
|
|
|
|
// decode a shuffle mask.
|
|
|
|
if (ShuffleMask.empty())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!DestName) DestName = Src1Name;
|
2017-10-11 08:46:09 +08:00
|
|
|
if (DestName) {
|
|
|
|
OS << DestName;
|
2018-03-29 12:14:04 +08:00
|
|
|
printMasking(OS, MI, MCII);
|
2017-10-11 08:46:09 +08:00
|
|
|
} else
|
|
|
|
OS << "mem";
|
|
|
|
|
|
|
|
OS << " = ";
|
2015-05-25 09:43:23 +08:00
|
|
|
|
|
|
|
// If the two sources are the same, canonicalize the input elements to be
|
|
|
|
// from the first src so that we get larger element spans.
|
|
|
|
if (Src1Name == Src2Name) {
|
|
|
|
for (unsigned i = 0, e = ShuffleMask.size(); i != e; ++i) {
|
|
|
|
if ((int)ShuffleMask[i] >= 0 && // Not sentinel.
|
2015-05-25 09:43:34 +08:00
|
|
|
ShuffleMask[i] >= (int)e) // From second mask.
|
2015-05-25 09:43:23 +08:00
|
|
|
ShuffleMask[i] -= e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The shuffle mask specifies which elements of the src1/src2 fill in the
|
|
|
|
// destination, with a few sentinel values. Loop through and print them
|
|
|
|
// out.
|
|
|
|
for (unsigned i = 0, e = ShuffleMask.size(); i != e; ++i) {
|
|
|
|
if (i != 0)
|
|
|
|
OS << ',';
|
|
|
|
if (ShuffleMask[i] == SM_SentinelZero) {
|
|
|
|
OS << "zero";
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise, it must come from src1 or src2. Print the span of elements
|
|
|
|
// that comes from this src.
|
|
|
|
bool isSrc1 = ShuffleMask[i] < (int)ShuffleMask.size();
|
|
|
|
const char *SrcName = isSrc1 ? Src1Name : Src2Name;
|
|
|
|
OS << (SrcName ? SrcName : "mem") << '[';
|
|
|
|
bool IsFirst = true;
|
|
|
|
while (i != e && (int)ShuffleMask[i] != SM_SentinelZero &&
|
|
|
|
(ShuffleMask[i] < (int)ShuffleMask.size()) == isSrc1) {
|
|
|
|
if (!IsFirst)
|
|
|
|
OS << ',';
|
|
|
|
else
|
|
|
|
IsFirst = false;
|
|
|
|
if (ShuffleMask[i] == SM_SentinelUndef)
|
|
|
|
OS << "u";
|
|
|
|
else
|
|
|
|
OS << ShuffleMask[i] % ShuffleMask.size();
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
OS << ']';
|
2015-05-25 09:43:34 +08:00
|
|
|
--i; // For loop increments element #.
|
2015-05-25 09:43:23 +08:00
|
|
|
}
|
2019-02-04 20:51:26 +08:00
|
|
|
OS << '\n';
|
2015-05-25 09:43:23 +08:00
|
|
|
|
|
|
|
// We successfully added a comment to this instruction.
|
|
|
|
return true;
|
|
|
|
}
|