[mips][msa] Direct Object Emission support for LDI instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193081 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matheus Almeida 2013-10-21 12:56:20 +00:00
parent f6d4cff9b1
commit b14ad46549
3 changed files with 32 additions and 8 deletions

View File

@ -331,8 +331,13 @@ class MSA_I8_FMT<bits<2> major, bits<6> minor>: MSAInst {
}
class MSA_I10_FMT<bits<3> major, bits<2> df, bits<6> minor>: MSAInst {
bits<10> s10;
bits<5> wd;
let Inst{25-23} = major;
let Inst{22-21} = df;
let Inst{20-11} = s10;
let Inst{10-6} = wd;
let Inst{5-0} = minor;
}

View File

@ -1149,11 +1149,11 @@ class MSA_I8_SHF_DESC_BASE<string instr_asm, RegisterOperand ROWD,
InstrItinClass Itinerary = itin;
}
class MSA_I10_LDI_DESC_BASE<string instr_asm, RegisterClass RCWD,
class MSA_I10_LDI_DESC_BASE<string instr_asm, RegisterOperand ROWD,
InstrItinClass itin = NoItinerary> {
dag OutOperandList = (outs RCWD:$wd);
dag InOperandList = (ins vsplat_simm10:$i10);
string AsmString = !strconcat(instr_asm, "\t$wd, $i10");
dag OutOperandList = (outs ROWD:$wd);
dag InOperandList = (ins vsplat_simm10:$s10);
string AsmString = !strconcat(instr_asm, "\t$wd, $s10");
// LDI is matched using custom matching code in MipsSEISelDAGToDAG.cpp
list<dag> Pattern = [];
bit hasSideEffects = 0;
@ -2052,10 +2052,10 @@ class LD_H_DESC : LD_DESC_BASE<"ld.h", load, v8i16, MSA128H>;
class LD_W_DESC : LD_DESC_BASE<"ld.w", load, v4i32, MSA128W>;
class LD_D_DESC : LD_DESC_BASE<"ld.d", load, v2i64, MSA128D>;
class LDI_B_DESC : MSA_I10_LDI_DESC_BASE<"ldi.b", MSA128B>;
class LDI_H_DESC : MSA_I10_LDI_DESC_BASE<"ldi.h", MSA128H>;
class LDI_W_DESC : MSA_I10_LDI_DESC_BASE<"ldi.w", MSA128W>;
class LDI_D_DESC : MSA_I10_LDI_DESC_BASE<"ldi.d", MSA128D>;
class LDI_B_DESC : MSA_I10_LDI_DESC_BASE<"ldi.b", MSA128BOpnd>;
class LDI_H_DESC : MSA_I10_LDI_DESC_BASE<"ldi.h", MSA128HOpnd>;
class LDI_W_DESC : MSA_I10_LDI_DESC_BASE<"ldi.w", MSA128WOpnd>;
class LDI_D_DESC : MSA_I10_LDI_DESC_BASE<"ldi.d", MSA128DOpnd>;
class LSA_DESC {
dag OutOperandList = (outs GPR32:$rd);

View File

@ -0,0 +1,19 @@
# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 -mattr=+msa -arch=mips | FileCheck %s
#
# RUN: llvm-mc %s -triple=mipsel-unknown-linux -mcpu=mips32r2 -mattr=+msa -arch=mips -filetype=obj -o - | llvm-objdump -d -triple=mipsel-unknown-linux -mattr=+msa -arch=mips - | FileCheck %s -check-prefix=CHECKOBJDUMP
#
# CHECK: ldi.b $w8, 198 # encoding: [0x79,0x06,0x32,0x0c]
# CHECK: ldi.h $w20, 313 # encoding: [0x79,0x29,0xcd,0x0c]
# CHECK: ldi.w $w24, 492 # encoding: [0x79,0x4f,0x66,0x0c]
# CHECK: ldi.d $w27, -180 # encoding: [0x79,0x7a,0x66,0xcc]
# CHECKOBJDUMP: ldi.b $w8, 198
# CHECKOBJDUMP: ldi.h $w20, 313
# CHECKOBJDUMP: ldi.w $w24, 492
# CHECKOBJDUMP: ldi.d $w27, 844
ldi.b $w8, 198
ldi.h $w20, 313
ldi.w $w24, 492
ldi.d $w27, -180