This patch introduces A15 as a target in LLVM.
[oota-llvm.git] / lib / Target / ARM / ARMInstrFormats.td
index 27f2b67fcd9c010773f79901c1523970cd7a27f3..c8966fb97a4c9d67d5c9cb154069250f13e4e73b 100644 (file)
@@ -1,4 +1,4 @@
-//===- ARMInstrFormats.td - ARM Instruction Formats ----------*- tablegen -*-=//
+//===-- ARMInstrFormats.td - ARM Instruction Formats -------*- tablegen -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -201,21 +201,29 @@ def msr_mask : Operand<i32> {
 //     16       imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
 //     32       imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
 //     64       64 - <imm> is encoded in imm6<5:0>
+def shr_imm8_asm_operand : ImmAsmOperand { let Name = "ShrImm8"; }
 def shr_imm8  : Operand<i32> {
   let EncoderMethod = "getShiftRight8Imm";
   let DecoderMethod = "DecodeShiftRight8Imm";
+  let ParserMatchClass = shr_imm8_asm_operand;
 }
+def shr_imm16_asm_operand : ImmAsmOperand { let Name = "ShrImm16"; }
 def shr_imm16 : Operand<i32> {
   let EncoderMethod = "getShiftRight16Imm";
   let DecoderMethod = "DecodeShiftRight16Imm";
+  let ParserMatchClass = shr_imm16_asm_operand;
 }
+def shr_imm32_asm_operand : ImmAsmOperand { let Name = "ShrImm32"; }
 def shr_imm32 : Operand<i32> {
   let EncoderMethod = "getShiftRight32Imm";
   let DecoderMethod = "DecodeShiftRight32Imm";
+  let ParserMatchClass = shr_imm32_asm_operand;
 }
+def shr_imm64_asm_operand : ImmAsmOperand { let Name = "ShrImm64"; }
 def shr_imm64 : Operand<i32> {
   let EncoderMethod = "getShiftRight64Imm";
   let DecoderMethod = "DecodeShiftRight64Imm";
+  let ParserMatchClass = shr_imm64_asm_operand;
 }
 
 //===----------------------------------------------------------------------===//
@@ -234,6 +242,12 @@ class VFP3InstAlias<string Asm, dag Result, bit Emit = 0b1>
 class NEONInstAlias<string Asm, dag Result, bit Emit = 0b1>
       : InstAlias<Asm, Result, Emit>, Requires<[HasNEON]>;
 
+
+class VFP2MnemonicAlias<string src, string dst> : MnemonicAlias<src, dst>,
+          Requires<[HasVFP2]>;
+class NEONMnemonicAlias<string src, string dst> : MnemonicAlias<src, dst>,
+          Requires<[HasNEON]>;
+
 //===----------------------------------------------------------------------===//
 // ARM Instruction templates.
 //
@@ -276,6 +290,14 @@ class InstTemplate<AddrMode am, int sz, IndexMode im,
 
 class Encoding {
   field bits<32> Inst;
+  // Mask of bits that cause an encoding to be UNPREDICTABLE.
+  // If a bit is set, then if the corresponding bit in the
+  // target encoding differs from its value in the "Inst" field,
+  // the instruction is UNPREDICTABLE (SoftFail in abstract parlance).
+  field bits<32> Unpredictable = 0;
+  // SoftFail is the generic name for this field, but we alias it so
+  // as to make it more obvious what it means in ARM-land.
+  field bits<32> SoftFail = Unpredictable;
 }
 
 class InstARM<AddrMode am, int sz, IndexMode im,
@@ -510,6 +532,7 @@ class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
   let Inst{11-4} = 0b00001001;
   let Inst{3-0} = Rt2;
 
+  let Unpredictable{11-8} = 0b1111;
   let DecoderMethod = "DecodeSwap";
 }
 
@@ -804,6 +827,8 @@ class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
   let Inst{7-4}   = 0b0111;
   let Inst{9-8}   = 0b00;
   let Inst{27-20} = opcod;
+
+  let Unpredictable{9-8} = 0b11;
 }
 
 // Misc Arithmetic instructions.
@@ -1580,8 +1605,11 @@ class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
                 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
                 list<dag> pattern>
   : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
+  bits<5> fbits;
   // size (fixed-point number): sx == 0 ? 16 : 32
   let Inst{7} = op5; // sx
+  let Inst{5} = fbits{0};
+  let Inst{3-0} = fbits{4-1};
 }
 
 // VFP conversion instructions, if no NEON
