blob: eb7eaa6c970816f696b6e718cac9e0238aa97402 [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
Bob Wilson76a312b2010-03-19 22:51:32 +0000453def : ARMPat<(f32_to_f16 SPR:$a),
454 (i32 (COPY_TO_REGCLASS (VCVTBSH SPR:$a), GPR))>;
Johnny Chen2d658df2010-02-09 17:21:56 +0000455
Bob Wilson76a312b2010-03-19 22:51:32 +0000456def : ARMPat<(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
526def VMOVSR : AVConv4I<0b11100000, 0b1010,
527 (outs SPR:$Sn), (ins GPR:$Rt),
528 IIC_fpMOVIS, "vmov", "\t$Sn, $Rt",
529 [(set SPR:$Sn, (bitconvert GPR:$Rt))]> {
530 // Instruction operands.
531 bits<5> Sn;
532 bits<4> Rt;
533
534 // Encode instruction operands.
535 let Inst{19-16} = Sn{4-1};
536 let Inst{7} = Sn{0};
537 let Inst{15-12} = Rt;
538
539 let Inst{6-5} = 0b00;
540 let Inst{3-0} = 0b0000;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000541
542 // Some single precision VFP instructions may be executed on both NEON and VFP
543 // pipelines.
544 let D = VFPNeonDomain;
Bill Wendling7d31a162010-10-20 22:44:54 +0000545}
Evan Chenga8e29892007-01-19 07:51:42 +0000546
Evan Cheng020cc1b2010-05-13 00:16:46 +0000547let neverHasSideEffects = 1 in {
Jim Grosbache5165492009-11-09 00:11:35 +0000548def VMOVRRD : AVConv3I<0b11000101, 0b1011,
Bill Wendling01aabda2010-10-20 23:37:40 +0000549 (outs GPR:$Rt, GPR:$Rt2), (ins DPR:$Dm),
550 IIC_fpMOVDI, "vmov", "\t$Rt, $Rt2, $Dm",
Johnny Chen7acca672010-02-05 18:04:58 +0000551 [/* FIXME: Can't write pattern for multiple result instr*/]> {
Bill Wendling01aabda2010-10-20 23:37:40 +0000552 // Instruction operands.
553 bits<5> Dm;
554 bits<4> Rt;
555 bits<4> Rt2;
556
557 // Encode instruction operands.
558 let Inst{3-0} = Dm{3-0};
559 let Inst{5} = Dm{4};
560 let Inst{15-12} = Rt;
561 let Inst{19-16} = Rt2;
562
Johnny Chen7acca672010-02-05 18:04:58 +0000563 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000564
565 // Some single precision VFP instructions may be executed on both NEON and VFP
566 // pipelines.
567 let D = VFPNeonDomain;
Johnny Chen7acca672010-02-05 18:04:58 +0000568}
Evan Chenga8e29892007-01-19 07:51:42 +0000569
Johnny Chen23401d62010-02-08 17:26:09 +0000570def VMOVRRS : AVConv3I<0b11000101, 0b1010,
Owen Anderson694e0ff2011-08-29 23:15:25 +0000571 (outs GPR:$Rt, GPR:$Rt2), (ins SPR:$src1, SPR:$src2),
572 IIC_fpMOVDI, "vmov", "\t$Rt, $Rt2, $src1, $src2",
Johnny Chen23401d62010-02-08 17:26:09 +0000573 [/* For disassembly only; pattern left blank */]> {
Owen Anderson694e0ff2011-08-29 23:15:25 +0000574 bits<5> src1;
575 bits<4> Rt;
576 bits<4> Rt2;
577
578 // Encode instruction operands.
Richard Bartonfae96f12012-07-10 12:51:09 +0000579 let Inst{3-0} = src1{4-1};
580 let Inst{5} = src1{0};
Owen Anderson694e0ff2011-08-29 23:15:25 +0000581 let Inst{15-12} = Rt;
582 let Inst{19-16} = Rt2;
583
Johnny Chen23401d62010-02-08 17:26:09 +0000584 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000585
586 // Some single precision VFP instructions may be executed on both NEON and VFP
587 // pipelines.
588 let D = VFPNeonDomain;
Owen Anderson357ec682011-08-22 20:27:12 +0000589 let DecoderMethod = "DecodeVMOVRRS";
Johnny Chen23401d62010-02-08 17:26:09 +0000590}
Evan Cheng020cc1b2010-05-13 00:16:46 +0000591} // neverHasSideEffects
Johnny Chen23401d62010-02-08 17:26:09 +0000592
Evan Chenga8e29892007-01-19 07:51:42 +0000593// FMDHR: GPR -> SPR
594// FMDLR: GPR -> SPR
595
Jim Grosbache5165492009-11-09 00:11:35 +0000596def VMOVDRR : AVConv5I<0b11000100, 0b1011,
Bill Wendling01aabda2010-10-20 23:37:40 +0000597 (outs DPR:$Dm), (ins GPR:$Rt, GPR:$Rt2),
598 IIC_fpMOVID, "vmov", "\t$Dm, $Rt, $Rt2",
599 [(set DPR:$Dm, (arm_fmdrr GPR:$Rt, GPR:$Rt2))]> {
600 // Instruction operands.
601 bits<5> Dm;
602 bits<4> Rt;
603 bits<4> Rt2;
604
605 // Encode instruction operands.
606 let Inst{3-0} = Dm{3-0};
607 let Inst{5} = Dm{4};
608 let Inst{15-12} = Rt;
609 let Inst{19-16} = Rt2;
610
611 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000612
613 // Some single precision VFP instructions may be executed on both NEON and VFP
614 // pipelines.
615 let D = VFPNeonDomain;
Johnny Chen7acca672010-02-05 18:04:58 +0000616}
Evan Chenga8e29892007-01-19 07:51:42 +0000617
Evan Cheng020cc1b2010-05-13 00:16:46 +0000618let neverHasSideEffects = 1 in
Johnny Chen23401d62010-02-08 17:26:09 +0000619def VMOVSRR : AVConv5I<0b11000100, 0b1010,
620 (outs SPR:$dst1, SPR:$dst2), (ins GPR:$src1, GPR:$src2),
Anton Korobeynikova31c6fb2010-04-07 18:20:02 +0000621 IIC_fpMOVID, "vmov", "\t$dst1, $dst2, $src1, $src2",
Johnny Chen23401d62010-02-08 17:26:09 +0000622 [/* For disassembly only; pattern left blank */]> {
Owen Anderson694e0ff2011-08-29 23:15:25 +0000623 // Instruction operands.
624 bits<5> dst1;
625 bits<4> src1;
626 bits<4> src2;
627
628 // Encode instruction operands.
Richard Bartonfae96f12012-07-10 12:51:09 +0000629 let Inst{3-0} = dst1{4-1};
630 let Inst{5} = dst1{0};
Owen Anderson694e0ff2011-08-29 23:15:25 +0000631 let Inst{15-12} = src1;
632 let Inst{19-16} = src2;
633
Johnny Chen23401d62010-02-08 17:26:09 +0000634 let Inst{7-6} = 0b00;
Bob Wilsonb34d8372011-04-19 18:11:38 +0000635
636 // Some single precision VFP instructions may be executed on both NEON and VFP
637 // pipelines.
638 let D = VFPNeonDomain;
Owen Anderson357ec682011-08-22 20:27:12 +0000639
640 let DecoderMethod = "DecodeVMOVSRR";
Johnny Chen23401d62010-02-08 17:26:09 +0000641}
642
Evan Chenga8e29892007-01-19 07:51:42 +0000643// FMRDH: SPR -> GPR
644// FMRDL: SPR -> GPR
645// FMRRS: SPR -> GPR
Bill Wendling67a704d2010-10-13 20:58:46 +0000646// FMRX: SPR system reg -> GPR
Evan Chenga8e29892007-01-19 07:51:42 +0000647// FMSRR: GPR -> SPR
Bill Wendling67a704d2010-10-13 20:58:46 +0000648// FMXR: GPR -> VFP system reg
Evan Chenga8e29892007-01-19 07:51:42 +0000649
650
Bill Wendling67a704d2010-10-13 20:58:46 +0000651// Int -> FP:
Evan Chenga8e29892007-01-19 07:51:42 +0000652
Bill Wendling67a704d2010-10-13 20:58:46 +0000653class AVConv1IDs_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
654 bits<4> opcod4, dag oops, dag iops,
655 InstrItinClass itin, string opc, string asm,
656 list<dag> pattern>
657 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
658 pattern> {
659 // Instruction operands.
660 bits<5> Dd;
661 bits<5> Sm;
662
663 // Encode instruction operands.
664 let Inst{3-0} = Sm{4-1};
665 let Inst{5} = Sm{0};
666 let Inst{15-12} = Dd{3-0};
667 let Inst{22} = Dd{4};
668}
669
670class AVConv1InSs_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
671 bits<4> opcod4, dag oops, dag iops,InstrItinClass itin,
672 string opc, string asm, list<dag> pattern>
673 : AVConv1In<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
674 pattern> {
675 // Instruction operands.
676 bits<5> Sd;
677 bits<5> Sm;
678
679 // Encode instruction operands.
680 let Inst{3-0} = Sm{4-1};
681 let Inst{5} = Sm{0};
682 let Inst{15-12} = Sd{4-1};
683 let Inst{22} = Sd{0};
684}
685
686def VSITOD : AVConv1IDs_Encode<0b11101, 0b11, 0b1000, 0b1011,
687 (outs DPR:$Dd), (ins SPR:$Sm),
688 IIC_fpCVTID, "vcvt", ".f64.s32\t$Dd, $Sm",
689 [(set DPR:$Dd, (f64 (arm_sitof SPR:$Sm)))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000690 let Inst{7} = 1; // s32
Evan Cheng78be83d2008-11-11 19:40:26 +0000691}
Evan Chenga8e29892007-01-19 07:51:42 +0000692
Bill Wendling67a704d2010-10-13 20:58:46 +0000693def VSITOS : AVConv1InSs_Encode<0b11101, 0b11, 0b1000, 0b1010,
694 (outs SPR:$Sd),(ins SPR:$Sm),
695 IIC_fpCVTIS, "vcvt", ".f32.s32\t$Sd, $Sm",
696 [(set SPR:$Sd, (arm_sitof SPR:$Sm))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000697 let Inst{7} = 1; // s32
Evan Cheng5eda2822011-02-16 00:35:02 +0000698
Evan Cheng6557bce2011-02-22 19:53:14 +0000699 // Some single precision VFP instructions may be executed on both NEON and
700 // VFP pipelines on A8.
701 let D = VFPNeonA8Domain;
Evan Cheng78be83d2008-11-11 19:40:26 +0000702}
Evan Chenga8e29892007-01-19 07:51:42 +0000703
Bill Wendling67a704d2010-10-13 20:58:46 +0000704def VUITOD : AVConv1IDs_Encode<0b11101, 0b11, 0b1000, 0b1011,
705 (outs DPR:$Dd), (ins SPR:$Sm),
706 IIC_fpCVTID, "vcvt", ".f64.u32\t$Dd, $Sm",
707 [(set DPR:$Dd, (f64 (arm_uitof SPR:$Sm)))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000708 let Inst{7} = 0; // u32
709}
Evan Chenga8e29892007-01-19 07:51:42 +0000710
Bill Wendling67a704d2010-10-13 20:58:46 +0000711def VUITOS : AVConv1InSs_Encode<0b11101, 0b11, 0b1000, 0b1010,
712 (outs SPR:$Sd), (ins SPR:$Sm),
713 IIC_fpCVTIS, "vcvt", ".f32.u32\t$Sd, $Sm",
714 [(set SPR:$Sd, (arm_uitof SPR:$Sm))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000715 let Inst{7} = 0; // u32
Evan Cheng5eda2822011-02-16 00:35:02 +0000716
Evan Cheng6557bce2011-02-22 19:53:14 +0000717 // Some single precision VFP instructions may be executed on both NEON and
718 // VFP pipelines on A8.
719 let D = VFPNeonA8Domain;
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000720}
Evan Chenga8e29892007-01-19 07:51:42 +0000721
Bill Wendling67a704d2010-10-13 20:58:46 +0000722// FP -> Int:
723
724class AVConv1IsD_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
725 bits<4> opcod4, dag oops, dag iops,
726 InstrItinClass itin, string opc, string asm,
727 list<dag> pattern>
728 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
729 pattern> {
730 // Instruction operands.
731 bits<5> Sd;
732 bits<5> Dm;
733
734 // Encode instruction operands.
735 let Inst{3-0} = Dm{3-0};
736 let Inst{5} = Dm{4};
737 let Inst{15-12} = Sd{4-1};
738 let Inst{22} = Sd{0};
739}
740
741class AVConv1InsS_Encode<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3,
742 bits<4> opcod4, dag oops, dag iops,
743 InstrItinClass itin, string opc, string asm,
744 list<dag> pattern>
745 : AVConv1In<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
746 pattern> {
747 // Instruction operands.
748 bits<5> Sd;
749 bits<5> Sm;
750
751 // Encode instruction operands.
752 let Inst{3-0} = Sm{4-1};
753 let Inst{5} = Sm{0};
754 let Inst{15-12} = Sd{4-1};
755 let Inst{22} = Sd{0};
756}
757
Evan Chenga8e29892007-01-19 07:51:42 +0000758// Always set Z bit in the instruction, i.e. "round towards zero" variants.
Bill Wendling67a704d2010-10-13 20:58:46 +0000759def VTOSIZD : AVConv1IsD_Encode<0b11101, 0b11, 0b1101, 0b1011,
760 (outs SPR:$Sd), (ins DPR:$Dm),
761 IIC_fpCVTDI, "vcvt", ".s32.f64\t$Sd, $Dm",
762 [(set SPR:$Sd, (arm_ftosi (f64 DPR:$Dm)))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000763 let Inst{7} = 1; // Z bit
764}
Evan Chenga8e29892007-01-19 07:51:42 +0000765
Bill Wendling67a704d2010-10-13 20:58:46 +0000766def VTOSIZS : AVConv1InsS_Encode<0b11101, 0b11, 0b1101, 0b1010,
767 (outs SPR:$Sd), (ins SPR:$Sm),
768 IIC_fpCVTSI, "vcvt", ".s32.f32\t$Sd, $Sm",
769 [(set SPR:$Sd, (arm_ftosi SPR:$Sm))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000770 let Inst{7} = 1; // Z bit
Evan Cheng5eda2822011-02-16 00:35:02 +0000771
Evan Cheng6557bce2011-02-22 19:53:14 +0000772 // Some single precision VFP instructions may be executed on both NEON and
773 // VFP pipelines on A8.
774 let D = VFPNeonA8Domain;
Evan Cheng78be83d2008-11-11 19:40:26 +0000775}
Evan Chenga8e29892007-01-19 07:51:42 +0000776
Bill Wendling67a704d2010-10-13 20:58:46 +0000777def VTOUIZD : AVConv1IsD_Encode<0b11101, 0b11, 0b1100, 0b1011,
778 (outs SPR:$Sd), (ins DPR:$Dm),
779 IIC_fpCVTDI, "vcvt", ".u32.f64\t$Sd, $Dm",
780 [(set SPR:$Sd, (arm_ftoui (f64 DPR:$Dm)))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000781 let Inst{7} = 1; // Z bit
782}
Evan Chenga8e29892007-01-19 07:51:42 +0000783
Bill Wendling67a704d2010-10-13 20:58:46 +0000784def VTOUIZS : AVConv1InsS_Encode<0b11101, 0b11, 0b1100, 0b1010,
785 (outs SPR:$Sd), (ins SPR:$Sm),
786 IIC_fpCVTSI, "vcvt", ".u32.f32\t$Sd, $Sm",
787 [(set SPR:$Sd, (arm_ftoui SPR:$Sm))]> {
Evan Cheng78be83d2008-11-11 19:40:26 +0000788 let Inst{7} = 1; // Z bit
Evan Cheng5eda2822011-02-16 00:35:02 +0000789
Evan Cheng6557bce2011-02-22 19:53:14 +0000790 // Some single precision VFP instructions may be executed on both NEON and
791 // VFP pipelines on A8.
792 let D = VFPNeonA8Domain;
Evan Cheng78be83d2008-11-11 19:40:26 +0000793}
Evan Chenga8e29892007-01-19 07:51:42 +0000794
Johnny Chen15b423f2010-02-08 22:02:41 +0000795// And the Z bit '0' variants, i.e. use the rounding mode specified by FPSCR.
Nate Begemand1fb5832010-08-03 21:31:55 +0000796let Uses = [FPSCR] in {
Bill Wendling67a704d2010-10-13 20:58:46 +0000797// FIXME: Verify encoding after integrated assembler is working.
798def VTOSIRD : AVConv1IsD_Encode<0b11101, 0b11, 0b1101, 0b1011,
799 (outs SPR:$Sd), (ins DPR:$Dm),
800 IIC_fpCVTDI, "vcvtr", ".s32.f64\t$Sd, $Dm",
801 [(set SPR:$Sd, (int_arm_vcvtr (f64 DPR:$Dm)))]>{
Johnny Chen15b423f2010-02-08 22:02:41 +0000802 let Inst{7} = 0; // Z bit
803}
804
Bill Wendling67a704d2010-10-13 20:58:46 +0000805def VTOSIRS : AVConv1InsS_Encode<0b11101, 0b11, 0b1101, 0b1010,
806 (outs SPR:$Sd), (ins SPR:$Sm),
807 IIC_fpCVTSI, "vcvtr", ".s32.f32\t$Sd, $Sm",
808 [(set SPR:$Sd, (int_arm_vcvtr SPR:$Sm))]> {
Johnny Chen15b423f2010-02-08 22:02:41 +0000809 let Inst{7} = 0; // Z bit
810}
811
Bill Wendling67a704d2010-10-13 20:58:46 +0000812def VTOUIRD : AVConv1IsD_Encode<0b11101, 0b11, 0b1100, 0b1011,
813 (outs SPR:$Sd), (ins DPR:$Dm),
814 IIC_fpCVTDI, "vcvtr", ".u32.f64\t$Sd, $Dm",
Bill Wendling88cf0382010-10-14 01:02:08 +0000815 [(set SPR:$Sd, (int_arm_vcvtru(f64 DPR:$Dm)))]>{
Johnny Chen15b423f2010-02-08 22:02:41 +0000816 let Inst{7} = 0; // Z bit
817}
818
Bill Wendling67a704d2010-10-13 20:58:46 +0000819def VTOUIRS : AVConv1InsS_Encode<0b11101, 0b11, 0b1100, 0b1010,
820 (outs SPR:$Sd), (ins SPR:$Sm),
821 IIC_fpCVTSI, "vcvtr", ".u32.f32\t$Sd, $Sm",
822 [(set SPR:$Sd, (int_arm_vcvtru SPR:$Sm))]> {
Johnny Chen15b423f2010-02-08 22:02:41 +0000823 let Inst{7} = 0; // Z bit
824}
Nate Begemand1fb5832010-08-03 21:31:55 +0000825}
Johnny Chen15b423f2010-02-08 22:02:41 +0000826
Johnny Chen27bb8d02010-02-11 18:17:16 +0000827// Convert between floating-point and fixed-point
828// Data type for fixed-point naming convention:
829// S16 (U=0, sx=0) -> SH
830// U16 (U=1, sx=0) -> UH
831// S32 (U=0, sx=1) -> SL
832// U32 (U=1, sx=1) -> UL
833
Jim Grosbach8c748112011-12-22 19:45:01 +0000834let Constraints = "$a = $dst" in {
Johnny Chen27bb8d02010-02-11 18:17:16 +0000835
836// FP to Fixed-Point:
837
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000838// Single Precision register
Jim Grosbachc92ba4e2012-04-23 22:04:10 +0000839class AVConv1XInsS_Encode<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4,
840 bit op5, dag oops, dag iops, InstrItinClass itin,
841 string opc, string asm, list<dag> pattern>
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000842 : AVConv1XI<op1, op2, op3, op4, op5, oops, iops, itin, opc, asm, pattern> {
843 bits<5> dst;
844 // if dp_operation then UInt(D:Vd) else UInt(Vd:D);
845 let Inst{22} = dst{0};
846 let Inst{15-12} = dst{4-1};
847}
848
849// Double Precision register
Jim Grosbachc92ba4e2012-04-23 22:04:10 +0000850class AVConv1XInsD_Encode<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4,
851 bit op5, dag oops, dag iops, InstrItinClass itin,
852 string opc, string asm, list<dag> pattern>
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000853 : AVConv1XI<op1, op2, op3, op4, op5, oops, iops, itin, opc, asm, pattern> {
854 bits<5> dst;
855 // if dp_operation then UInt(D:Vd) else UInt(Vd:D);
856 let Inst{22} = dst{4};
857 let Inst{15-12} = dst{3-0};
858}
859
860def VTOSHS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1110, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000861 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000862 IIC_fpCVTSI, "vcvt", ".s16.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000863 // Some single precision VFP instructions may be executed on both NEON and
864 // VFP pipelines on A8.
865 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000866}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000867
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000868def VTOUHS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1111, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000869 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000870 IIC_fpCVTSI, "vcvt", ".u16.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000871 // Some single precision VFP instructions may be executed on both NEON and
872 // VFP pipelines on A8.
873 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000874}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000875
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000876def VTOSLS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1110, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000877 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000878 IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000879 // Some single precision VFP instructions may be executed on both NEON and
880 // VFP pipelines on A8.
881 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000882}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000883
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000884def VTOULS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1111, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000885 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000886 IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000887 // Some single precision VFP instructions may be executed on both NEON and
888 // VFP pipelines on A8.
889 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000890}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000891
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000892def VTOSHD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1110, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000893 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000894 IIC_fpCVTDI, "vcvt", ".s16.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000895
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000896def VTOUHD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1111, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000897 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000898 IIC_fpCVTDI, "vcvt", ".u16.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000899
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000900def VTOSLD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1110, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000901 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000902 IIC_fpCVTDI, "vcvt", ".s32.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000903
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000904def VTOULD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1111, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000905 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000906 IIC_fpCVTDI, "vcvt", ".u32.f64\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000907
908// Fixed-Point to FP:
909
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000910def VSHTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1010, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000911 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000912 IIC_fpCVTIS, "vcvt", ".f32.s16\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000913 // Some single precision VFP instructions may be executed on both NEON and
914 // VFP pipelines on A8.
915 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000916}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000917
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000918def VUHTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1011, 0b1010, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000919 (outs SPR:$dst), (ins SPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000920 IIC_fpCVTIS, "vcvt", ".f32.u16\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000921 // Some single precision VFP instructions may be executed on both NEON and
922 // VFP pipelines on A8.
923 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000924}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000925
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000926def VSLTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1010, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000927 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000928 IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000929 // Some single precision VFP instructions may be executed on both NEON and
930 // VFP pipelines on A8.
931 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000932}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000933
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000934def VULTOS : AVConv1XInsS_Encode<0b11101, 0b11, 0b1011, 0b1010, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000935 (outs SPR:$dst), (ins SPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000936 IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a, $fbits", []> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000937 // Some single precision VFP instructions may be executed on both NEON and
938 // VFP pipelines on A8.
939 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000940}
Johnny Chen27bb8d02010-02-11 18:17:16 +0000941
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000942def VSHTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1010, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000943 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000944 IIC_fpCVTID, "vcvt", ".f64.s16\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000945
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000946def VUHTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1011, 0b1011, 0,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000947 (outs DPR:$dst), (ins DPR:$a, fbits16:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000948 IIC_fpCVTID, "vcvt", ".f64.u16\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000949
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000950def VSLTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1010, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000951 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000952 IIC_fpCVTID, "vcvt", ".f64.s32\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000953
Kristof Beyls8a6bcc32012-03-15 17:50:29 +0000954def VULTOD : AVConv1XInsD_Encode<0b11101, 0b11, 0b1011, 0b1011, 1,
Jim Grosbach4050bc42011-12-22 22:19:05 +0000955 (outs DPR:$dst), (ins DPR:$a, fbits32:$fbits),
Jim Grosbach8c748112011-12-22 19:45:01 +0000956 IIC_fpCVTID, "vcvt", ".f64.u32\t$dst, $a, $fbits", []>;
Johnny Chen27bb8d02010-02-11 18:17:16 +0000957
Jim Grosbach8c748112011-12-22 19:45:01 +0000958} // End of 'let Constraints = "$a = $dst" in'
Johnny Chen27bb8d02010-02-11 18:17:16 +0000959
Evan Chenga8e29892007-01-19 07:51:42 +0000960//===----------------------------------------------------------------------===//
Cameron Zwarich375db7f2011-07-07 08:28:52 +0000961// FP Multiply-Accumulate Operations.
Evan Chenga8e29892007-01-19 07:51:42 +0000962//
963
Evan Cheng529916c2010-11-12 20:32:20 +0000964def VMLAD : ADbI<0b11100, 0b00, 0, 0,
965 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
966 IIC_fpMAC64, "vmla", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +0000967 [(set DPR:$Dd, (fadd_mlx (fmul_su DPR:$Dn, DPR:$Dm),
968 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +0000969 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +0000970 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000971
Bill Wendling69661192010-11-01 06:00:39 +0000972def VMLAS : ASbIn<0b11100, 0b00, 0, 0,
973 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
974 IIC_fpMAC32, "vmla", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +0000975 [(set SPR:$Sd, (fadd_mlx (fmul_su SPR:$Sn, SPR:$Sm),
976 SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +0000977 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +0000978 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +0000979 // Some single precision VFP instructions may be executed on both NEON and
980 // VFP pipelines on A8.
981 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +0000982}
Evan Chenga8e29892007-01-19 07:51:42 +0000983
Evan Cheng48575f62010-12-05 22:04:16 +0000984def : Pat<(fadd_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
Evan Cheng529916c2010-11-12 20:32:20 +0000985 (VMLAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +0000986 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +0000987def : Pat<(fadd_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
Evan Cheng529916c2010-11-12 20:32:20 +0000988 (VMLAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +0000989 Requires<[HasVFP2,DontUseNEONForFP, UseFPVMLx,DontUseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000990
Evan Cheng529916c2010-11-12 20:32:20 +0000991def VMLSD : ADbI<0b11100, 0b00, 1, 0,
992 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
993 IIC_fpMAC64, "vmls", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +0000994 [(set DPR:$Dd, (fadd_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
995 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +0000996 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +0000997 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +0000998
Bill Wendling69661192010-11-01 06:00:39 +0000999def VMLSS : ASbIn<0b11100, 0b00, 1, 0,
1000 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1001 IIC_fpMAC32, "vmls", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +00001002 [(set SPR:$Sd, (fadd_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1003 SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001004 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001005 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +00001006 // Some single precision VFP instructions may be executed on both NEON and
1007 // VFP pipelines on A8.
1008 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +00001009}
Evan Chenga8e29892007-01-19 07:51:42 +00001010
Evan Cheng48575f62010-12-05 22:04:16 +00001011def : Pat<(fsub_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
Evan Cheng529916c2010-11-12 20:32:20 +00001012 (VMLSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001013 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +00001014def : Pat<(fsub_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
Evan Cheng529916c2010-11-12 20:32:20 +00001015 (VMLSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001016 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]>;
David Goodwinb84f3d42009-08-04 18:44:29 +00001017
Evan Cheng529916c2010-11-12 20:32:20 +00001018def VNMLAD : ADbI<0b11100, 0b01, 1, 0,
1019 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1020 IIC_fpMAC64, "vnmla", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +00001021 [(set DPR:$Dd,(fsub_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
1022 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001023 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001024 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +00001025
Bill Wendling69661192010-11-01 06:00:39 +00001026def VNMLAS : ASbI<0b11100, 0b01, 1, 0,
1027 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1028 IIC_fpMAC32, "vnmla", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +00001029 [(set SPR:$Sd, (fsub_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1030 SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001031 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001032 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +00001033 // Some single precision VFP instructions may be executed on both NEON and
1034 // VFP pipelines on A8.
1035 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +00001036}
Bill Wendling88cf0382010-10-14 01:02:08 +00001037
Evan Cheng48575f62010-12-05 22:04:16 +00001038def : Pat<(fsub_mlx (fneg (fmul_su DPR:$a, (f64 DPR:$b))), DPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001039 (VNMLAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001040 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +00001041def : Pat<(fsub_mlx (fneg (fmul_su SPR:$a, SPR:$b)), SPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001042 (VNMLAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001043 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +00001044
Evan Cheng529916c2010-11-12 20:32:20 +00001045def VNMLSD : ADbI<0b11100, 0b01, 0, 0,
1046 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1047 IIC_fpMAC64, "vnmls", ".f64\t$Dd, $Dn, $Dm",
Evan Cheng48575f62010-12-05 22:04:16 +00001048 [(set DPR:$Dd, (fsub_mlx (fmul_su DPR:$Dn, DPR:$Dm),
1049 (f64 DPR:$Ddin)))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001050 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001051 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +00001052
Bill Wendling69661192010-11-01 06:00:39 +00001053def VNMLSS : ASbI<0b11100, 0b01, 0, 0,
1054 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1055 IIC_fpMAC32, "vnmls", ".f32\t$Sd, $Sn, $Sm",
Evan Cheng48575f62010-12-05 22:04:16 +00001056 [(set SPR:$Sd, (fsub_mlx (fmul_su SPR:$Sn, SPR:$Sm), SPR:$Sdin))]>,
Evan Cheng529916c2010-11-12 20:32:20 +00001057 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001058 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]> {
Evan Cheng6557bce2011-02-22 19:53:14 +00001059 // Some single precision VFP instructions may be executed on both NEON and
1060 // VFP pipelines on A8.
1061 let D = VFPNeonA8Domain;
Evan Cheng5eda2822011-02-16 00:35:02 +00001062}
Bill Wendling88cf0382010-10-14 01:02:08 +00001063
Evan Cheng48575f62010-12-05 22:04:16 +00001064def : Pat<(fsub_mlx (fmul_su DPR:$a, (f64 DPR:$b)), DPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001065 (VNMLSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001066 Requires<[HasVFP2,UseFPVMLx,DontUseFusedMAC]>;
Evan Cheng48575f62010-12-05 22:04:16 +00001067def : Pat<(fsub_mlx (fmul_su SPR:$a, SPR:$b), SPR:$dstin),
Evan Cheng529916c2010-11-12 20:32:20 +00001068 (VNMLSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001069 Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx,DontUseFusedMAC]>;
Bill Wendling88cf0382010-10-14 01:02:08 +00001070
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001071//===----------------------------------------------------------------------===//
1072// Fused FP Multiply-Accumulate Operations.
1073//
1074def VFMAD : ADbI<0b11101, 0b10, 0, 0,
1075 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1076 IIC_fpFMAC64, "vfma", ".f64\t$Dd, $Dn, $Dm",
1077 [(set DPR:$Dd, (fadd_mlx (fmul_su DPR:$Dn, DPR:$Dm),
1078 (f64 DPR:$Ddin)))]>,
1079 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001080 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001081
1082def VFMAS : ASbIn<0b11101, 0b10, 0, 0,
1083 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1084 IIC_fpFMAC32, "vfma", ".f32\t$Sd, $Sn, $Sm",
1085 [(set SPR:$Sd, (fadd_mlx (fmul_su SPR:$Sn, SPR:$Sm),
1086 SPR:$Sdin))]>,
1087 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001088 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001089 // Some single precision VFP instructions may be executed on both NEON and
1090 // VFP pipelines.
1091}
1092
1093def : Pat<(fadd_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
1094 (VFMAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001095 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001096def : Pat<(fadd_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
1097 (VFMAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001098 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001099
Evan Cheng3aef2ff2012-04-10 21:40:28 +00001100// Match @llvm.fma.* intrinsics
Lang Hames77878002012-04-27 18:51:24 +00001101// (fma x, y, z) -> (vfms z, x, y)
1102def : Pat<(f64 (fma DPR:$Dn, DPR:$Dm, DPR:$Ddin)),
Evan Cheng3aef2ff2012-04-10 21:40:28 +00001103 (VFMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1104 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001105def : Pat<(f32 (fma SPR:$Sn, SPR:$Sm, SPR:$Sdin)),
Evan Cheng3aef2ff2012-04-10 21:40:28 +00001106 (VFMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1107 Requires<[HasVFP4]>;
1108
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001109def VFMSD : ADbI<0b11101, 0b10, 1, 0,
1110 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1111 IIC_fpFMAC64, "vfms", ".f64\t$Dd, $Dn, $Dm",
1112 [(set DPR:$Dd, (fadd_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
1113 (f64 DPR:$Ddin)))]>,
1114 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001115 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001116
1117def VFMSS : ASbIn<0b11101, 0b10, 1, 0,
1118 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1119 IIC_fpFMAC32, "vfms", ".f32\t$Sd, $Sn, $Sm",
1120 [(set SPR:$Sd, (fadd_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1121 SPR:$Sdin))]>,
1122 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001123 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001124 // Some single precision VFP instructions may be executed on both NEON and
1125 // VFP pipelines.
1126}
1127
1128def : Pat<(fsub_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))),
1129 (VFMSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001130 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001131def : Pat<(fsub_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
1132 (VFMSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001133 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001134
Evan Cheng14b4c032012-04-11 06:59:47 +00001135// Match @llvm.fma.* intrinsics
Lang Hames77878002012-04-27 18:51:24 +00001136// (fma (fneg x), y, z) -> (vfms z, x, y)
1137def : Pat<(f64 (fma (fneg DPR:$Dn), DPR:$Dm, DPR:$Ddin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001138 (VFMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1139 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001140def : Pat<(f32 (fma (fneg SPR:$Sn), SPR:$Sm, SPR:$Sdin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001141 (VFMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1142 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001143// (fma x, (fneg y), z) -> (vfms z, x, y)
1144def : Pat<(f64 (fma DPR:$Dn, (fneg DPR:$Dm), DPR:$Ddin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001145 (VFMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1146 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001147def : Pat<(f32 (fma SPR:$Sn, (fneg SPR:$Sm), SPR:$Sdin)),
Evan Cheng14b4c032012-04-11 06:59:47 +00001148 (VFMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1149 Requires<[HasVFP4]>;
1150
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001151def VFNMAD : ADbI<0b11101, 0b01, 1, 0,
1152 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1153 IIC_fpFMAC64, "vfnma", ".f64\t$Dd, $Dn, $Dm",
1154 [(set DPR:$Dd,(fsub_mlx (fneg (fmul_su DPR:$Dn,DPR:$Dm)),
1155 (f64 DPR:$Ddin)))]>,
1156 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001157 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001158
1159def VFNMAS : ASbI<0b11101, 0b01, 1, 0,
1160 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1161 IIC_fpFMAC32, "vfnma", ".f32\t$Sd, $Sn, $Sm",
1162 [(set SPR:$Sd, (fsub_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)),
1163 SPR:$Sdin))]>,
1164 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001165 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001166 // Some single precision VFP instructions may be executed on both NEON and
1167 // VFP pipelines.
1168}
1169
1170def : Pat<(fsub_mlx (fneg (fmul_su DPR:$a, (f64 DPR:$b))), DPR:$dstin),
1171 (VFNMAD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001172 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001173def : Pat<(fsub_mlx (fneg (fmul_su SPR:$a, SPR:$b)), SPR:$dstin),
1174 (VFNMAS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001175 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001176
Evan Cheng92c90452012-04-11 01:21:25 +00001177// Match @llvm.fma.* intrinsics
Lang Hames77878002012-04-27 18:51:24 +00001178// (fneg (fma x, y, z)) -> (vfnma z, x, y)
1179def : Pat<(fneg (fma (f64 DPR:$Dn), (f64 DPR:$Dm), (f64 DPR:$Ddin))),
Evan Cheng92c90452012-04-11 01:21:25 +00001180 (VFNMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1181 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001182def : Pat<(fneg (fma (f32 SPR:$Sn), (f32 SPR:$Sm), (f32 SPR:$Sdin))),
Evan Cheng92c90452012-04-11 01:21:25 +00001183 (VFNMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1184 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001185// (fma (fneg x), y, (fneg z)) -> (vfnma z, x, y)
1186def : Pat<(f64 (fma (fneg DPR:$Dn), DPR:$Dm, (fneg DPR:$Ddin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001187 (VFNMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1188 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001189def : Pat<(f32 (fma (fneg SPR:$Sn), SPR:$Sm, (fneg SPR:$Sdin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001190 (VFNMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1191 Requires<[HasVFP4]>;
Evan Cheng92c90452012-04-11 01:21:25 +00001192
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001193def VFNMSD : ADbI<0b11101, 0b01, 0, 0,
1194 (outs DPR:$Dd), (ins DPR:$Ddin, DPR:$Dn, DPR:$Dm),
1195 IIC_fpFMAC64, "vfnms", ".f64\t$Dd, $Dn, $Dm",
1196 [(set DPR:$Dd, (fsub_mlx (fmul_su DPR:$Dn, DPR:$Dm),
1197 (f64 DPR:$Ddin)))]>,
1198 RegConstraint<"$Ddin = $Dd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001199 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001200
1201def VFNMSS : ASbI<0b11101, 0b01, 0, 0,
1202 (outs SPR:$Sd), (ins SPR:$Sdin, SPR:$Sn, SPR:$Sm),
1203 IIC_fpFMAC32, "vfnms", ".f32\t$Sd, $Sn, $Sm",
1204 [(set SPR:$Sd, (fsub_mlx (fmul_su SPR:$Sn, SPR:$Sm), SPR:$Sdin))]>,
1205 RegConstraint<"$Sdin = $Sd">,
Evan Chengbee78fe2012-04-11 05:33:07 +00001206 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]> {
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001207 // Some single precision VFP instructions may be executed on both NEON and
1208 // VFP pipelines.
1209}
1210
1211def : Pat<(fsub_mlx (fmul_su DPR:$a, (f64 DPR:$b)), DPR:$dstin),
1212 (VFNMSD DPR:$dstin, DPR:$a, DPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001213 Requires<[HasVFP4,UseFusedMAC]>;
Anton Korobeynikov4b4e6222012-01-22 12:07:33 +00001214def : Pat<(fsub_mlx (fmul_su SPR:$a, SPR:$b), SPR:$dstin),
1215 (VFNMSS SPR:$dstin, SPR:$a, SPR:$b)>,
Evan Chengbee78fe2012-04-11 05:33:07 +00001216 Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
Evan Chenga8e29892007-01-19 07:51:42 +00001217
Evan Cheng14b4c032012-04-11 06:59:47 +00001218// Match @llvm.fma.* intrinsics
Lang Hamesdc13d2e2012-06-21 06:10:00 +00001219
1220// (fma x, y, (fneg z)) -> (vfnms z, x, y))
1221def : Pat<(f64 (fma DPR:$Dn, DPR:$Dm, (fneg DPR:$Ddin))),
1222 (VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1223 Requires<[HasVFP4]>;
1224def : Pat<(f32 (fma SPR:$Sn, SPR:$Sm, (fneg SPR:$Sdin))),
1225 (VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1226 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001227// (fneg (fma (fneg x), y, z)) -> (vfnms z, x, y)
1228def : Pat<(fneg (f64 (fma (fneg DPR:$Dn), DPR:$Dm, DPR:$Ddin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001229 (VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1230 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001231def : Pat<(fneg (f32 (fma (fneg SPR:$Sn), SPR:$Sm, SPR:$Sdin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001232 (VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1233 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001234// (fneg (fma x, (fneg y), z) -> (vfnms z, x, y)
1235def : Pat<(fneg (f64 (fma DPR:$Dn, (fneg DPR:$Dm), DPR:$Ddin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001236 (VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
1237 Requires<[HasVFP4]>;
Lang Hames77878002012-04-27 18:51:24 +00001238def : Pat<(fneg (f32 (fma SPR:$Sn, (fneg SPR:$Sm), SPR:$Sdin))),
Evan Cheng14b4c032012-04-11 06:59:47 +00001239 (VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
1240 Requires<[HasVFP4]>;
1241
Evan Chenga8e29892007-01-19 07:51:42 +00001242//===----------------------------------------------------------------------===//
1243// FP Conditional moves.
1244//
1245
Evan Cheng020cc1b2010-05-13 00:16:46 +00001246let neverHasSideEffects = 1 in {
Jim Grosbachf219f312011-03-11 23:09:50 +00001247def VMOVDcc : ARMPseudoInst<(outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm, pred:$p),
Owen Anderson16884412011-07-13 23:22:26 +00001248 4, IIC_fpUNA64,
Bill Wendling69661192010-11-01 06:00:39 +00001249 [/*(set DPR:$Dd, (ARMcmov DPR:$Dn, DPR:$Dm, imm:$cc))*/]>,
1250 RegConstraint<"$Dn = $Dd">;
Evan Chenga8e29892007-01-19 07:51:42 +00001251
Jim Grosbachf219f312011-03-11 23:09:50 +00001252def VMOVScc : ARMPseudoInst<(outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm, pred:$p),
Owen Anderson16884412011-07-13 23:22:26 +00001253 4, IIC_fpUNA32,
Bill Wendling69661192010-11-01 06:00:39 +00001254 [/*(set SPR:$Sd, (ARMcmov SPR:$Sn, SPR:$Sm, imm:$cc))*/]>,
1255 RegConstraint<"$Sn = $Sd">;
Evan Cheng020cc1b2010-05-13 00:16:46 +00001256} // neverHasSideEffects
Evan Cheng78be83d2008-11-11 19:40:26 +00001257
1258//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001259// Move from VFP System Register to ARM core register.
Evan Cheng78be83d2008-11-11 19:40:26 +00001260//
1261
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001262class MovFromVFP<bits<4> opc19_16, dag oops, dag iops, string opc, string asm,
1263 list<dag> pattern>:
1264 VFPAI<oops, iops, VFPMiscFrm, IIC_fpSTAT, opc, asm, pattern> {
Evan Cheng39382422009-10-28 01:44:26 +00001265
Bill Wendling88cf0382010-10-14 01:02:08 +00001266 // Instruction operand.
1267 bits<4> Rt;
1268
Johnny Chenc9745042010-02-09 22:35:38 +00001269 let Inst{27-20} = 0b11101111;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001270 let Inst{19-16} = opc19_16;
1271 let Inst{15-12} = Rt;
Johnny Chenc9745042010-02-09 22:35:38 +00001272 let Inst{11-8} = 0b1010;
1273 let Inst{7} = 0;
Bill Wendling88cf0382010-10-14 01:02:08 +00001274 let Inst{6-5} = 0b00;
Johnny Chenc9745042010-02-09 22:35:38 +00001275 let Inst{4} = 1;
Bill Wendling88cf0382010-10-14 01:02:08 +00001276 let Inst{3-0} = 0b0000;
Johnny Chenc9745042010-02-09 22:35:38 +00001277}
Johnny Chenc9745042010-02-09 22:35:38 +00001278
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001279// APSR is the application level alias of CPSR. This FPSCR N, Z, C, V flags
1280// to APSR.
Lang Hames4f92b5e2012-03-06 00:19:55 +00001281let Defs = [CPSR], Uses = [FPSCR_NZCV], Rt = 0b1111 /* apsr_nzcv */ in
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001282def FMSTAT : MovFromVFP<0b0001 /* fpscr */, (outs), (ins),
Jim Grosbachb84ad4a2012-03-15 21:34:14 +00001283 "vmrs", "\tAPSR_nzcv, fpscr", [(arm_fmstat)]>;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001284
1285// Application level FPSCR -> GPR
1286let hasSideEffects = 1, Uses = [FPSCR] in
1287def VMRS : MovFromVFP<0b0001 /* fpscr */, (outs GPR:$Rt), (ins),
1288 "vmrs", "\t$Rt, fpscr",
1289 [(set GPR:$Rt, (int_arm_get_fpscr))]>;
1290
1291// System level FPEXC, FPSID -> GPR
1292let Uses = [FPSCR] in {
1293 def VMRS_FPEXC : MovFromVFP<0b1000 /* fpexc */, (outs GPR:$Rt), (ins),
1294 "vmrs", "\t$Rt, fpexc", []>;
1295 def VMRS_FPSID : MovFromVFP<0b0000 /* fpsid */, (outs GPR:$Rt), (ins),
1296 "vmrs", "\t$Rt, fpsid", []>;
Jim Grosbach9426ac72012-03-16 00:27:18 +00001297 def VMRS_MVFR0 : MovFromVFP<0b0111 /* mvfr0 */, (outs GPR:$Rt), (ins),
1298 "vmrs", "\t$Rt, mvfr0", []>;
1299 def VMRS_MVFR1 : MovFromVFP<0b0110 /* mvfr1 */, (outs GPR:$Rt), (ins),
1300 "vmrs", "\t$Rt, mvfr1", []>;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001301}
1302
1303//===----------------------------------------------------------------------===//
1304// Move from ARM core register to VFP System Register.
1305//
1306
1307class MovToVFP<bits<4> opc19_16, dag oops, dag iops, string opc, string asm,
1308 list<dag> pattern>:
1309 VFPAI<oops, iops, VFPMiscFrm, IIC_fpSTAT, opc, asm, pattern> {
1310
Bill Wendling88cf0382010-10-14 01:02:08 +00001311 // Instruction operand.
1312 bits<4> src;
1313
1314 // Encode instruction operand.
1315 let Inst{15-12} = src;
1316
Johnny Chenc9745042010-02-09 22:35:38 +00001317 let Inst{27-20} = 0b11101110;
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001318 let Inst{19-16} = opc19_16;
Johnny Chenc9745042010-02-09 22:35:38 +00001319 let Inst{11-8} = 0b1010;
1320 let Inst{7} = 0;
1321 let Inst{4} = 1;
1322}
Evan Cheng39382422009-10-28 01:44:26 +00001323
Bruno Cardoso Lopes61505902011-01-18 21:58:20 +00001324let Defs = [FPSCR] in {
1325 // Application level GPR -> FPSCR
1326 def VMSR : MovToVFP<0b0001 /* fpscr */, (outs), (ins GPR:$src),
1327 "vmsr", "\tfpscr, $src", [(int_arm_set_fpscr GPR:$src)]>;
1328 // System level GPR -> FPEXC
1329 def VMSR_FPEXC : MovToVFP<0b1000 /* fpexc */, (outs), (ins GPR:$src),
1330 "vmsr", "\tfpexc, $src", []>;
1331 // System level GPR -> FPSID
1332 def VMSR_FPSID : MovToVFP<0b0000 /* fpsid */, (outs), (ins GPR:$src),
1333 "vmsr", "\tfpsid, $src", []>;
1334}
1335
1336//===----------------------------------------------------------------------===//
1337// Misc.
1338//
1339
Evan Cheng39382422009-10-28 01:44:26 +00001340// Materialize FP immediates. VFP3 only.
Jim Grosbache5165492009-11-09 00:11:35 +00001341let isReMaterializable = 1 in {
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001342def FCONSTD : VFPAI<(outs DPR:$Dd), (ins vfp_f64imm:$imm),
Anton Korobeynikov63401e32010-04-07 18:19:56 +00001343 VFPMiscFrm, IIC_fpUNA64,
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001344 "vmov", ".f64\t$Dd, $imm",
1345 [(set DPR:$Dd, vfp_f64imm:$imm)]>, Requires<[HasVFP3]> {
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001346 bits<5> Dd;
1347 bits<8> imm;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001348
Jim Grosbache5165492009-11-09 00:11:35 +00001349 let Inst{27-23} = 0b11101;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001350 let Inst{22} = Dd{4};
Jim Grosbache5165492009-11-09 00:11:35 +00001351 let Inst{21-20} = 0b11;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001352 let Inst{19-16} = imm{7-4};
1353 let Inst{15-12} = Dd{3-0};
Jim Grosbache5165492009-11-09 00:11:35 +00001354 let Inst{11-9} = 0b101;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001355 let Inst{8} = 1; // Double precision.
Jim Grosbache5165492009-11-09 00:11:35 +00001356 let Inst{7-4} = 0b0000;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001357 let Inst{3-0} = imm{3-0};
Jim Grosbache5165492009-11-09 00:11:35 +00001358}
1359
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001360def FCONSTS : VFPAI<(outs SPR:$Sd), (ins vfp_f32imm:$imm),
1361 VFPMiscFrm, IIC_fpUNA32,
1362 "vmov", ".f32\t$Sd, $imm",
1363 [(set SPR:$Sd, vfp_f32imm:$imm)]>, Requires<[HasVFP3]> {
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001364 bits<5> Sd;
1365 bits<8> imm;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001366
Evan Cheng39382422009-10-28 01:44:26 +00001367 let Inst{27-23} = 0b11101;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001368 let Inst{22} = Sd{0};
Evan Cheng39382422009-10-28 01:44:26 +00001369 let Inst{21-20} = 0b11;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001370 let Inst{19-16} = imm{7-4};
1371 let Inst{15-12} = Sd{4-1};
Evan Cheng39382422009-10-28 01:44:26 +00001372 let Inst{11-9} = 0b101;
Bill Wendlingbbbdcd42010-10-14 02:33:26 +00001373 let Inst{8} = 0; // Single precision.
Evan Cheng39382422009-10-28 01:44:26 +00001374 let Inst{7-4} = 0b0000;
Jim Grosbach4ebbf7b2011-09-30 00:50:06 +00001375 let Inst{3-0} = imm{3-0};
Evan Cheng39382422009-10-28 01:44:26 +00001376}
Evan Cheng39382422009-10-28 01:44:26 +00001377}
Jim Grosbach5cd5ac62011-10-03 21:12:43 +00001378
1379//===----------------------------------------------------------------------===//
1380// Assembler aliases.
1381//
Jim Grosbach67ca1ad2011-12-08 00:49:29 +00001382// A few mnemnoic aliases for pre-unifixed syntax. We don't guarantee to
1383// support them all, but supporting at least some of the basics is
1384// good to be friendly.
Jim Grosbach21d7fb82011-12-09 23:34:09 +00001385def : VFP2MnemonicAlias<"flds", "vldr">;
1386def : VFP2MnemonicAlias<"fldd", "vldr">;
1387def : VFP2MnemonicAlias<"fmrs", "vmov">;
1388def : VFP2MnemonicAlias<"fmsr", "vmov">;
1389def : VFP2MnemonicAlias<"fsqrts", "vsqrt">;
1390def : VFP2MnemonicAlias<"fsqrtd", "vsqrt">;
1391def : VFP2MnemonicAlias<"fadds", "vadd.f32">;
1392def : VFP2MnemonicAlias<"faddd", "vadd.f64">;
1393def : VFP2MnemonicAlias<"fmrdd", "vmov">;
1394def : VFP2MnemonicAlias<"fmrds", "vmov">;
1395def : VFP2MnemonicAlias<"fmrrd", "vmov">;
1396def : VFP2MnemonicAlias<"fmdrr", "vmov">;
Jim Grosbach68490192011-12-19 19:43:50 +00001397def : VFP2MnemonicAlias<"fmuls", "vmul.f32">;
Jim Grosbach21d7fb82011-12-09 23:34:09 +00001398def : VFP2MnemonicAlias<"fmuld", "vmul.f64">;
1399def : VFP2MnemonicAlias<"fnegs", "vneg.f32">;
1400def : VFP2MnemonicAlias<"fnegd", "vneg.f64">;
Jim Grosbach48171e72011-12-10 00:01:02 +00001401def : VFP2MnemonicAlias<"ftosizd", "vcvt.s32.f64">;
1402def : VFP2MnemonicAlias<"ftosid", "vcvtr.s32.f64">;
1403def : VFP2MnemonicAlias<"ftosizs", "vcvt.s32.f32">;
1404def : VFP2MnemonicAlias<"ftosis", "vcvtr.s32.f32">;
1405def : VFP2MnemonicAlias<"ftouizd", "vcvt.u32.f64">;
1406def : VFP2MnemonicAlias<"ftouid", "vcvtr.u32.f64">;
1407def : VFP2MnemonicAlias<"ftouizs", "vcvt.u32.f32">;
1408def : VFP2MnemonicAlias<"ftouis", "vcvtr.u32.f32">;
1409def : VFP2MnemonicAlias<"fsitod", "vcvt.f64.s32">;
1410def : VFP2MnemonicAlias<"fsitos", "vcvt.f32.s32">;
1411def : VFP2MnemonicAlias<"fuitod", "vcvt.f64.u32">;
1412def : VFP2MnemonicAlias<"fuitos", "vcvt.f32.u32">;
Jim Grosbachf1015402011-12-13 20:13:48 +00001413def : VFP2MnemonicAlias<"fsts", "vstr">;
1414def : VFP2MnemonicAlias<"fstd", "vstr">;
Jim Grosbach0f293de2011-12-13 20:40:37 +00001415def : VFP2MnemonicAlias<"fmacd", "vmla.f64">;
1416def : VFP2MnemonicAlias<"fmacs", "vmla.f32">;
Jim Grosbach9c397892011-12-19 19:02:41 +00001417def : VFP2MnemonicAlias<"fcpys", "vmov.f32">;
1418def : VFP2MnemonicAlias<"fcpyd", "vmov.f64">;
Jim Grosbach1aa149f2011-12-22 19:20:45 +00001419def : VFP2MnemonicAlias<"fcmps", "vcmp.f32">;
1420def : VFP2MnemonicAlias<"fcmpd", "vcmp.f64">;
Jim Grosbach9c397892011-12-19 19:02:41 +00001421def : VFP2MnemonicAlias<"fdivs", "vdiv.f32">;
1422def : VFP2MnemonicAlias<"fdivd", "vdiv.f64">;
Jim Grosbach66cba302012-03-16 21:06:13 +00001423def : VFP2MnemonicAlias<"fmrx", "vmrs">;
1424def : VFP2MnemonicAlias<"fmxr", "vmsr">;
Jim Grosbach67ca1ad2011-12-08 00:49:29 +00001425
Jim Grosbach6357cae2012-03-15 20:48:18 +00001426// Be friendly and accept the old form of zero-compare
1427def : VFP2InstAlias<"fcmpzd${p} $val", (VCMPZD DPR:$val, pred:$p)>;
1428def : VFP2InstAlias<"fcmpzs${p} $val", (VCMPZS SPR:$val, pred:$p)>;
1429
1430
Jim Grosbach5cd5ac62011-10-03 21:12:43 +00001431def : VFP2InstAlias<"fmstat${p}", (FMSTAT pred:$p)>;
Jim Grosbach48171e72011-12-10 00:01:02 +00001432def : VFP2InstAlias<"fadds${p} $Sd, $Sn, $Sm",
1433 (VADDS SPR:$Sd, SPR:$Sn, SPR:$Sm, pred:$p)>;
1434def : VFP2InstAlias<"faddd${p} $Dd, $Dn, $Dm",
1435 (VADDD DPR:$Dd, DPR:$Dn, DPR:$Dm, pred:$p)>;
1436def : VFP2InstAlias<"fsubs${p} $Sd, $Sn, $Sm",
1437 (VSUBS SPR:$Sd, SPR:$Sn, SPR:$Sm, pred:$p)>;
1438def : VFP2InstAlias<"fsubd${p} $Dd, $Dn, $Dm",
1439 (VSUBD DPR:$Dd, DPR:$Dn, DPR:$Dm, pred:$p)>;
Jim Grosbach5cd5ac62011-10-03 21:12:43 +00001440
Jim Grosbach976c0da2011-12-08 22:51:25 +00001441// No need for the size suffix on VSQRT. It's implied by the register classes.
1442def : VFP2InstAlias<"vsqrt${p} $Sd, $Sm", (VSQRTS SPR:$Sd, SPR:$Sm, pred:$p)>;
1443def : VFP2InstAlias<"vsqrt${p} $Dd, $Dm", (VSQRTD DPR:$Dd, DPR:$Dm, pred:$p)>;
1444
Jim Grosbachffc658b2011-11-14 23:03:21 +00001445// VLDR/VSTR accept an optional type suffix.
Jim Grosbach1ceef1a2011-12-07 01:50:36 +00001446def : VFP2InstAlias<"vldr${p}.32 $Sd, $addr",
1447 (VLDRS SPR:$Sd, addrmode5:$addr, pred:$p)>;
1448def : VFP2InstAlias<"vstr${p}.32 $Sd, $addr",
1449 (VSTRS SPR:$Sd, addrmode5:$addr, pred:$p)>;
1450def : VFP2InstAlias<"vldr${p}.64 $Dd, $addr",
1451 (VLDRD DPR:$Dd, addrmode5:$addr, pred:$p)>;
1452def : VFP2InstAlias<"vstr${p}.64 $Dd, $addr",
1453 (VSTRD DPR:$Dd, addrmode5:$addr, pred:$p)>;
Jim Grosbachbfb0a172011-11-15 20:14:51 +00001454
Jim Grosbachaf33a0c2011-12-21 23:24:15 +00001455// VMOV can accept optional 32-bit or less data type suffix suffix.
1456def : VFP2InstAlias<"vmov${p}.8 $Rt, $Sn",
Jim Grosbacha68e90c2011-11-15 20:29:42 +00001457 (VMOVRS GPR:$Rt, SPR:$Sn, pred:$p)>;
Jim Grosbachaf33a0c2011-12-21 23:24:15 +00001458def : VFP2InstAlias<"vmov${p}.16 $Rt, $Sn",
1459 (VMOVRS GPR:$Rt, SPR:$Sn, pred:$p)>;
1460def : VFP2InstAlias<"vmov${p}.32 $Rt, $Sn",
1461 (VMOVRS GPR:$Rt, SPR:$Sn, pred:$p)>;
1462def : VFP2InstAlias<"vmov${p}.8 $Sn, $Rt",
1463 (VMOVSR SPR:$Sn, GPR:$Rt, pred:$p)>;
1464def : VFP2InstAlias<"vmov${p}.16 $Sn, $Rt",
1465 (VMOVSR SPR:$Sn, GPR:$Rt, pred:$p)>;
1466def : VFP2InstAlias<"vmov${p}.32 $Sn, $Rt",
Jim Grosbacha68e90c2011-11-15 20:29:42 +00001467 (VMOVSR SPR:$Sn, GPR:$Rt, pred:$p)>;
1468
1469def : VFP2InstAlias<"vmov${p}.f64 $Rt, $Rt2, $Dn",
1470 (VMOVRRD GPR:$Rt, GPR:$Rt2, DPR:$Dn, pred:$p)>;
1471def : VFP2InstAlias<"vmov${p}.f64 $Dn, $Rt, $Rt2",
1472 (VMOVDRR DPR:$Dn, GPR:$Rt, GPR:$Rt2, pred:$p)>;
Jim Grosbacheaf20562011-11-15 21:18:35 +00001473
1474// VMOVS doesn't need the .f32 to disambiguate from the NEON encoding the way
1475// VMOVD does.
1476def : VFP2InstAlias<"vmov${p} $Sd, $Sm",
1477 (VMOVS SPR:$Sd, SPR:$Sm, pred:$p)>;