blob: b5a896c69985adaca3c1d1b1c5430fd52bd8fd7f [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
Evan Chenga99c5082012-08-15 17:44:53 +000064def alignedload32 : PatFrag<(ops node:$ptr), (load node:$ptr), [{
65 return cast<LoadSDNode>(N)->getAlignment() >= 4;
66}]>;
67
68def alignedstore32 : PatFrag<(ops node:$val, node:$ptr),
69 (store node:$val, node:$ptr), [{
70 return cast<StoreSDNode>(N)->getAlignment() >= 4;
71}]>;
72
Jim Grosbach4050bc42011-12-22 22:19:05 +000073// The VCVT to/from fixed-point instructions encode the 'fbits' operand
74// (the number of fixed bits) differently than it appears in the assembly
75// source. It's encoded as "Size - fbits" where Size is the size of the
76// fixed-point representation (32 or 16) and fbits is the value appearing
77// in the assembly source, an integer in [0,16] or (0,32], depending on size.
78def fbits32_asm_operand : AsmOperandClass { let Name = "FBits32"; }
79def fbits32 : Operand<i32> {
80 let PrintMethod = "printFBits32";
81 let ParserMatchClass = fbits32_asm_operand;
82}
83
84def fbits16_asm_operand : AsmOperandClass { let Name = "FBits16"; }
85def fbits16 : Operand<i32> {
86 let PrintMethod = "printFBits16";
87 let ParserMatchClass = fbits16_asm_operand;
88}
Evan Cheng39382422009-10-28 01:44:26 +000089
90//===----------------------------------------------------------------------===//
Evan Chenga8e29892007-01-19 07:51:42 +000091// Load / store Instructions.
92//
93
Dan Gohmanbc9d98b2010-02-27 23:47:46 +000094let canFoldAsLoad = 1, isReMaterializable = 1 in {
Bill Wendling92b5a2e2010-11-03 01:49:29 +000095
Bill Wendling7d31a162010-10-20 22:44:54 +000096def VLDRD : ADI5<0b1101, 0b01, (outs DPR:$Dd), (ins addrmode5:$addr),
Jim Grosbachffc658b2011-11-14 23:03:21 +000097 IIC_fpLoad64, "vldr", "\t$Dd, $addr",
Evan Chenga99c5082012-08-15 17:44:53 +000098 [(set DPR:$Dd, (f64 (alignedload32 addrmode5:$addr)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +000099
Bill Wendling92b5a2e2010-11-03 01:49:29 +0000100def VLDRS : ASI5<0b1101, 0b01, (outs SPR:$Sd), (ins addrmode5:$addr),
Jim Grosbachffc658b2011-11-14 23:03:21 +0000101 IIC_fpLoad32, "vldr", "\t$Sd, $addr",
Evan Cheng5eda2822011-02-16 00:35:02 +0000102 [(set SPR:$Sd, (load addrmode5:$addr))]> {
103 // Some single precision VFP instructions may be executed on both NEON and VFP
104 // pipelines.
105 let D = VFPNeonDomain;
106}
Bill Wendling92b5a2e2010-11-03 01:49:29 +0000107
108} // End of 'let canFoldAsLoad = 1, isReMaterializable = 1 in'
Evan Chenga8e29892007-01-19 07:51:42 +0000109
Bill Wendling2f46f1f2010-11-04 00:59:42 +0000110def VSTRD : ADI5<0b1101, 0b00, (outs), (ins DPR:$Dd, addrmode5:$addr),
Jim Grosbachffc658b2011-11-14 23:03:21 +0000111 IIC_fpStore64, "vstr", "\t$Dd, $addr",
Evan Chenga99c5082012-08-15 17:44:53 +0000112 [(alignedstore32 (f64 DPR:$Dd), addrmode5:$addr)]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000113
Bill Wendling2f46f1f2010-11-04 00:59:42 +0000114def VSTRS : ASI5<0b1101, 0b00, (outs), (ins SPR:$Sd, addrmode5:$addr),
Jim Grosbachffc658b2011-11-14 23:03:21 +0000115 IIC_fpStore32, "vstr", "\t$Sd, $addr",
Evan Cheng5eda2822011-02-16 00:35:02 +0000116 [(store SPR:$Sd, addrmode5:$addr)]> {
117 // Some single precision VFP instructions may be executed on both NEON and VFP
118 // pipelines.
119 let D = VFPNeonDomain;
120}
Evan Chenga8e29892007-01-19 07:51:42 +0000121
122//===----------------------------------------------------------------------===//
123// Load / store multiple Instructions.
124//
125
Bill Wendling73fe34a2010-11-16 01:16:36 +0000126multiclass vfp_ldst_mult<string asm, bit L_bit,
127 InstrItinClass itin, InstrItinClass itin_upd> {
128 // Double Precision
129 def DIA :
Bill Wendling0f630752010-11-17 04:32:08 +0000130 AXDI4<(outs), (ins GPR:$Rn, pred:$p, dpr_reglist:$regs, variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000131 IndexModeNone, itin,
Bill Wendling73fe34a2010-11-16 01:16:36 +0000132 !strconcat(asm, "ia${p}\t$Rn, $regs"), "", []> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000133 let Inst{24-23} = 0b01; // Increment After
134 let Inst{21} = 0; // No writeback
135 let Inst{20} = L_bit;
136 }
Bill Wendling73fe34a2010-11-16 01:16:36 +0000137 def DIA_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,
Bill Wendling73fe34a2010-11-16 01:16:36 +0000141 !strconcat(asm, "ia${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000142 let Inst{24-23} = 0b01; // Increment After
143 let Inst{21} = 1; // Writeback
144 let Inst{20} = L_bit;
145 }
Bill Wendling73fe34a2010-11-16 01:16:36 +0000146 def DDB_UPD :
Jim Grosbachf921c0fe2011-06-13 22:54:22 +0000147 AXDI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, dpr_reglist:$regs,
148 variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000149 IndexModeUpd, itin_upd,
150 !strconcat(asm, "db${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
151 let Inst{24-23} = 0b10; // Decrement Before
152 let Inst{21} = 1; // Writeback
153 let Inst{20} = L_bit;
154 }
Bill Wendling6c470b82010-11-13 09:09:38 +0000155
Bill Wendling73fe34a2010-11-16 01:16:36 +0000156 // Single Precision
157 def SIA :
Bill Wendling0f630752010-11-17 04:32:08 +0000158 AXSI4<(outs), (ins GPR:$Rn, pred:$p, spr_reglist:$regs, variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000159 IndexModeNone, itin,
Bill Wendling73fe34a2010-11-16 01:16:36 +0000160 !strconcat(asm, "ia${p}\t$Rn, $regs"), "", []> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000161 let Inst{24-23} = 0b01; // Increment After
162 let Inst{21} = 0; // No writeback
163 let Inst{20} = L_bit;
Evan Cheng5eda2822011-02-16 00:35:02 +0000164
165 // Some single precision VFP instructions may be executed on both NEON and
166 // VFP pipelines.
167 let D = VFPNeonDomain;
Bill Wendling6c470b82010-11-13 09:09:38 +0000168 }
Bill Wendling73fe34a2010-11-16 01:16:36 +0000169 def SIA_UPD :
Jim Grosbachf921c0fe2011-06-13 22:54:22 +0000170 AXSI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, spr_reglist:$regs,
171 variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000172 IndexModeUpd, itin_upd,
Bill Wendling73fe34a2010-11-16 01:16:36 +0000173 !strconcat(asm, "ia${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000174 let Inst{24-23} = 0b01; // Increment After
175 let Inst{21} = 1; // Writeback
176 let Inst{20} = L_bit;
Evan Cheng5eda2822011-02-16 00:35:02 +0000177
178 // Some single precision VFP instructions may be executed on both NEON and
179 // VFP pipelines.
180 let D = VFPNeonDomain;
Bill Wendling6c470b82010-11-13 09:09:38 +0000181 }
Bill Wendling73fe34a2010-11-16 01:16:36 +0000182 def SDB_UPD :
Jim Grosbachf921c0fe2011-06-13 22:54:22 +0000183 AXSI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, spr_reglist:$regs,
184 variable_ops),
Bill Wendling6c470b82010-11-13 09:09:38 +0000185 IndexModeUpd, itin_upd,
186 !strconcat(asm, "db${p}\t$Rn!, $regs"), "$Rn = $wb", []> {
187 let Inst{24-23} = 0b10; // Decrement Before
188 let Inst{21} = 1; // Writeback
189 let Inst{20} = L_bit;
Evan Cheng5eda2822011-02-16 00:35:02 +0000190
191 // Some single precision VFP instructions may be executed on both NEON and
192 // VFP pipelines.
193 let D = VFPNeonDomain;
Bill Wendling6c470b82010-11-13 09:09:38 +0000194 }
195}
196
Bill Wendlingddc918b2010-11-13 10:57:02 +0000197let neverHasSideEffects = 1 in {
198
Bill Wendling73fe34a2010-11-16 01:16:36 +0000199let mayLoad = 1, hasExtraDefRegAllocReq = 1 in
200defm VLDM : vfp_ldst_mult<"vldm", 1, IIC_fpLoad_m, IIC_fpLoad_mu>;
Bill Wendlingddc918b2010-11-13 10:57:02 +0000201
Bill Wendling73fe34a2010-11-16 01:16:36 +0000202let mayStore = 1, hasExtraSrcRegAllocReq = 1 in
203defm VSTM : vfp_ldst_mult<"vstm", 0, IIC_fpLoad_m, IIC_fpLoad_mu>;
Bill Wendlingddc918b2010-11-13 10:57:02 +0000204
205} // neverHasSideEffects
206
Bill Wendling73c57e12010-11-16 02:00:24 +0000207def : MnemonicAlias<"vldm", "vldmia">;
208def : MnemonicAlias<"vstm", "vstmia">;
209
Jim Grosbach0d06bb92011-06-27 20:00:07 +0000210def : InstAlias<"vpush${p} $r", (VSTMDDB_UPD SP, pred:$p, dpr_reglist:$r)>,
211 Requires<[HasVFP2]>;
212def : InstAlias<"vpush${p} $r", (VSTMSDB_UPD SP, pred:$p, spr_reglist:$r)>,
213 Requires<[HasVFP2]>;
214def : InstAlias<"vpop${p} $r", (VLDMDIA_UPD SP, pred:$p, dpr_reglist:$r)>,
215 Requires<[HasVFP2]>;
216def : InstAlias<"vpop${p} $r", (VLDMSIA_UPD SP, pred:$p, spr_reglist:$r)>,
217 Requires<[HasVFP2]>;
Jim Grosbachbc978a62012-03-05 23:16:31 +0000218defm : VFPDTAnyInstAlias<"vpush${p}", "$r",
219 (VSTMSDB_UPD SP, pred:$p, spr_reglist:$r)>;
220defm : VFPDTAnyInstAlias<"vpush${p}", "$r",
221 (VSTMDDB_UPD SP, pred:$p, dpr_reglist:$r)>;
222defm : VFPDTAnyInstAlias<"vpop${p}", "$r",
223 (VLDMSIA_UPD SP, pred:$p, spr_reglist:$r)>;
224defm : VFPDTAnyInstAlias<"vpop${p}", "$r",
225 (VLDMDIA_UPD SP, pred:$p, dpr_reglist:$r)>;
Jim Grosbach0d06bb92011-06-27 20:00:07 +0000226
Evan Chenga8e29892007-01-19 07:51:42 +0000227// FLDMX, FSTMX - mixing S/D registers for pre-armv6 cores
228
229//===----------------------------------------------------------------------===//
230// FP Binary Operations.
231//
232
Jim Grosbach181b1472012-04-20 00:15:00 +0000233let TwoOperandAliasConstraint = "$Dn = $Dd" in
Bill Wendling69661192010-11-01 06:00:39 +0000234def VADDD : ADbI<0b11100, 0b11, 0, 0,
235 (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm),
236 IIC_fpALU64, "vadd", ".f64\t$Dd, $Dn, $Dm",
237 [(set DPR:$Dd, (fadd DPR:$Dn, (f64 DPR:$Dm)))]>;
Bill Wendling174777b2010-10-12 22:08:41 +0000238
Jim Grosbach181b1472012-04-20 00:15:00 +0000239let TwoOperandAliasConstraint = "$Sn = $Sd" in
Bill Wendling69661192010-11-01 06:00:39 +0000240def VADDS : ASbIn<0b11100, 0b11, 0, 0,
241 (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm),
242 IIC_fpALU32, "vadd", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000243 [(set SPR:$Sd, (fadd SPR:$Sn, SPR:$Sm))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000244 // Some single precision VFP instructions may be executed on both NEON and
245 // VFP pipelines on A8.
246 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000247}
Evan Chenga8e29892007-01-19 07:51:42 +0000248
Jim Grosbach181b1472012-04-20 00:15:00 +0000249let TwoOperandAliasConstraint = "$Dn = $Dd" in
Bill Wendling69661192010-11-01 06:00:39 +0000250def VSUBD : ADbI<0b11100, 0b11, 1, 0,
251 (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm),
252 IIC_fpALU64, "vsub", ".f64\t$Dd, $Dn, $Dm",
253 [(set DPR:$Dd, (fsub DPR:$Dn, (f64 DPR:$Dm)))]>;
Jim Grosbach499e8862010-10-12 21:22:40 +0000254
Jim Grosbach181b1472012-04-20 00:15:00 +0000255let TwoOperandAliasConstraint = "$Sn = $Sd" in
Bill Wendling69661192010-11-01 06:00:39 +0000256def VSUBS : ASbIn<0b11100, 0b11, 1, 0,
257 (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm),
258 IIC_fpALU32, "vsub", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000259 [(set SPR:$Sd, (fsub SPR:$Sn, SPR:$Sm))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000260 // Some single precision VFP instructions may be executed on both NEON and
261 // VFP pipelines on A8.
262 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000263}
Evan Chenga8e29892007-01-19 07:51:42 +0000264
Jim Grosbach181b1472012-04-20 00:15:00 +0000265let TwoOperandAliasConstraint = "$Dn = $Dd" in
Bill Wendling69661192010-11-01 06:00:39 +0000266def VDIVD : ADbI<0b11101, 0b00, 0, 0,
267 (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm),
268 IIC_fpDIV64, "vdiv", ".f64\t$Dd, $Dn, $Dm",
269 [(set DPR:$Dd, (fdiv DPR:$Dn, (f64 DPR:$Dm)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000270
Jim Grosbach181b1472012-04-20 00:15:00 +0000271let TwoOperandAliasConstraint = "$Sn = $Sd" in
Bill Wendling69661192010-11-01 06:00:39 +0000272def VDIVS : ASbI<0b11101, 0b00, 0, 0,
273 (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm),
274 IIC_fpDIV32, "vdiv", ".f32\t$Sd, $Sn, $Sm",
275 [(set SPR:$Sd, (fdiv SPR:$Sn, SPR:$Sm))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000276
Jim Grosbach181b1472012-04-20 00:15:00 +0000277let TwoOperandAliasConstraint = "$Dn = $Dd" in
Bill Wendling69661192010-11-01 06:00:39 +0000278def VMULD : ADbI<0b11100, 0b10, 0, 0,
279 (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm),
280 IIC_fpMUL64, "vmul", ".f64\t$Dd, $Dn, $Dm",
281 [(set DPR:$Dd, (fmul DPR:$Dn, (f64 DPR:$Dm)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000282
Jim Grosbach181b1472012-04-20 00:15:00 +0000283let TwoOperandAliasConstraint = "$Sn = $Sd" in
Bill Wendling69661192010-11-01 06:00:39 +0000284def VMULS : ASbIn<0b11100, 0b10, 0, 0,
285 (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm),
286 IIC_fpMUL32, "vmul", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000287 [(set SPR:$Sd, (fmul SPR:$Sn, SPR:$Sm))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000288 // Some single precision VFP instructions may be executed on both NEON and
289 // VFP pipelines on A8.
290 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000291}
Jim Grosbache5165492009-11-09 00:11:35 +0000292
Bill Wendling69661192010-11-01 06:00:39 +0000293def VNMULD : ADbI<0b11100, 0b10, 1, 0,
294 (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm),
295 IIC_fpMUL64, "vnmul", ".f64\t$Dd, $Dn, $Dm",
296 [(set DPR:$Dd, (fneg (fmul DPR:$Dn, (f64 DPR:$Dm))))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000297
Bill Wendling69661192010-11-01 06:00:39 +0000298def VNMULS : ASbI<0b11100, 0b10, 1, 0,
299 (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm),
300 IIC_fpMUL32, "vnmul", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000301 [(set SPR:$Sd, (fneg (fmul SPR:$Sn, SPR:$Sm)))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000302 // Some single precision VFP instructions may be executed on both NEON and
303 // VFP pipelines on A8.
304 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000305}
Evan Chenga8e29892007-01-19 07:51:42 +0000306
Chris Lattner72939122007-05-03 00:32:00 +0000307// Match reassociated forms only if not sign dependent rounding.
Chris Lattnerd10a53d2010-03-08 18:51:21 +0000308def : Pat<(fmul (fneg DPR:$a), (f64 DPR:$b)),
Jim Grosbache5165492009-11-09 00:11:35 +0000309 (VNMULD DPR:$a, DPR:$b)>, Requires<[NoHonorSignDependentRounding]>;
Chris Lattner72939122007-05-03 00:32:00 +0000310def : Pat<(fmul (fneg SPR:$a), SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000311 (VNMULS SPR:$a, SPR:$b)>, Requires<[NoHonorSignDependentRounding]>;
Chris Lattner72939122007-05-03 00:32:00 +0000312
Bill Wendlingdd3bc112010-10-12 22:55:35 +0000313// These are encoded as unary instructions.
Lang Hames4f92b5e2012-03-06 00:19:55 +0000314let Defs = [FPSCR_NZCV] in {
Bill Wendling69661192010-11-01 06:00:39 +0000315def VCMPED : ADuI<0b11101, 0b11, 0b0100, 0b11, 0,
316 (outs), (ins DPR:$Dd, DPR:$Dm),
317 IIC_fpCMP64, "vcmpe", ".f64\t$Dd, $Dm",
318 [(arm_cmpfp DPR:$Dd, (f64 DPR:$Dm))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000319
Bill Wendling69661192010-11-01 06:00:39 +0000320def VCMPES : ASuI<0b11101, 0b11, 0b0100, 0b11, 0,
321 (outs), (ins SPR:$Sd, SPR:$Sm),
322 IIC_fpCMP32, "vcmpe", ".f32\t$Sd, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000323 [(arm_cmpfp SPR:$Sd, SPR:$Sm)]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000324 // Some single precision VFP instructions may be executed on both NEON and
325 // VFP pipelines on A8.
326 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000327}
Bill Wendlingdd3bc112010-10-12 22:55:35 +0000328
Bill Wendling67a704d2010-10-13 20:58:46 +0000329// FIXME: Verify encoding after integrated assembler is working.
Bill Wendling69661192010-11-01 06:00:39 +0000330def VCMPD : ADuI<0b11101, 0b11, 0b0100, 0b01, 0,
331 (outs), (ins DPR:$Dd, DPR:$Dm),
332 IIC_fpCMP64, "vcmp", ".f64\t$Dd, $Dm",
333 [/* For disassembly only; pattern left blank */]>;
Bill Wendlingdd3bc112010-10-12 22:55:35 +0000334
Bill Wendling69661192010-11-01 06:00:39 +0000335def VCMPS : ASuI<0b11101, 0b11, 0b0100, 0b01, 0,
336 (outs), (ins SPR:$Sd, SPR:$Sm),
337 IIC_fpCMP32, "vcmp", ".f32\t$Sd, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000338 [/* For disassembly only; pattern left blank */]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000339 // Some single precision VFP instructions may be executed on both NEON and
340 // VFP pipelines on A8.
341 let D = VFPNeonA8Domain;
Bill Wendlingdd3bc112010-10-12 22:55:35 +0000342}
Lang Hames4f92b5e2012-03-06 00:19:55 +0000343} // Defs = [FPSCR_NZCV]
Evan Chenga8e29892007-01-19 07:51:42 +0000344
345//===----------------------------------------------------------------------===//
346// FP Unary Operations.
347//
348
Bill Wendling69661192010-11-01 06:00:39 +0000349def VABSD : ADuI<0b11101, 0b11, 0b0000, 0b11, 0,
350 (outs DPR:$Dd), (ins DPR:$Dm),
351 IIC_fpUNA64, "vabs", ".f64\t$Dd, $Dm",
352 [(set DPR:$Dd, (fabs (f64 DPR:$Dm)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000353
Bill Wendling69661192010-11-01 06:00:39 +0000354def VABSS : ASuIn<0b11101, 0b11, 0b0000, 0b11, 0,
355 (outs SPR:$Sd), (ins SPR:$Sm),
356 IIC_fpUNA32, "vabs", ".f32\t$Sd, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000357 [(set SPR:$Sd, (fabs SPR:$Sm))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000358 // Some single precision VFP instructions may be executed on both NEON and
359 // VFP pipelines on A8.
360 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000361}
Evan Chenga8e29892007-01-19 07:51:42 +0000362
Lang Hames4f92b5e2012-03-06 00:19:55 +0000363let Defs = [FPSCR_NZCV] in {
Bill Wendling69661192010-11-01 06:00:39 +0000364def VCMPEZD : ADuI<0b11101, 0b11, 0b0101, 0b11, 0,
365 (outs), (ins DPR:$Dd),
366 IIC_fpCMP64, "vcmpe", ".f64\t$Dd, #0",
367 [(arm_cmpfp0 (f64 DPR:$Dd))]> {
368 let Inst{3-0} = 0b0000;
369 let Inst{5} = 0;
Bill Wendling1fc6d882010-10-13 00:38:07 +0000370}
371
Bill Wendling69661192010-11-01 06:00:39 +0000372def VCMPEZS : ASuI<0b11101, 0b11, 0b0101, 0b11, 0,
373 (outs), (ins SPR:$Sd),
374 IIC_fpCMP32, "vcmpe", ".f32\t$Sd, #0",
375 [(arm_cmpfp0 SPR:$Sd)]> {
376 let Inst{3-0} = 0b0000;
377 let Inst{5} = 0;
Evan Cheng5eda2822011-02-16 00:35:02 +0000378
Evan Cheng6557bce2011-02-22 19:53:14 +0000379 // Some single precision VFP instructions may be executed on both NEON and
380 // VFP pipelines on A8.
381 let D = VFPNeonA8Domain;
Bill Wendling1fc6d882010-10-13 00:38:07 +0000382}
Evan Chenga8e29892007-01-19 07:51:42 +0000383
Bill Wendling67a704d2010-10-13 20:58:46 +0000384// FIXME: Verify encoding after integrated assembler is working.
Bill Wendling69661192010-11-01 06:00:39 +0000385def VCMPZD : ADuI<0b11101, 0b11, 0b0101, 0b01, 0,
386 (outs), (ins DPR:$Dd),
387 IIC_fpCMP64, "vcmp", ".f64\t$Dd, #0",
388 [/* For disassembly only; pattern left blank */]> {
389 let Inst{3-0} = 0b0000;
390 let Inst{5} = 0;
Bill Wendling67a704d2010-10-13 20:58:46 +0000391}
Johnny Chen7edd8e32010-02-08 19:41:48 +0000392
Bill Wendling69661192010-11-01 06:00:39 +0000393def VCMPZS : ASuI<0b11101, 0b11, 0b0101, 0b01, 0,
394 (outs), (ins SPR:$Sd),
395 IIC_fpCMP32, "vcmp", ".f32\t$Sd, #0",
396 [/* For disassembly only; pattern left blank */]> {
397 let Inst{3-0} = 0b0000;
398 let Inst{5} = 0;
Evan Cheng5eda2822011-02-16 00:35:02 +0000399
Evan Cheng6557bce2011-02-22 19:53:14 +0000400 // Some single precision VFP instructions may be executed on both NEON and
401 // VFP pipelines on A8.
402 let D = VFPNeonA8Domain;
Bill Wendling67a704d2010-10-13 20:58:46 +0000403}
Lang Hames4f92b5e2012-03-06 00:19:55 +0000404} // Defs = [FPSCR_NZCV]
Evan Chenga8e29892007-01-19 07:51:42 +0000405
Bill Wendling54908dd2010-10-13 00:56:35 +0000406def VCVTDS : ASuI<0b11101, 0b11, 0b0111, 0b11, 0,
407 (outs DPR:$Dd), (ins SPR:$Sm),
408 IIC_fpCVTDS, "vcvt", ".f64.f32\t$Dd, $Sm",
409 [(set DPR:$Dd, (fextend SPR:$Sm))]> {
410 // Instruction operands.
411 bits<5> Dd;
412 bits<5> Sm;
413
414 // Encode instruction operands.
415 let Inst{3-0} = Sm{4-1};
416 let Inst{5} = Sm{0};
417 let Inst{15-12} = Dd{3-0};
418 let Inst{22} = Dd{4};
419}
Evan Chenga8e29892007-01-19 07:51:42 +0000420
Evan Cheng96581d32008-11-11 02:11:05 +0000421// Special case encoding: bits 11-8 is 0b1011.
Bill Wendling54908dd2010-10-13 00:56:35 +0000422def VCVTSD : VFPAI<(outs SPR:$Sd), (ins DPR:$Dm), VFPUnaryFrm,
423 IIC_fpCVTSD, "vcvt", ".f32.f64\t$Sd, $Dm",
424 [(set SPR:$Sd, (fround DPR:$Dm))]> {
425 // Instruction operands.
426 bits<5> Sd;
427 bits<5> Dm;
428
429 // Encode instruction operands.
430 let Inst{3-0} = Dm{3-0};
431 let Inst{5} = Dm{4};
432 let Inst{15-12} = Sd{4-1};
433 let Inst{22} = Sd{0};
434
Evan Cheng96581d32008-11-11 02:11:05 +0000435 let Inst{27-23} = 0b11101;
436 let Inst{21-16} = 0b110111;
437 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000438 let Inst{7-6} = 0b11;
439 let Inst{4} = 0;
Evan Cheng96581d32008-11-11 02:11:05 +0000440}
Evan Chenga8e29892007-01-19 07:51:42 +0000441
Johnny Chen2d658df2010-02-09 17:21:56 +0000442// Between half-precision and single-precision. For disassembly only.
443
Bill Wendling67a704d2010-10-13 20:58:46 +0000444// FIXME: Verify encoding after integrated assembler is working.
Anton Korobeynikov65219992012-08-14 23:36:01 +0000445def VCVTBHS: ASuI<0b11101, 0b11, 0b0010, 0b01, 0, (outs SPR:$Sd), (ins SPR:$Sm),
Owen Anderson838130e2011-08-22 21:34:00 +0000446 /* FIXME */ IIC_fpCVTSH, "vcvtb", ".f32.f16\t$Sd, $Sm",
Anton Korobeynikovf0d50072010-03-18 22:35:37 +0000447 [/* For disassembly only; pattern left blank */]>;
448
Anton Korobeynikov65219992012-08-14 23:36:01 +0000449def VCVTBSH: ASuI<0b11101, 0b11, 0b0011, 0b01, 0, (outs SPR:$Sd), (ins SPR:$Sm),
450 /* FIXME */ IIC_fpCVTHS, "vcvtb", ".f16.f32\t$Sd, $Sm",
451 [/* For disassembly only; pattern left blank */]>;
452
Anton Korobeynikov6d655a52012-08-18 13:08:43 +0000453def : Pat<(f32_to_f16 SPR:$a),
454 (i32 (COPY_TO_REGCLASS (VCVTBSH SPR:$a), GPR))>;
Johnny Chen2d658df2010-02-09 17:21:56 +0000455
Anton Korobeynikov6d655a52012-08-18 13:08:43 +0000456def : Pat<(f16_to_f32 GPR:$a),
457 (VCVTBHS (COPY_TO_REGCLASS GPR:$a, SPR))>;
Johnny Chen2d658df2010-02-09 17:21:56 +0000458
Anton Korobeynikov65219992012-08-14 23:36:01 +0000459def VCVTTHS: ASuI<0b11101, 0b11, 0b0010, 0b11, 0, (outs SPR:$Sd), (ins SPR:$Sm),
Owen Anderson838130e2011-08-22 21:34:00 +0000460 /* FIXME */ IIC_fpCVTSH, "vcvtt", ".f32.f16\t$Sd, $Sm",
Johnny Chen2d658df2010-02-09 17:21:56 +0000461 [/* For disassembly only; pattern left blank */]>;
462
Anton Korobeynikov65219992012-08-14 23:36:01 +0000463def VCVTTSH: ASuI<0b11101, 0b11, 0b0011, 0b11, 0, (outs SPR:$Sd), (ins SPR:$Sm),
Owen Anderson838130e2011-08-22 21:34:00 +0000464 /* FIXME */ IIC_fpCVTHS, "vcvtt", ".f16.f32\t$Sd, $Sm",
Johnny Chen2d658df2010-02-09 17:21:56 +0000465 [/* For disassembly only; pattern left blank */]>;
466
Bill Wendling69661192010-11-01 06:00:39 +0000467def VNEGD : ADuI<0b11101, 0b11, 0b0001, 0b01, 0,
468 (outs DPR:$Dd), (ins DPR:$Dm),
469 IIC_fpUNA64, "vneg", ".f64\t$Dd, $Dm",
470 [(set DPR:$Dd, (fneg (f64 DPR:$Dm)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000471
Bill Wendling69661192010-11-01 06:00:39 +0000472def VNEGS : ASuIn<0b11101, 0b11, 0b0001, 0b01, 0,
473 (outs SPR:$Sd), (ins SPR:$Sm),
474 IIC_fpUNA32, "vneg", ".f32\t$Sd, $Sm",
Evan Cheng5eda2822011-02-16 00:35:02 +0000475 [(set SPR:$Sd, (fneg SPR:$Sm))]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000476 // Some single precision VFP instructions may be executed on both NEON and
477 // VFP pipelines on A8.
478 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000479}
Evan Chenga8e29892007-01-19 07:51:42 +0000480
Bill Wendling69661192010-11-01 06:00:39 +0000481def VSQRTD : ADuI<0b11101, 0b11, 0b0001, 0b11, 0,
482 (outs DPR:$Dd), (ins DPR:$Dm),
483 IIC_fpSQRT64, "vsqrt", ".f64\t$Dd, $Dm",
484 [(set DPR:$Dd, (fsqrt (f64 DPR:$Dm)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000485
Bill Wendling69661192010-11-01 06:00:39 +0000486def VSQRTS : ASuI<0b11101, 0b11, 0b0001, 0b11, 0,
487 (outs SPR:$Sd), (ins SPR:$Sm),
488 IIC_fpSQRT32, "vsqrt", ".f32\t$Sd, $Sm",
489 [(set SPR:$Sd, (fsqrt SPR:$Sm))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000490
Bill Wendling67a704d2010-10-13 20:58:46 +0000491let neverHasSideEffects = 1 in {
Bill Wendling69661192010-11-01 06:00:39 +0000492def VMOVD : ADuI<0b11101, 0b11, 0b0000, 0b01, 0,
493 (outs DPR:$Dd), (ins DPR:$Dm),
494 IIC_fpUNA64, "vmov", ".f64\t$Dd, $Dm", []>;
Bill Wendling67a704d2010-10-13 20:58:46 +0000495
Bill Wendling69661192010-11-01 06:00:39 +0000496def VMOVS : ASuI<0b11101, 0b11, 0b0000, 0b01, 0,
497 (outs SPR:$Sd), (ins SPR:$Sm),
498 IIC_fpUNA32, "vmov", ".f32\t$Sd, $Sm", []>;
Bill Wendling67a704d2010-10-13 20:58:46 +0000499} // neverHasSideEffects
500
Evan Chenga8e29892007-01-19 07:51:42 +0000501//===----------------------------------------------------------------------===//
502// FP <-> GPR Copies. Int <-> FP Conversions.
503//
504
Bill Wendling7d31a162010-10-20 22:44:54 +0000505def VMOVRS : AVConv2I<0b11100001, 0b1010,
506 (outs GPR:$Rt), (ins SPR:$Sn),
507 IIC_fpMOVSI, "vmov", "\t$Rt, $Sn",
508 [(set GPR:$Rt, (bitconvert SPR:$Sn))]> {
509 // Instruction operands.
510 bits<4> Rt;
511 bits<5> Sn;
Evan Chenga8e29892007-01-19 07:51:42 +0000512
Bill Wendling7d31a162010-10-20 22:44:54 +0000513 // Encode instruction operands.
514 let Inst{19-16} = Sn{4-1};
515 let Inst{7} = Sn{0};
516 let Inst{15-12} = Rt;
517
518 let Inst{6-5} = 0b00;
519 let Inst{3-0} = 0b0000;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000520
521 // Some single precision VFP instructions may be executed on both NEON and VFP
522 // pipelines.
523 let D = VFPNeonDomain;
Bill Wendling7d31a162010-10-20 22:44:54 +0000524}
525
Bob Wilsoneb1641d2012-09-29 21:43:49 +0000526// Bitcast i32 -> f32. NEON prefers to use VMOVDRR.
Bill Wendling7d31a162010-10-20 22:44:54 +0000527def VMOVSR : AVConv4I<0b11100000, 0b1010,
528 (outs SPR:$Sn), (ins GPR:$Rt),
529 IIC_fpMOVIS, "vmov", "\t$Sn, $Rt",
Bob Wilsoneb1641d2012-09-29 21:43:49 +0000530 [(set SPR:$Sn, (bitconvert GPR:$Rt))]>,
531 Requires<[HasVFP2, UseVMOVSR]> {
Bill Wendling7d31a162010-10-20 22:44:54 +0000532 // Instruction operands.
533 bits<5> Sn;
534 bits<4> Rt;
535
536 // Encode instruction operands.
537 let Inst{19-16} = Sn{4-1};
538 let Inst{7} = Sn{0};
539 let Inst{15-12} = Rt;
540
541 let Inst{6-5} = 0b00;
542 let Inst{3-0} = 0b0000;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000543
544 // Some single precision VFP instructions may be executed on both NEON and VFP
545 // pipelines.
546 let D = VFPNeonDomain;
Bill Wendling7d31a162010-10-20 22:44:54 +0000547}
Evan Chenga8e29892007-01-19 07:51:42 +0000548
Evan Cheng020cc1b2010-05-13 00:16:46 +0000549let neverHasSideEffects = 1 in {
Jim Grosbache5165492009-11-09 00:11:35 +0000550def VMOVRRD : AVConv3I<0b11000101, 0b1011,
Bill Wendling01aabda2010-10-20 23:37:40 +0000551 (outs GPR:$Rt, GPR:$Rt2), (ins DPR:$Dm),
552 IIC_fpMOVDI, "vmov", "\t$Rt, $Rt2, $Dm",
Johnny Chen7acca672010-02-05 18:04:58 +0000553 [/* FIXME: Can't write pattern for multiple result instr*/]> {
Bill Wendling01aabda2010-10-20 23:37:40 +0000554 // Instruction operands.
555 bits<5> Dm;
556 bits<4> Rt;
557 bits<4> Rt2;
558
559 // Encode instruction operands.
560 let Inst{3-0} = Dm{3-0};
561 let Inst{5} = Dm{4};
562 let Inst{15-12} = Rt;
563 let Inst{19-16} = Rt2;
564
Johnny Chen7acca672010-02-05 18:04:58 +0000565 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000566
567 // Some single precision VFP instructions may be executed on both NEON and VFP
568 // pipelines.
569 let D = VFPNeonDomain;
Johnny Chen7acca672010-02-05 18:04:58 +0000570}
Evan Chenga8e29892007-01-19 07:51:42 +0000571
Johnny Chen23401d62010-02-08 17:26:09 +0000572def VMOVRRS : AVConv3I<0b11000101, 0b1010,
Owen Anderson694e0ff2011-08-29 23:15:25 +0000573 (outs GPR:$Rt, GPR:$Rt2), (ins SPR:$src1, SPR:$src2),
574 IIC_fpMOVDI, "vmov", "\t$Rt, $Rt2, $src1, $src2",
Johnny Chen23401d62010-02-08 17:26:09 +0000575 [/* For disassembly only; pattern left blank */]> {
Owen Anderson694e0ff2011-08-29 23:15:25 +0000576 bits<5> src1;
577 bits<4> Rt;
578 bits<4> Rt2;
579
580 // Encode instruction operands.
Richard Bartonfae96f12012-07-10 12:51:09 +0000581 let Inst{3-0} = src1{4-1};
582 let Inst{5} = src1{0};
Owen Anderson694e0ff2011-08-29 23:15:25 +0000583 let Inst{15-12} = Rt;
584 let Inst{19-16} = Rt2;
585
Johnny Chen23401d62010-02-08 17:26:09 +0000586 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000587
588 // Some single precision VFP instructions may be executed on both NEON and VFP
589 // pipelines.
590 let D = VFPNeonDomain;
Owen Anderson357ec682011-08-22 20:27:12 +0000591 let DecoderMethod = "DecodeVMOVRRS";
Johnny Chen23401d62010-02-08 17:26:09 +0000592}
Evan Cheng020cc1b2010-05-13 00:16:46 +0000593} // neverHasSideEffects
Johnny Chen23401d62010-02-08 17:26:09 +0000594
Evan Chenga8e29892007-01-19 07:51:42 +0000595// FMDHR: GPR -> SPR
596// FMDLR: GPR -> SPR
597
Jim Grosbache5165492009-11-09 00:11:35 +0000598def VMOVDRR : AVConv5I<0b11000100, 0b1011,
Bill Wendling01aabda2010-10-20 23:37:40 +0000599 (outs DPR:$Dm), (ins GPR:$Rt, GPR:$Rt2),
600 IIC_fpMOVID, "vmov", "\t$Dm, $Rt, $Rt2",
601 [(set DPR:$Dm, (arm_fmdrr GPR:$Rt, GPR:$Rt2))]> {
602 // Instruction operands.
603 bits<5> Dm;
604 bits<4> Rt;
605 bits<4> Rt2;
606
607 // Encode instruction operands.
608 let Inst{3-0} = Dm{3-0};
609 let Inst{5} = Dm{4};
610 let Inst{15-12} = Rt;
611 let Inst{19-16} = Rt2;
612
613 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000614
615 // Some single precision VFP instructions may be executed on both NEON and VFP
616 // pipelines.
617 let D = VFPNeonDomain;
Johnny Chen7acca672010-02-05 18:04:58 +0000618}
Evan Chenga8e29892007-01-19 07:51:42 +0000619
Evan Cheng020cc1b2010-05-13 00:16:46 +0000620let neverHasSideEffects = 1 in
Johnny Chen23401d62010-02-08 17:26:09 +0000621def VMOVSRR : AVConv5I<0b11000100, 0b1010,
622 (outs SPR:$dst1, SPR:$dst2), (ins GPR:$src1, GPR:$src2),
Anton Korobeynikova31c6fb2010-04-07 18:20:02 +0000623 IIC_fpMOVID, "vmov", "\t$dst1, $dst2, $src1, $src2",
Johnny Chen23401d62010-02-08 17:26:09 +0000624 [/* For disassembly only; pattern left blank */]> {
Owen Anderson694e0ff2011-08-29 23:15:25 +0000625 // Instruction operands.
626 bits<5> dst1;
627 bits<4> src1;
628 bits<4> src2;
629
630 // Encode instruction operands.
Richard Bartonfae96f12012-07-10 12:51:09 +0000631 let Inst{3-0} = dst1{4-1};
632 let Inst{5} = dst1{0};
Owen Anderson694e0ff2011-08-29 23:15:25 +0000633 let Inst{15-12} = src1;
634 let Inst{19-16} = src2;
635
Johnny Chen23401d62010-02-08 17:26:09 +0000636 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000637
638 // Some single precision VFP instructions may be executed on both NEON and VFP
639 // pipelines.
640 let D = VFPNeonDomain;
Owen Anderson357ec682011-08-22 20:27:12 +0000641
642 let DecoderMethod = "DecodeVMOVSRR";
Johnny Chen23401d62010-02-08 17:26:09 +0000643}
644
Evan Chenga8e29892007-01-19 07:51:42 +0000645// FMRDH: SPR -> GPR
646// FMRDL: SPR -> GPR
647// FMRRS: SPR -> GPR
Bill Wendling67a704d2010-10-13 20:58:46 +0000648// FMRX: SPR system reg -> GPR
Evan Chenga8e29892007-01-19 07:51:42 +0000649// FMSRR: GPR -> SPR
Bill Wendling67a704d2010-10-13 20:58:46 +0000650// FMXR: GPR -> VFP system reg
Evan Chenga8e29892007-01-19 07:51:42 +0000651
652
Bill Wendling67a704d2010-10-13 20:58:46 +0000653// Int -> FP:
Evan Chenga8e29892007-01-19 07:51:42 +0000654
Bill Wendling67a704d2010-10-13 20:58:46 +0000655class AVConv1IDs_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
656 bits<4> opcod4, dag oops, dag iops,
657 InstrItinClass itin, string opc, string asm,
658 list<dag> pattern>
659 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
660 pattern> {
661 // Instruction operands.
662 bits<5> Dd;
663 bits<5> Sm;
664
665 // Encode instruction operands.
666 let Inst{3-0} = Sm{4-1};
667 let Inst{5} = Sm{0};
668 let Inst{15-12} = Dd{3-0};
669 let Inst{22} = Dd{4};
670}
671
672class AVConv1InSs_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
673 bits<4> opcod4, dag oops, dag iops,InstrItinClass itin,
674 string opc, string asm, list<dag> pattern>
675 : AVConv1In<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
676 pattern> {
677 // Instruction operands.
678 bits<5> Sd;
679 bits<5> Sm;
680
681 // Encode instruction operands.
682 let Inst{3-0} = Sm{4-1};
683 let Inst{5} = Sm{0};
684 let Inst{15-12} = Sd{4-1};
685 let Inst{22} = Sd{0};
686}
687
688def VSITOD : AVConv1IDs_Encode<0b11101, 0b11, 0b1000, 0b1011,
689 (outs DPR:$Dd), (ins SPR:$Sm),
690 IIC_fpCVTID, "vcvt", ".f64.s32\t$Dd, $Sm",
691 [(set DPR:$Dd, (f64 (arm_sitof SPR:$Sm)))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000692 let Inst{7} = 1; // s32
Evan Cheng78be83d2008-11-11 19:40:26 +0000693}
Evan Chenga8e29892007-01-19 07:51:42 +0000694
Bill Wendling67a704d2010-10-13 20:58:46 +0000695def VSITOS : AVConv1InSs_Encode<0b11101, 0b11, 0b1000, 0b1010,
696 (outs SPR:$Sd),(ins SPR:$Sm),
697 IIC_fpCVTIS, "vcvt", ".f32.s32\t$Sd, $Sm",
698 [(set SPR:$Sd, (arm_sitof SPR:$Sm))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000699 let Inst{7} = 1; // s32
Evan Cheng5eda2822011-02-16 00:35:02 +0000700
Evan Cheng6557bce2011-02-22 19:53:14 +0000701 // Some single precision VFP instructions may be executed on both NEON and
702 // VFP pipelines on A8.
703 let D = VFPNeonA8Domain;
Evan Cheng78be83d2008-11-11 19:40:26 +0000704}
Evan Chenga8e29892007-01-19 07:51:42 +0000705
Bill Wendling67a704d2010-10-13 20:58:46 +0000706def VUITOD : AVConv1IDs_Encode<0b11101, 0b11, 0b1000, 0b1011,
707 (outs DPR:$Dd), (ins SPR:$Sm),
708 IIC_fpCVTID, "vcvt", ".f64.u32\t$Dd, $Sm",
709 [(set DPR:$Dd, (f64 (arm_uitof SPR:$Sm)))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000710 let Inst{7} = 0; // u32
711}
Evan Chenga8e29892007-01-19 07:51:42 +0000712
Bill Wendling67a704d2010-10-13 20:58:46 +0000713def VUITOS : AVConv1InSs_Encode<0b11101, 0b11, 0b1000, 0b1010,
714 (outs SPR:$Sd), (ins SPR:$Sm),
715 IIC_fpCVTIS, "vcvt", ".f32.u32\t$Sd, $Sm",
716 [(set SPR:$Sd, (arm_uitof SPR:$Sm))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000717 let Inst{7} = 0; // u32
Evan Cheng5eda2822011-02-16 00:35:02 +0000718
Evan Cheng6557bce2011-02-22 19:53:14 +0000719 // Some single precision VFP instructions may be executed on both NEON and
720 // VFP pipelines on A8.
721 let D = VFPNeonA8Domain;
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000722}
Evan Chenga8e29892007-01-19 07:51:42 +0000723
Bill Wendling67a704d2010-10-13 20:58:46 +0000724// FP -> Int:
725
726class AVConv1IsD_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
727 bits<4> opcod4, dag oops, dag iops,
728 InstrItinClass itin, string opc, string asm,
729 list<dag> pattern>
730 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
731 pattern> {
732 // Instruction operands.
733 bits<5> Sd;
734 bits<5> Dm;
735
736 // Encode instruction operands.
737 let Inst{3-0} = Dm{3-0};
738 let Inst{5} = Dm{4};
739 let Inst{15-12} = Sd{4-1};
740 let Inst{22} = Sd{0};
741}
742
743class AVConv1InsS_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
744 bits<4> opcod4, dag oops, dag iops,
745 InstrItinClass itin, string opc, string asm,
746 list<dag> pattern>
747 : AVConv1In<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
748 pattern> {
749 // Instruction operands.
750 bits<5> Sd;
751 bits<5> Sm;
752
753 // Encode instruction operands.
754 let Inst{3-0} = Sm{4-1};
755 let Inst{5} = Sm{0};
756 let Inst{15-12} = Sd{4-1};
757 let Inst{22} = Sd{0};
758}
759
Evan Chenga8e29892007-01-19 07:51:42 +0000760// Always set Z bit in the instruction, i.e. "round towards zero" variants.
Bill Wendling67a704d2010-10-13 20:58:46 +0000761def VTOSIZD : AVConv1IsD_Encode<0b11101, 0b11, 0b1101, 0b1011,
762 (outs SPR:$Sd), (ins DPR:$Dm),
763 IIC_fpCVTDI, "vcvt", ".s32.f64\t$Sd, $Dm",
764 [(set SPR:$Sd, (arm_ftosi (f64 DPR:$Dm)))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000765 let Inst{7} = 1; // Z bit
766}
Evan Chenga8e29892007-01-19 07:51:42 +0000767
Bill Wendling67a704d2010-10-13 20:58:46 +0000768def VTOSIZS : AVConv1InsS_Encode<0b11101, 0b11, 0b1101, 0b1010,
769 (outs SPR:$Sd), (ins SPR:$Sm),
770 IIC_fpCVTSI, "vcvt", ".s32.f32\t$Sd, $Sm",
771 [(set SPR:$Sd, (arm_ftosi SPR:$Sm))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000772 let Inst{7} = 1; // Z bit
Evan Cheng5eda2822011-02-16 00:35:02 +0000773
Evan Cheng6557bce2011-02-22 19:53:14 +0000774 // Some single precision VFP instructions may be executed on both NEON and
775 // VFP pipelines on A8.
776 let D = VFPNeonA8Domain;
Evan Cheng78be83d2008-11-11 19:40:26 +0000777}
Evan Chenga8e29892007-01-19 07:51:42 +0000778
Bill Wendling67a704d2010-10-13 20:58:46 +0000779def VTOUIZD : AVConv1IsD_Encode<0b11101, 0b11, 0b1100, 0b1011,
780 (outs SPR:$Sd), (ins DPR:$Dm),
781 IIC_fpCVTDI, "vcvt", ".u32.f64\t$Sd, $Dm",
782 [(set SPR:$Sd, (arm_ftoui (f64 DPR:$Dm)))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000783 let Inst{7} = 1; // Z bit
784}
Evan Chenga8e29892007-01-19 07:51:42 +0000785
Bill Wendling67a704d2010-10-13 20:58:46 +0000786def VTOUIZS : AVConv1InsS_Encode<0b11101, 0b11, 0b1100, 0b1010,
787 (outs SPR:$Sd), (ins SPR:$Sm),
788 IIC_fpCVTSI, "vcvt", ".u32.f32\t$Sd, $Sm",
789 [(set SPR:$Sd, (arm_ftoui SPR:$Sm))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000790 let Inst{7} = 1; // Z bit
Evan Cheng5eda2822011-02-16 00:35:02 +0000791
Evan Cheng6557bce2011-02-22 19:53:14 +0000792 // Some single precision VFP instructions may be executed on both NEON and
793 // VFP pipelines on A8.
794 let D = VFPNeonA8Domain;
Evan Cheng78be83d2008-11-11 19:40:26 +0000795}
Evan Chenga8e29892007-01-19 07:51:42 +0000796
Johnny Chen15b423f2010-02-08 22:02:41 +0000797// And the Z bit '0' variants, i.e. use the rounding mode specified by FPSCR.
Nate Begemand1fb5832010-08-03 21:31:55 +0000798let Uses = [FPSCR] in {
Bill Wendling67a704d2010-10-13 20:58:46 +0000799// FIXME: Verify encoding after integrated assembler is working.
800def VTOSIRD : AVConv1IsD_Encode<0b11101, 0b11, 0b1101, 0b1011,
801 (outs SPR:$Sd), (ins DPR:$Dm),
802 IIC_fpCVTDI, "vcvtr", ".s32.f64\t$Sd, $Dm",
803 [(set SPR:$Sd, (int_arm_vcvtr (f64 DPR:$Dm)))]>{
Johnny Chen15b423f2010-02-08 22:02:41 +0000804 let Inst{7} = 0; // Z bit
805}
806
Bill Wendling67a704d2010-10-13 20:58:46 +0000807def VTOSIRS : AVConv1InsS_Encode<0b11101, 0b11, 0b1101, 0b1010,
808 (outs SPR:$Sd), (ins SPR:$Sm),
809 IIC_fpCVTSI, "vcvtr", ".s32.f32\t$Sd, $Sm",
810 [(set SPR:$Sd, (int_arm_vcvtr SPR:$Sm))]> {
Johnny Chen15b423f2010-02-08 22:02:41 +0000811 let Inst{7} = 0; // Z bit
812}
813
Bill Wendling67a704d2010-10-13 20:58:46 +0000814def VTOUIRD : AVConv1IsD_Encode<0b11101, 0b11, 0b1100, 0b1011,
815 (outs SPR:$Sd), (ins DPR:$Dm),
816 IIC_fpCVTDI, "vcvtr", ".u32.f64\t$Sd, $Dm",
Bill Wendling88cf0382010-10-14 01:02:08 +0000817 [(set SPR:$Sd, (int_arm_vcvtru(f64 DPR:$Dm)))]>{
Johnny Chen15b423f2010-02-08 22:02:41 +0000818 let Inst{7} = 0; // Z bit
819}
820
Bill Wendling67a704d2010-10-13 20:58:46 +0000821def VTOUIRS : AVConv1InsS_Encode<0b11101, 0b11, 0b1100, 0b1010,
822 (outs SPR:$Sd), (ins SPR:$Sm),
823 IIC_fpCVTSI, "vcvtr", ".u32.f32\t$Sd, $Sm",
824 [(set SPR:$Sd, (int_arm_vcvtru SPR:$Sm))]> {
Johnny Chen15b423f2010-02-08 22:02:41 +0000825 let Inst{7} = 0; // Z bit
826}
Nate Begemand1fb5832010-08-03 21:31:55 +0000827}
Johnny Chen15b423f2010-02-08 22:02:41 +0000828
Johnny Chen27bb8d02010-02-11 18:17:16 +0000829// Convert between floating-point and fixed-point
830// Data type for fixed-point naming convention:
831// S16 (U=0, sx=0) -> SH
832// U16 (U=1, sx=0) -> UH
833// S32 (U=0, sx=1) -> SL
834// U32 (U=1, sx=1) -> UL
835
Jim Grosbach8c748112011-12-22 19:45:01 +0000836let Constraints = "$a = $dst" in {
Johnny Chen27bb8d02010-02-11 18:17:16 +0000837
838// FP to Fixed-Point:
839
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000840// Single Precision register
Jim Grosbachc92ba4e2012-04-23 22:04:10 +0000841class AVConv1XInsS_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{0};
848 let Inst{15-12} = dst{4-1};
849}
850
851// Double Precision register
Jim Grosbachc92ba4e2012-04-23 22:04:10 +0000852class AVConv1XInsD_Encode<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4,
853 bit op5, dag oops, dag iops, InstrItinClass itin,
854 string opc, string asm, list<dag> pattern>
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000855 : AVConv1XI<op1, op2, op3, op4, op5, oops, iops, itin, opc, asm, pattern> {
856 bits<5> dst;
857 // if dp_operation then UInt(D:Vd) else UInt(Vd:D);
858 let Inst{22} = dst{4};
859 let Inst{15-12} = dst{3-0};
860}
861
862def VTOSHS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1110, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000863 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000864 IIC_fpCVTSI, "vcvt", ".s16.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000865 // Some single precision VFP instructions may be executed on both NEON and
866 // VFP pipelines on A8.
867 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000868}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000869
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000870def VTOUHS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1111, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000871 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000872 IIC_fpCVTSI, "vcvt", ".u16.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000873 // Some single precision VFP instructions may be executed on both NEON and
874 // VFP pipelines on A8.
875 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000876}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000877
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000878def VTOSLS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1110, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000879 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000880 IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000881 // Some single precision VFP instructions may be executed on both NEON and
882 // VFP pipelines on A8.
883 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000884}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000885
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000886def VTOULS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1111, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000887 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000888 IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000889 // Some single precision VFP instructions may be executed on both NEON and
890 // VFP pipelines on A8.
891 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000892}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000893
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000894def VTOSHD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1110, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000895 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000896 IIC_fpCVTDI, "vcvt", ".s16.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000897
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000898def VTOUHD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1111, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000899 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000900 IIC_fpCVTDI, "vcvt", ".u16.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000901
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000902def VTOSLD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1110, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000903 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000904 IIC_fpCVTDI, "vcvt", ".s32.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000905
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000906def VTOULD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1111, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000907 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000908 IIC_fpCVTDI, "vcvt", ".u32.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000909
910// Fixed-Point to FP:
911
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000912def VSHTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1010, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000913 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000914 IIC_fpCVTIS, "vcvt", ".f32.s16\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000915 // Some single precision VFP instructions may be executed on both NEON and
916 // VFP pipelines on A8.
917 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000918}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000919
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000920def VUHTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1011, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000921 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000922 IIC_fpCVTIS, "vcvt", ".f32.u16\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000923 // Some single precision VFP instructions may be executed on both NEON and
924 // VFP pipelines on A8.
925 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000926}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000927
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000928def VSLTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1010, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000929 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000930 IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000931 // Some single precision VFP instructions may be executed on both NEON and
932 // VFP pipelines on A8.
933 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000934}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000935
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000936def VULTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1011, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000937 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000938 IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000939 // Some single precision VFP instructions may be executed on both NEON and
940 // VFP pipelines on A8.
941 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000942}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000943
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000944def VSHTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1010, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000945 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000946 IIC_fpCVTID, "vcvt", ".f64.s16\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000947
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000948def VUHTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1011, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000949 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000950 IIC_fpCVTID, "vcvt", ".f64.u16\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000951
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000952def VSLTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1010, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000953 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000954 IIC_fpCVTID, "vcvt", ".f64.s32\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000955
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000956def VULTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1011, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000957 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000958 IIC_fpCVTID, "vcvt", ".f64.u32\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000959
Jim Grosbach8c748112011-12-22 19:45:01 +0000960} // End of 'let Constraints = "$a = $dst" in'
Johnny Chen27bb8d02010-02-11 18:17:16 +0000961
Evan Chenga8e29892007-01-19 07:51:42 +0000962//===----------------------------------------------------------------------===//
Cameron Zwarich375db7f2011-07-07 08:28:52 +0000963// FP Multiply-Accumulate Operations.
Evan Chenga8e29892007-01-19 07:51:42 +0000964//
965
Evan Cheng529916c2010-11-12 20:32:20 +0000966def VMLAD : ADbI<0b11100, 0b00, 0, 0,
967 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
968 IIC_fpMAC64, "vmla", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +0000969 [(set DPR:$Dd, (fadd_mlx (fmul_su DPR:$Dn, DPR:$Dm),
970 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +0000971 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +0000972 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000973
Bill Wendling69661192010-11-01 06:00:39 +0000974def VMLAS : ASbIn<0b11100, 0b00, 0, 0,
975 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
976 IIC_fpMAC32, "vmla", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +0000977 [(set SPR:$Sd, (fadd_mlx (fmul_su SPR:$Sn, SPR:$Sm),
978 SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +0000979 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +0000980 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000981 // Some single precision VFP instructions may be executed on both NEON and
982 // VFP pipelines on A8.
983 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000984}
Evan Chenga8e29892007-01-19 07:51:42 +0000985
Evan Cheng48575f62010-12-05 22:04:16 +0000986def : Pat<(fadd_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
Evan Cheng529916c2010-11-12 20:32:20 +0000987 (VMLAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +0000988 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +0000989def : Pat<(fadd_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
Evan Cheng529916c2010-11-12 20:32:20 +0000990 (VMLAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +0000991 Requires<[HasVFP2,DontUseNEONForFP, UseFPVMLx,DontUseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000992
Evan Cheng529916c2010-11-12 20:32:20 +0000993def VMLSD : ADbI<0b11100, 0b00, 1, 0,
994 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
995 IIC_fpMAC64, "vmls", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +0000996 [(set DPR:$Dd, (fadd_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
997 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +0000998 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +0000999 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +00001000
Bill Wendling69661192010-11-01 06:00:39 +00001001def VMLSS : ASbIn<0b11100, 0b00, 1, 0,
1002 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1003 IIC_fpMAC32, "vmls", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +00001004 [(set SPR:$Sd, (fadd_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1005 SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001006 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001007 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +00001008 // Some single precision VFP instructions may be executed on both NEON and
1009 // VFP pipelines on A8.
1010 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +00001011}
Evan Chenga8e29892007-01-19 07:51:42 +00001012
Evan Cheng48575f62010-12-05 22:04:16 +00001013def : Pat<(fsub_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
Evan Cheng529916c2010-11-12 20:32:20 +00001014 (VMLSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001015 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +00001016def : Pat<(fsub_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
Evan Cheng529916c2010-11-12 20:32:20 +00001017 (VMLSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001018 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]>;
David Goodwinb84f3d42009-08-04 18:44:29 +00001019
Evan Cheng529916c2010-11-12 20:32:20 +00001020def VNMLAD : ADbI<0b11100, 0b01, 1, 0,
1021 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1022 IIC_fpMAC64, "vnmla", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +00001023 [(set DPR:$Dd,(fsub_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
1024 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001025 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001026 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +00001027
Bill Wendling69661192010-11-01 06:00:39 +00001028def VNMLAS : ASbI<0b11100, 0b01, 1, 0,
1029 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1030 IIC_fpMAC32, "vnmla", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +00001031 [(set SPR:$Sd, (fsub_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1032 SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001033 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001034 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +00001035 // Some single precision VFP instructions may be executed on both NEON and
1036 // VFP pipelines on A8.
1037 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +00001038}
Bill Wendling88cf0382010-10-14 01:02:08 +00001039
Evan Cheng48575f62010-12-05 22:04:16 +00001040def : Pat<(fsub_mlx (fneg (fmul_su DPR:$a, (f64 DPR:$b))), DPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001041 (VNMLAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001042 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +00001043def : Pat<(fsub_mlx (fneg (fmul_su SPR:$a, SPR:$b)), SPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001044 (VNMLAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001045 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +00001046
Evan Cheng529916c2010-11-12 20:32:20 +00001047def VNMLSD : ADbI<0b11100, 0b01, 0, 0,
1048 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1049 IIC_fpMAC64, "vnmls", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +00001050 [(set DPR:$Dd, (fsub_mlx (fmul_su DPR:$Dn, DPR:$Dm),
1051 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001052 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001053 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +00001054
Bill Wendling69661192010-11-01 06:00:39 +00001055def VNMLSS : ASbI<0b11100, 0b01, 0, 0,
1056 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1057 IIC_fpMAC32, "vnmls", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +00001058 [(set SPR:$Sd, (fsub_mlx (fmul_su SPR:$Sn, SPR:$Sm), SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001059 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001060 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +00001061 // Some single precision VFP instructions may be executed on both NEON and
1062 // VFP pipelines on A8.
1063 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +00001064}
Bill Wendling88cf0382010-10-14 01:02:08 +00001065
Evan Cheng48575f62010-12-05 22:04:16 +00001066def : Pat<(fsub_mlx (fmul_su DPR:$a, (f64 DPR:$b)), DPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001067 (VNMLSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001068 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +00001069def : Pat<(fsub_mlx (fmul_su SPR:$a, SPR:$b), SPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001070 (VNMLSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001071 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +00001072
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001073//===----------------------------------------------------------------------===//
1074// Fused FP Multiply-Accumulate Operations.
1075//
1076def VFMAD : ADbI<0b11101, 0b10, 0, 0,
1077 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1078 IIC_fpFMAC64, "vfma", ".f64\t$Dd, $Dn, $Dm",
1079 [(set DPR:$Dd, (fadd_mlx (fmul_su DPR:$Dn, DPR:$Dm),
1080 (f64 DPR:$Ddin)))]>,
1081 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001082 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001083
1084def VFMAS : ASbIn<0b11101, 0b10, 0, 0,
1085 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1086 IIC_fpFMAC32, "vfma", ".f32\t$Sd, $Sn, $Sm",
1087 [(set SPR:$Sd, (fadd_mlx (fmul_su SPR:$Sn, SPR:$Sm),
1088 SPR:$Sdin))]>,
1089 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001090 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001091 // Some single precision VFP instructions may be executed on both NEON and
1092 // VFP pipelines.
1093}
1094
1095def : Pat<(fadd_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
1096 (VFMAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001097 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001098def : Pat<(fadd_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
1099 (VFMAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001100 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001101
Evan Cheng3aef2ff2012-04-10 21:40:28 +00001102// Match @llvm.fma.* intrinsics
Lang Hames77878002012-04-27 18:51:24 +00001103// (fma x, y, z) -> (vfms z, x, y)
1104def : Pat<(f64 (fma DPR:$Dn, DPR:$Dm, DPR:$Ddin)),
Evan Cheng3aef2ff2012-04-10 21:40:28 +00001105 (VFMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1106 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001107def : Pat<(f32 (fma SPR:$Sn, SPR:$Sm, SPR:$Sdin)),
Evan Cheng3aef2ff2012-04-10 21:40:28 +00001108 (VFMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1109 Requires<[HasVFP4]>;
1110
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001111def VFMSD : ADbI<0b11101, 0b10, 1, 0,
1112 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1113 IIC_fpFMAC64, "vfms", ".f64\t$Dd, $Dn, $Dm",
1114 [(set DPR:$Dd, (fadd_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
1115 (f64 DPR:$Ddin)))]>,
1116 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001117 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001118
1119def VFMSS : ASbIn<0b11101, 0b10, 1, 0,
1120 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1121 IIC_fpFMAC32, "vfms", ".f32\t$Sd, $Sn, $Sm",
1122 [(set SPR:$Sd, (fadd_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1123 SPR:$Sdin))]>,
1124 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001125 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001126 // Some single precision VFP instructions may be executed on both NEON and
1127 // VFP pipelines.
1128}
1129
1130def : Pat<(fsub_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
1131 (VFMSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001132 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001133def : Pat<(fsub_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
1134 (VFMSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001135 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001136
Evan Cheng14b4c032012-04-11 06:59:47 +00001137// Match @llvm.fma.* intrinsics
Lang Hames77878002012-04-27 18:51:24 +00001138// (fma (fneg x), y, z) -> (vfms z, x, y)
1139def : Pat<(f64 (fma (fneg DPR:$Dn), DPR:$Dm, DPR:$Ddin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001140 (VFMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1141 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001142def : Pat<(f32 (fma (fneg SPR:$Sn), SPR:$Sm, SPR:$Sdin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001143 (VFMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1144 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001145// (fma x, (fneg y), z) -> (vfms z, x, y)
1146def : Pat<(f64 (fma DPR:$Dn, (fneg DPR:$Dm), DPR:$Ddin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001147 (VFMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1148 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001149def : Pat<(f32 (fma SPR:$Sn, (fneg SPR:$Sm), SPR:$Sdin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001150 (VFMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1151 Requires<[HasVFP4]>;
1152
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001153def VFNMAD : ADbI<0b11101, 0b01, 1, 0,
1154 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1155 IIC_fpFMAC64, "vfnma", ".f64\t$Dd, $Dn, $Dm",
1156 [(set DPR:$Dd,(fsub_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
1157 (f64 DPR:$Ddin)))]>,
1158 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001159 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001160
1161def VFNMAS : ASbI<0b11101, 0b01, 1, 0,
1162 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1163 IIC_fpFMAC32, "vfnma", ".f32\t$Sd, $Sn, $Sm",
1164 [(set SPR:$Sd, (fsub_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1165 SPR:$Sdin))]>,
1166 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001167 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001168 // Some single precision VFP instructions may be executed on both NEON and
1169 // VFP pipelines.
1170}
1171
1172def : Pat<(fsub_mlx (fneg (fmul_su DPR:$a, (f64 DPR:$b))), DPR:$dstin),
1173 (VFNMAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001174 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001175def : Pat<(fsub_mlx (fneg (fmul_su SPR:$a, SPR:$b)), SPR:$dstin),
1176 (VFNMAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001177 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001178
Evan Cheng92c90452012-04-11 01:21:25 +00001179// Match @llvm.fma.* intrinsics
Lang Hames77878002012-04-27 18:51:24 +00001180// (fneg (fma x, y, z)) -> (vfnma z, x, y)
1181def : Pat<(fneg (fma (f64 DPR:$Dn), (f64 DPR:$Dm), (f64 DPR:$Ddin))),
Evan Cheng92c90452012-04-11 01:21:25 +00001182 (VFNMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1183 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001184def : Pat<(fneg (fma (f32 SPR:$Sn), (f32 SPR:$Sm), (f32 SPR:$Sdin))),
Evan Cheng92c90452012-04-11 01:21:25 +00001185 (VFNMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1186 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001187// (fma (fneg x), y, (fneg z)) -> (vfnma z, x, y)
1188def : Pat<(f64 (fma (fneg DPR:$Dn), DPR:$Dm, (fneg DPR:$Ddin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001189 (VFNMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1190 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001191def : Pat<(f32 (fma (fneg SPR:$Sn), SPR:$Sm, (fneg SPR:$Sdin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001192 (VFNMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1193 Requires<[HasVFP4]>;
Evan Cheng92c90452012-04-11 01:21:25 +00001194
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001195def VFNMSD : ADbI<0b11101, 0b01, 0, 0,
1196 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1197 IIC_fpFMAC64, "vfnms", ".f64\t$Dd, $Dn, $Dm",
1198 [(set DPR:$Dd, (fsub_mlx (fmul_su DPR:$Dn, DPR:$Dm),
1199 (f64 DPR:$Ddin)))]>,
1200 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001201 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001202
1203def VFNMSS : ASbI<0b11101, 0b01, 0, 0,
1204 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1205 IIC_fpFMAC32, "vfnms", ".f32\t$Sd, $Sn, $Sm",
1206 [(set SPR:$Sd, (fsub_mlx (fmul_su SPR:$Sn, SPR:$Sm), SPR:$Sdin))]>,
1207 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001208 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001209 // Some single precision VFP instructions may be executed on both NEON and
1210 // VFP pipelines.
1211}
1212
1213def : Pat<(fsub_mlx (fmul_su DPR:$a, (f64 DPR:$b)), DPR:$dstin),
1214 (VFNMSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001215 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001216def : Pat<(fsub_mlx (fmul_su SPR:$a, SPR:$b), SPR:$dstin),
1217 (VFNMSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001218 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +00001219
Evan Cheng14b4c032012-04-11 06:59:47 +00001220// Match @llvm.fma.* intrinsics
Lang Hamesdc13d2e2012-06-21 06:10:00 +00001221
1222// (fma x, y, (fneg z)) -> (vfnms z, x, y))
1223def : Pat<(f64 (fma DPR:$Dn, DPR:$Dm, (fneg DPR:$Ddin))),
1224 (VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1225 Requires<[HasVFP4]>;
1226def : Pat<(f32 (fma SPR:$Sn, SPR:$Sm, (fneg SPR:$Sdin))),
1227 (VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1228 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001229// (fneg (fma (fneg x), y, z)) -> (vfnms z, x, y)
1230def : Pat<(fneg (f64 (fma (fneg DPR:$Dn), DPR:$Dm, DPR:$Ddin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001231 (VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1232 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001233def : Pat<(fneg (f32 (fma (fneg SPR:$Sn), SPR:$Sm, SPR:$Sdin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001234 (VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1235 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001236// (fneg (fma x, (fneg y), z) -> (vfnms z, x, y)
1237def : Pat<(fneg (f64 (fma DPR:$Dn, (fneg DPR:$Dm), DPR:$Ddin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001238 (VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1239 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001240def : Pat<(fneg (f32 (fma SPR:$Sn, (fneg SPR:$Sm), SPR:$Sdin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001241 (VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1242 Requires<[HasVFP4]>;
1243
Evan Chenga8e29892007-01-19 07:51:42 +00001244//===----------------------------------------------------------------------===//
1245// FP Conditional moves.
1246//
1247
Evan Cheng020cc1b2010-05-13 00:16:46 +00001248let neverHasSideEffects = 1 in {
Jim Grosbachf219f312011-03-11 23:09:50 +00001249def VMOVDcc : ARMPseudoInst<(outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm, pred:$p),
Owen Anderson16884412011-07-13 23:22:26 +00001250 4, IIC_fpUNA64,
Bill Wendling69661192010-11-01 06:00:39 +00001251 [/*(set DPR:$Dd, (ARMcmov DPR:$Dn, DPR:$Dm, imm:$cc))*/]>,
1252 RegConstraint<"$Dn = $Dd">;
Evan Chenga8e29892007-01-19 07:51:42 +00001253
Jim Grosbachf219f312011-03-11 23:09:50 +00001254def VMOVScc : ARMPseudoInst<(outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm, pred:$p),
Owen Anderson16884412011-07-13 23:22:26 +00001255 4, IIC_fpUNA32,
Bill Wendling69661192010-11-01 06:00:39 +00001256 [/*(set SPR:$Sd, (ARMcmov SPR:$Sn, SPR:$Sm, imm:$cc))*/]>,
1257 RegConstraint<"$Sn = $Sd">;
Evan Cheng020cc1b2010-05-13 00:16:46 +00001258} // neverHasSideEffects
Evan Cheng78be83d2008-11-11 19:40:26 +00001259
1260//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001261// Move from VFP System Register to ARM core register.
Evan Cheng78be83d2008-11-11 19:40:26 +00001262//
1263
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001264class MovFromVFP<bits<4> opc19_16, dag oops, dag iops, string opc, string asm,
1265 list<dag> pattern>:
1266 VFPAI<oops, iops, VFPMiscFrm, IIC_fpSTAT, opc, asm, pattern> {
Evan Cheng39382422009-10-28 01:44:26 +00001267
Bill Wendling88cf0382010-10-14 01:02:08 +00001268 // Instruction operand.
1269 bits<4> Rt;
1270
Johnny Chenc9745042010-02-09 22:35:38 +00001271 let Inst{27-20} = 0b11101111;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001272 let Inst{19-16} = opc19_16;
1273 let Inst{15-12} = Rt;
Johnny Chenc9745042010-02-09 22:35:38 +00001274 let Inst{11-8} = 0b1010;
1275 let Inst{7} = 0;
Bill Wendling88cf0382010-10-14 01:02:08 +00001276 let Inst{6-5} = 0b00;
Johnny Chenc9745042010-02-09 22:35:38 +00001277 let Inst{4} = 1;
Bill Wendling88cf0382010-10-14 01:02:08 +00001278 let Inst{3-0} = 0b0000;
Johnny Chenc9745042010-02-09 22:35:38 +00001279}
Johnny Chenc9745042010-02-09 22:35:38 +00001280
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001281// APSR is the application level alias of CPSR. This FPSCR N, Z, C, V flags
1282// to APSR.
Lang Hames4f92b5e2012-03-06 00:19:55 +00001283let Defs = [CPSR], Uses = [FPSCR_NZCV], Rt = 0b1111 /* apsr_nzcv */ in
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001284def FMSTAT : MovFromVFP<0b0001 /* fpscr */, (outs), (ins),
Jim Grosbachb84ad4a2012-03-15 21:34:14 +00001285 "vmrs", "\tAPSR_nzcv, fpscr", [(arm_fmstat)]>;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001286
1287// Application level FPSCR -> GPR
1288let hasSideEffects = 1, Uses = [FPSCR] in
1289def VMRS : MovFromVFP<0b0001 /* fpscr */, (outs GPR:$Rt), (ins),
1290 "vmrs", "\t$Rt, fpscr",
1291 [(set GPR:$Rt, (int_arm_get_fpscr))]>;
1292
1293// System level FPEXC, FPSID -> GPR
1294let Uses = [FPSCR] in {
1295 def VMRS_FPEXC : MovFromVFP<0b1000 /* fpexc */, (outs GPR:$Rt), (ins),
1296 "vmrs", "\t$Rt, fpexc", []>;
1297 def VMRS_FPSID : MovFromVFP<0b0000 /* fpsid */, (outs GPR:$Rt), (ins),
1298 "vmrs", "\t$Rt, fpsid", []>;
Jim Grosbach9426ac72012-03-16 00:27:18 +00001299 def VMRS_MVFR0 : MovFromVFP<0b0111 /* mvfr0 */, (outs GPR:$Rt), (ins),
1300 "vmrs", "\t$Rt, mvfr0", []>;
1301 def VMRS_MVFR1 : MovFromVFP<0b0110 /* mvfr1 */, (outs GPR:$Rt), (ins),
1302 "vmrs", "\t$Rt, mvfr1", []>;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001303}
1304
1305//===----------------------------------------------------------------------===//
1306// Move from ARM core register to VFP System Register.
1307//
1308
1309class MovToVFP<bits<4> opc19_16, dag oops, dag iops, string opc, string asm,
1310 list<dag> pattern>:
1311 VFPAI<oops, iops, VFPMiscFrm, IIC_fpSTAT, opc, asm, pattern> {
1312
Bill Wendling88cf0382010-10-14 01:02:08 +00001313 // Instruction operand.
1314 bits<4> src;
1315
1316 // Encode instruction operand.
1317 let Inst{15-12} = src;
1318
Johnny Chenc9745042010-02-09 22:35:38 +00001319 let Inst{27-20} = 0b11101110;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001320 let Inst{19-16} = opc19_16;
Johnny Chenc9745042010-02-09 22:35:38 +00001321 let Inst{11-8} = 0b1010;
1322 let Inst{7} = 0;
1323 let Inst{4} = 1;
1324}
Evan Cheng39382422009-10-28 01:44:26 +00001325
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001326let Defs = [FPSCR] in {
1327 // Application level GPR -> FPSCR
1328 def VMSR : MovToVFP<0b0001 /* fpscr */, (outs), (ins GPR:$src),
1329 "vmsr", "\tfpscr, $src", [(int_arm_set_fpscr GPR:$src)]>;
1330 // System level GPR -> FPEXC
1331 def VMSR_FPEXC : MovToVFP<0b1000 /* fpexc */, (outs), (ins GPR:$src),
1332 "vmsr", "\tfpexc, $src", []>;
1333 // System level GPR -> FPSID
1334 def VMSR_FPSID : MovToVFP<0b0000 /* fpsid */, (outs), (ins GPR:$src),
1335 "vmsr", "\tfpsid, $src", []>;
1336}
1337
1338//===----------------------------------------------------------------------===//
1339// Misc.
1340//
1341
Evan Cheng39382422009-10-28 01:44:26 +00001342// Materialize FP immediates. VFP3 only.
Jim Grosbache5165492009-11-09 00:11:35 +00001343let isReMaterializable = 1 in {
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001344def FCONSTD : VFPAI<(outs DPR:$Dd), (ins vfp_f64imm:$imm),
Anton Korobeynikov63401e32010-04-07 18:19:56 +00001345 VFPMiscFrm, IIC_fpUNA64,
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001346 "vmov", ".f64\t$Dd, $imm",
1347 [(set DPR:$Dd, vfp_f64imm:$imm)]>, Requires<[HasVFP3]> {
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001348 bits<5> Dd;
1349 bits<8> imm;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001350
Jim Grosbache5165492009-11-09 00:11:35 +00001351 let Inst{27-23} = 0b11101;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001352 let Inst{22} = Dd{4};
Jim Grosbache5165492009-11-09 00:11:35 +00001353 let Inst{21-20} = 0b11;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001354 let Inst{19-16} = imm{7-4};
1355 let Inst{15-12} = Dd{3-0};
Jim Grosbache5165492009-11-09 00:11:35 +00001356 let Inst{11-9} = 0b101;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001357 let Inst{8} = 1; // Double precision.
Jim Grosbache5165492009-11-09 00:11:35 +00001358 let Inst{7-4} = 0b0000;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001359 let Inst{3-0} = imm{3-0};
Jim Grosbache5165492009-11-09 00:11:35 +00001360}
1361
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001362def FCONSTS : VFPAI<(outs SPR:$Sd), (ins vfp_f32imm:$imm),
1363 VFPMiscFrm, IIC_fpUNA32,
1364 "vmov", ".f32\t$Sd, $imm",
1365 [(set SPR:$Sd, vfp_f32imm:$imm)]>, Requires<[HasVFP3]> {
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001366 bits<5> Sd;
1367 bits<8> imm;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001368
Evan Cheng39382422009-10-28 01:44:26 +00001369 let Inst{27-23} = 0b11101;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001370 let Inst{22} = Sd{0};
Evan Cheng39382422009-10-28 01:44:26 +00001371 let Inst{21-20} = 0b11;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001372 let Inst{19-16} = imm{7-4};
1373 let Inst{15-12} = Sd{4-1};
Evan Cheng39382422009-10-28 01:44:26 +00001374 let Inst{11-9} = 0b101;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001375 let Inst{8} = 0; // Single precision.
Evan Cheng39382422009-10-28 01:44:26 +00001376 let Inst{7-4} = 0b0000;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001377 let Inst{3-0} = imm{3-0};
Evan Cheng39382422009-10-28 01:44:26 +00001378}
Evan Cheng39382422009-10-28 01:44:26 +00001379}
Jim Grosbach5cd5ac62011-10-03 21:12:43 +00001380
1381//===----------------------------------------------------------------------===//
1382// Assembler aliases.
1383//
Jim Grosbach67ca1ad2011-12-08 00:49:29 +00001384// A few mnemnoic aliases for pre-unifixed syntax. We don't guarantee to
1385// support them all, but supporting at least some of the basics is
1386// good to be friendly.
Jim Grosbach21d7fb82011-12-09 23:34:09 +00001387def : VFP2MnemonicAlias<"flds", "vldr">;
1388def : VFP2MnemonicAlias<"fldd", "vldr">;
1389def : VFP2MnemonicAlias<"fmrs", "vmov">;
1390def : VFP2MnemonicAlias<"fmsr", "vmov">;
1391def : VFP2MnemonicAlias<"fsqrts", "vsqrt">;
1392def : VFP2MnemonicAlias<"fsqrtd", "vsqrt">;
1393def : VFP2MnemonicAlias<"fadds", "vadd.f32">;
1394def : VFP2MnemonicAlias<"faddd", "vadd.f64">;
1395def : VFP2MnemonicAlias<"fmrdd", "vmov">;
1396def : VFP2MnemonicAlias<"fmrds", "vmov">;
1397def : VFP2MnemonicAlias<"fmrrd", "vmov">;
1398def : VFP2MnemonicAlias<"fmdrr", "vmov">;
Jim Grosbach68490192011-12-19 19:43:50 +00001399def : VFP2MnemonicAlias<"fmuls", "vmul.f32">;
Jim Grosbach21d7fb82011-12-09 23:34:09 +00001400def : VFP2MnemonicAlias<"fmuld", "vmul.f64">;
1401def : VFP2MnemonicAlias<"fnegs", "vneg.f32">;
1402def : VFP2MnemonicAlias<"fnegd", "vneg.f64">;
Jim Grosbach48171e72011-12-10 00:01:02 +00001403def : VFP2MnemonicAlias<"ftosizd", "vcvt.s32.f64">;
1404def : VFP2MnemonicAlias<"ftosid", "vcvtr.s32.f64">;
1405def : VFP2MnemonicAlias<"ftosizs", "vcvt.s32.f32">;
1406def : VFP2MnemonicAlias<"ftosis", "vcvtr.s32.f32">;
1407def : VFP2MnemonicAlias<"ftouizd", "vcvt.u32.f64">;
1408def : VFP2MnemonicAlias<"ftouid", "vcvtr.u32.f64">;
1409def : VFP2MnemonicAlias<"ftouizs", "vcvt.u32.f32">;
1410def : VFP2MnemonicAlias<"ftouis", "vcvtr.u32.f32">;
1411def : VFP2MnemonicAlias<"fsitod", "vcvt.f64.s32">;
1412def : VFP2MnemonicAlias<"fsitos", "vcvt.f32.s32">;
1413def : VFP2MnemonicAlias<"fuitod", "vcvt.f64.u32">;
1414def : VFP2MnemonicAlias<"fuitos", "vcvt.f32.u32">;
Jim Grosbachf1015402011-12-13 20:13:48 +00001415def : VFP2MnemonicAlias<"fsts", "vstr">;
1416def : VFP2MnemonicAlias<"fstd", "vstr">;
Jim Grosbach0f293de2011-12-13 20:40:37 +00001417def : VFP2MnemonicAlias<"fmacd", "vmla.f64">;
1418def : VFP2MnemonicAlias<"fmacs", "vmla.f32">;
Jim Grosbach9c397892011-12-19 19:02:41 +00001419def : VFP2MnemonicAlias<"fcpys", "vmov.f32">;
1420def : VFP2MnemonicAlias<"fcpyd", "vmov.f64">;
Jim Grosbach1aa149f2011-12-22 19:20:45 +00001421def : VFP2MnemonicAlias<"fcmps", "vcmp.f32">;
1422def : VFP2MnemonicAlias<"fcmpd", "vcmp.f64">;
Jim Grosbach9c397892011-12-19 19:02:41 +00001423def : VFP2MnemonicAlias<"fdivs", "vdiv.f32">;
1424def : VFP2MnemonicAlias<"fdivd", "vdiv.f64">;
Jim Grosbach66cba302012-03-16 21:06:13 +00001425def : VFP2MnemonicAlias<"fmrx", "vmrs">;
1426def : VFP2MnemonicAlias<"fmxr", "vmsr">;
Jim Grosbach67ca1ad2011-12-08 00:49:29 +00001427
Jim Grosbach6357cae2012-03-15 20:48:18 +00001428// Be friendly and accept the old form of zero-compare
1429def : VFP2InstAlias<"fcmpzd${p} $val", (VCMPZD DPR:$val, pred:$p)>;
1430def : VFP2InstAlias<"fcmpzs${p} $val", (VCMPZS SPR:$val, pred:$p)>;
1431
1432
Jim Grosbach5cd5ac62011-10-03 21:12:43 +00001433def : VFP2InstAlias<"fmstat${p}", (FMSTAT pred:$p)>;
Jim Grosbach48171e72011-12-10 00:01:02 +00001434def : VFP2InstAlias<"fadds${p} $Sd, $Sn, $Sm",
1435 (VADDS SPR:$Sd, SPR:$Sn, SPR:$Sm, pred:$p)>;
1436def : VFP2InstAlias<"faddd${p} $Dd, $Dn, $Dm",
1437 (VADDD DPR:$Dd, DPR:$Dn, DPR:$Dm, pred:$p)>;
1438def : VFP2InstAlias<"fsubs${p} $Sd, $Sn, $Sm",
1439 (VSUBS SPR:$Sd, SPR:$Sn, SPR:$Sm, pred:$p)>;
1440def : VFP2InstAlias<"fsubd${p} $Dd, $Dn, $Dm",
1441 (VSUBD DPR:$Dd, DPR:$Dn, DPR:$Dm, pred:$p)>;
Jim Grosbach5cd5ac62011-10-03 21:12:43 +00001442
Jim Grosbach976c0da2011-12-08 22:51:25 +00001443// No need for the size suffix on VSQRT. It's implied by the register classes.
1444def : VFP2InstAlias<"vsqrt${p} $Sd, $Sm", (VSQRTS SPR:$Sd, SPR:$Sm, pred:$p)>;
1445def : VFP2InstAlias<"vsqrt${p} $Dd, $Dm", (VSQRTD DPR:$Dd, DPR:$Dm, pred:$p)>;
1446
Jim Grosbachffc658b2011-11-14 23:03:21 +00001447// VLDR/VSTR accept an optional type suffix.
Jim Grosbach1ceef1a2011-12-07 01:50:36 +00001448def : VFP2InstAlias<"vldr${p}.32 $Sd, $addr",
1449 (VLDRS SPR:$Sd, addrmode5:$addr, pred:$p)>;
1450def : VFP2InstAlias<"vstr${p}.32 $Sd, $addr",
1451 (VSTRS SPR:$Sd, addrmode5:$addr, pred:$p)>;
1452def : VFP2InstAlias<"vldr${p}.64 $Dd, $addr",
1453 (VLDRD DPR:$Dd, addrmode5:$addr, pred:$p)>;
1454def : VFP2InstAlias<"vstr${p}.64 $Dd, $addr",
1455 (VSTRD DPR:$Dd, addrmode5:$addr, pred:$p)>;
Jim Grosbachbfb0a172011-11-15 20:14:51 +00001456
Jim Grosbachaf33a0c2011-12-21 23:24:15 +00001457// VMOV can accept optional 32-bit or less data type suffix suffix.
1458def : VFP2InstAlias<"vmov${p}.8 $Rt, $Sn",
Jim Grosbacha68e90c2011-11-15 20:29:42 +00001459 (VMOVRS GPR:$Rt, SPR:$Sn, pred:$p)>;
Jim Grosbachaf33a0c2011-12-21 23:24:15 +00001460def : VFP2InstAlias<"vmov${p}.16 $Rt, $Sn",
1461 (VMOVRS GPR:$Rt, SPR:$Sn, pred:$p)>;
1462def : VFP2InstAlias<"vmov${p}.32 $Rt, $Sn",
1463 (VMOVRS GPR:$Rt, SPR:$Sn, pred:$p)>;
1464def : VFP2InstAlias<"vmov${p}.8 $Sn, $Rt",
1465 (VMOVSR SPR:$Sn, GPR:$Rt, pred:$p)>;
1466def : VFP2InstAlias<"vmov${p}.16 $Sn, $Rt",
1467 (VMOVSR SPR:$Sn, GPR:$Rt, pred:$p)>;
1468def : VFP2InstAlias<"vmov${p}.32 $Sn, $Rt",
Jim Grosbacha68e90c2011-11-15 20:29:42 +00001469 (VMOVSR SPR:$Sn, GPR:$Rt, pred:$p)>;
1470
1471def : VFP2InstAlias<"vmov${p}.f64 $Rt, $Rt2, $Dn",
1472 (VMOVRRD GPR:$Rt, GPR:$Rt2, DPR:$Dn, pred:$p)>;
1473def : VFP2InstAlias<"vmov${p}.f64 $Dn, $Rt, $Rt2",
1474 (VMOVDRR DPR:$Dn, GPR:$Rt, GPR:$Rt2, pred:$p)>;
Jim Grosbacheaf20562011-11-15 21:18:35 +00001475
1476// VMOVS doesn't need the .f32 to disambiguate from the NEON encoding the way
1477// VMOVD does.
1478def : VFP2InstAlias<"vmov${p} $Sd, $Sm",
1479 (VMOVS SPR:$Sd, SPR:$Sm, pred:$p)>;