@@ -1836,7 +1864,6 @@ class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
           string opc, string dt, string asm, string cstr, list<dag> pattern>
   : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
               oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
-
   // Instruction operands.
   bits<5> Vd;
   bits<5> Vn;
@@ -1997,74 +2024,21 @@ class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
 // VFP/NEON Instruction aliases for type suffices.
 class VFPDataTypeInstAlias<string opc, string dt, string asm, dag Result> :
   InstAlias<!strconcat(opc, dt, "\t", asm), Result>, Requires<[HasVFP2]>;
-multiclass VFPDT8ReqInstAlias<string opc, string asm, dag Result> {
-  def I8 : VFPDataTypeInstAlias<opc, ".i8", asm, Result>;
-  def S8 : VFPDataTypeInstAlias<opc, ".s8", asm, Result>;
-  def U8 : VFPDataTypeInstAlias<opc, ".u8", asm, Result>;
-  def P8 : VFPDataTypeInstAlias<opc, ".p8", asm, Result>;
-}
-// VFPDT8ReqInstAlias plus plain ".8"
-multiclass VFPDT8InstAlias<string opc, string asm, dag Result> {
-  def _8 : VFPDataTypeInstAlias<opc, ".8", asm, Result>;
-  defm _ : VFPDT8ReqInstAlias<opc, asm, Result>;
-}
-multiclass VFPDT16ReqInstAlias<string opc, string asm, dag Result> {
-  def I16 : VFPDataTypeInstAlias<opc, ".i16", asm, Result>;
-  def S16 : VFPDataTypeInstAlias<opc, ".s16", asm, Result>;
-  def U16 : VFPDataTypeInstAlias<opc, ".u16", asm, Result>;
-  def P16 : VFPDataTypeInstAlias<opc, ".p16", asm, Result>;
-}
-// VFPDT16ReqInstAlias plus plain ".16"
-multiclass VFPDT16InstAlias<string opc, string asm, dag Result> {
-  def _16 : VFPDataTypeInstAlias<opc, ".16", asm, Result>;
-  defm _ : VFPDT16ReqInstAlias<opc, asm, Result>;
-}
-multiclass VFPDT32ReqInstAlias<string opc, string asm, dag Result> {
-  def I32 : VFPDataTypeInstAlias<opc, ".i32", asm, Result>;
-  def S32 : VFPDataTypeInstAlias<opc, ".s32", asm, Result>;
-  def U32 : VFPDataTypeInstAlias<opc, ".u32", asm, Result>;
-  def F32 : VFPDataTypeInstAlias<opc, ".f32", asm, Result>;
-  def F   : VFPDataTypeInstAlias<opc, ".f",   asm, Result>;
-}
-// VFPDT32ReqInstAlias plus plain ".32"
-multiclass VFPDT32InstAlias<string opc, string asm, dag Result> {
-  def _32 : VFPDataTypeInstAlias<opc, ".32", asm, Result>;
-  defm _ : VFPDT32ReqInstAlias<opc, asm, Result>;
-}
-multiclass VFPDT64ReqInstAlias<string opc, string asm, dag Result> {
-  def I64 : VFPDataTypeInstAlias<opc, ".i64", asm, Result>;
-  def S64 : VFPDataTypeInstAlias<opc, ".s64", asm, Result>;
-  def U64 : VFPDataTypeInstAlias<opc, ".u64", asm, Result>;
-  def F64 : VFPDataTypeInstAlias<opc, ".f64", asm, Result>;
-  def D   : VFPDataTypeInstAlias<opc, ".d",   asm, Result>;
-}
-// VFPDT64ReqInstAlias plus plain ".64"
-multiclass VFPDT64InstAlias<string opc, string asm, dag Result> {
-  def _64 : VFPDataTypeInstAlias<opc, ".64", asm, Result>;
-  defm _ : VFPDT64ReqInstAlias<opc, asm, Result>;
-}
-multiclass VFPDT64NoF64ReqInstAlias<string opc, string asm, dag Result> {
-  def I64 : VFPDataTypeInstAlias<opc, ".i64", asm, Result>;
-  def S64 : VFPDataTypeInstAlias<opc, ".s64", asm, Result>;
-  def U64 : VFPDataTypeInstAlias<opc, ".u64", asm, Result>;
-  def D   : VFPDataTypeInstAlias<opc, ".d",   asm, Result>;
-}
-// VFPDT64ReqInstAlias plus plain ".64"
-multiclass VFPDT64NoF64InstAlias<string opc, string asm, dag Result> {
-  def _64 : VFPDataTypeInstAlias<opc, ".64", asm, Result>;
-  defm _ : VFPDT64ReqInstAlias<opc, asm, Result>;
-}
+
 multiclass VFPDTAnyInstAlias<string opc, string asm, dag Result> {
-  defm _ : VFPDT8InstAlias<opc, asm, Result>;
-  defm _ : VFPDT16InstAlias<opc, asm, Result>;
-  defm _ : VFPDT32InstAlias<opc, asm, Result>;
-  defm _ : VFPDT64InstAlias<opc, asm, Result>;
+  def : VFPDataTypeInstAlias<opc, ".8", asm, Result>;
+  def : VFPDataTypeInstAlias<opc, ".16", asm, Result>;
+  def : VFPDataTypeInstAlias<opc, ".32", asm, Result>;
+  def : VFPDataTypeInstAlias<opc, ".64", asm, Result>;
+}
+
+multiclass NEONDTAnyInstAlias<string opc, string asm, dag Result> {
+  let Predicates = [HasNEON] in {
+  def : VFPDataTypeInstAlias<opc, ".8", asm, Result>;
+  def : VFPDataTypeInstAlias<opc, ".16", asm, Result>;
+  def : VFPDataTypeInstAlias<opc, ".32", asm, Result>;
+  def : VFPDataTypeInstAlias<opc, ".64", asm, Result>;
 }
-multiclass VFPDTAnyNoF64InstAlias<string opc, string asm, dag Result> {
-  defm _ : VFPDT8InstAlias<opc, asm, Result>;
-  defm _ : VFPDT16InstAlias<opc, asm, Result>;
-  defm _ : VFPDT32InstAlias<opc, asm, Result>;
-  defm _ : VFPDT64NoF64InstAlias<opc, asm, Result>;
 }
 
 // The same alias classes using AsmPseudo instead, for the more complex
@@ -2074,72 +2048,26 @@ multiclass VFPDTAnyNoF64InstAlias<string opc, string asm, dag Result> {
 // for instalias defs.
 class NEONDataTypeAsmPseudoInst<string opc, string dt, string asm, dag iops> :
   AsmPseudoInst<!strconcat(opc, dt, "\t", asm), iops>, Requires<[HasNEON]>;
-multiclass NEONDT8ReqAsmPseudoInst<string opc, string asm, dag iops> {
-  def I8 : NEONDataTypeAsmPseudoInst<opc, ".i8", asm, iops>;
-  def S8 : NEONDataTypeAsmPseudoInst<opc, ".s8", asm, iops>;
-  def U8 : NEONDataTypeAsmPseudoInst<opc, ".u8", asm, iops>;
-  def P8 : NEONDataTypeAsmPseudoInst<opc, ".p8", asm, iops>;
-}
-// NEONDT8ReqAsmPseudoInst plus plain ".8"
-multiclass NEONDT8AsmPseudoInst<string opc, string asm, dag iops> {
-  def _8 : NEONDataTypeAsmPseudoInst<opc, ".8", asm, iops>;
-  defm _ : NEONDT8ReqAsmPseudoInst<opc, asm, iops>;
-}
-multiclass NEONDT16ReqAsmPseudoInst<string opc, string asm, dag iops> {
-  def I16 : NEONDataTypeAsmPseudoInst<opc, ".i16", asm, iops>;
-  def S16 : NEONDataTypeAsmPseudoInst<opc, ".s16", asm, iops>;
-  def U16 : NEONDataTypeAsmPseudoInst<opc, ".u16", asm, iops>;
-  def P16 : NEONDataTypeAsmPseudoInst<opc, ".p16", asm, iops>;
-}
-// NEONDT16ReqAsmPseudoInst plus plain ".16"
-multiclass NEONDT16AsmPseudoInst<string opc, string asm, dag iops> {
-  def _16 : NEONDataTypeAsmPseudoInst<opc, ".16", asm, iops>;
-  defm _ : NEONDT16ReqAsmPseudoInst<opc, asm, iops>;
-}
-multiclass NEONDT32ReqAsmPseudoInst<string opc, string asm, dag iops> {
-  def I32 : NEONDataTypeAsmPseudoInst<opc, ".i32", asm, iops>;
-  def S32 : NEONDataTypeAsmPseudoInst<opc, ".s32", asm, iops>;
-  def U32 : NEONDataTypeAsmPseudoInst<opc, ".u32", asm, iops>;
-  def F32 : NEONDataTypeAsmPseudoInst<opc, ".f32", asm, iops>;
-  def F   : NEONDataTypeAsmPseudoInst<opc, ".f",   asm, iops>;
-}
-// NEONDT32ReqAsmPseudoInst plus plain ".32"
-multiclass NEONDT32AsmPseudoInst<string opc, string asm, dag iops> {
-  def _32 : NEONDataTypeAsmPseudoInst<opc, ".32", asm, iops>;
-  defm _ : NEONDT32ReqAsmPseudoInst<opc, asm, iops>;
-}
-multiclass NEONDT64ReqAsmPseudoInst<string opc, string asm, dag iops> {
-  def I64 : NEONDataTypeAsmPseudoInst<opc, ".i64", asm, iops>;
-  def S64 : NEONDataTypeAsmPseudoInst<opc, ".s64", asm, iops>;
-  def U64 : NEONDataTypeAsmPseudoInst<opc, ".u64", asm, iops>;
-  def F64 : NEONDataTypeAsmPseudoInst<opc, ".f64", asm, iops>;
-  def D   : NEONDataTypeAsmPseudoInst<opc, ".d",   asm, iops>;
-}
-// NEONDT64ReqAsmPseudoInst plus plain ".64"
-multiclass NEONDT64AsmPseudoInst<string opc, string asm, dag iops> {
-  def _64 : NEONDataTypeAsmPseudoInst<opc, ".64", asm, iops>;
-  defm _ : NEONDT64ReqAsmPseudoInst<opc, asm, iops>;
-}
-multiclass NEONDT64NoF64ReqAsmPseudoInst<string opc, string asm, dag iops> {
-  def I64 : NEONDataTypeAsmPseudoInst<opc, ".i64", asm, iops>;
-  def S64 : NEONDataTypeAsmPseudoInst<opc, ".s64", asm, iops>;
-  def U64 : NEONDataTypeAsmPseudoInst<opc, ".u64", asm, iops>;
-  def D   : NEONDataTypeAsmPseudoInst<opc, ".d",   asm, iops>;
-}
-// NEONDT64ReqAsmPseudoInst plus plain ".64"
-multiclass NEONDT64NoF64AsmPseudoInst<string opc, string asm, dag iops> {
-  def _64 : NEONDataTypeAsmPseudoInst<opc, ".64", asm, iops>;
-  defm _ : NEONDT64ReqAsmPseudoInst<opc, asm, iops>;
-}
-multiclass NEONDTAnyAsmPseudoInst<string opc, string asm, dag iops> {
-  defm _ : NEONDT8AsmPseudoInst<opc, asm, iops>;
-  defm _ : NEONDT16AsmPseudoInst<opc, asm, iops>;
-  defm _ : NEONDT32AsmPseudoInst<opc, asm, iops>;
-  defm _ : NEONDT64AsmPseudoInst<opc, asm, iops>;
-}
-multiclass NEONDTAnyNoF64AsmPseudoInst<string opc, string asm, dag iops> {
-  defm _ : NEONDT8AsmPseudoInst<opc, asm, iops>;
-  defm _ : NEONDT16AsmPseudoInst<opc, asm, iops>;
-  defm _ : NEONDT32AsmPseudoInst<opc, asm, iops>;
-  defm _ : NEONDT64NoF64AsmPseudoInst<opc, asm, iops>;
-}
+
+// Data type suffix token aliases. Implements Table A7-3 in the ARM ARM.
+def : TokenAlias<".s8", ".i8">;
+def : TokenAlias<".u8", ".i8">;
+def : TokenAlias<".s16", ".i16">;
+def : TokenAlias<".u16", ".i16">;
+def : TokenAlias<".s32", ".i32">;
+def : TokenAlias<".u32", ".i32">;
+def : TokenAlias<".s64", ".i64">;
+def : TokenAlias<".u64", ".i64">;
+
+def : TokenAlias<".i8", ".8">;
+def : TokenAlias<".i16", ".16">;
+def : TokenAlias<".i32", ".32">;
+def : TokenAlias<".i64", ".64">;
+
+def : TokenAlias<".p8", ".8">;
+def : TokenAlias<".p16", ".16">;
+
+def : TokenAlias<".f32", ".32">;
+def : TokenAlias<".f64", ".64">;
+def : TokenAlias<".f", ".f32">;
+def : TokenAlias<".d", ".f64">;