blob: e516593089ff2c9c2ba8a24ad8912b51af920f57 [file] [log] [blame]
Evan Chenga8e29892007-01-19 07:51:42 +00001//===- ARMInstrVFP.td - VFP support for ARM -------------------------------===//
2//
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
Evan Chenga8e29892007-01-19 07:51:42 +000014def SDT_FTOI :
15SDTypeProfile<1, 1, [SDTCisVT<0, f32>, SDTCisFP<1>]>;
16def SDT_ITOF :
17SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f32>]>;
18def SDT_CMPFP0 :
19SDTypeProfile<0, 1, [SDTCisFP<0>]>;
Jim Grosbache5165492009-11-09 00:11:35 +000020def SDT_VMOVDRR :
Evan Chenga8e29892007-01-19 07:51:42 +000021SDTypeProfile<1, 2, [SDTCisVT<0, f64>, SDTCisVT<1, i32>,
22 SDTCisSameAs<1, 2>]>;
23
Evan Cheng96581d32008-11-11 02:11:05 +000024def arm_ftoui : SDNode<"ARMISD::FTOUI", SDT_FTOI>;
25def arm_ftosi : SDNode<"ARMISD::FTOSI", SDT_FTOI>;
26def arm_sitof : SDNode<"ARMISD::SITOF", SDT_ITOF>;
27def arm_uitof : SDNode<"ARMISD::UITOF", SDT_ITOF>;
Chris Lattner48be23c2008-01-15 22:02:54 +000028def arm_fmstat : SDNode<"ARMISD::FMSTAT", SDTNone, [SDNPInFlag,SDNPOutFlag]>;
Evan Cheng96581d32008-11-11 02:11:05 +000029def arm_cmpfp : SDNode<"ARMISD::CMPFP", SDT_ARMCmp, [SDNPOutFlag]>;
30def arm_cmpfp0 : SDNode<"ARMISD::CMPFPw0",SDT_CMPFP0, [SDNPOutFlag]>;
Jim Grosbache5165492009-11-09 00:11:35 +000031def arm_fmdrr : SDNode<"ARMISD::VMOVDRR", SDT_VMOVDRR>;
Evan Chenga8e29892007-01-19 07:51:42 +000032
33//===----------------------------------------------------------------------===//
Evan Cheng39382422009-10-28 01:44:26 +000034// Operand Definitions.
35//
36
37
38def vfp_f32imm : Operand<f32>,
39 PatLeaf<(f32 fpimm), [{
40 return ARM::getVFPf32Imm(N->getValueAPF()) != -1;
41 }]> {
42 let PrintMethod = "printVFPf32ImmOperand";
43}
44
45def vfp_f64imm : Operand<f64>,
46 PatLeaf<(f64 fpimm), [{
47 return ARM::getVFPf64Imm(N->getValueAPF()) != -1;
48 }]> {
49 let PrintMethod = "printVFPf64ImmOperand";
50}
51
52
53//===----------------------------------------------------------------------===//
Evan Chenga8e29892007-01-19 07:51:42 +000054// Load / store Instructions.
55//
56
Evan Cheng4aedb612009-11-20 19:57:15 +000057let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in {
Jim Grosbache5165492009-11-09 00:11:35 +000058def VLDRD : ADI5<0b1101, 0b01, (outs DPR:$dst), (ins addrmode5:$addr),
59 IIC_fpLoad64, "vldr", ".64\t$dst, $addr",
Evan Chenga8e29892007-01-19 07:51:42 +000060 [(set DPR:$dst, (load addrmode5:$addr))]>;
61
Jim Grosbache5165492009-11-09 00:11:35 +000062def VLDRS : ASI5<0b1101, 0b01, (outs SPR:$dst), (ins addrmode5:$addr),
63 IIC_fpLoad32, "vldr", ".32\t$dst, $addr",
Evan Chenga8e29892007-01-19 07:51:42 +000064 [(set SPR:$dst, (load addrmode5:$addr))]>;
Dan Gohman15511cf2008-12-03 18:15:48 +000065} // canFoldAsLoad
Evan Chenga8e29892007-01-19 07:51:42 +000066
Jim Grosbache5165492009-11-09 00:11:35 +000067def VSTRD : ADI5<0b1101, 0b00, (outs), (ins DPR:$src, addrmode5:$addr),
68 IIC_fpStore64, "vstr", ".64\t$src, $addr",
Evan Chenga8e29892007-01-19 07:51:42 +000069 [(store DPR:$src, addrmode5:$addr)]>;
70
Jim Grosbache5165492009-11-09 00:11:35 +000071def VSTRS : ASI5<0b1101, 0b00, (outs), (ins SPR:$src, addrmode5:$addr),
72 IIC_fpStore32, "vstr", ".32\t$src, $addr",
Evan Chenga8e29892007-01-19 07:51:42 +000073 [(store SPR:$src, addrmode5:$addr)]>;
Evan Chenga8e29892007-01-19 07:51:42 +000074
75//===----------------------------------------------------------------------===//
76// Load / store multiple Instructions.
77//
78
Evan Cheng0d92f5f2009-10-01 08:22:27 +000079let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Jim Grosbache5165492009-11-09 00:11:35 +000080def VLDMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$wb,
David Goodwinb2bb7db2009-09-21 20:52:17 +000081 variable_ops), IIC_fpLoadm,
Jim Grosbache5165492009-11-09 00:11:35 +000082 "vldm${addr:submode}${p}\t${addr:base}, $wb",
Evan Chengcd8e66a2008-11-11 21:48:44 +000083 []> {
84 let Inst{20} = 1;
85}
Evan Chenga8e29892007-01-19 07:51:42 +000086
Jim Grosbache5165492009-11-09 00:11:35 +000087def VLDMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$wb,
David Goodwinb2bb7db2009-09-21 20:52:17 +000088 variable_ops), IIC_fpLoadm,
Jim Grosbache5165492009-11-09 00:11:35 +000089 "vldm${addr:submode}${p}\t${addr:base}, $wb",
Evan Chengcd8e66a2008-11-11 21:48:44 +000090 []> {
91 let Inst{20} = 1;
92}
Evan Cheng0d92f5f2009-10-01 08:22:27 +000093} // mayLoad, hasExtraDefRegAllocReq
Evan Chenga8e29892007-01-19 07:51:42 +000094
Evan Cheng0d92f5f2009-10-01 08:22:27 +000095let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Jim Grosbache5165492009-11-09 00:11:35 +000096def VSTMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$wb,
David Goodwinb2bb7db2009-09-21 20:52:17 +000097 variable_ops), IIC_fpStorem,
Jim Grosbache5165492009-11-09 00:11:35 +000098 "vstm${addr:submode}${p}\t${addr:base}, $wb",
Evan Chengcd8e66a2008-11-11 21:48:44 +000099 []> {
100 let Inst{20} = 0;
101}
Evan Chenga8e29892007-01-19 07:51:42 +0000102
Jim Grosbache5165492009-11-09 00:11:35 +0000103def VSTMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$wb,
David Goodwinb2bb7db2009-09-21 20:52:17 +0000104 variable_ops), IIC_fpStorem,
Jim Grosbache5165492009-11-09 00:11:35 +0000105 "vstm${addr:submode}${p}\t${addr:base}, $wb",
Evan Chengcd8e66a2008-11-11 21:48:44 +0000106 []> {
107 let Inst{20} = 0;
108}
Evan Cheng0d92f5f2009-10-01 08:22:27 +0000109} // mayStore, hasExtraSrcRegAllocReq
Evan Chenga8e29892007-01-19 07:51:42 +0000110
111// FLDMX, FSTMX - mixing S/D registers for pre-armv6 cores
112
113//===----------------------------------------------------------------------===//
114// FP Binary Operations.
115//
116
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000117def VADDD : ADbI<0b11100, 0b11, 0, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000118 IIC_fpALU64, "vadd", ".f64\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000119 [(set DPR:$dst, (fadd DPR:$a, DPR:$b))]>;
120
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000121def VADDS : ASbIn<0b11100, 0b11, 0, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000122 IIC_fpALU32, "vadd", ".f32\t$dst, $a, $b",
David Goodwin42a83f22009-08-04 17:53:06 +0000123 [(set SPR:$dst, (fadd SPR:$a, SPR:$b))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000124
Evan Cheng3c4a4ff2008-11-12 07:18:38 +0000125// These are encoded as unary instructions.
Evan Cheng91449a82009-07-20 02:12:31 +0000126let Defs = [FPSCR] in {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000127def VCMPED : ADuI<0b11101, 0b11, 0b0100, 0b11, 0, (outs), (ins DPR:$a, DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000128 IIC_fpCMP64, "vcmpe", ".f64\t$a, $b",
Evan Cheng3c4a4ff2008-11-12 07:18:38 +0000129 [(arm_cmpfp DPR:$a, DPR:$b)]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000130
Johnny Chen7edd8e32010-02-08 19:41:48 +0000131def VCMPD : ADuI<0b11101, 0b11, 0b0100, 0b01, 0, (outs), (ins DPR:$a, DPR:$b),
132 IIC_fpCMP64, "vcmp", ".f64\t$a, $b",
133 [/* For disassembly only; pattern left blank */]>;
134
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000135def VCMPES : ASuI<0b11101, 0b11, 0b0100, 0b11, 0, (outs), (ins SPR:$a, SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000136 IIC_fpCMP32, "vcmpe", ".f32\t$a, $b",
Evan Cheng3c4a4ff2008-11-12 07:18:38 +0000137 [(arm_cmpfp SPR:$a, SPR:$b)]>;
Johnny Chen7edd8e32010-02-08 19:41:48 +0000138
139def VCMPS : ASuI<0b11101, 0b11, 0b0100, 0b01, 0, (outs), (ins SPR:$a, SPR:$b),
140 IIC_fpCMP32, "vcmp", ".f32\t$a, $b",
141 [/* For disassembly only; pattern left blank */]>;
Evan Cheng91449a82009-07-20 02:12:31 +0000142}
Evan Chenga8e29892007-01-19 07:51:42 +0000143
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000144def VDIVD : ADbI<0b11101, 0b00, 0, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000145 IIC_fpDIV64, "vdiv", ".f64\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000146 [(set DPR:$dst, (fdiv DPR:$a, DPR:$b))]>;
147
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000148def VDIVS : ASbI<0b11101, 0b00, 0, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000149 IIC_fpDIV32, "vdiv", ".f32\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000150 [(set SPR:$dst, (fdiv SPR:$a, SPR:$b))]>;
151
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000152def VMULD : ADbI<0b11100, 0b10, 0, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000153 IIC_fpMUL64, "vmul", ".f64\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000154 [(set DPR:$dst, (fmul DPR:$a, DPR:$b))]>;
155
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000156def VMULS : ASbIn<0b11100, 0b10, 0, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000157 IIC_fpMUL32, "vmul", ".f32\t$dst, $a, $b",
David Goodwin42a83f22009-08-04 17:53:06 +0000158 [(set SPR:$dst, (fmul SPR:$a, SPR:$b))]>;
Jim Grosbache5165492009-11-09 00:11:35 +0000159
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000160def VNMULD : ADbI<0b11100, 0b10, 1, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000161 IIC_fpMUL64, "vnmul", ".f64\t$dst, $a, $b",
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000162 [(set DPR:$dst, (fneg (fmul DPR:$a, DPR:$b)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000163
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000164def VNMULS : ASbI<0b11100, 0b10, 1, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000165 IIC_fpMUL32, "vnmul", ".f32\t$dst, $a, $b",
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000166 [(set SPR:$dst, (fneg (fmul SPR:$a, SPR:$b)))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000167
Chris Lattner72939122007-05-03 00:32:00 +0000168// Match reassociated forms only if not sign dependent rounding.
169def : Pat<(fmul (fneg DPR:$a), DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000170 (VNMULD DPR:$a, DPR:$b)>, Requires<[NoHonorSignDependentRounding]>;
Chris Lattner72939122007-05-03 00:32:00 +0000171def : Pat<(fmul (fneg SPR:$a), SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000172 (VNMULS SPR:$a, SPR:$b)>, Requires<[NoHonorSignDependentRounding]>;
Chris Lattner72939122007-05-03 00:32:00 +0000173
174
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000175def VSUBD : ADbI<0b11100, 0b11, 1, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000176 IIC_fpALU64, "vsub", ".f64\t$dst, $a, $b",
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000177 [(set DPR:$dst, (fsub DPR:$a, DPR:$b))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000178
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000179def VSUBS : ASbIn<0b11100, 0b11, 1, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000180 IIC_fpALU32, "vsub", ".f32\t$dst, $a, $b",
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000181 [(set SPR:$dst, (fsub SPR:$a, SPR:$b))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000182
183//===----------------------------------------------------------------------===//
184// FP Unary Operations.
185//
186
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000187def VABSD : ADuI<0b11101, 0b11, 0b0000, 0b11, 0, (outs DPR:$dst), (ins DPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000188 IIC_fpUNA64, "vabs", ".f64\t$dst, $a",
Evan Chenga8e29892007-01-19 07:51:42 +0000189 [(set DPR:$dst, (fabs DPR:$a))]>;
190
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000191def VABSS : ASuIn<0b11101, 0b11, 0b0000, 0b11, 0,(outs SPR:$dst), (ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000192 IIC_fpUNA32, "vabs", ".f32\t$dst, $a",
David Goodwin53e44712009-08-04 20:39:05 +0000193 [(set SPR:$dst, (fabs SPR:$a))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000194
Evan Cheng91449a82009-07-20 02:12:31 +0000195let Defs = [FPSCR] in {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000196def VCMPEZD : ADuI<0b11101, 0b11, 0b0101, 0b11, 0, (outs), (ins DPR:$a),
Jim Grosbach43cca692009-11-09 15:27:51 +0000197 IIC_fpCMP64, "vcmpe", ".f64\t$a, #0",
Evan Chenga8e29892007-01-19 07:51:42 +0000198 [(arm_cmpfp0 DPR:$a)]>;
199
Johnny Chen7edd8e32010-02-08 19:41:48 +0000200def VCMPZD : ADuI<0b11101, 0b11, 0b0101, 0b01, 0, (outs), (ins DPR:$a),
201 IIC_fpCMP64, "vcmp", ".f64\t$a, #0",
202 [/* For disassembly only; pattern left blank */]>;
203
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000204def VCMPEZS : ASuI<0b11101, 0b11, 0b0101, 0b11, 0, (outs), (ins SPR:$a),
Jim Grosbach43cca692009-11-09 15:27:51 +0000205 IIC_fpCMP32, "vcmpe", ".f32\t$a, #0",
Evan Chenga8e29892007-01-19 07:51:42 +0000206 [(arm_cmpfp0 SPR:$a)]>;
Johnny Chen7edd8e32010-02-08 19:41:48 +0000207
208def VCMPZS : ASuI<0b11101, 0b11, 0b0101, 0b01, 0, (outs), (ins SPR:$a),
209 IIC_fpCMP32, "vcmp", ".f32\t$a, #0",
210 [/* For disassembly only; pattern left blank */]>;
Evan Cheng91449a82009-07-20 02:12:31 +0000211}
Evan Chenga8e29892007-01-19 07:51:42 +0000212
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000213def VCVTDS : ASuI<0b11101, 0b11, 0b0111, 0b11, 0, (outs DPR:$dst), (ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000214 IIC_fpCVTDS, "vcvt", ".f64.f32\t$dst, $a",
Evan Chenga8e29892007-01-19 07:51:42 +0000215 [(set DPR:$dst, (fextend SPR:$a))]>;
216
Evan Cheng96581d32008-11-11 02:11:05 +0000217// Special case encoding: bits 11-8 is 0b1011.
Jim Grosbache5165492009-11-09 00:11:35 +0000218def VCVTSD : VFPAI<(outs SPR:$dst), (ins DPR:$a), VFPUnaryFrm,
219 IIC_fpCVTSD, "vcvt", ".f32.f64\t$dst, $a",
David Goodwin3ca524e2009-07-10 17:03:29 +0000220 [(set SPR:$dst, (fround DPR:$a))]> {
Evan Cheng96581d32008-11-11 02:11:05 +0000221 let Inst{27-23} = 0b11101;
222 let Inst{21-16} = 0b110111;
223 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000224 let Inst{7-6} = 0b11;
225 let Inst{4} = 0;
Evan Cheng96581d32008-11-11 02:11:05 +0000226}
Evan Chenga8e29892007-01-19 07:51:42 +0000227
Johnny Chen2d658df2010-02-09 17:21:56 +0000228// Between half-precision and single-precision. For disassembly only.
229
230def VCVTBSH : ASuI<0b11101, 0b11, 0b0010, 0b01, 0, (outs SPR:$dst), (ins SPR:$a),
231 /* FIXME */ IIC_fpCVTDS, "vcvtb", ".f32.f16\t$dst, $a",
232 [/* For disassembly only; pattern left blank */]>;
233
234def VCVTBHS : ASuI<0b11101, 0b11, 0b0011, 0b01, 0, (outs SPR:$dst), (ins SPR:$a),
235 /* FIXME */ IIC_fpCVTDS, "vcvtb", ".f16.f32\t$dst, $a",
236 [/* For disassembly only; pattern left blank */]>;
237
238def VCVTTSH : ASuI<0b11101, 0b11, 0b0010, 0b11, 0, (outs SPR:$dst), (ins SPR:$a),
239 /* FIXME */ IIC_fpCVTDS, "vcvtt", ".f32.f16\t$dst, $a",
240 [/* For disassembly only; pattern left blank */]>;
241
242def VCVTTHS : ASuI<0b11101, 0b11, 0b0011, 0b11, 0, (outs SPR:$dst), (ins SPR:$a),
243 /* FIXME */ IIC_fpCVTDS, "vcvtt", ".f16.f32\t$dst, $a",
244 [/* For disassembly only; pattern left blank */]>;
245
Evan Chengcd799b92009-06-12 20:46:18 +0000246let neverHasSideEffects = 1 in {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000247def VMOVD: ADuI<0b11101, 0b11, 0b0000, 0b01, 0, (outs DPR:$dst), (ins DPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000248 IIC_fpUNA64, "vmov", ".f64\t$dst, $a", []>;
Evan Chenga8e29892007-01-19 07:51:42 +0000249
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000250def VMOVS: ASuI<0b11101, 0b11, 0b0000, 0b01, 0, (outs SPR:$dst), (ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000251 IIC_fpUNA32, "vmov", ".f32\t$dst, $a", []>;
Evan Chengcd799b92009-06-12 20:46:18 +0000252} // neverHasSideEffects
Evan Chenga8e29892007-01-19 07:51:42 +0000253
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000254def VNEGD : ADuI<0b11101, 0b11, 0b0001, 0b01, 0, (outs DPR:$dst), (ins DPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000255 IIC_fpUNA64, "vneg", ".f64\t$dst, $a",
Evan Chenga8e29892007-01-19 07:51:42 +0000256 [(set DPR:$dst, (fneg DPR:$a))]>;
257
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000258def VNEGS : ASuIn<0b11101, 0b11, 0b0001, 0b01, 0,(outs SPR:$dst), (ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000259 IIC_fpUNA32, "vneg", ".f32\t$dst, $a",
David Goodwin53e44712009-08-04 20:39:05 +0000260 [(set SPR:$dst, (fneg SPR:$a))]>;
Evan Chenga8e29892007-01-19 07:51:42 +0000261
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000262def VSQRTD : ADuI<0b11101, 0b11, 0b0001, 0b11, 0, (outs DPR:$dst), (ins DPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000263 IIC_fpSQRT64, "vsqrt", ".f64\t$dst, $a",
Evan Chenga8e29892007-01-19 07:51:42 +0000264 [(set DPR:$dst, (fsqrt DPR:$a))]>;
265
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000266def VSQRTS : ASuI<0b11101, 0b11, 0b0001, 0b11, 0, (outs SPR:$dst), (ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000267 IIC_fpSQRT32, "vsqrt", ".f32\t$dst, $a",
Evan Chenga8e29892007-01-19 07:51:42 +0000268 [(set SPR:$dst, (fsqrt SPR:$a))]>;
269
270//===----------------------------------------------------------------------===//
271// FP <-> GPR Copies. Int <-> FP Conversions.
272//
273
Jim Grosbache5165492009-11-09 00:11:35 +0000274def VMOVRS : AVConv2I<0b11100001, 0b1010, (outs GPR:$dst), (ins SPR:$src),
275 IIC_VMOVSI, "vmov", "\t$dst, $src",
Evan Chenga8e29892007-01-19 07:51:42 +0000276 [(set GPR:$dst, (bitconvert SPR:$src))]>;
277
Jim Grosbache5165492009-11-09 00:11:35 +0000278def VMOVSR : AVConv4I<0b11100000, 0b1010, (outs SPR:$dst), (ins GPR:$src),
279 IIC_VMOVIS, "vmov", "\t$dst, $src",
Evan Chenga8e29892007-01-19 07:51:42 +0000280 [(set SPR:$dst, (bitconvert GPR:$src))]>;
281
Jim Grosbache5165492009-11-09 00:11:35 +0000282def VMOVRRD : AVConv3I<0b11000101, 0b1011,
Evan Chengd20d6582009-10-01 01:33:39 +0000283 (outs GPR:$wb, GPR:$dst2), (ins DPR:$src),
Jim Grosbache5165492009-11-09 00:11:35 +0000284 IIC_VMOVDI, "vmov", "\t$wb, $dst2, $src",
Johnny Chen7acca672010-02-05 18:04:58 +0000285 [/* FIXME: Can't write pattern for multiple result instr*/]> {
286 let Inst{7-6} = 0b00;
287}
Evan Chenga8e29892007-01-19 07:51:42 +0000288
Johnny Chen23401d62010-02-08 17:26:09 +0000289def VMOVRRS : AVConv3I<0b11000101, 0b1010,
290 (outs GPR:$wb, GPR:$dst2), (ins SPR:$src1, SPR:$src2),
291 IIC_VMOVDI, "vmov", "\t$wb, $dst2, $src1, $src2",
292 [/* For disassembly only; pattern left blank */]> {
293 let Inst{7-6} = 0b00;
294}
295
Evan Chenga8e29892007-01-19 07:51:42 +0000296// FMDHR: GPR -> SPR
297// FMDLR: GPR -> SPR
298
Jim Grosbache5165492009-11-09 00:11:35 +0000299def VMOVDRR : AVConv5I<0b11000100, 0b1011,
Evan Cheng38b6fd62008-12-11 22:02:02 +0000300 (outs DPR:$dst), (ins GPR:$src1, GPR:$src2),
Jim Grosbache5165492009-11-09 00:11:35 +0000301 IIC_VMOVID, "vmov", "\t$dst, $src1, $src2",
Johnny Chen7acca672010-02-05 18:04:58 +0000302 [(set DPR:$dst, (arm_fmdrr GPR:$src1, GPR:$src2))]> {
303 let Inst{7-6} = 0b00;
304}
Evan Chenga8e29892007-01-19 07:51:42 +0000305
Johnny Chen23401d62010-02-08 17:26:09 +0000306def VMOVSRR : AVConv5I<0b11000100, 0b1010,
307 (outs SPR:$dst1, SPR:$dst2), (ins GPR:$src1, GPR:$src2),
308 IIC_VMOVID, "vmov", "\t$dst1, $dst2, $src1, $src2",
309 [/* For disassembly only; pattern left blank */]> {
310 let Inst{7-6} = 0b00;
311}
312
Evan Chenga8e29892007-01-19 07:51:42 +0000313// FMRDH: SPR -> GPR
314// FMRDL: SPR -> GPR
315// FMRRS: SPR -> GPR
316// FMRX : SPR system reg -> GPR
317
318// FMSRR: GPR -> SPR
319
Evan Chenga8e29892007-01-19 07:51:42 +0000320// FMXR: GPR -> VFP Sstem reg
321
322
323// Int to FP:
324
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000325def VSITOD : AVConv1I<0b11101, 0b11, 0b1000, 0b1011,
326 (outs DPR:$dst), (ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000327 IIC_fpCVTID, "vcvt", ".f64.s32\t$dst, $a",
Evan Cheng78be83d2008-11-11 19:40:26 +0000328 [(set DPR:$dst, (arm_sitof SPR:$a))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000329 let Inst{7} = 1; // s32
Evan Cheng78be83d2008-11-11 19:40:26 +0000330}
Evan Chenga8e29892007-01-19 07:51:42 +0000331
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000332def VSITOS : AVConv1In<0b11101, 0b11, 0b1000, 0b1010,
333 (outs SPR:$dst),(ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000334 IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a",
Evan Cheng78be83d2008-11-11 19:40:26 +0000335 [(set SPR:$dst, (arm_sitof SPR:$a))]> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000336 let Inst{7} = 1; // s32
Evan Cheng78be83d2008-11-11 19:40:26 +0000337}
Evan Chenga8e29892007-01-19 07:51:42 +0000338
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000339def VUITOD : AVConv1I<0b11101, 0b11, 0b1000, 0b1011,
340 (outs DPR:$dst), (ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000341 IIC_fpCVTID, "vcvt", ".f64.u32\t$dst, $a",
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000342 [(set DPR:$dst, (arm_uitof SPR:$a))]> {
343 let Inst{7} = 0; // u32
344}
Evan Chenga8e29892007-01-19 07:51:42 +0000345
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000346def VUITOS : AVConv1In<0b11101, 0b11, 0b1000, 0b1010,
347 (outs SPR:$dst), (ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000348 IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a",
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000349 [(set SPR:$dst, (arm_uitof SPR:$a))]> {
350 let Inst{7} = 0; // u32
351}
Evan Chenga8e29892007-01-19 07:51:42 +0000352
353// FP to Int:
354// Always set Z bit in the instruction, i.e. "round towards zero" variants.
355
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000356def VTOSIZD : AVConv1I<0b11101, 0b11, 0b1101, 0b1011,
Evan Cheng78be83d2008-11-11 19:40:26 +0000357 (outs SPR:$dst), (ins DPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000358 IIC_fpCVTDI, "vcvt", ".s32.f64\t$dst, $a",
Evan Cheng78be83d2008-11-11 19:40:26 +0000359 [(set SPR:$dst, (arm_ftosi DPR:$a))]> {
360 let Inst{7} = 1; // Z bit
361}
Evan Chenga8e29892007-01-19 07:51:42 +0000362
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000363def VTOSIZS : AVConv1In<0b11101, 0b11, 0b1101, 0b1010,
David Goodwin338268c2009-08-10 22:17:39 +0000364 (outs SPR:$dst), (ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000365 IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a",
Evan Cheng78be83d2008-11-11 19:40:26 +0000366 [(set SPR:$dst, (arm_ftosi SPR:$a))]> {
367 let Inst{7} = 1; // Z bit
368}
Evan Chenga8e29892007-01-19 07:51:42 +0000369
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000370def VTOUIZD : AVConv1I<0b11101, 0b11, 0b1100, 0b1011,
Evan Cheng78be83d2008-11-11 19:40:26 +0000371 (outs SPR:$dst), (ins DPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000372 IIC_fpCVTDI, "vcvt", ".u32.f64\t$dst, $a",
Evan Cheng78be83d2008-11-11 19:40:26 +0000373 [(set SPR:$dst, (arm_ftoui DPR:$a))]> {
374 let Inst{7} = 1; // Z bit
375}
Evan Chenga8e29892007-01-19 07:51:42 +0000376
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000377def VTOUIZS : AVConv1In<0b11101, 0b11, 0b1100, 0b1010,
David Goodwin338268c2009-08-10 22:17:39 +0000378 (outs SPR:$dst), (ins SPR:$a),
Jim Grosbache5165492009-11-09 00:11:35 +0000379 IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a",
Evan Cheng78be83d2008-11-11 19:40:26 +0000380 [(set SPR:$dst, (arm_ftoui SPR:$a))]> {
381 let Inst{7} = 1; // Z bit
382}
Evan Chenga8e29892007-01-19 07:51:42 +0000383
Johnny Chen15b423f2010-02-08 22:02:41 +0000384// And the Z bit '0' variants, i.e. use the rounding mode specified by FPSCR.
385// For disassembly only.
386
387def VTOSIRD : AVConv1I<0b11101, 0b11, 0b1101, 0b1011,
388 (outs SPR:$dst), (ins DPR:$a),
389 IIC_fpCVTDI, "vcvtr", ".s32.f64\t$dst, $a",
390 [/* For disassembly only; pattern left blank */]> {
391 let Inst{7} = 0; // Z bit
392}
393
394def VTOSIRS : AVConv1In<0b11101, 0b11, 0b1101, 0b1010,
395 (outs SPR:$dst), (ins SPR:$a),
396 IIC_fpCVTSI, "vcvtr", ".s32.f32\t$dst, $a",
397 [/* For disassembly only; pattern left blank */]> {
398 let Inst{7} = 0; // Z bit
399}
400
401def VTOUIRD : AVConv1I<0b11101, 0b11, 0b1100, 0b1011,
402 (outs SPR:$dst), (ins DPR:$a),
403 IIC_fpCVTDI, "vcvtr", ".u32.f64\t$dst, $a",
404 [/* For disassembly only; pattern left blank */]> {
405 let Inst{7} = 0; // Z bit
406}
407
408def VTOUIRS : AVConv1In<0b11101, 0b11, 0b1100, 0b1010,
409 (outs SPR:$dst), (ins SPR:$a),
410 IIC_fpCVTSI, "vcvtr", ".u32.f32\t$dst, $a",
411 [/* For disassembly only; pattern left blank */]> {
412 let Inst{7} = 0; // Z bit
413}
414
Johnny Chen27bb8d02010-02-11 18:17:16 +0000415// Convert between floating-point and fixed-point
416// Data type for fixed-point naming convention:
417// S16 (U=0, sx=0) -> SH
418// U16 (U=1, sx=0) -> UH
419// S32 (U=0, sx=1) -> SL
420// U32 (U=1, sx=1) -> UL
421
422let Constraints = "$a = $dst" in {
423
424// FP to Fixed-Point:
425
426def VTOSHS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 0,
427 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
428 IIC_fpCVTSI, "vcvt", ".s16.f32\t$dst, $a, $fbits",
429 [/* For disassembly only; pattern left blank */]>;
430
431def VTOUHS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 0,
432 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
433 IIC_fpCVTSI, "vcvt", ".u16.f32\t$dst, $a, $fbits",
434 [/* For disassembly only; pattern left blank */]>;
435
436def VTOSLS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 1,
437 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
438 IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a, $fbits",
439 [/* For disassembly only; pattern left blank */]>;
440
441def VTOULS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 1,
442 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
443 IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a, $fbits",
444 [/* For disassembly only; pattern left blank */]>;
445
446def VTOSHD : AVConv1XI<0b11101, 0b11, 0b1110, 0b1011, 0,
447 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
448 IIC_fpCVTDI, "vcvt", ".s16.f64\t$dst, $a, $fbits",
449 [/* For disassembly only; pattern left blank */]>;
450
451def VTOUHD : AVConv1XI<0b11101, 0b11, 0b1111, 0b1011, 0,
452 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
453 IIC_fpCVTDI, "vcvt", ".u16.f64\t$dst, $a, $fbits",
454 [/* For disassembly only; pattern left blank */]>;
455
456def VTOSLD : AVConv1XI<0b11101, 0b11, 0b1110, 0b1011, 1,
457 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
458 IIC_fpCVTDI, "vcvt", ".s32.f64\t$dst, $a, $fbits",
459 [/* For disassembly only; pattern left blank */]>;
460
461def VTOULD : AVConv1XI<0b11101, 0b11, 0b1111, 0b1011, 1,
462 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
463 IIC_fpCVTDI, "vcvt", ".u32.f64\t$dst, $a, $fbits",
464 [/* For disassembly only; pattern left blank */]>;
465
466// Fixed-Point to FP:
467
468def VSHTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 0,
469 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
470 IIC_fpCVTIS, "vcvt", ".f32.s16\t$dst, $a, $fbits",
471 [/* For disassembly only; pattern left blank */]>;
472
473def VUHTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 0,
474 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
475 IIC_fpCVTIS, "vcvt", ".f32.u16\t$dst, $a, $fbits",
476 [/* For disassembly only; pattern left blank */]>;
477
478def VSLTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 1,
479 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
480 IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a, $fbits",
481 [/* For disassembly only; pattern left blank */]>;
482
483def VULTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 1,
484 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
485 IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a, $fbits",
486 [/* For disassembly only; pattern left blank */]>;
487
488def VSHTOD : AVConv1XI<0b11101, 0b11, 0b1010, 0b1011, 0,
489 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
490 IIC_fpCVTID, "vcvt", ".f64.s16\t$dst, $a, $fbits",
491 [/* For disassembly only; pattern left blank */]>;
492
493def VUHTOD : AVConv1XI<0b11101, 0b11, 0b1011, 0b1011, 0,
494 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
495 IIC_fpCVTID, "vcvt", ".f64.u16\t$dst, $a, $fbits",
496 [/* For disassembly only; pattern left blank */]>;
497
498def VSLTOD : AVConv1XI<0b11101, 0b11, 0b1010, 0b1011, 1,
499 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
500 IIC_fpCVTID, "vcvt", ".f64.s32\t$dst, $a, $fbits",
501 [/* For disassembly only; pattern left blank */]>;
502
503def VULTOD : AVConv1XI<0b11101, 0b11, 0b1011, 0b1011, 1,
504 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
505 IIC_fpCVTID, "vcvt", ".f64.u32\t$dst, $a, $fbits",
506 [/* For disassembly only; pattern left blank */]>;
507
508} // End of 'let Constraints = "$src = $dst" in'
509
Evan Chenga8e29892007-01-19 07:51:42 +0000510//===----------------------------------------------------------------------===//
511// FP FMA Operations.
512//
513
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000514def VMLAD : ADbI<0b11100, 0b00, 0, 0,
515 (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000516 IIC_fpMAC64, "vmla", ".f64\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000517 [(set DPR:$dst, (fadd (fmul DPR:$a, DPR:$b), DPR:$dstin))]>,
518 RegConstraint<"$dstin = $dst">;
519
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000520def VMLAS : ASbIn<0b11100, 0b00, 0, 0,
521 (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000522 IIC_fpMAC32, "vmla", ".f32\t$dst, $a, $b",
David Goodwin42a83f22009-08-04 17:53:06 +0000523 [(set SPR:$dst, (fadd (fmul SPR:$a, SPR:$b), SPR:$dstin))]>,
524 RegConstraint<"$dstin = $dst">;
Evan Chenga8e29892007-01-19 07:51:42 +0000525
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000526def VNMLSD : ADbI<0b11100, 0b01, 0, 0,
527 (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000528 IIC_fpMAC64, "vnmls", ".f64\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000529 [(set DPR:$dst, (fsub (fmul DPR:$a, DPR:$b), DPR:$dstin))]>,
530 RegConstraint<"$dstin = $dst">;
531
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000532def VNMLSS : ASbI<0b11100, 0b01, 0, 0,
533 (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000534 IIC_fpMAC32, "vnmls", ".f32\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000535 [(set SPR:$dst, (fsub (fmul SPR:$a, SPR:$b), SPR:$dstin))]>,
536 RegConstraint<"$dstin = $dst">;
537
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000538def VMLSD : ADbI<0b11100, 0b00, 1, 0,
539 (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000540 IIC_fpMAC64, "vmls", ".f64\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000541 [(set DPR:$dst, (fadd (fneg (fmul DPR:$a, DPR:$b)), DPR:$dstin))]>,
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000542 RegConstraint<"$dstin = $dst">;
Evan Chenga8e29892007-01-19 07:51:42 +0000543
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000544def VMLSS : ASbIn<0b11100, 0b00, 1, 0,
545 (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000546 IIC_fpMAC32, "vmls", ".f32\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000547 [(set SPR:$dst, (fadd (fneg (fmul SPR:$a, SPR:$b)), SPR:$dstin))]>,
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000548 RegConstraint<"$dstin = $dst">;
Evan Chenga8e29892007-01-19 07:51:42 +0000549
David Goodwinb84f3d42009-08-04 18:44:29 +0000550def : Pat<(fsub DPR:$dstin, (fmul DPR:$a, DPR:$b)),
Jim Grosbache5165492009-11-09 00:11:35 +0000551 (VMLSD DPR:$dstin, DPR:$a, DPR:$b)>, Requires<[DontUseNEONForFP]>;
David Goodwinb84f3d42009-08-04 18:44:29 +0000552def : Pat<(fsub SPR:$dstin, (fmul SPR:$a, SPR:$b)),
Jim Grosbache5165492009-11-09 00:11:35 +0000553 (VMLSS SPR:$dstin, SPR:$a, SPR:$b)>, Requires<[DontUseNEONForFP]>;
David Goodwinb84f3d42009-08-04 18:44:29 +0000554
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000555def VNMLAD : ADbI<0b11100, 0b01, 1, 0,
556 (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000557 IIC_fpMAC64, "vnmla", ".f64\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000558 [(set DPR:$dst, (fsub (fneg (fmul DPR:$a, DPR:$b)), DPR:$dstin))]>,
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000559 RegConstraint<"$dstin = $dst">;
Evan Chenga8e29892007-01-19 07:51:42 +0000560
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000561def VNMLAS : ASbI<0b11100, 0b01, 1, 0,
562 (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b),
Jim Grosbache5165492009-11-09 00:11:35 +0000563 IIC_fpMAC32, "vnmla", ".f32\t$dst, $a, $b",
Evan Chenga8e29892007-01-19 07:51:42 +0000564 [(set SPR:$dst, (fsub (fneg (fmul SPR:$a, SPR:$b)), SPR:$dstin))]>,
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000565 RegConstraint<"$dstin = $dst">;
Evan Chenga8e29892007-01-19 07:51:42 +0000566
567//===----------------------------------------------------------------------===//
568// FP Conditional moves.
569//
570
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000571def VMOVDcc : ADuI<0b11101, 0b11, 0b0000, 0b01, 0,
Evan Cheng78be83d2008-11-11 19:40:26 +0000572 (outs DPR:$dst), (ins DPR:$false, DPR:$true),
Jim Grosbache5165492009-11-09 00:11:35 +0000573 IIC_fpUNA64, "vmov", ".f64\t$dst, $true",
Evan Chengc85e8322007-07-05 07:13:32 +0000574 [/*(set DPR:$dst, (ARMcmov DPR:$false, DPR:$true, imm:$cc))*/]>,
575 RegConstraint<"$false = $dst">;
Evan Chenga8e29892007-01-19 07:51:42 +0000576
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000577def VMOVScc : ASuI<0b11101, 0b11, 0b0000, 0b01, 0,
Evan Cheng78be83d2008-11-11 19:40:26 +0000578 (outs SPR:$dst), (ins SPR:$false, SPR:$true),
Jim Grosbache5165492009-11-09 00:11:35 +0000579 IIC_fpUNA32, "vmov", ".f32\t$dst, $true",
Evan Chengc85e8322007-07-05 07:13:32 +0000580 [/*(set SPR:$dst, (ARMcmov SPR:$false, SPR:$true, imm:$cc))*/]>,
581 RegConstraint<"$false = $dst">;
Evan Chenga8e29892007-01-19 07:51:42 +0000582
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000583def VNEGDcc : ADuI<0b11101, 0b11, 0b0001, 0b01, 0,
Evan Cheng78be83d2008-11-11 19:40:26 +0000584 (outs DPR:$dst), (ins DPR:$false, DPR:$true),
Jim Grosbache5165492009-11-09 00:11:35 +0000585 IIC_fpUNA64, "vneg", ".f64\t$dst, $true",
Evan Chengc85e8322007-07-05 07:13:32 +0000586 [/*(set DPR:$dst, (ARMcneg DPR:$false, DPR:$true, imm:$cc))*/]>,
587 RegConstraint<"$false = $dst">;
Evan Chenga8e29892007-01-19 07:51:42 +0000588
Johnny Chen69a8c7f2010-01-29 23:21:10 +0000589def VNEGScc : ASuI<0b11101, 0b11, 0b0001, 0b01, 0,
Evan Cheng78be83d2008-11-11 19:40:26 +0000590 (outs SPR:$dst), (ins SPR:$false, SPR:$true),
Jim Grosbache5165492009-11-09 00:11:35 +0000591 IIC_fpUNA32, "vneg", ".f32\t$dst, $true",
Evan Chengc85e8322007-07-05 07:13:32 +0000592 [/*(set SPR:$dst, (ARMcneg SPR:$false, SPR:$true, imm:$cc))*/]>,
593 RegConstraint<"$false = $dst">;
Evan Cheng78be83d2008-11-11 19:40:26 +0000594
595
596//===----------------------------------------------------------------------===//
597// Misc.
598//
599
Evan Cheng1e13c792009-11-10 19:44:56 +0000600// APSR is the application level alias of CPSR. This FPSCR N, Z, C, V flags
601// to APSR.
Evan Cheng91449a82009-07-20 02:12:31 +0000602let Defs = [CPSR], Uses = [FPSCR] in
Jim Grosbache5165492009-11-09 00:11:35 +0000603def FMSTAT : VFPAI<(outs), (ins), VFPMiscFrm, IIC_fpSTAT, "vmrs",
Jim Grosbachf4cbc0e2009-11-13 01:17:22 +0000604 "\tapsr_nzcv, fpscr",
Evan Chengdd22a452009-10-27 00:20:49 +0000605 [(arm_fmstat)]> {
Evan Chengcd8e66a2008-11-11 21:48:44 +0000606 let Inst{27-20} = 0b11101111;
607 let Inst{19-16} = 0b0001;
608 let Inst{15-12} = 0b1111;
609 let Inst{11-8} = 0b1010;
610 let Inst{7} = 0;
611 let Inst{4} = 1;
612}
Evan Cheng39382422009-10-28 01:44:26 +0000613
Johnny Chenc9745042010-02-09 22:35:38 +0000614// FPSCR <-> GPR (for disassembly only)
615
616let Uses = [FPSCR] in {
617def VMRS : VFPAI<(outs GPR:$dst), (ins), VFPMiscFrm, IIC_fpSTAT, "vmrs",
618 "\t$dst, fpscr",
619 [/* For disassembly only; pattern left blank */]> {
620 let Inst{27-20} = 0b11101111;
621 let Inst{19-16} = 0b0001;
622 let Inst{11-8} = 0b1010;
623 let Inst{7} = 0;
624 let Inst{4} = 1;
625}
626}
627
628let Defs = [FPSCR] in {
629def VMSR : VFPAI<(outs), (ins GPR:$src), VFPMiscFrm, IIC_fpSTAT, "vmsr",
630 "\tfpscr, $src",
631 [/* For disassembly only; pattern left blank */]> {
632 let Inst{27-20} = 0b11101110;
633 let Inst{19-16} = 0b0001;
634 let Inst{11-8} = 0b1010;
635 let Inst{7} = 0;
636 let Inst{4} = 1;
637}
638}
Evan Cheng39382422009-10-28 01:44:26 +0000639
640// Materialize FP immediates. VFP3 only.
Jim Grosbache5165492009-11-09 00:11:35 +0000641let isReMaterializable = 1 in {
642def FCONSTD : VFPAI<(outs DPR:$dst), (ins vfp_f64imm:$imm),
643 VFPMiscFrm, IIC_VMOVImm,
Evan Cheng9d172d52009-11-24 01:05:23 +0000644 "vmov", ".f64\t$dst, $imm",
Jim Grosbache5165492009-11-09 00:11:35 +0000645 [(set DPR:$dst, vfp_f64imm:$imm)]>, Requires<[HasVFP3]> {
646 let Inst{27-23} = 0b11101;
647 let Inst{21-20} = 0b11;
648 let Inst{11-9} = 0b101;
649 let Inst{8} = 1;
650 let Inst{7-4} = 0b0000;
651}
652
Evan Cheng39382422009-10-28 01:44:26 +0000653def FCONSTS : VFPAI<(outs SPR:$dst), (ins vfp_f32imm:$imm),
654 VFPMiscFrm, IIC_VMOVImm,
Evan Cheng9d172d52009-11-24 01:05:23 +0000655 "vmov", ".f32\t$dst, $imm",
Evan Cheng39382422009-10-28 01:44:26 +0000656 [(set SPR:$dst, vfp_f32imm:$imm)]>, Requires<[HasVFP3]> {
657 let Inst{27-23} = 0b11101;
658 let Inst{21-20} = 0b11;
659 let Inst{11-9} = 0b101;
660 let Inst{8} = 0;
661 let Inst{7-4} = 0b0000;
662}
Evan Cheng39382422009-10-28 01:44:26 +0000663}