forked from OSchip/llvm-project
[mips] Alter register classes for MSA pseudo f16 instructions
This change introduces additional machine instructions in functions dealing with the expansion of msa pseudo f16 instructions due to register classes being inappropriate when checked with machine verifier. Differential Revision: https://reviews.llvm.org/D34276 llvm-svn: 308301
This commit is contained in:
parent
b939d32f53
commit
58f225b371
|
@ -443,8 +443,17 @@ let AdditionalPredicates = [NotInMicroMips] in {
|
|||
}
|
||||
def MFC1 : MMRel, MFC1_FT<"mfc1", GPR32Opnd, FGR32Opnd, II_MFC1,
|
||||
bitconvert>, MFC1_FM<0>;
|
||||
def MFC1_D64 : MFC1_FT<"mfc1", GPR32Opnd, FGR64Opnd, II_MFC1>, MFC1_FM<0>,
|
||||
FGR_64 {
|
||||
let DecoderNamespace = "Mips64";
|
||||
}
|
||||
def MTC1 : MMRel, MTC1_FT<"mtc1", FGR32Opnd, GPR32Opnd, II_MTC1,
|
||||
bitconvert>, MFC1_FM<4>;
|
||||
def MTC1_D64 : MTC1_FT<"mtc1", FGR64Opnd, GPR32Opnd, II_MTC1>, MFC1_FM<4>,
|
||||
FGR_64 {
|
||||
let DecoderNamespace = "Mips64";
|
||||
}
|
||||
|
||||
let AdditionalPredicates = [NotInMicroMips] in {
|
||||
def MFHC1_D32 : MMRel, MFC1_FT<"mfhc1", GPR32Opnd, AFGR64Opnd, II_MFHC1>,
|
||||
MFC1_FM<3>, ISA_MIPS32R2, FGR_32;
|
||||
|
|
|
@ -3420,9 +3420,17 @@ MipsSETargetLowering::emitST_F16_PSEUDO(MachineInstr &MI,
|
|||
: (Subtarget.isABI_O32() ? &Mips::GPR32RegClass
|
||||
: &Mips::GPR64RegClass);
|
||||
const bool UsingMips32 = RC == &Mips::GPR32RegClass;
|
||||
unsigned Rs = RegInfo.createVirtualRegister(RC);
|
||||
unsigned Rs = RegInfo.createVirtualRegister(&Mips::GPR32RegClass);
|
||||
|
||||
BuildMI(*BB, MI, DL, TII->get(Mips::COPY_U_H), Rs).addReg(Ws).addImm(0);
|
||||
if(!UsingMips32) {
|
||||
unsigned Tmp = RegInfo.createVirtualRegister(&Mips::GPR64RegClass);
|
||||
BuildMI(*BB, MI, DL, TII->get(Mips::SUBREG_TO_REG), Tmp)
|
||||
.addImm(0)
|
||||
.addReg(Rs)
|
||||
.addImm(Mips::sub_32);
|
||||
Rs = Tmp;
|
||||
}
|
||||
BuildMI(*BB, MI, DL, TII->get(UsingMips32 ? Mips::SH : Mips::SH64))
|
||||
.addReg(Rs)
|
||||
.addReg(Rt)
|
||||
|
@ -3473,6 +3481,12 @@ MipsSETargetLowering::emitLD_F16_PSEUDO(MachineInstr &MI,
|
|||
for (unsigned i = 1; i < MI.getNumOperands(); i++)
|
||||
MIB.add(MI.getOperand(i));
|
||||
|
||||
if(!UsingMips32) {
|
||||
unsigned Tmp = RegInfo.createVirtualRegister(&Mips::GPR32RegClass);
|
||||
BuildMI(*BB, MI, DL, TII->get(Mips::COPY), Tmp).addReg(Rt, 0, Mips::sub_32);
|
||||
Rt = Tmp;
|
||||
}
|
||||
|
||||
BuildMI(*BB, MI, DL, TII->get(Mips::FILL_H), Wd).addReg(Rt);
|
||||
|
||||
MI.eraseFromParent();
|
||||
|
@ -3540,6 +3554,7 @@ MipsSETargetLowering::emitFPROUND_PSEUDO(MachineInstr &MI,
|
|||
assert(Subtarget.hasMSA() && Subtarget.hasMips32r2());
|
||||
|
||||
bool IsFGR64onMips64 = Subtarget.hasMips64() && IsFGR64;
|
||||
bool IsFGR64onMips32 = !Subtarget.hasMips64() && IsFGR64;
|
||||
|
||||
const TargetInstrInfo *TII = Subtarget.getInstrInfo();
|
||||
DebugLoc DL = MI.getDebugLoc();
|
||||
|
@ -3550,7 +3565,9 @@ MipsSETargetLowering::emitFPROUND_PSEUDO(MachineInstr &MI,
|
|||
unsigned Wtemp = RegInfo.createVirtualRegister(&Mips::MSA128WRegClass);
|
||||
const TargetRegisterClass *GPRRC =
|
||||
IsFGR64onMips64 ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
|
||||
unsigned MFC1Opc = IsFGR64onMips64 ? Mips::DMFC1 : Mips::MFC1;
|
||||
unsigned MFC1Opc = IsFGR64onMips64
|
||||
? Mips::DMFC1
|
||||
: (IsFGR64onMips32 ? Mips::MFC1_D64 : Mips::MFC1);
|
||||
unsigned FILLOpc = IsFGR64onMips64 ? Mips::FILL_D : Mips::FILL_W;
|
||||
|
||||
// Perform the register class copy as mentioned above.
|
||||
|
@ -3559,7 +3576,7 @@ MipsSETargetLowering::emitFPROUND_PSEUDO(MachineInstr &MI,
|
|||
BuildMI(*BB, MI, DL, TII->get(FILLOpc), Wtemp).addReg(Rtemp);
|
||||
unsigned WPHI = Wtemp;
|
||||
|
||||
if (!Subtarget.hasMips64() && IsFGR64) {
|
||||
if (IsFGR64onMips32) {
|
||||
unsigned Rtemp2 = RegInfo.createVirtualRegister(GPRRC);
|
||||
BuildMI(*BB, MI, DL, TII->get(Mips::MFHC1_D64), Rtemp2).addReg(Fs);
|
||||
unsigned Wtemp2 = RegInfo.createVirtualRegister(&Mips::MSA128WRegClass);
|
||||
|
@ -3653,7 +3670,9 @@ MipsSETargetLowering::emitFPEXTEND_PSEUDO(MachineInstr &MI,
|
|||
MachineRegisterInfo &RegInfo = BB->getParent()->getRegInfo();
|
||||
const TargetRegisterClass *GPRRC =
|
||||
IsFGR64onMips64 ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
|
||||
unsigned MTC1Opc = IsFGR64onMips64 ? Mips::DMTC1 : Mips::MTC1;
|
||||
unsigned MTC1Opc = IsFGR64onMips64
|
||||
? Mips::DMTC1
|
||||
: (IsFGR64onMips32 ? Mips::MTC1_D64 : Mips::MTC1);
|
||||
unsigned COPYOpc = IsFGR64onMips64 ? Mips::COPY_S_D : Mips::COPY_S_W;
|
||||
|
||||
unsigned Wtemp = RegInfo.createVirtualRegister(&Mips::MSA128WRegClass);
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
; RUN: llc -relocation-model=pic -march=mipsel -mcpu=mips32r5 \
|
||||
; RUN: -mattr=+fp64,+msa < %s | FileCheck %s \
|
||||
; RUN: -mattr=+fp64,+msa -verify-machineinstrs < %s | FileCheck %s \
|
||||
; RUN: --check-prefixes=ALL,MIPS32,MIPSR5,MIPS32-O32,MIPS32R5-O32
|
||||
; RUN: llc -relocation-model=pic -march=mips64el -mcpu=mips64r5 \
|
||||
; RUN: -mattr=+fp64,+msa -target-abi n32 < %s | FileCheck %s \
|
||||
; RUN: -mattr=+fp64,+msa -verify-machineinstrs -target-abi n32 < %s | FileCheck %s \
|
||||
; RUN: --check-prefixes=ALL,MIPS64,MIPSR5,MIPS64-N32,MIPS64R5-N32
|
||||
; RUN: llc -relocation-model=pic -march=mips64el -mcpu=mips64r5 \
|
||||
; RUN: -mattr=+fp64,+msa -target-abi n64 < %s | FileCheck %s \
|
||||
; RUN: -mattr=+fp64,+msa -verify-machineinstrs -target-abi n64 < %s | FileCheck %s \
|
||||
; RUN: --check-prefixes=ALL,MIPS64,MIPSR5,MIPS64-N64,MIPS64R5-N64
|
||||
|
||||
; RUN: llc -relocation-model=pic -march=mipsel -mcpu=mips32r6 \
|
||||
; RUN: -mattr=+fp64,+msa < %s | FileCheck %s \
|
||||
; RUN: -mattr=+fp64,+msa -verify-machineinstrs < %s | FileCheck %s \
|
||||
; RUN: --check-prefixes=ALL,MIPS32,MIPSR6,MIPSR6-O32
|
||||
; RUN: llc -relocation-model=pic -march=mips64el -mcpu=mips64r6 \
|
||||
; RUN: -mattr=+fp64,+msa -target-abi n32 < %s | FileCheck %s \
|
||||
; RUN: -mattr=+fp64,+msa -verify-machineinstrs -target-abi n32 < %s | FileCheck %s \
|
||||
; RUN: --check-prefixes=ALL,MIPS64,MIPSR6,MIPS64-N32,MIPSR6-N32
|
||||
; RUN: llc -relocation-model=pic -march=mips64el -mcpu=mips64r6 \
|
||||
; RUN: -mattr=+fp64,+msa -target-abi n64 < %s | FileCheck %s \
|
||||
; RUN: -mattr=+fp64,+msa -verify-machineinstrs -target-abi n64 < %s | FileCheck %s \
|
||||
; RUN: --check-prefixes=ALL,MIPS64,MIPSR6,MIPS64-N64,MIPSR6-N64
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue