From 3ca524e336ad0be449c080235a2d7a38516f0ca4 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Fri, 10 Jul 2009 17:03:29 +0000 Subject: [PATCH] Predicate VFP instructions on HasVFP2 instead of IsARM. This allows VFP instructions with thumb-2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75254 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMInstrFormats.td | 48 ++++++++++++++++++++++++------- lib/Target/ARM/ARMInstrVFP.td | 8 +++--- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/lib/Target/ARM/ARMInstrFormats.td b/lib/Target/ARM/ARMInstrFormats.td index 89a0e7e02db..9ea4c33749d 100644 --- a/lib/Target/ARM/ARMInstrFormats.td +++ b/lib/Target/ARM/ARMInstrFormats.td @@ -918,10 +918,38 @@ class T2Pat : Pat { // ARM VFP Instruction templates. // +// Almost all VFP instructions are predicable. +class VFPI pattern> + : InstARM { + let OutOperandList = oops; + let InOperandList = !con(iops, (ops pred:$p)); + let AsmString = !strconcat(opc, !strconcat("${p}", asm)); + let Pattern = pattern; + list Predicates = [HasVFP2]; +} + +// Special cases +class VFPXI pattern> + : InstARM { + let OutOperandList = oops; + let InOperandList = iops; + let AsmString = asm; + let Pattern = pattern; + list Predicates = [HasVFP2]; +} + +class VFPAI pattern> + : VFPI; + // ARM VFP addrmode5 loads and stores class ADI5 opcod1, bits<2> opcod2, dag oops, dag iops, string opc, string asm, list pattern> - : I { // TODO: Mark the instructions with the appropriate subtarget info. let Inst{27-24} = opcod1; @@ -931,7 +959,7 @@ class ADI5 opcod1, bits<2> opcod2, dag oops, dag iops, class ASI5 opcod1, bits<2> opcod2, dag oops, dag iops, string opc, string asm, list pattern> - : I { // TODO: Mark the instructions with the appropriate subtarget info. let Inst{27-24} = opcod1; @@ -941,7 +969,7 @@ class ASI5 opcod1, bits<2> opcod2, dag oops, dag iops, // Load / store multiple class AXSI5 pattern> - : XI { // TODO: Mark the instructions with the appropriate subtarget info. let Inst{27-25} = 0b110; @@ -949,7 +977,7 @@ class AXSI5 pattern> } class AXDI5 pattern> - : XI { // TODO: Mark the instructions with the appropriate subtarget info. let Inst{27-25} = 0b110; @@ -960,7 +988,7 @@ class AXDI5 pattern> // Double precision, unary class ADuI opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops, string opc, string asm, list pattern> - : AI { + : VFPAI { let Inst{27-20} = opcod1; let Inst{19-16} = opcod2; let Inst{11-8} = 0b1011; @@ -970,7 +998,7 @@ class ADuI opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops, // Double precision, binary class ADbI opcod, dag oops, dag iops, string opc, string asm, list pattern> - : AI { + : VFPAI { let Inst{27-20} = opcod; let Inst{11-8} = 0b1011; } @@ -978,7 +1006,7 @@ class ADbI opcod, dag oops, dag iops, string opc, // Single precision, unary class ASuI opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops, string opc, string asm, list pattern> - : AI { + : VFPAI { // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding. let Inst{27-20} = opcod1; let Inst{19-16} = opcod2; @@ -989,7 +1017,7 @@ class ASuI opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops, // Single precision, binary class ASbI opcod, dag oops, dag iops, string opc, string asm, list pattern> - : AI { + : VFPAI { // Bit 22 (D bit) can be changed during instruction encoding. let Inst{27-20} = opcod; let Inst{11-8} = 0b1010; @@ -998,7 +1026,7 @@ class ASbI opcod, dag oops, dag iops, string opc, // VFP conversion instructions class AVConv1I opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops, string opc, string asm, list pattern> - : AI { + : VFPAI { let Inst{27-20} = opcod1; let Inst{19-16} = opcod2; let Inst{11-8} = opcod3; @@ -1007,7 +1035,7 @@ class AVConv1I opcod1, bits<4> opcod2, bits<4> opcod3, class AVConvXI opcod1, bits<4> opcod2, dag oops, dag iops, Format f, string opc, string asm, list pattern> - : AI { + : VFPAI { let Inst{27-20} = opcod1; let Inst{11-8} = opcod2; let Inst{4} = 1; diff --git a/lib/Target/ARM/ARMInstrVFP.td b/lib/Target/ARM/ARMInstrVFP.td index 9104c77115f..a4deaca491e 100644 --- a/lib/Target/ARM/ARMInstrVFP.td +++ b/lib/Target/ARM/ARMInstrVFP.td @@ -183,9 +183,9 @@ def FCVTDS : ASuI<0b11101011, 0b0111, 0b1100, (outs DPR:$dst), (ins SPR:$a), [(set DPR:$dst, (fextend SPR:$a))]>; // Special case encoding: bits 11-8 is 0b1011. -def FCVTSD : AI<(outs SPR:$dst), (ins DPR:$a), VFPUnaryFrm, - "fcvtsd", " $dst, $a", - [(set SPR:$dst, (fround DPR:$a))]> { +def FCVTSD : VFPAI<(outs SPR:$dst), (ins DPR:$a), VFPUnaryFrm, + "fcvtsd", " $dst, $a", + [(set SPR:$dst, (fround DPR:$a))]> { let Inst{27-23} = 0b11101; let Inst{21-16} = 0b110111; let Inst{11-8} = 0b1011; @@ -390,7 +390,7 @@ def FNEGScc : ASuI<0b11101011, 0b0001, 0b0100, // let Defs = [CPSR] in -def FMSTAT : AI<(outs), (ins), VFPMiscFrm, "fmstat", "", [(arm_fmstat)]> { +def FMSTAT : VFPAI<(outs), (ins), VFPMiscFrm, "fmstat", "", [(arm_fmstat)]> { let Inst{27-20} = 0b11101111; let Inst{19-16} = 0b0001; let Inst{15-12} = 0b1111; -- 2.34.1