blob: 23c132e4f6a894020d0f3b59c15036c86c434e72 [file] [log] [blame]
Jia Liu31d157a2012-02-18 12:03:15 +00001//===-- ARMInstrVFP.td - VFP support for ARM ---------------*- tablegen -*-===//
Evan Chenga8e29892007-01-19 07:51:42 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Evan Chenga8e29892007-01-19 07:51:42 +00007//
8//===----------------------------------------------------------------------===//
9//
Jim Grosbache5d20f92008-09-11 21:41:29 +000010// This file describes the ARM VFP instruction set.
Evan Chenga8e29892007-01-19 07:51:42 +000011//
12//===----------------------------------------------------------------------===//
13
Bill Wendling2695d8e2010-10-15 21:50:45 +000014def SDT_FTOI : SDTypeProfile<1, 1, [SDTCisVT<0, f32>, SDTCisFP<1>]>;
15def SDT_ITOF : SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f32>]>;
16def SDT_CMPFP0 : SDTypeProfile<0, 1, [SDTCisFP<0>]>;
17def SDT_VMOVDRR : SDTypeProfile<1, 2, [SDTCisVT<0, f64>, SDTCisVT<1, i32>,
18 SDTCisSameAs<1, 2>]>;
Evan Chenga8e29892007-01-19 07:51:42 +000019
Bill Wendling2695d8e2010-10-15 21:50:45 +000020def arm_ftoui : SDNode<"ARMISD::FTOUI", SDT_FTOI>;
21def arm_ftosi : SDNode<"ARMISD::FTOSI", SDT_FTOI>;
22def arm_sitof : SDNode<"ARMISD::SITOF", SDT_ITOF>;
23def arm_uitof : SDNode<"ARMISD::UITOF", SDT_ITOF>;
Chris Lattner036609b2010-12-23 18:28:41 +000024def arm_fmstat : SDNode<"ARMISD::FMSTAT", SDTNone, [SDNPInGlue, SDNPOutGlue]>;
25def arm_cmpfp : SDNode<"ARMISD::CMPFP", SDT_ARMCmp, [SDNPOutGlue]>;
26def arm_cmpfp0 : SDNode<"ARMISD::CMPFPw0", SDT_CMPFP0, [SDNPOutGlue]>;
Bill Wendling2695d8e2010-10-15 21:50:45 +000027def arm_fmdrr : SDNode<"ARMISD::VMOVDRR", SDT_VMOVDRR>;
Evan Chenga8e29892007-01-19 07:51:42 +000028
Bill Wendling88cf0382010-10-14 01:02:08 +000029
Evan Chenga8e29892007-01-19 07:51:42 +000030//===----------------------------------------------------------------------===//
Evan Cheng39382422009-10-28 01:44:26 +000031// Operand Definitions.
32//
33
Jim Grosbach9d390362011-10-03 23:38:36 +000034// 8-bit floating-point immediate encodings.
35def FPImmOperand : AsmOperandClass {
36 let Name = "FPImm";
37 let ParserMethod = "parseFPImm";
38}
39
Evan Cheng39382422009-10-28 01:44:26 +000040def vfp_f32imm : Operand<f32>,
41 PatLeaf<(f32 fpimm), [{
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +000042 return ARM_AM::getFP32Imm(N->getValueAPF()) != -1;
43 }], SDNodeXForm<fpimm, [{
44 APFloat InVal = N->getValueAPF();
45 uint32_t enc = ARM_AM::getFP32Imm(InVal);
46 return CurDAG->getTargetConstant(enc, MVT::i32);
47 }]>> {
48 let PrintMethod = "printFPImmOperand";
Jim Grosbach9d390362011-10-03 23:38:36 +000049 let ParserMatchClass = FPImmOperand;
Evan Cheng39382422009-10-28 01:44:26 +000050}
51
52def vfp_f64imm : Operand<f64>,
53 PatLeaf<(f64 fpimm), [{
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +000054 return ARM_AM::getFP64Imm(N->getValueAPF()) != -1;
55 }], SDNodeXForm<fpimm, [{
56 APFloat InVal = N->getValueAPF();
57 uint32_t enc = ARM_AM::getFP64Imm(InVal);
58 return CurDAG->getTargetConstant(enc, MVT::i32);
59 }]>> {
60 let PrintMethod = "printFPImmOperand";
Jim Grosbach9d390362011-10-03 23:38:36 +000061 let ParserMatchClass = FPImmOperand;
Evan Cheng39382422009-10-28 01:44:26 +000062}
63
Jim Grosbach4050bc42011-12-22 22:19:05 +000064// The VCVT to/from fixed-point instructions encode the 'fbits' operand
65// (the number of fixed bits) differently than it appears in the assembly
66// source. It's encoded as "Size - fbits" where Size is the size of the
67// fixed-point representation (32 or 16) and fbits is the value appearing
68// in the assembly source, an integer in [0,16] or (0,32], depending on size.
69def fbits32_asm_operand : AsmOperandClass { let Name = "FBits32"; }
70def fbits32 : Operand<i32> {
71 let PrintMethod = "printFBits32";
72 let ParserMatchClass = fbits32_asm_operand;
73}
74
75def fbits16_asm_operand : AsmOperandClass { let Name = "FBits16"; }
76def fbits16 : Operand<i32> {
77 let PrintMethod = "printFBits16";
78 let ParserMatchClass = fbits16_asm_operand;
79}
Evan Cheng39382422009-10-28 01:44:26 +000080
81//===----------------------------------------------------------------------===//
Evan Chenga8e29892007-01-19 07:51:42 +000082// Load / store Instructions.
83//
84
Dan Gohmanbc9d98b2010-02-27 23:47:46 +000085let canFoldAsLoad = 1, isReMaterializable = 1 in {
Bill Wendling92b5a2e2010-11-03 01:49:29 +000086
Bill Wendling7d31a162010-10-20 22:44:54 +000087def VLDRD : ADI5<0b1101, 0b01, (outs DPR:$Dd), (ins addrmode5:$addr),
Jim Grosbachffc658b2011-11-14 23:03:21 +000088 IIC_fpLoad64, "vldr", "\t$Dd, $addr",
Bill Wendling2f46f1f2010-11-04 00:59:42 +000089 [(set DPR:$Dd, (f64 (load addrmode5:$addr)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +000090
Bill Wendling92b5a2e2010-11-03 01:49:29 +000091def VLDRS : ASI5<0b1101, 0b01, (outs SPR:$Sd), (ins addrmode5:$addr),
Jim Grosbachffc658b2011-11-14 23:03:21 +000092 IIC_fpLoad32, "vldr", "\t$Sd, $addr",
Evan Cheng5eda2822011-02-16 00:35:02 +000093 [(set SPR:$Sd, (load addrmode5:$addr))]> {
94 // Some single precision VFP instructions may be executed on both NEON and VFP
95 // pipelines.
96 let D = VFPNeonDomain;
97}
Bill Wendling92b5a2e2010-11-03 01:49:29 +000098
99} // End of 'let canFoldAsLoad = 1, isReMaterializable = 1 in'
Evan Chenga8e29892007-01-19 07:51:42 +0000100
Bill Wendling2f46f1f2010-11-04 00:59:42 +0000101def VSTRD : ADI5<0b1101, 0b00, (outs), (ins DPR:$Dd, addrmode5:$addr),
Jim Grosbachffc658b2011-11-14 23:03:21 +0000102 IIC_fpStore64, "vstr", "\t$Dd, $addr",
Bill Wendling2f46f1f2010-11-04 00:59:42 +0000103 [(store (f64 DPR:$Dd), addrmode5:$addr)]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000104
Bill Wendling2f46f1f2010-11-04 00:59:42 +0000105def VSTRS : ASI5<0b1101, 0b00, (outs), (ins SPR:$Sd, addrmode5:$addr),
Jim Grosbachffc658b2011-11-14 23:03:21 +0000106 IIC_fpStore32, "vstr", "\t$Sd, $addr",
Evan Cheng5eda2822011-02-16 00:35:02 +0000107 [(store SPR:$Sd, addrmode5:$addr)]> {
108 // Some single precision VFP instructions may be executed on both NEON and VFP
109 // pipelines.
110 let D = VFPNeonDomain;
111}
Evan Chenga8e29892007-01-19 07:51:42 +0000112
113//===----------------------------------------------------------------------===//
114// Load / store multiple Instructions.
115//
116
Bill Wendling73fe34a2010-11-16 01:16:36 +0000117multiclass vfp_ldst_mult<string asm, bit L_bit,
118 InstrItinClass itin, InstrItinClass itin_upd> {
119 // Double Precision
120 def DIA :
Bill Wendling0f630752010-11-17 04:32:08 +0000121 AXDI4<(outs), (ins GPR:$Rn, pred:$p, dpr_reglist:$regs, variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000122 IndexModeNone, itin,
Bill Wendling73fe34a2010-11-16 01:16:36 +0000123 !strconcat(asm, "ia${p}\t$Rn, $regs"), "", []> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000124 let Inst{24-23} = 0b01; // Increment After
125 let Inst{21} = 0; // No writeback
126 let Inst{20} = L_bit;
127 }
Bill Wendling73fe34a2010-11-16 01:16:36 +0000128 def DIA_UPD :
Jim Grosbachf921c0fe2011-06-13 22:54:22 +0000129 AXDI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, dpr_reglist:$regs,
130 variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000131 IndexModeUpd, itin_upd,
Bill Wendling73fe34a2010-11-16 01:16:36 +0000132 !strconcat(asm, "ia${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000133 let Inst{24-23} = 0b01; // Increment After
134 let Inst{21} = 1; // Writeback
135 let Inst{20} = L_bit;
136 }
Bill Wendling73fe34a2010-11-16 01:16:36 +0000137 def DDB_UPD :
Jim Grosbachf921c0fe2011-06-13 22:54:22 +0000138 AXDI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, dpr_reglist:$regs,
139 variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000140 IndexModeUpd, itin_upd,
141 !strconcat(asm, "db${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
142 let Inst{24-23} = 0b10; // Decrement Before
143 let Inst{21} = 1; // Writeback
144 let Inst{20} = L_bit;
145 }
Bill Wendling6c470b82010-11-13 09:09:38 +0000146
Bill Wendling73fe34a2010-11-16 01:16:36 +0000147 // Single Precision
148 def SIA :
Bill Wendling0f630752010-11-17 04:32:08 +0000149 AXSI4<(outs), (ins GPR:$Rn, pred:$p, spr_reglist:$regs, variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000150 IndexModeNone, itin,
Bill Wendling73fe34a2010-11-16 01:16:36 +0000151 !strconcat(asm, "ia${p}\t$Rn, $regs"), "", []> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000152 let Inst{24-23} = 0b01; // Increment After
153 let Inst{21} = 0; // No writeback
154 let Inst{20} = L_bit;
Evan Cheng5eda2822011-02-16 00:35:02 +0000155
156 // Some single precision VFP instructions may be executed on both NEON and
157 // VFP pipelines.
158 let D = VFPNeonDomain;
Bill Wendling6c470b82010-11-13 09:09:38 +0000159 }
Bill Wendling73fe34a2010-11-16 01:16:36 +0000160 def SIA_UPD :
Jim Grosbachf921c0fe2011-06-13 22:54:22 +0000161 AXSI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, spr_reglist:$regs,
162 variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000163 IndexModeUpd, itin_upd,
Bill Wendling73fe34a2010-11-16 01:16:36 +0000164 !strconcat(asm, "ia${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000165 let Inst{24-23} = 0b01; // Increment After
166 let Inst{21} = 1; // Writeback
167 let Inst{20} = L_bit;
Evan Cheng5eda2822011-02-16 00:35:02 +0000168
169 // Some single precision VFP instructions may be executed on both NEON and
170 // VFP pipelines.
171 let D = VFPNeonDomain;
Bill Wendling6c470b82010-11-13 09:09:38 +0000172 }
Bill Wendling73fe34a2010-11-16 01:16:36 +0000173 def SDB_UPD :
Jim Grosbachf921c0fe2011-06-13 22:54:22 +0000174 AXSI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, spr_reglist:$regs,
175 variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000176 IndexModeUpd, itin_upd,
177 !strconcat(asm, "db${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
178 let Inst{24-23} = 0b10; // Decrement Before
179 let Inst{21} = 1; // Writeback
180 let Inst{20} = L_bit;
Evan Cheng5eda2822011-02-16 00:35:02 +0000181
182 // Some single precision VFP instructions may be executed on both NEON and
183 // VFP pipelines.
184 let D = VFPNeonDomain;
Bill Wendling6c470b82010-11-13 09:09:38 +0000185 }
186}
187
Bill Wendlingddc918b2010-11-13 10:57:02 +0000188let neverHasSideEffects = 1 in {
189
Bill Wendling73fe34a2010-11-16 01:16:36 +0000190let mayLoad = 1, hasExtraDefRegAllocReq = 1 in
191defm VLDM : vfp_ldst_mult<"vldm", 1, IIC_fpLoad_m, IIC_fpLoad_mu>;
Bill Wendlingddc918b2010-11-13 10:57:02 +0000192
Bill Wendling73fe34a2010-11-16 01:16:36 +0000193let mayStore = 1, hasExtraSrcRegAllocReq = 1 in
194defm VSTM : vfp_ldst_mult<"vstm", 0, IIC_fpLoad_m, IIC_fpLoad_mu>;
Bill Wendlingddc918b2010-11-13 10:57:02 +0000195
196} // neverHasSideEffects
197
Bill Wendling73c57e12010-11-16 02:00:24 +0000198def : MnemonicAlias<"vldm", "vldmia">;
199def : MnemonicAlias<"vstm", "vstmia">;
200
Jim Grosbach0d06bb92011-06-27 20:00:07 +0000201def : InstAlias<"vpush${p} $r", (VSTMDDB_UPD SP, pred:$p, dpr_reglist:$r)>,
202 Requires<[HasVFP2]>;
203def : InstAlias<"vpush${p} $r", (VSTMSDB_UPD SP, pred:$p, spr_reglist:$r)>,
204 Requires<[HasVFP2]>;
205def : InstAlias<"vpop${p} $r", (VLDMDIA_UPD SP, pred:$p, dpr_reglist:$r)>,
206 Requires<[HasVFP2]>;
207def : InstAlias<"vpop${p} $r", (VLDMSIA_UPD SP, pred:$p, spr_reglist:$r)>,
208 Requires<[HasVFP2]>;
Jim Grosbachbc978a62012-03-05 23:16:31 +0000209defm : VFPDTAnyInstAlias<"vpush${p}", "$r",
210 (VSTMSDB_UPD SP, pred:$p, spr_reglist:$r)>;
211defm : VFPDTAnyInstAlias<"vpush${p}", "$r",
212 (VSTMDDB_UPD SP, pred:$p, dpr_reglist:$r)>;
213defm : VFPDTAnyInstAlias<"vpop${p}", "$r",
214 (VLDMSIA_UPD SP, pred:$p, spr_reglist:$r)>;
215defm : VFPDTAnyInstAlias<"vpop${p}", "$r",
216 (VLDMDIA_UPD SP, pred:$p, dpr_reglist:$r)>;
Jim Grosbach0d06bb92011-06-27 20:00:07 +0000217
Evan Chenga8e29892007-01-19 07:51:42 +0000218// FLDMX, FSTMX - mixing S/D registers for pre-armv6 cores
219
220//===----------------------------------------------------------------------===//
221// FP Binary Operations.
222//
223
Jim Grosbach181b1472012-04-20 00:15:00 +0000224let TwoOperandAliasConstraint = "$Dn = $Dd" in
Bill Wendling69661192010-11-01 06:00:39 +0000225def VADDD : ADbI<0b11100, 0b11, 0, 0,
226 (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm),
227 IIC_fpALU64, "vadd", ".f64\t$Dd, $Dn, $Dm",
228 [(set DPR:$Dd, (fadd DPR:$Dn, (f64 DPR:$Dm)))]>;
Bill Wendling174777b2010-10-12 22:08:41 +0000229
Jim Grosbach181b1472012-04-20 00:15:00 +0000230let TwoOperandAliasConstraint = "$Sn = $Sd" in
Bill Wendling69661192010-11-01 06:00:39 +0000231def VADDS : ASbIn<0b11100, 0b11, 0, 0,
232 (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm),
233 IIC_fpALU32, "vadd", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000234 [(set SPR:$Sd, (fadd SPR:$Sn, SPR:$Sm))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000235 // Some single precision VFP instructions may be executed on both NEON and
236 // VFP pipelines on A8.
237 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000238}
Evan Chenga8e29892007-01-19 07:51:42 +0000239
Jim Grosbach181b1472012-04-20 00:15:00 +0000240let TwoOperandAliasConstraint = "$Dn = $Dd" in
Bill Wendling69661192010-11-01 06:00:39 +0000241def VSUBD : ADbI<0b11100, 0b11, 1, 0,
242 (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm),
243 IIC_fpALU64, "vsub", ".f64\t$Dd, $Dn, $Dm",
244 [(set DPR:$Dd, (fsub DPR:$Dn, (f64 DPR:$Dm)))]>;
Jim Grosbach499e8862010-10-12 21:22:40 +0000245
Jim Grosbach181b1472012-04-20 00:15:00 +0000246let TwoOperandAliasConstraint = "$Sn = $Sd" in
Bill Wendling69661192010-11-01 06:00:39 +0000247def VSUBS : ASbIn<0b11100, 0b11, 1, 0,
248 (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm),
249 IIC_fpALU32, "vsub", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000250 [(set SPR:$Sd, (fsub SPR:$Sn, SPR:$Sm))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000251 // Some single precision VFP instructions may be executed on both NEON and
252 // VFP pipelines on A8.
253 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000254}
Evan Chenga8e29892007-01-19 07:51:42 +0000255
Jim Grosbach181b1472012-04-20 00:15:00 +0000256let TwoOperandAliasConstraint = "$Dn = $Dd" in
Bill Wendling69661192010-11-01 06:00:39 +0000257def VDIVD : ADbI<0b11101, 0b00, 0, 0,
258 (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm),
259 IIC_fpDIV64, "vdiv", ".f64\t$Dd, $Dn, $Dm",
260 [(set DPR:$Dd, (fdiv DPR:$Dn, (f64 DPR:$Dm)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000261
Jim Grosbach181b1472012-04-20 00:15:00 +0000262let TwoOperandAliasConstraint = "$Sn = $Sd" in
Bill Wendling69661192010-11-01 06:00:39 +0000263def VDIVS : ASbI<0b11101, 0b00, 0, 0,
264 (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm),
265 IIC_fpDIV32, "vdiv", ".f32\t$Sd, $Sn, $Sm",
266 [(set SPR:$Sd, (fdiv SPR:$Sn, SPR:$Sm))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000267
Jim Grosbach181b1472012-04-20 00:15:00 +0000268let TwoOperandAliasConstraint = "$Dn = $Dd" in
Bill Wendling69661192010-11-01 06:00:39 +0000269def VMULD : ADbI<0b11100, 0b10, 0, 0,
270 (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm),
271 IIC_fpMUL64, "vmul", ".f64\t$Dd, $Dn, $Dm",
272 [(set DPR:$Dd, (fmul DPR:$Dn, (f64 DPR:$Dm)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000273
Jim Grosbach181b1472012-04-20 00:15:00 +0000274let TwoOperandAliasConstraint = "$Sn = $Sd" in
Bill Wendling69661192010-11-01 06:00:39 +0000275def VMULS : ASbIn<0b11100, 0b10, 0, 0,
276 (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm),
277 IIC_fpMUL32, "vmul", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000278 [(set SPR:$Sd, (fmul SPR:$Sn, SPR:$Sm))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000279 // Some single precision VFP instructions may be executed on both NEON and
280 // VFP pipelines on A8.
281 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000282}
Jim Grosbache5165492009-11-09 00:11:35 +0000283
Bill Wendling69661192010-11-01 06:00:39 +0000284def VNMULD : ADbI<0b11100, 0b10, 1, 0,
285 (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm),
286 IIC_fpMUL64, "vnmul", ".f64\t$Dd, $Dn, $Dm",
287 [(set DPR:$Dd, (fneg (fmul DPR:$Dn, (f64 DPR:$Dm))))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000288
Bill Wendling69661192010-11-01 06:00:39 +0000289def VNMULS : ASbI<0b11100, 0b10, 1, 0,
290 (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm),
291 IIC_fpMUL32, "vnmul", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000292 [(set SPR:$Sd, (fneg (fmul SPR:$Sn, SPR:$Sm)))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000293 // Some single precision VFP instructions may be executed on both NEON and
294 // VFP pipelines on A8.
295 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000296}
Evan Chenga8e29892007-01-19 07:51:42 +0000297
Chris Lattner72939122007-05-03 00:32:00 +0000298// Match reassociated forms only if not sign dependent rounding.
Chris Lattnerd10a53d2010-03-08 18:51:21 +0000299def : Pat<(fmul (fneg DPR:$a), (f64 DPR:$b)),
Jim Grosbache5165492009-11-09 00:11:35 +0000300 (VNMULD DPR:$a, DPR:$b)>, Requires<[NoHonorSignDependentRounding]>;
Chris Lattner72939122007-05-03 00:32:00 +0000301def : Pat<(fmul (fneg SPR:$a), SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000302 (VNMULS SPR:$a, SPR:$b)>, Requires<[NoHonorSignDependentRounding]>;
Chris Lattner72939122007-05-03 00:32:00 +0000303
Bill Wendlingdd3bc112010-10-12 22:55:35 +0000304// These are encoded as unary instructions.
Lang Hames4f92b5e2012-03-06 00:19:55 +0000305let Defs = [FPSCR_NZCV] in {
Bill Wendling69661192010-11-01 06:00:39 +0000306def VCMPED : ADuI<0b11101, 0b11, 0b0100, 0b11, 0,
307 (outs), (ins DPR:$Dd, DPR:$Dm),
308 IIC_fpCMP64, "vcmpe", ".f64\t$Dd, $Dm",
309 [(arm_cmpfp DPR:$Dd, (f64 DPR:$Dm))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000310
Bill Wendling69661192010-11-01 06:00:39 +0000311def VCMPES : ASuI<0b11101, 0b11, 0b0100, 0b11, 0,
312 (outs), (ins SPR:$Sd, SPR:$Sm),
313 IIC_fpCMP32, "vcmpe", ".f32\t$Sd, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000314 [(arm_cmpfp SPR:$Sd, SPR:$Sm)]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000315 // Some single precision VFP instructions may be executed on both NEON and
316 // VFP pipelines on A8.
317 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000318}
Bill Wendlingdd3bc112010-10-12 22:55:35 +0000319
Bill Wendling67a704d2010-10-13 20:58:46 +0000320// FIXME: Verify encoding after integrated assembler is working.
Bill Wendling69661192010-11-01 06:00:39 +0000321def VCMPD : ADuI<0b11101, 0b11, 0b0100, 0b01, 0,
322 (outs), (ins DPR:$Dd, DPR:$Dm),
323 IIC_fpCMP64, "vcmp", ".f64\t$Dd, $Dm",
324 [/* For disassembly only; pattern left blank */]>;
Bill Wendlingdd3bc112010-10-12 22:55:35 +0000325
Bill Wendling69661192010-11-01 06:00:39 +0000326def VCMPS : ASuI<0b11101, 0b11, 0b0100, 0b01, 0,
327 (outs), (ins SPR:$Sd, SPR:$Sm),
328 IIC_fpCMP32, "vcmp", ".f32\t$Sd, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000329 [/* For disassembly only; pattern left blank */]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000330 // Some single precision VFP instructions may be executed on both NEON and
331 // VFP pipelines on A8.
332 let D = VFPNeonA8Domain;
Bill Wendlingdd3bc112010-10-12 22:55:35 +0000333}
Lang Hames4f92b5e2012-03-06 00:19:55 +0000334} // Defs = [FPSCR_NZCV]
Evan Chenga8e29892007-01-19 07:51:42 +0000335
336//===----------------------------------------------------------------------===//
337// FP Unary Operations.
338//
339
Bill Wendling69661192010-11-01 06:00:39 +0000340def VABSD : ADuI<0b11101, 0b11, 0b0000, 0b11, 0,
341 (outs DPR:$Dd), (ins DPR:$Dm),
342 IIC_fpUNA64, "vabs", ".f64\t$Dd, $Dm",
343 [(set DPR:$Dd, (fabs (f64 DPR:$Dm)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000344
Bill Wendling69661192010-11-01 06:00:39 +0000345def VABSS : ASuIn<0b11101, 0b11, 0b0000, 0b11, 0,
346 (outs SPR:$Sd), (ins SPR:$Sm),
347 IIC_fpUNA32, "vabs", ".f32\t$Sd, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000348 [(set SPR:$Sd, (fabs SPR:$Sm))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000349 // Some single precision VFP instructions may be executed on both NEON and
350 // VFP pipelines on A8.
351 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000352}
Evan Chenga8e29892007-01-19 07:51:42 +0000353
Lang Hames4f92b5e2012-03-06 00:19:55 +0000354let Defs = [FPSCR_NZCV] in {
Bill Wendling69661192010-11-01 06:00:39 +0000355def VCMPEZD : ADuI<0b11101, 0b11, 0b0101, 0b11, 0,
356 (outs), (ins DPR:$Dd),
357 IIC_fpCMP64, "vcmpe", ".f64\t$Dd, #0",
358 [(arm_cmpfp0 (f64 DPR:$Dd))]> {
359 let Inst{3-0} = 0b0000;
360 let Inst{5} = 0;
Bill Wendling1fc6d882010-10-13 00:38:07 +0000361}
362
Bill Wendling69661192010-11-01 06:00:39 +0000363def VCMPEZS : ASuI<0b11101, 0b11, 0b0101, 0b11, 0,
364 (outs), (ins SPR:$Sd),
365 IIC_fpCMP32, "vcmpe", ".f32\t$Sd, #0",
366 [(arm_cmpfp0 SPR:$Sd)]> {
367 let Inst{3-0} = 0b0000;
368 let Inst{5} = 0;
Evan Cheng5eda2822011-02-16 00:35:02 +0000369
Evan Cheng6557bce2011-02-22 19:53:14 +0000370 // Some single precision VFP instructions may be executed on both NEON and
371 // VFP pipelines on A8.
372 let D = VFPNeonA8Domain;
Bill Wendling1fc6d882010-10-13 00:38:07 +0000373}
Evan Chenga8e29892007-01-19 07:51:42 +0000374
Bill Wendling67a704d2010-10-13 20:58:46 +0000375// FIXME: Verify encoding after integrated assembler is working.
Bill Wendling69661192010-11-01 06:00:39 +0000376def VCMPZD : ADuI<0b11101, 0b11, 0b0101, 0b01, 0,
377 (outs), (ins DPR:$Dd),
378 IIC_fpCMP64, "vcmp", ".f64\t$Dd, #0",
379 [/* For disassembly only; pattern left blank */]> {
380 let Inst{3-0} = 0b0000;
381 let Inst{5} = 0;
Bill Wendling67a704d2010-10-13 20:58:46 +0000382}
Johnny Chen7edd8e32010-02-08 19:41:48 +0000383
Bill Wendling69661192010-11-01 06:00:39 +0000384def VCMPZS : ASuI<0b11101, 0b11, 0b0101, 0b01, 0,
385 (outs), (ins SPR:$Sd),
386 IIC_fpCMP32, "vcmp", ".f32\t$Sd, #0",
387 [/* For disassembly only; pattern left blank */]> {
388 let Inst{3-0} = 0b0000;
389 let Inst{5} = 0;
Evan Cheng5eda2822011-02-16 00:35:02 +0000390
Evan Cheng6557bce2011-02-22 19:53:14 +0000391 // Some single precision VFP instructions may be executed on both NEON and
392 // VFP pipelines on A8.
393 let D = VFPNeonA8Domain;
Bill Wendling67a704d2010-10-13 20:58:46 +0000394}
Lang Hames4f92b5e2012-03-06 00:19:55 +0000395} // Defs = [FPSCR_NZCV]
Evan Chenga8e29892007-01-19 07:51:42 +0000396
Bill Wendling54908dd2010-10-13 00:56:35 +0000397def VCVTDS : ASuI<0b11101, 0b11, 0b0111, 0b11, 0,
398 (outs DPR:$Dd), (ins SPR:$Sm),
399 IIC_fpCVTDS, "vcvt", ".f64.f32\t$Dd, $Sm",
400 [(set DPR:$Dd, (fextend SPR:$Sm))]> {
401 // Instruction operands.
402 bits<5> Dd;
403 bits<5> Sm;
404
405 // Encode instruction operands.
406 let Inst{3-0} = Sm{4-1};
407 let Inst{5} = Sm{0};
408 let Inst{15-12} = Dd{3-0};
409 let Inst{22} = Dd{4};
410}
Evan Chenga8e29892007-01-19 07:51:42 +0000411
Evan Cheng96581d32008-11-11 02:11:05 +0000412// Special case encoding: bits 11-8 is 0b1011.
Bill Wendling54908dd2010-10-13 00:56:35 +0000413def VCVTSD : VFPAI<(outs SPR:$Sd), (ins DPR:$Dm), VFPUnaryFrm,
414 IIC_fpCVTSD, "vcvt", ".f32.f64\t$Sd, $Dm",
415 [(set SPR:$Sd, (fround DPR:$Dm))]> {
416 // Instruction operands.
417 bits<5> Sd;
418 bits<5> Dm;
419
420 // Encode instruction operands.
421 let Inst{3-0} = Dm{3-0};
422 let Inst{5} = Dm{4};
423 let Inst{15-12} = Sd{4-1};
424 let Inst{22} = Sd{0};
425
Evan Cheng96581d32008-11-11 02:11:05 +0000426 let Inst{27-23} = 0b11101;
427 let Inst{21-16} = 0b110111;
428 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000429 let Inst{7-6} = 0b11;
430 let Inst{4} = 0;
Evan Cheng96581d32008-11-11 02:11:05 +0000431}
Evan Chenga8e29892007-01-19 07:51:42 +0000432
Johnny Chen2d658df2010-02-09 17:21:56 +0000433// Between half-precision and single-precision. For disassembly only.
434
Bill Wendling67a704d2010-10-13 20:58:46 +0000435// FIXME: Verify encoding after integrated assembler is working.
Owen Anderson838130e2011-08-22 21:34:00 +0000436def VCVTBSH: ASuI<0b11101, 0b11, 0b0010, 0b01, 0, (outs SPR:$Sd), (ins SPR:$Sm),
437 /* FIXME */ IIC_fpCVTSH, "vcvtb", ".f32.f16\t$Sd, $Sm",
Anton Korobeynikovf0d50072010-03-18 22:35:37 +0000438 [/* For disassembly only; pattern left blank */]>;
439
Bob Wilson76a312b2010-03-19 22:51:32 +0000440def : ARMPat<(f32_to_f16 SPR:$a),
441 (i32 (COPY_TO_REGCLASS (VCVTBSH SPR:$a), GPR))>;
Johnny Chen2d658df2010-02-09 17:21:56 +0000442
Owen Anderson838130e2011-08-22 21:34:00 +0000443def VCVTBHS: ASuI<0b11101, 0b11, 0b0011, 0b01, 0, (outs SPR:$Sd), (ins SPR:$Sm),
444 /* FIXME */ IIC_fpCVTHS, "vcvtb", ".f16.f32\t$Sd, $Sm",
Anton Korobeynikovf0d50072010-03-18 22:35:37 +0000445 [/* For disassembly only; pattern left blank */]>;
446
Bob Wilson76a312b2010-03-19 22:51:32 +0000447def : ARMPat<(f16_to_f32 GPR:$a),
448 (VCVTBHS (COPY_TO_REGCLASS GPR:$a, SPR))>;
Johnny Chen2d658df2010-02-09 17:21:56 +0000449
Owen Anderson838130e2011-08-22 21:34:00 +0000450def VCVTTSH: ASuI<0b11101, 0b11, 0b0010, 0b11, 0, (outs SPR:$Sd), (ins SPR:$Sm),
451 /* FIXME */ IIC_fpCVTSH, "vcvtt", ".f32.f16\t$Sd, $Sm",
Johnny Chen2d658df2010-02-09 17:21:56 +0000452 [/* For disassembly only; pattern left blank */]>;
453
Owen Anderson838130e2011-08-22 21:34:00 +0000454def VCVTTHS: ASuI<0b11101, 0b11, 0b0011, 0b11, 0, (outs SPR:$Sd), (ins SPR:$Sm),
455 /* FIXME */ IIC_fpCVTHS, "vcvtt", ".f16.f32\t$Sd, $Sm",
Johnny Chen2d658df2010-02-09 17:21:56 +0000456 [/* For disassembly only; pattern left blank */]>;
457
Bill Wendling69661192010-11-01 06:00:39 +0000458def VNEGD : ADuI<0b11101, 0b11, 0b0001, 0b01, 0,
459 (outs DPR:$Dd), (ins DPR:$Dm),
460 IIC_fpUNA64, "vneg", ".f64\t$Dd, $Dm",
461 [(set DPR:$Dd, (fneg (f64 DPR:$Dm)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000462
Bill Wendling69661192010-11-01 06:00:39 +0000463def VNEGS : ASuIn<0b11101, 0b11, 0b0001, 0b01, 0,
464 (outs SPR:$Sd), (ins SPR:$Sm),
465 IIC_fpUNA32, "vneg", ".f32\t$Sd, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000466 [(set SPR:$Sd, (fneg SPR:$Sm))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000467 // Some single precision VFP instructions may be executed on both NEON and
468 // VFP pipelines on A8.
469 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000470}
Evan Chenga8e29892007-01-19 07:51:42 +0000471
Bill Wendling69661192010-11-01 06:00:39 +0000472def VSQRTD : ADuI<0b11101, 0b11, 0b0001, 0b11, 0,
473 (outs DPR:$Dd), (ins DPR:$Dm),
474 IIC_fpSQRT64, "vsqrt", ".f64\t$Dd, $Dm",
475 [(set DPR:$Dd, (fsqrt (f64 DPR:$Dm)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000476
Bill Wendling69661192010-11-01 06:00:39 +0000477def VSQRTS : ASuI<0b11101, 0b11, 0b0001, 0b11, 0,
478 (outs SPR:$Sd), (ins SPR:$Sm),
479 IIC_fpSQRT32, "vsqrt", ".f32\t$Sd, $Sm",
480 [(set SPR:$Sd, (fsqrt SPR:$Sm))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000481
Bill Wendling67a704d2010-10-13 20:58:46 +0000482let neverHasSideEffects = 1 in {
Bill Wendling69661192010-11-01 06:00:39 +0000483def VMOVD : ADuI<0b11101, 0b11, 0b0000, 0b01, 0,
484 (outs DPR:$Dd), (ins DPR:$Dm),
485 IIC_fpUNA64, "vmov", ".f64\t$Dd, $Dm", []>;
Bill Wendling67a704d2010-10-13 20:58:46 +0000486
Bill Wendling69661192010-11-01 06:00:39 +0000487def VMOVS : ASuI<0b11101, 0b11, 0b0000, 0b01, 0,
488 (outs SPR:$Sd), (ins SPR:$Sm),
489 IIC_fpUNA32, "vmov", ".f32\t$Sd, $Sm", []>;
Bill Wendling67a704d2010-10-13 20:58:46 +0000490} // neverHasSideEffects
491
Evan Chenga8e29892007-01-19 07:51:42 +0000492//===----------------------------------------------------------------------===//
493// FP <-> GPR Copies. Int <-> FP Conversions.
494//
495
Bill Wendling7d31a162010-10-20 22:44:54 +0000496def VMOVRS : AVConv2I<0b11100001, 0b1010,
497 (outs GPR:$Rt), (ins SPR:$Sn),
498 IIC_fpMOVSI, "vmov", "\t$Rt, $Sn",
499 [(set GPR:$Rt, (bitconvert SPR:$Sn))]> {
500 // Instruction operands.
501 bits<4> Rt;
502 bits<5> Sn;
Evan Chenga8e29892007-01-19 07:51:42 +0000503
Bill Wendling7d31a162010-10-20 22:44:54 +0000504 // Encode instruction operands.
505 let Inst{19-16} = Sn{4-1};
506 let Inst{7} = Sn{0};
507 let Inst{15-12} = Rt;
508
509 let Inst{6-5} = 0b00;
510 let Inst{3-0} = 0b0000;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000511
512 // Some single precision VFP instructions may be executed on both NEON and VFP
513 // pipelines.
514 let D = VFPNeonDomain;
Bill Wendling7d31a162010-10-20 22:44:54 +0000515}
516
517def VMOVSR : AVConv4I<0b11100000, 0b1010,
518 (outs SPR:$Sn), (ins GPR:$Rt),
519 IIC_fpMOVIS, "vmov", "\t$Sn, $Rt",
520 [(set SPR:$Sn, (bitconvert GPR:$Rt))]> {
521 // Instruction operands.
522 bits<5> Sn;
523 bits<4> Rt;
524
525 // Encode instruction operands.
526 let Inst{19-16} = Sn{4-1};
527 let Inst{7} = Sn{0};
528 let Inst{15-12} = Rt;
529
530 let Inst{6-5} = 0b00;
531 let Inst{3-0} = 0b0000;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000532
533 // Some single precision VFP instructions may be executed on both NEON and VFP
534 // pipelines.
535 let D = VFPNeonDomain;
Bill Wendling7d31a162010-10-20 22:44:54 +0000536}
Evan Chenga8e29892007-01-19 07:51:42 +0000537
Evan Cheng020cc1b2010-05-13 00:16:46 +0000538let neverHasSideEffects = 1 in {
Jim Grosbache5165492009-11-09 00:11:35 +0000539def VMOVRRD : AVConv3I<0b11000101, 0b1011,
Bill Wendling01aabda2010-10-20 23:37:40 +0000540 (outs GPR:$Rt, GPR:$Rt2), (ins DPR:$Dm),
541 IIC_fpMOVDI, "vmov", "\t$Rt, $Rt2, $Dm",
Johnny Chen7acca672010-02-05 18:04:58 +0000542 [/* FIXME: Can't write pattern for multiple result instr*/]> {
Bill Wendling01aabda2010-10-20 23:37:40 +0000543 // Instruction operands.
544 bits<5> Dm;
545 bits<4> Rt;
546 bits<4> Rt2;
547
548 // Encode instruction operands.
549 let Inst{3-0} = Dm{3-0};
550 let Inst{5} = Dm{4};
551 let Inst{15-12} = Rt;
552 let Inst{19-16} = Rt2;
553
Johnny Chen7acca672010-02-05 18:04:58 +0000554 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000555
556 // Some single precision VFP instructions may be executed on both NEON and VFP
557 // pipelines.
558 let D = VFPNeonDomain;
Johnny Chen7acca672010-02-05 18:04:58 +0000559}
Evan Chenga8e29892007-01-19 07:51:42 +0000560
Johnny Chen23401d62010-02-08 17:26:09 +0000561def VMOVRRS : AVConv3I<0b11000101, 0b1010,
Owen Anderson694e0ff2011-08-29 23:15:25 +0000562 (outs GPR:$Rt, GPR:$Rt2), (ins SPR:$src1, SPR:$src2),
563 IIC_fpMOVDI, "vmov", "\t$Rt, $Rt2, $src1, $src2",
Johnny Chen23401d62010-02-08 17:26:09 +0000564 [/* For disassembly only; pattern left blank */]> {
Owen Anderson694e0ff2011-08-29 23:15:25 +0000565 bits<5> src1;
566 bits<4> Rt;
567 bits<4> Rt2;
568
569 // Encode instruction operands.
Richard Bartonfae96f12012-07-10 12:51:09 +0000570 let Inst{3-0} = src1{4-1};
571 let Inst{5} = src1{0};
Owen Anderson694e0ff2011-08-29 23:15:25 +0000572 let Inst{15-12} = Rt;
573 let Inst{19-16} = Rt2;
574
Johnny Chen23401d62010-02-08 17:26:09 +0000575 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000576
577 // Some single precision VFP instructions may be executed on both NEON and VFP
578 // pipelines.
579 let D = VFPNeonDomain;
Owen Anderson357ec682011-08-22 20:27:12 +0000580 let DecoderMethod = "DecodeVMOVRRS";
Johnny Chen23401d62010-02-08 17:26:09 +0000581}
Evan Cheng020cc1b2010-05-13 00:16:46 +0000582} // neverHasSideEffects
Johnny Chen23401d62010-02-08 17:26:09 +0000583
Evan Chenga8e29892007-01-19 07:51:42 +0000584// FMDHR: GPR -> SPR
585// FMDLR: GPR -> SPR
586
Jim Grosbache5165492009-11-09 00:11:35 +0000587def VMOVDRR : AVConv5I<0b11000100, 0b1011,
Bill Wendling01aabda2010-10-20 23:37:40 +0000588 (outs DPR:$Dm), (ins GPR:$Rt, GPR:$Rt2),
589 IIC_fpMOVID, "vmov", "\t$Dm, $Rt, $Rt2",
590 [(set DPR:$Dm, (arm_fmdrr GPR:$Rt, GPR:$Rt2))]> {
591 // Instruction operands.
592 bits<5> Dm;
593 bits<4> Rt;
594 bits<4> Rt2;
595
596 // Encode instruction operands.
597 let Inst{3-0} = Dm{3-0};
598 let Inst{5} = Dm{4};
599 let Inst{15-12} = Rt;
600 let Inst{19-16} = Rt2;
601
602 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000603
604 // Some single precision VFP instructions may be executed on both NEON and VFP
605 // pipelines.
606 let D = VFPNeonDomain;
Johnny Chen7acca672010-02-05 18:04:58 +0000607}
Evan Chenga8e29892007-01-19 07:51:42 +0000608
Evan Cheng020cc1b2010-05-13 00:16:46 +0000609let neverHasSideEffects = 1 in
Johnny Chen23401d62010-02-08 17:26:09 +0000610def VMOVSRR : AVConv5I<0b11000100, 0b1010,
611 (outs SPR:$dst1, SPR:$dst2), (ins GPR:$src1, GPR:$src2),
Anton Korobeynikova31c6fb2010-04-07 18:20:02 +0000612 IIC_fpMOVID, "vmov", "\t$dst1, $dst2, $src1, $src2",
Johnny Chen23401d62010-02-08 17:26:09 +0000613 [/* For disassembly only; pattern left blank */]> {
Owen Anderson694e0ff2011-08-29 23:15:25 +0000614 // Instruction operands.
615 bits<5> dst1;
616 bits<4> src1;
617 bits<4> src2;
618
619 // Encode instruction operands.
Richard Bartonfae96f12012-07-10 12:51:09 +0000620 let Inst{3-0} = dst1{4-1};
621 let Inst{5} = dst1{0};
Owen Anderson694e0ff2011-08-29 23:15:25 +0000622 let Inst{15-12} = src1;
623 let Inst{19-16} = src2;
624
Johnny Chen23401d62010-02-08 17:26:09 +0000625 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000626
627 // Some single precision VFP instructions may be executed on both NEON and VFP
628 // pipelines.
629 let D = VFPNeonDomain;
Owen Anderson357ec682011-08-22 20:27:12 +0000630
631 let DecoderMethod = "DecodeVMOVSRR";
Johnny Chen23401d62010-02-08 17:26:09 +0000632}
633
Evan Chenga8e29892007-01-19 07:51:42 +0000634// FMRDH: SPR -> GPR
635// FMRDL: SPR -> GPR
636// FMRRS: SPR -> GPR
Bill Wendling67a704d2010-10-13 20:58:46 +0000637// FMRX: SPR system reg -> GPR
Evan Chenga8e29892007-01-19 07:51:42 +0000638// FMSRR: GPR -> SPR
Bill Wendling67a704d2010-10-13 20:58:46 +0000639// FMXR: GPR -> VFP system reg
Evan Chenga8e29892007-01-19 07:51:42 +0000640
641
Bill Wendling67a704d2010-10-13 20:58:46 +0000642// Int -> FP:
Evan Chenga8e29892007-01-19 07:51:42 +0000643
Bill Wendling67a704d2010-10-13 20:58:46 +0000644class AVConv1IDs_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
645 bits<4> opcod4, dag oops, dag iops,
646 InstrItinClass itin, string opc, string asm,
647 list<dag> pattern>
648 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
649 pattern> {
650 // Instruction operands.
651 bits<5> Dd;
652 bits<5> Sm;
653
654 // Encode instruction operands.
655 let Inst{3-0} = Sm{4-1};
656 let Inst{5} = Sm{0};
657 let Inst{15-12} = Dd{3-0};
658 let Inst{22} = Dd{4};
659}
660
661class AVConv1InSs_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
662 bits<4> opcod4, dag oops, dag iops,InstrItinClass itin,
663 string opc, string asm, list<dag> pattern>
664 : AVConv1In<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
665 pattern> {
666 // Instruction operands.
667 bits<5> Sd;
668 bits<5> Sm;
669
670 // Encode instruction operands.
671 let Inst{3-0} = Sm{4-1};
672 let Inst{5} = Sm{0};
673 let Inst{15-12} = Sd{4-1};
674 let Inst{22} = Sd{0};
675}
676
677def VSITOD : AVConv1IDs_Encode<0b11101, 0b11, 0b1000, 0b1011,
678 (outs DPR:$Dd), (ins SPR:$Sm),
679 IIC_fpCVTID, "vcvt", ".f64.s32\t$Dd, $Sm",
680 [(set DPR:$Dd, (f64 (arm_sitof SPR:$Sm)))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000681 let Inst{7} = 1; // s32
Evan Cheng78be83d2008-11-11 19:40:26 +0000682}
Evan Chenga8e29892007-01-19 07:51:42 +0000683
Bill Wendling67a704d2010-10-13 20:58:46 +0000684def VSITOS : AVConv1InSs_Encode<0b11101, 0b11, 0b1000, 0b1010,
685 (outs SPR:$Sd),(ins SPR:$Sm),
686 IIC_fpCVTIS, "vcvt", ".f32.s32\t$Sd, $Sm",
687 [(set SPR:$Sd, (arm_sitof SPR:$Sm))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000688 let Inst{7} = 1; // s32
Evan Cheng5eda2822011-02-16 00:35:02 +0000689
Evan Cheng6557bce2011-02-22 19:53:14 +0000690 // Some single precision VFP instructions may be executed on both NEON and
691 // VFP pipelines on A8.
692 let D = VFPNeonA8Domain;
Evan Cheng78be83d2008-11-11 19:40:26 +0000693}
Evan Chenga8e29892007-01-19 07:51:42 +0000694
Bill Wendling67a704d2010-10-13 20:58:46 +0000695def VUITOD : AVConv1IDs_Encode<0b11101, 0b11, 0b1000, 0b1011,
696 (outs DPR:$Dd), (ins SPR:$Sm),
697 IIC_fpCVTID, "vcvt", ".f64.u32\t$Dd, $Sm",
698 [(set DPR:$Dd, (f64 (arm_uitof SPR:$Sm)))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000699 let Inst{7} = 0; // u32
700}
Evan Chenga8e29892007-01-19 07:51:42 +0000701
Bill Wendling67a704d2010-10-13 20:58:46 +0000702def VUITOS : AVConv1InSs_Encode<0b11101, 0b11, 0b1000, 0b1010,
703 (outs SPR:$Sd), (ins SPR:$Sm),
704 IIC_fpCVTIS, "vcvt", ".f32.u32\t$Sd, $Sm",
705 [(set SPR:$Sd, (arm_uitof SPR:$Sm))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000706 let Inst{7} = 0; // u32
Evan Cheng5eda2822011-02-16 00:35:02 +0000707
Evan Cheng6557bce2011-02-22 19:53:14 +0000708 // Some single precision VFP instructions may be executed on both NEON and
709 // VFP pipelines on A8.
710 let D = VFPNeonA8Domain;
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000711}
Evan Chenga8e29892007-01-19 07:51:42 +0000712
Bill Wendling67a704d2010-10-13 20:58:46 +0000713// FP -> Int:
714
715class AVConv1IsD_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
716 bits<4> opcod4, dag oops, dag iops,
717 InstrItinClass itin, string opc, string asm,
718 list<dag> pattern>
719 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
720 pattern> {
721 // Instruction operands.
722 bits<5> Sd;
723 bits<5> Dm;
724
725 // Encode instruction operands.
726 let Inst{3-0} = Dm{3-0};
727 let Inst{5} = Dm{4};
728 let Inst{15-12} = Sd{4-1};
729 let Inst{22} = Sd{0};
730}
731
732class AVConv1InsS_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
733 bits<4> opcod4, dag oops, dag iops,
734 InstrItinClass itin, string opc, string asm,
735 list<dag> pattern>
736 : AVConv1In<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
737 pattern> {
738 // Instruction operands.
739 bits<5> Sd;
740 bits<5> Sm;
741
742 // Encode instruction operands.
743 let Inst{3-0} = Sm{4-1};
744 let Inst{5} = Sm{0};
745 let Inst{15-12} = Sd{4-1};
746 let Inst{22} = Sd{0};
747}
748
Evan Chenga8e29892007-01-19 07:51:42 +0000749// Always set Z bit in the instruction, i.e. "round towards zero" variants.
Bill Wendling67a704d2010-10-13 20:58:46 +0000750def VTOSIZD : AVConv1IsD_Encode<0b11101, 0b11, 0b1101, 0b1011,
751 (outs SPR:$Sd), (ins DPR:$Dm),
752 IIC_fpCVTDI, "vcvt", ".s32.f64\t$Sd, $Dm",
753 [(set SPR:$Sd, (arm_ftosi (f64 DPR:$Dm)))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000754 let Inst{7} = 1; // Z bit
755}
Evan Chenga8e29892007-01-19 07:51:42 +0000756
Bill Wendling67a704d2010-10-13 20:58:46 +0000757def VTOSIZS : AVConv1InsS_Encode<0b11101, 0b11, 0b1101, 0b1010,
758 (outs SPR:$Sd), (ins SPR:$Sm),
759 IIC_fpCVTSI, "vcvt", ".s32.f32\t$Sd, $Sm",
760 [(set SPR:$Sd, (arm_ftosi SPR:$Sm))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000761 let Inst{7} = 1; // Z bit
Evan Cheng5eda2822011-02-16 00:35:02 +0000762
Evan Cheng6557bce2011-02-22 19:53:14 +0000763 // Some single precision VFP instructions may be executed on both NEON and
764 // VFP pipelines on A8.
765 let D = VFPNeonA8Domain;
Evan Cheng78be83d2008-11-11 19:40:26 +0000766}
Evan Chenga8e29892007-01-19 07:51:42 +0000767
Bill Wendling67a704d2010-10-13 20:58:46 +0000768def VTOUIZD : AVConv1IsD_Encode<0b11101, 0b11, 0b1100, 0b1011,
769 (outs SPR:$Sd), (ins DPR:$Dm),
770 IIC_fpCVTDI, "vcvt", ".u32.f64\t$Sd, $Dm",
771 [(set SPR:$Sd, (arm_ftoui (f64 DPR:$Dm)))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000772 let Inst{7} = 1; // Z bit
773}
Evan Chenga8e29892007-01-19 07:51:42 +0000774
Bill Wendling67a704d2010-10-13 20:58:46 +0000775def VTOUIZS : AVConv1InsS_Encode<0b11101, 0b11, 0b1100, 0b1010,
776 (outs SPR:$Sd), (ins SPR:$Sm),
777 IIC_fpCVTSI, "vcvt", ".u32.f32\t$Sd, $Sm",
778 [(set SPR:$Sd, (arm_ftoui SPR:$Sm))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000779 let Inst{7} = 1; // Z bit
Evan Cheng5eda2822011-02-16 00:35:02 +0000780
Evan Cheng6557bce2011-02-22 19:53:14 +0000781 // Some single precision VFP instructions may be executed on both NEON and
782 // VFP pipelines on A8.
783 let D = VFPNeonA8Domain;
Evan Cheng78be83d2008-11-11 19:40:26 +0000784}
Evan Chenga8e29892007-01-19 07:51:42 +0000785
Johnny Chen15b423f2010-02-08 22:02:41 +0000786// And the Z bit '0' variants, i.e. use the rounding mode specified by FPSCR.
Nate Begemand1fb5832010-08-03 21:31:55 +0000787let Uses = [FPSCR] in {
Bill Wendling67a704d2010-10-13 20:58:46 +0000788// FIXME: Verify encoding after integrated assembler is working.
789def VTOSIRD : AVConv1IsD_Encode<0b11101, 0b11, 0b1101, 0b1011,
790 (outs SPR:$Sd), (ins DPR:$Dm),
791 IIC_fpCVTDI, "vcvtr", ".s32.f64\t$Sd, $Dm",
792 [(set SPR:$Sd, (int_arm_vcvtr (f64 DPR:$Dm)))]>{
Johnny Chen15b423f2010-02-08 22:02:41 +0000793 let Inst{7} = 0; // Z bit
794}
795
Bill Wendling67a704d2010-10-13 20:58:46 +0000796def VTOSIRS : AVConv1InsS_Encode<0b11101, 0b11, 0b1101, 0b1010,
797 (outs SPR:$Sd), (ins SPR:$Sm),
798 IIC_fpCVTSI, "vcvtr", ".s32.f32\t$Sd, $Sm",
799 [(set SPR:$Sd, (int_arm_vcvtr SPR:$Sm))]> {
Johnny Chen15b423f2010-02-08 22:02:41 +0000800 let Inst{7} = 0; // Z bit
801}
802
Bill Wendling67a704d2010-10-13 20:58:46 +0000803def VTOUIRD : AVConv1IsD_Encode<0b11101, 0b11, 0b1100, 0b1011,
804 (outs SPR:$Sd), (ins DPR:$Dm),
805 IIC_fpCVTDI, "vcvtr", ".u32.f64\t$Sd, $Dm",
Bill Wendling88cf0382010-10-14 01:02:08 +0000806 [(set SPR:$Sd, (int_arm_vcvtru(f64 DPR:$Dm)))]>{
Johnny Chen15b423f2010-02-08 22:02:41 +0000807 let Inst{7} = 0; // Z bit
808}
809
Bill Wendling67a704d2010-10-13 20:58:46 +0000810def VTOUIRS : AVConv1InsS_Encode<0b11101, 0b11, 0b1100, 0b1010,
811 (outs SPR:$Sd), (ins SPR:$Sm),
812 IIC_fpCVTSI, "vcvtr", ".u32.f32\t$Sd, $Sm",
813 [(set SPR:$Sd, (int_arm_vcvtru SPR:$Sm))]> {
Johnny Chen15b423f2010-02-08 22:02:41 +0000814 let Inst{7} = 0; // Z bit
815}
Nate Begemand1fb5832010-08-03 21:31:55 +0000816}
Johnny Chen15b423f2010-02-08 22:02:41 +0000817
Johnny Chen27bb8d02010-02-11 18:17:16 +0000818// Convert between floating-point and fixed-point
819// Data type for fixed-point naming convention:
820// S16 (U=0, sx=0) -> SH
821// U16 (U=1, sx=0) -> UH
822// S32 (U=0, sx=1) -> SL
823// U32 (U=1, sx=1) -> UL
824
Jim Grosbach8c748112011-12-22 19:45:01 +0000825let Constraints = "$a = $dst" in {
Johnny Chen27bb8d02010-02-11 18:17:16 +0000826
827// FP to Fixed-Point:
828
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000829// Single Precision register
Jim Grosbachc92ba4e2012-04-23 22:04:10 +0000830class AVConv1XInsS_Encode<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4,
831 bit op5, dag oops, dag iops, InstrItinClass itin,
832 string opc, string asm, list<dag> pattern>
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000833 : AVConv1XI<op1, op2, op3, op4, op5, oops, iops, itin, opc, asm, pattern> {
834 bits<5> dst;
835 // if dp_operation then UInt(D:Vd) else UInt(Vd:D);
836 let Inst{22} = dst{0};
837 let Inst{15-12} = dst{4-1};
838}
839
840// Double Precision register
Jim Grosbachc92ba4e2012-04-23 22:04:10 +0000841class AVConv1XInsD_Encode<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4,
842 bit op5, dag oops, dag iops, InstrItinClass itin,
843 string opc, string asm, list<dag> pattern>
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000844 : AVConv1XI<op1, op2, op3, op4, op5, oops, iops, itin, opc, asm, pattern> {
845 bits<5> dst;
846 // if dp_operation then UInt(D:Vd) else UInt(Vd:D);
847 let Inst{22} = dst{4};
848 let Inst{15-12} = dst{3-0};
849}
850
851def VTOSHS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1110, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000852 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000853 IIC_fpCVTSI, "vcvt", ".s16.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000854 // Some single precision VFP instructions may be executed on both NEON and
855 // VFP pipelines on A8.
856 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000857}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000858
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000859def VTOUHS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1111, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000860 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000861 IIC_fpCVTSI, "vcvt", ".u16.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000862 // Some single precision VFP instructions may be executed on both NEON and
863 // VFP pipelines on A8.
864 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000865}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000866
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000867def VTOSLS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1110, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000868 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000869 IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000870 // Some single precision VFP instructions may be executed on both NEON and
871 // VFP pipelines on A8.
872 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000873}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000874
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000875def VTOULS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1111, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000876 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000877 IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000878 // Some single precision VFP instructions may be executed on both NEON and
879 // VFP pipelines on A8.
880 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000881}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000882
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000883def VTOSHD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1110, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000884 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000885 IIC_fpCVTDI, "vcvt", ".s16.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000886
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000887def VTOUHD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1111, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000888 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000889 IIC_fpCVTDI, "vcvt", ".u16.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000890
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000891def VTOSLD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1110, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000892 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000893 IIC_fpCVTDI, "vcvt", ".s32.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000894
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000895def VTOULD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1111, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000896 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000897 IIC_fpCVTDI, "vcvt", ".u32.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000898
899// Fixed-Point to FP:
900
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000901def VSHTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1010, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000902 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000903 IIC_fpCVTIS, "vcvt", ".f32.s16\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000904 // Some single precision VFP instructions may be executed on both NEON and
905 // VFP pipelines on A8.
906 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000907}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000908
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000909def VUHTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1011, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000910 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000911 IIC_fpCVTIS, "vcvt", ".f32.u16\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000912 // Some single precision VFP instructions may be executed on both NEON and
913 // VFP pipelines on A8.
914 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000915}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000916
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000917def VSLTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1010, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000918 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000919 IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000920 // Some single precision VFP instructions may be executed on both NEON and
921 // VFP pipelines on A8.
922 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000923}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000924
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000925def VULTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1011, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000926 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000927 IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000928 // Some single precision VFP instructions may be executed on both NEON and
929 // VFP pipelines on A8.
930 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000931}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000932
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000933def VSHTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1010, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000934 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000935 IIC_fpCVTID, "vcvt", ".f64.s16\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000936
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000937def VUHTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1011, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000938 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000939 IIC_fpCVTID, "vcvt", ".f64.u16\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000940
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000941def VSLTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1010, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000942 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000943 IIC_fpCVTID, "vcvt", ".f64.s32\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000944
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000945def VULTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1011, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000946 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000947 IIC_fpCVTID, "vcvt", ".f64.u32\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000948
Jim Grosbach8c748112011-12-22 19:45:01 +0000949} // End of 'let Constraints = "$a = $dst" in'
Johnny Chen27bb8d02010-02-11 18:17:16 +0000950
Evan Chenga8e29892007-01-19 07:51:42 +0000951//===----------------------------------------------------------------------===//
Cameron Zwarich375db7f2011-07-07 08:28:52 +0000952// FP Multiply-Accumulate Operations.
Evan Chenga8e29892007-01-19 07:51:42 +0000953//
954
Evan Cheng529916c2010-11-12 20:32:20 +0000955def VMLAD : ADbI<0b11100, 0b00, 0, 0,
956 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
957 IIC_fpMAC64, "vmla", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +0000958 [(set DPR:$Dd, (fadd_mlx (fmul_su DPR:$Dn, DPR:$Dm),
959 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +0000960 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +0000961 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000962
Bill Wendling69661192010-11-01 06:00:39 +0000963def VMLAS : ASbIn<0b11100, 0b00, 0, 0,
964 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
965 IIC_fpMAC32, "vmla", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +0000966 [(set SPR:$Sd, (fadd_mlx (fmul_su SPR:$Sn, SPR:$Sm),
967 SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +0000968 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +0000969 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000970 // Some single precision VFP instructions may be executed on both NEON and
971 // VFP pipelines on A8.
972 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000973}
Evan Chenga8e29892007-01-19 07:51:42 +0000974
Evan Cheng48575f62010-12-05 22:04:16 +0000975def : Pat<(fadd_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
Evan Cheng529916c2010-11-12 20:32:20 +0000976 (VMLAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +0000977 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +0000978def : Pat<(fadd_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
Evan Cheng529916c2010-11-12 20:32:20 +0000979 (VMLAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +0000980 Requires<[HasVFP2,DontUseNEONForFP, UseFPVMLx,DontUseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000981
Evan Cheng529916c2010-11-12 20:32:20 +0000982def VMLSD : ADbI<0b11100, 0b00, 1, 0,
983 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
984 IIC_fpMAC64, "vmls", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +0000985 [(set DPR:$Dd, (fadd_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
986 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +0000987 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +0000988 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +0000989
Bill Wendling69661192010-11-01 06:00:39 +0000990def VMLSS : ASbIn<0b11100, 0b00, 1, 0,
991 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
992 IIC_fpMAC32, "vmls", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +0000993 [(set SPR:$Sd, (fadd_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
994 SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +0000995 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +0000996 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000997 // Some single precision VFP instructions may be executed on both NEON and
998 // VFP pipelines on A8.
999 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +00001000}
Evan Chenga8e29892007-01-19 07:51:42 +00001001
Evan Cheng48575f62010-12-05 22:04:16 +00001002def : Pat<(fsub_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
Evan Cheng529916c2010-11-12 20:32:20 +00001003 (VMLSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001004 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +00001005def : Pat<(fsub_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
Evan Cheng529916c2010-11-12 20:32:20 +00001006 (VMLSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001007 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]>;
David Goodwinb84f3d42009-08-04 18:44:29 +00001008
Evan Cheng529916c2010-11-12 20:32:20 +00001009def VNMLAD : ADbI<0b11100, 0b01, 1, 0,
1010 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1011 IIC_fpMAC64, "vnmla", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +00001012 [(set DPR:$Dd,(fsub_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
1013 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001014 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001015 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +00001016
Bill Wendling69661192010-11-01 06:00:39 +00001017def VNMLAS : ASbI<0b11100, 0b01, 1, 0,
1018 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1019 IIC_fpMAC32, "vnmla", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +00001020 [(set SPR:$Sd, (fsub_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1021 SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001022 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001023 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +00001024 // Some single precision VFP instructions may be executed on both NEON and
1025 // VFP pipelines on A8.
1026 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +00001027}
Bill Wendling88cf0382010-10-14 01:02:08 +00001028
Evan Cheng48575f62010-12-05 22:04:16 +00001029def : Pat<(fsub_mlx (fneg (fmul_su DPR:$a, (f64 DPR:$b))), DPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001030 (VNMLAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001031 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +00001032def : Pat<(fsub_mlx (fneg (fmul_su SPR:$a, SPR:$b)), SPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001033 (VNMLAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001034 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +00001035
Evan Cheng529916c2010-11-12 20:32:20 +00001036def VNMLSD : ADbI<0b11100, 0b01, 0, 0,
1037 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1038 IIC_fpMAC64, "vnmls", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +00001039 [(set DPR:$Dd, (fsub_mlx (fmul_su DPR:$Dn, DPR:$Dm),
1040 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001041 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001042 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +00001043
Bill Wendling69661192010-11-01 06:00:39 +00001044def VNMLSS : ASbI<0b11100, 0b01, 0, 0,
1045 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1046 IIC_fpMAC32, "vnmls", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +00001047 [(set SPR:$Sd, (fsub_mlx (fmul_su SPR:$Sn, SPR:$Sm), SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001048 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001049 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +00001050 // Some single precision VFP instructions may be executed on both NEON and
1051 // VFP pipelines on A8.
1052 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +00001053}
Bill Wendling88cf0382010-10-14 01:02:08 +00001054
Evan Cheng48575f62010-12-05 22:04:16 +00001055def : Pat<(fsub_mlx (fmul_su DPR:$a, (f64 DPR:$b)), DPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001056 (VNMLSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001057 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +00001058def : Pat<(fsub_mlx (fmul_su SPR:$a, SPR:$b), SPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001059 (VNMLSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001060 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +00001061
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001062//===----------------------------------------------------------------------===//
1063// Fused FP Multiply-Accumulate Operations.
1064//
1065def VFMAD : ADbI<0b11101, 0b10, 0, 0,
1066 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1067 IIC_fpFMAC64, "vfma", ".f64\t$Dd, $Dn, $Dm",
1068 [(set DPR:$Dd, (fadd_mlx (fmul_su DPR:$Dn, DPR:$Dm),
1069 (f64 DPR:$Ddin)))]>,
1070 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001071 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001072
1073def VFMAS : ASbIn<0b11101, 0b10, 0, 0,
1074 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1075 IIC_fpFMAC32, "vfma", ".f32\t$Sd, $Sn, $Sm",
1076 [(set SPR:$Sd, (fadd_mlx (fmul_su SPR:$Sn, SPR:$Sm),
1077 SPR:$Sdin))]>,
1078 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001079 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001080 // Some single precision VFP instructions may be executed on both NEON and
1081 // VFP pipelines.
1082}
1083
1084def : Pat<(fadd_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
1085 (VFMAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001086 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001087def : Pat<(fadd_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
1088 (VFMAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001089 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001090
Evan Cheng3aef2ff2012-04-10 21:40:28 +00001091// Match @llvm.fma.* intrinsics
Lang Hames77878002012-04-27 18:51:24 +00001092// (fma x, y, z) -> (vfms z, x, y)
1093def : Pat<(f64 (fma DPR:$Dn, DPR:$Dm, DPR:$Ddin)),
Evan Cheng3aef2ff2012-04-10 21:40:28 +00001094 (VFMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1095 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001096def : Pat<(f32 (fma SPR:$Sn, SPR:$Sm, SPR:$Sdin)),
Evan Cheng3aef2ff2012-04-10 21:40:28 +00001097 (VFMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1098 Requires<[HasVFP4]>;
1099
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001100def VFMSD : ADbI<0b11101, 0b10, 1, 0,
1101 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1102 IIC_fpFMAC64, "vfms", ".f64\t$Dd, $Dn, $Dm",
1103 [(set DPR:$Dd, (fadd_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
1104 (f64 DPR:$Ddin)))]>,
1105 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001106 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001107
1108def VFMSS : ASbIn<0b11101, 0b10, 1, 0,
1109 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1110 IIC_fpFMAC32, "vfms", ".f32\t$Sd, $Sn, $Sm",
1111 [(set SPR:$Sd, (fadd_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1112 SPR:$Sdin))]>,
1113 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001114 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001115 // Some single precision VFP instructions may be executed on both NEON and
1116 // VFP pipelines.
1117}
1118
1119def : Pat<(fsub_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
1120 (VFMSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001121 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001122def : Pat<(fsub_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
1123 (VFMSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001124 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001125
Evan Cheng14b4c032012-04-11 06:59:47 +00001126// Match @llvm.fma.* intrinsics
Lang Hames77878002012-04-27 18:51:24 +00001127// (fma (fneg x), y, z) -> (vfms z, x, y)
1128def : Pat<(f64 (fma (fneg DPR:$Dn), DPR:$Dm, DPR:$Ddin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001129 (VFMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1130 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001131def : Pat<(f32 (fma (fneg SPR:$Sn), SPR:$Sm, SPR:$Sdin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001132 (VFMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1133 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001134// (fma x, (fneg y), z) -> (vfms z, x, y)
1135def : Pat<(f64 (fma DPR:$Dn, (fneg DPR:$Dm), DPR:$Ddin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001136 (VFMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1137 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001138def : Pat<(f32 (fma SPR:$Sn, (fneg SPR:$Sm), SPR:$Sdin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001139 (VFMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1140 Requires<[HasVFP4]>;
1141
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001142def VFNMAD : ADbI<0b11101, 0b01, 1, 0,
1143 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1144 IIC_fpFMAC64, "vfnma", ".f64\t$Dd, $Dn, $Dm",
1145 [(set DPR:$Dd,(fsub_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
1146 (f64 DPR:$Ddin)))]>,
1147 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001148 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001149
1150def VFNMAS : ASbI<0b11101, 0b01, 1, 0,
1151 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1152 IIC_fpFMAC32, "vfnma", ".f32\t$Sd, $Sn, $Sm",
1153 [(set SPR:$Sd, (fsub_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1154 SPR:$Sdin))]>,
1155 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001156 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001157 // Some single precision VFP instructions may be executed on both NEON and
1158 // VFP pipelines.
1159}
1160
1161def : Pat<(fsub_mlx (fneg (fmul_su DPR:$a, (f64 DPR:$b))), DPR:$dstin),
1162 (VFNMAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001163 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001164def : Pat<(fsub_mlx (fneg (fmul_su SPR:$a, SPR:$b)), SPR:$dstin),
1165 (VFNMAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001166 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001167
Evan Cheng92c90452012-04-11 01:21:25 +00001168// Match @llvm.fma.* intrinsics
Lang Hames77878002012-04-27 18:51:24 +00001169// (fneg (fma x, y, z)) -> (vfnma z, x, y)
1170def : Pat<(fneg (fma (f64 DPR:$Dn), (f64 DPR:$Dm), (f64 DPR:$Ddin))),
Evan Cheng92c90452012-04-11 01:21:25 +00001171 (VFNMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1172 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001173def : Pat<(fneg (fma (f32 SPR:$Sn), (f32 SPR:$Sm), (f32 SPR:$Sdin))),
Evan Cheng92c90452012-04-11 01:21:25 +00001174 (VFNMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1175 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001176// (fma (fneg x), y, (fneg z)) -> (vfnma z, x, y)
1177def : Pat<(f64 (fma (fneg DPR:$Dn), DPR:$Dm, (fneg DPR:$Ddin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001178 (VFNMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1179 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001180def : Pat<(f32 (fma (fneg SPR:$Sn), SPR:$Sm, (fneg SPR:$Sdin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001181 (VFNMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1182 Requires<[HasVFP4]>;
Evan Cheng92c90452012-04-11 01:21:25 +00001183
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001184def VFNMSD : ADbI<0b11101, 0b01, 0, 0,
1185 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1186 IIC_fpFMAC64, "vfnms", ".f64\t$Dd, $Dn, $Dm",
1187 [(set DPR:$Dd, (fsub_mlx (fmul_su DPR:$Dn, DPR:$Dm),
1188 (f64 DPR:$Ddin)))]>,
1189 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001190 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001191
1192def VFNMSS : ASbI<0b11101, 0b01, 0, 0,
1193 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1194 IIC_fpFMAC32, "vfnms", ".f32\t$Sd, $Sn, $Sm",
1195 [(set SPR:$Sd, (fsub_mlx (fmul_su SPR:$Sn, SPR:$Sm), SPR:$Sdin))]>,
1196 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001197 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001198 // Some single precision VFP instructions may be executed on both NEON and
1199 // VFP pipelines.
1200}
1201
1202def : Pat<(fsub_mlx (fmul_su DPR:$a, (f64 DPR:$b)), DPR:$dstin),
1203 (VFNMSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001204 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001205def : Pat<(fsub_mlx (fmul_su SPR:$a, SPR:$b), SPR:$dstin),
1206 (VFNMSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001207 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +00001208
Evan Cheng14b4c032012-04-11 06:59:47 +00001209// Match @llvm.fma.* intrinsics
Lang Hamesdc13d2e2012-06-21 06:10:00 +00001210
1211// (fma x, y, (fneg z)) -> (vfnms z, x, y))
1212def : Pat<(f64 (fma DPR:$Dn, DPR:$Dm, (fneg DPR:$Ddin))),
1213 (VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1214 Requires<[HasVFP4]>;
1215def : Pat<(f32 (fma SPR:$Sn, SPR:$Sm, (fneg SPR:$Sdin))),
1216 (VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1217 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001218// (fneg (fma (fneg x), y, z)) -> (vfnms z, x, y)
1219def : Pat<(fneg (f64 (fma (fneg DPR:$Dn), DPR:$Dm, DPR:$Ddin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001220 (VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1221 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001222def : Pat<(fneg (f32 (fma (fneg SPR:$Sn), SPR:$Sm, SPR:$Sdin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001223 (VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1224 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001225// (fneg (fma x, (fneg y), z) -> (vfnms z, x, y)
1226def : Pat<(fneg (f64 (fma DPR:$Dn, (fneg DPR:$Dm), DPR:$Ddin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001227 (VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1228 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001229def : Pat<(fneg (f32 (fma SPR:$Sn, (fneg SPR:$Sm), SPR:$Sdin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001230 (VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1231 Requires<[HasVFP4]>;
1232
Evan Chenga8e29892007-01-19 07:51:42 +00001233//===----------------------------------------------------------------------===//
1234// FP Conditional moves.
1235//
1236
Evan Cheng020cc1b2010-05-13 00:16:46 +00001237let neverHasSideEffects = 1 in {
Jim Grosbachf219f312011-03-11 23:09:50 +00001238def VMOVDcc : ARMPseudoInst<(outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm, pred:$p),
Owen Anderson16884412011-07-13 23:22:26 +00001239 4, IIC_fpUNA64,
Bill Wendling69661192010-11-01 06:00:39 +00001240 [/*(set DPR:$Dd, (ARMcmov DPR:$Dn, DPR:$Dm, imm:$cc))*/]>,
1241 RegConstraint<"$Dn = $Dd">;
Evan Chenga8e29892007-01-19 07:51:42 +00001242
Jim Grosbachf219f312011-03-11 23:09:50 +00001243def VMOVScc : ARMPseudoInst<(outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm, pred:$p),
Owen Anderson16884412011-07-13 23:22:26 +00001244 4, IIC_fpUNA32,
Bill Wendling69661192010-11-01 06:00:39 +00001245 [/*(set SPR:$Sd, (ARMcmov SPR:$Sn, SPR:$Sm, imm:$cc))*/]>,
1246 RegConstraint<"$Sn = $Sd">;
Evan Cheng020cc1b2010-05-13 00:16:46 +00001247} // neverHasSideEffects
Evan Cheng78be83d2008-11-11 19:40:26 +00001248
1249//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001250// Move from VFP System Register to ARM core register.
Evan Cheng78be83d2008-11-11 19:40:26 +00001251//
1252
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001253class MovFromVFP<bits<4> opc19_16, dag oops, dag iops, string opc, string asm,
1254 list<dag> pattern>:
1255 VFPAI<oops, iops, VFPMiscFrm, IIC_fpSTAT, opc, asm, pattern> {
Evan Cheng39382422009-10-28 01:44:26 +00001256
Bill Wendling88cf0382010-10-14 01:02:08 +00001257 // Instruction operand.
1258 bits<4> Rt;
1259
Johnny Chenc9745042010-02-09 22:35:38 +00001260 let Inst{27-20} = 0b11101111;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001261 let Inst{19-16} = opc19_16;
1262 let Inst{15-12} = Rt;
Johnny Chenc9745042010-02-09 22:35:38 +00001263 let Inst{11-8} = 0b1010;
1264 let Inst{7} = 0;
Bill Wendling88cf0382010-10-14 01:02:08 +00001265 let Inst{6-5} = 0b00;
Johnny Chenc9745042010-02-09 22:35:38 +00001266 let Inst{4} = 1;
Bill Wendling88cf0382010-10-14 01:02:08 +00001267 let Inst{3-0} = 0b0000;
Johnny Chenc9745042010-02-09 22:35:38 +00001268}
Johnny Chenc9745042010-02-09 22:35:38 +00001269
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001270// APSR is the application level alias of CPSR. This FPSCR N, Z, C, V flags
1271// to APSR.
Lang Hames4f92b5e2012-03-06 00:19:55 +00001272let Defs = [CPSR], Uses = [FPSCR_NZCV], Rt = 0b1111 /* apsr_nzcv */ in
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001273def FMSTAT : MovFromVFP<0b0001 /* fpscr */, (outs), (ins),
Jim Grosbachb84ad4a2012-03-15 21:34:14 +00001274 "vmrs", "\tAPSR_nzcv, fpscr", [(arm_fmstat)]>;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001275
1276// Application level FPSCR -> GPR
1277let hasSideEffects = 1, Uses = [FPSCR] in
1278def VMRS : MovFromVFP<0b0001 /* fpscr */, (outs GPR:$Rt), (ins),
1279 "vmrs", "\t$Rt, fpscr",
1280 [(set GPR:$Rt, (int_arm_get_fpscr))]>;
1281
1282// System level FPEXC, FPSID -> GPR
1283let Uses = [FPSCR] in {
1284 def VMRS_FPEXC : MovFromVFP<0b1000 /* fpexc */, (outs GPR:$Rt), (ins),
1285 "vmrs", "\t$Rt, fpexc", []>;
1286 def VMRS_FPSID : MovFromVFP<0b0000 /* fpsid */, (outs GPR:$Rt), (ins),
1287 "vmrs", "\t$Rt, fpsid", []>;
Jim Grosbach9426ac72012-03-16 00:27:18 +00001288 def VMRS_MVFR0 : MovFromVFP<0b0111 /* mvfr0 */, (outs GPR:$Rt), (ins),
1289 "vmrs", "\t$Rt, mvfr0", []>;
1290 def VMRS_MVFR1 : MovFromVFP<0b0110 /* mvfr1 */, (outs GPR:$Rt), (ins),
1291 "vmrs", "\t$Rt, mvfr1", []>;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001292}
1293
1294//===----------------------------------------------------------------------===//
1295// Move from ARM core register to VFP System Register.
1296//
1297
1298class MovToVFP<bits<4> opc19_16, dag oops, dag iops, string opc, string asm,
1299 list<dag> pattern>:
1300 VFPAI<oops, iops, VFPMiscFrm, IIC_fpSTAT, opc, asm, pattern> {
1301
Bill Wendling88cf0382010-10-14 01:02:08 +00001302 // Instruction operand.
1303 bits<4> src;
1304
1305 // Encode instruction operand.
1306 let Inst{15-12} = src;
1307
Johnny Chenc9745042010-02-09 22:35:38 +00001308 let Inst{27-20} = 0b11101110;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001309 let Inst{19-16} = opc19_16;
Johnny Chenc9745042010-02-09 22:35:38 +00001310 let Inst{11-8} = 0b1010;
1311 let Inst{7} = 0;
1312 let Inst{4} = 1;
1313}
Evan Cheng39382422009-10-28 01:44:26 +00001314
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001315let Defs = [FPSCR] in {
1316 // Application level GPR -> FPSCR
1317 def VMSR : MovToVFP<0b0001 /* fpscr */, (outs), (ins GPR:$src),
1318 "vmsr", "\tfpscr, $src", [(int_arm_set_fpscr GPR:$src)]>;
1319 // System level GPR -> FPEXC
1320 def VMSR_FPEXC : MovToVFP<0b1000 /* fpexc */, (outs), (ins GPR:$src),
1321 "vmsr", "\tfpexc, $src", []>;
1322 // System level GPR -> FPSID
1323 def VMSR_FPSID : MovToVFP<0b0000 /* fpsid */, (outs), (ins GPR:$src),
1324 "vmsr", "\tfpsid, $src", []>;
1325}
1326
1327//===----------------------------------------------------------------------===//
1328// Misc.
1329//
1330
Evan Cheng39382422009-10-28 01:44:26 +00001331// Materialize FP immediates. VFP3 only.
Jim Grosbache5165492009-11-09 00:11:35 +00001332let isReMaterializable = 1 in {
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001333def FCONSTD : VFPAI<(outs DPR:$Dd), (ins vfp_f64imm:$imm),
Anton Korobeynikov63401e32010-04-07 18:19:56 +00001334 VFPMiscFrm, IIC_fpUNA64,
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001335 "vmov", ".f64\t$Dd, $imm",
1336 [(set DPR:$Dd, vfp_f64imm:$imm)]>, Requires<[HasVFP3]> {
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001337 bits<5> Dd;
1338 bits<8> imm;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001339
Jim Grosbache5165492009-11-09 00:11:35 +00001340 let Inst{27-23} = 0b11101;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001341 let Inst{22} = Dd{4};
Jim Grosbache5165492009-11-09 00:11:35 +00001342 let Inst{21-20} = 0b11;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001343 let Inst{19-16} = imm{7-4};
1344 let Inst{15-12} = Dd{3-0};
Jim Grosbache5165492009-11-09 00:11:35 +00001345 let Inst{11-9} = 0b101;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001346 let Inst{8} = 1; // Double precision.
Jim Grosbache5165492009-11-09 00:11:35 +00001347 let Inst{7-4} = 0b0000;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001348 let Inst{3-0} = imm{3-0};
Jim Grosbache5165492009-11-09 00:11:35 +00001349}
1350
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001351def FCONSTS : VFPAI<(outs SPR:$Sd), (ins vfp_f32imm:$imm),
1352 VFPMiscFrm, IIC_fpUNA32,
1353 "vmov", ".f32\t$Sd, $imm",
1354 [(set SPR:$Sd, vfp_f32imm:$imm)]>, Requires<[HasVFP3]> {
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001355 bits<5> Sd;
1356 bits<8> imm;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001357
Evan Cheng39382422009-10-28 01:44:26 +00001358 let Inst{27-23} = 0b11101;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001359 let Inst{22} = Sd{0};
Evan Cheng39382422009-10-28 01:44:26 +00001360 let Inst{21-20} = 0b11;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001361 let Inst{19-16} = imm{7-4};
1362 let Inst{15-12} = Sd{4-1};
Evan Cheng39382422009-10-28 01:44:26 +00001363 let Inst{11-9} = 0b101;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001364 let Inst{8} = 0; // Single precision.
Evan Cheng39382422009-10-28 01:44:26 +00001365 let Inst{7-4} = 0b0000;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001366 let Inst{3-0} = imm{3-0};
Evan Cheng39382422009-10-28 01:44:26 +00001367}
Evan Cheng39382422009-10-28 01:44:26 +00001368}
Jim Grosbach5cd5ac62011-10-03 21:12:43 +00001369
1370//===----------------------------------------------------------------------===//
1371// Assembler aliases.
1372//
Jim Grosbach67ca1ad2011-12-08 00:49:29 +00001373// A few mnemnoic aliases for pre-unifixed syntax. We don't guarantee to
1374// support them all, but supporting at least some of the basics is
1375// good to be friendly.
Jim Grosbach21d7fb82011-12-09 23:34:09 +00001376def : VFP2MnemonicAlias<"flds", "vldr">;
1377def : VFP2MnemonicAlias<"fldd", "vldr">;
1378def : VFP2MnemonicAlias<"fmrs", "vmov">;
1379def : VFP2MnemonicAlias<"fmsr", "vmov">;
1380def : VFP2MnemonicAlias<"fsqrts", "vsqrt">;
1381def : VFP2MnemonicAlias<"fsqrtd", "vsqrt">;
1382def : VFP2MnemonicAlias<"fadds", "vadd.f32">;
1383def : VFP2MnemonicAlias<"faddd", "vadd.f64">;
1384def : VFP2MnemonicAlias<"fmrdd", "vmov">;
1385def : VFP2MnemonicAlias<"fmrds", "vmov">;
1386def : VFP2MnemonicAlias<"fmrrd", "vmov">;
1387def : VFP2MnemonicAlias<"fmdrr", "vmov">;
Jim Grosbach68490192011-12-19 19:43:50 +00001388def : VFP2MnemonicAlias<"fmuls", "vmul.f32">;
Jim Grosbach21d7fb82011-12-09 23:34:09 +00001389def : VFP2MnemonicAlias<"fmuld", "vmul.f64">;
1390def : VFP2MnemonicAlias<"fnegs", "vneg.f32">;
1391def : VFP2MnemonicAlias<"fnegd", "vneg.f64">;
Jim Grosbach48171e72011-12-10 00:01:02 +00001392def : VFP2MnemonicAlias<"ftosizd", "vcvt.s32.f64">;
1393def : VFP2MnemonicAlias<"ftosid", "vcvtr.s32.f64">;
1394def : VFP2MnemonicAlias<"ftosizs", "vcvt.s32.f32">;
1395def : VFP2MnemonicAlias<"ftosis", "vcvtr.s32.f32">;
1396def : VFP2MnemonicAlias<"ftouizd", "vcvt.u32.f64">;
1397def : VFP2MnemonicAlias<"ftouid", "vcvtr.u32.f64">;
1398def : VFP2MnemonicAlias<"ftouizs", "vcvt.u32.f32">;
1399def : VFP2MnemonicAlias<"ftouis", "vcvtr.u32.f32">;
1400def : VFP2MnemonicAlias<"fsitod", "vcvt.f64.s32">;
1401def : VFP2MnemonicAlias<"fsitos", "vcvt.f32.s32">;
1402def : VFP2MnemonicAlias<"fuitod", "vcvt.f64.u32">;
1403def : VFP2MnemonicAlias<"fuitos", "vcvt.f32.u32">;
Jim Grosbachf1015402011-12-13 20:13:48 +00001404def : VFP2MnemonicAlias<"fsts", "vstr">;
1405def : VFP2MnemonicAlias<"fstd", "vstr">;
Jim Grosbach0f293de2011-12-13 20:40:37 +00001406def : VFP2MnemonicAlias<"fmacd", "vmla.f64">;
1407def : VFP2MnemonicAlias<"fmacs", "vmla.f32">;
Jim Grosbach9c397892011-12-19 19:02:41 +00001408def : VFP2MnemonicAlias<"fcpys", "vmov.f32">;
1409def : VFP2MnemonicAlias<"fcpyd", "vmov.f64">;
Jim Grosbach1aa149f2011-12-22 19:20:45 +00001410def : VFP2MnemonicAlias<"fcmps", "vcmp.f32">;
1411def : VFP2MnemonicAlias<"fcmpd", "vcmp.f64">;
Jim Grosbach9c397892011-12-19 19:02:41 +00001412def : VFP2MnemonicAlias<"fdivs", "vdiv.f32">;
1413def : VFP2MnemonicAlias<"fdivd", "vdiv.f64">;
Jim Grosbach66cba302012-03-16 21:06:13 +00001414def : VFP2MnemonicAlias<"fmrx", "vmrs">;
1415def : VFP2MnemonicAlias<"fmxr", "vmsr">;
Jim Grosbach67ca1ad2011-12-08 00:49:29 +00001416
Jim Grosbach6357cae2012-03-15 20:48:18 +00001417// Be friendly and accept the old form of zero-compare
1418def : VFP2InstAlias<"fcmpzd${p} $val", (VCMPZD DPR:$val, pred:$p)>;
1419def : VFP2InstAlias<"fcmpzs${p} $val", (VCMPZS SPR:$val, pred:$p)>;
1420
1421
Jim Grosbach5cd5ac62011-10-03 21:12:43 +00001422def : VFP2InstAlias<"fmstat${p}", (FMSTAT pred:$p)>;
Jim Grosbach48171e72011-12-10 00:01:02 +00001423def : VFP2InstAlias<"fadds${p} $Sd, $Sn, $Sm",
1424 (VADDS SPR:$Sd, SPR:$Sn, SPR:$Sm, pred:$p)>;
1425def : VFP2InstAlias<"faddd${p} $Dd, $Dn, $Dm",
1426 (VADDD DPR:$Dd, DPR:$Dn, DPR:$Dm, pred:$p)>;
1427def : VFP2InstAlias<"fsubs${p} $Sd, $Sn, $Sm",
1428 (VSUBS SPR:$Sd, SPR:$Sn, SPR:$Sm, pred:$p)>;
1429def : VFP2InstAlias<"fsubd${p} $Dd, $Dn, $Dm",
1430 (VSUBD DPR:$Dd, DPR:$Dn, DPR:$Dm, pred:$p)>;
Jim Grosbach5cd5ac62011-10-03 21:12:43 +00001431
Jim Grosbach976c0da2011-12-08 22:51:25 +00001432// No need for the size suffix on VSQRT. It's implied by the register classes.
1433def : VFP2InstAlias<"vsqrt${p} $Sd, $Sm", (VSQRTS SPR:$Sd, SPR:$Sm, pred:$p)>;
1434def : VFP2InstAlias<"vsqrt${p} $Dd, $Dm", (VSQRTD DPR:$Dd, DPR:$Dm, pred:$p)>;
1435
Jim Grosbachffc658b2011-11-14 23:03:21 +00001436// VLDR/VSTR accept an optional type suffix.
Jim Grosbach1ceef1a2011-12-07 01:50:36 +00001437def : VFP2InstAlias<"vldr${p}.32 $Sd, $addr",
1438 (VLDRS SPR:$Sd, addrmode5:$addr, pred:$p)>;
1439def : VFP2InstAlias<"vstr${p}.32 $Sd, $addr",
1440 (VSTRS SPR:$Sd, addrmode5:$addr, pred:$p)>;
1441def : VFP2InstAlias<"vldr${p}.64 $Dd, $addr",
1442 (VLDRD DPR:$Dd, addrmode5:$addr, pred:$p)>;
1443def : VFP2InstAlias<"vstr${p}.64 $Dd, $addr",
1444 (VSTRD DPR:$Dd, addrmode5:$addr, pred:$p)>;
Jim Grosbachbfb0a172011-11-15 20:14:51 +00001445
Jim Grosbachaf33a0c2011-12-21 23:24:15 +00001446// VMOV can accept optional 32-bit or less data type suffix suffix.
1447def : VFP2InstAlias<"vmov${p}.8 $Rt, $Sn",
Jim Grosbacha68e90c2011-11-15 20:29:42 +00001448 (VMOVRS GPR:$Rt, SPR:$Sn, pred:$p)>;
Jim Grosbachaf33a0c2011-12-21 23:24:15 +00001449def : VFP2InstAlias<"vmov${p}.16 $Rt, $Sn",
1450 (VMOVRS GPR:$Rt, SPR:$Sn, pred:$p)>;
1451def : VFP2InstAlias<"vmov${p}.32 $Rt, $Sn",
1452 (VMOVRS GPR:$Rt, SPR:$Sn, pred:$p)>;
1453def : VFP2InstAlias<"vmov${p}.8 $Sn, $Rt",
1454 (VMOVSR SPR:$Sn, GPR:$Rt, pred:$p)>;
1455def : VFP2InstAlias<"vmov${p}.16 $Sn, $Rt",
1456 (VMOVSR SPR:$Sn, GPR:$Rt, pred:$p)>;
1457def : VFP2InstAlias<"vmov${p}.32 $Sn, $Rt",
Jim Grosbacha68e90c2011-11-15 20:29:42 +00001458 (VMOVSR SPR:$Sn, GPR:$Rt, pred:$p)>;
1459
1460def : VFP2InstAlias<"vmov${p}.f64 $Rt, $Rt2, $Dn",
1461 (VMOVRRD GPR:$Rt, GPR:$Rt2, DPR:$Dn, pred:$p)>;
1462def : VFP2InstAlias<"vmov${p}.f64 $Dn, $Rt, $Rt2",
1463 (VMOVDRR DPR:$Dn, GPR:$Rt, GPR:$Rt2, pred:$p)>;
Jim Grosbacheaf20562011-11-15 21:18:35 +00001464
1465// VMOVS doesn't need the .f32 to disambiguate from the NEON encoding the way
1466// VMOVD does.
1467def : VFP2InstAlias<"vmov${p} $Sd, $Sm",
1468 (VMOVS SPR:$Sd, SPR:$Sm, pred:$p)>;