blob: bb62940156db84aaf78b18d62cb10e357b4388e6 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===- ARMInstrVFP.td - VFP support for ARM -------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
8//===----------------------------------------------------------------------===//
9//
Jim Grosbach31b3e682008-09-11 21:41:29 +000010// This file describes the ARM VFP instruction set.
Dan Gohmanf17a25c2007-07-18 16:29:46 +000011//
12//===----------------------------------------------------------------------===//
13
Dan Gohmanf17a25c2007-07-18 16:29:46 +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 Grosbache2fda532009-11-09 00:11:35 +000020def SDT_VMOVDRR :
Dan Gohmanf17a25c2007-07-18 16:29:46 +000021SDTypeProfile<1, 2, [SDTCisVT<0, f64>, SDTCisVT<1, i32>,
22 SDTCisSameAs<1, 2>]>;
23
Chris Lattner3d254552008-01-15 22:02:54 +000024def arm_fmstat : SDNode<"ARMISD::FMSTAT", SDTNone, [SDNPInFlag,SDNPOutFlag]>;
Evan Chengc63e15e2008-11-11 02:11:05 +000025def arm_cmpfp : SDNode<"ARMISD::CMPFP", SDT_ARMCmp, [SDNPOutFlag]>;
26def arm_cmpfp0 : SDNode<"ARMISD::CMPFPw0",SDT_CMPFP0, [SDNPOutFlag]>;
Jim Grosbache2fda532009-11-09 00:11:35 +000027def arm_fmdrr : SDNode<"ARMISD::VMOVDRR", SDT_VMOVDRR>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000028
29//===----------------------------------------------------------------------===//
Evan Cheng7c7a3ff2009-10-28 01:44:26 +000030// Operand Definitions.
31//
32
33
34def vfp_f32imm : Operand<f32>,
35 PatLeaf<(f32 fpimm), [{
36 return ARM::getVFPf32Imm(N->getValueAPF()) != -1;
37 }]> {
38 let PrintMethod = "printVFPf32ImmOperand";
39}
40
41def vfp_f64imm : Operand<f64>,
42 PatLeaf<(f64 fpimm), [{
43 return ARM::getVFPf64Imm(N->getValueAPF()) != -1;
44 }]> {
45 let PrintMethod = "printVFPf64ImmOperand";
46}
47
48
49//===----------------------------------------------------------------------===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +000050// Load / store Instructions.
51//
52
Dan Gohman6debe022010-02-27 23:47:46 +000053let canFoldAsLoad = 1, isReMaterializable = 1 in {
Jim Grosbache2fda532009-11-09 00:11:35 +000054def VLDRD : ADI5<0b1101, 0b01, (outs DPR:$dst), (ins addrmode5:$addr),
55 IIC_fpLoad64, "vldr", ".64\t$dst, $addr",
Chris Lattner4e624722010-03-08 18:51:21 +000056 [(set DPR:$dst, (f64 (load addrmode5:$addr)))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000057
Jim Grosbache2fda532009-11-09 00:11:35 +000058def VLDRS : ASI5<0b1101, 0b01, (outs SPR:$dst), (ins addrmode5:$addr),
59 IIC_fpLoad32, "vldr", ".32\t$dst, $addr",
Dan Gohmanf17a25c2007-07-18 16:29:46 +000060 [(set SPR:$dst, (load addrmode5:$addr))]>;
Dan Gohman5574cc72008-12-03 18:15:48 +000061} // canFoldAsLoad
Dan Gohmanf17a25c2007-07-18 16:29:46 +000062
Jim Grosbache2fda532009-11-09 00:11:35 +000063def VSTRD : ADI5<0b1101, 0b00, (outs), (ins DPR:$src, addrmode5:$addr),
64 IIC_fpStore64, "vstr", ".64\t$src, $addr",
Chris Lattner4e624722010-03-08 18:51:21 +000065 [(store (f64 DPR:$src), addrmode5:$addr)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000066
Jim Grosbache2fda532009-11-09 00:11:35 +000067def VSTRS : ASI5<0b1101, 0b00, (outs), (ins SPR:$src, addrmode5:$addr),
68 IIC_fpStore32, "vstr", ".32\t$src, $addr",
Dan Gohmanf17a25c2007-07-18 16:29:46 +000069 [(store SPR:$src, addrmode5:$addr)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000070
71//===----------------------------------------------------------------------===//
72// Load / store multiple Instructions.
73//
74
Evan Cheng7c8d5ea2009-10-01 08:22:27 +000075let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
Bob Wilson5ef33c72010-03-13 01:08:20 +000076def VLDMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dsts,
Bob Wilsonb9ee99d2010-03-13 07:34:35 +000077 variable_ops), IndexModeNone, IIC_fpLoadm,
Bob Wilson5ef33c72010-03-13 01:08:20 +000078 "vldm${addr:submode}${p}\t${addr:base}, $dsts", "", []> {
Evan Chengbb786b32008-11-11 21:48:44 +000079 let Inst{20} = 1;
80}
Dan Gohmanf17a25c2007-07-18 16:29:46 +000081
Bob Wilson5ef33c72010-03-13 01:08:20 +000082def VLDMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dsts,
Bob Wilsonb9ee99d2010-03-13 07:34:35 +000083 variable_ops), IndexModeNone, IIC_fpLoadm,
Bob Wilson5ef33c72010-03-13 01:08:20 +000084 "vldm${addr:submode}${p}\t${addr:base}, $dsts", "", []> {
85 let Inst{20} = 1;
86}
87
88def VLDMD_UPD : AXDI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
89 reglist:$dsts, variable_ops),
Bob Wilsonb9ee99d2010-03-13 07:34:35 +000090 IndexModeUpd, IIC_fpLoadm,
Bob Wilsona256a752010-03-16 18:38:09 +000091 "vldm${addr:submode}${p}\t${addr:base}!, $dsts",
Bob Wilson5ef33c72010-03-13 01:08:20 +000092 "$addr.base = $wb", []> {
Johnny Chenbc654322010-03-16 21:25:05 +000093 let Inst{21} = 1; // wback
Bob Wilson5ef33c72010-03-13 01:08:20 +000094 let Inst{20} = 1;
95}
96
97def VLDMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
98 reglist:$dsts, variable_ops),
Bob Wilsonb9ee99d2010-03-13 07:34:35 +000099 IndexModeUpd, IIC_fpLoadm,
Bob Wilsona256a752010-03-16 18:38:09 +0000100 "vldm${addr:submode}${p}\t${addr:base}!, $dsts",
Bob Wilson5ef33c72010-03-13 01:08:20 +0000101 "$addr.base = $wb", []> {
Johnny Chenbc654322010-03-16 21:25:05 +0000102 let Inst{21} = 1; // wback
Evan Chengbb786b32008-11-11 21:48:44 +0000103 let Inst{20} = 1;
104}
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000105} // mayLoad, hasExtraDefRegAllocReq
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000106
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000107let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
Bob Wilson5ef33c72010-03-13 01:08:20 +0000108def VSTMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$srcs,
Bob Wilsonb9ee99d2010-03-13 07:34:35 +0000109 variable_ops), IndexModeNone, IIC_fpStorem,
Bob Wilson5ef33c72010-03-13 01:08:20 +0000110 "vstm${addr:submode}${p}\t${addr:base}, $srcs", "", []> {
Evan Chengbb786b32008-11-11 21:48:44 +0000111 let Inst{20} = 0;
112}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000113
Bob Wilson5ef33c72010-03-13 01:08:20 +0000114def VSTMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$srcs,
Bob Wilsonb9ee99d2010-03-13 07:34:35 +0000115 variable_ops), IndexModeNone, IIC_fpStorem,
Bob Wilson5ef33c72010-03-13 01:08:20 +0000116 "vstm${addr:submode}${p}\t${addr:base}, $srcs", "", []> {
117 let Inst{20} = 0;
118}
119
120def VSTMD_UPD : AXDI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
121 reglist:$srcs, variable_ops),
Bob Wilsonb9ee99d2010-03-13 07:34:35 +0000122 IndexModeUpd, IIC_fpStorem,
Bob Wilsona256a752010-03-16 18:38:09 +0000123 "vstm${addr:submode}${p}\t${addr:base}!, $srcs",
Bob Wilson5ef33c72010-03-13 01:08:20 +0000124 "$addr.base = $wb", []> {
Johnny Chenbc654322010-03-16 21:25:05 +0000125 let Inst{21} = 1; // wback
Bob Wilson5ef33c72010-03-13 01:08:20 +0000126 let Inst{20} = 0;
127}
128
129def VSTMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p,
130 reglist:$srcs, variable_ops),
Bob Wilsonb9ee99d2010-03-13 07:34:35 +0000131 IndexModeUpd, IIC_fpStorem,
Bob Wilsona256a752010-03-16 18:38:09 +0000132 "vstm${addr:submode}${p}\t${addr:base}!, $srcs",
Bob Wilson5ef33c72010-03-13 01:08:20 +0000133 "$addr.base = $wb", []> {
Johnny Chenbc654322010-03-16 21:25:05 +0000134 let Inst{21} = 1; // wback
Evan Chengbb786b32008-11-11 21:48:44 +0000135 let Inst{20} = 0;
136}
Evan Cheng7c8d5ea2009-10-01 08:22:27 +0000137} // mayStore, hasExtraSrcRegAllocReq
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000138
139// FLDMX, FSTMX - mixing S/D registers for pre-armv6 cores
140
141//===----------------------------------------------------------------------===//
142// FP Binary Operations.
143//
144
Johnny Chenf363f2b2010-01-29 23:21:10 +0000145def VADDD : ADbI<0b11100, 0b11, 0, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000146 IIC_fpALU64, "vadd", ".f64\t$dst, $a, $b",
Chris Lattner4e624722010-03-08 18:51:21 +0000147 [(set DPR:$dst, (fadd DPR:$a, (f64 DPR:$b)))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000148
Johnny Chenf363f2b2010-01-29 23:21:10 +0000149def VADDS : ASbIn<0b11100, 0b11, 0, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000150 IIC_fpALU32, "vadd", ".f32\t$dst, $a, $b",
David Goodwindd19ce42009-08-04 17:53:06 +0000151 [(set SPR:$dst, (fadd SPR:$a, SPR:$b))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000152
Evan Cheng11838a82008-11-12 07:18:38 +0000153// These are encoded as unary instructions.
Evan Chengdf6703e2009-07-20 02:12:31 +0000154let Defs = [FPSCR] in {
Johnny Chenf363f2b2010-01-29 23:21:10 +0000155def VCMPED : ADuI<0b11101, 0b11, 0b0100, 0b11, 0, (outs), (ins DPR:$a, DPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000156 IIC_fpCMP64, "vcmpe", ".f64\t$a, $b",
Chris Lattner4e624722010-03-08 18:51:21 +0000157 [(arm_cmpfp DPR:$a, (f64 DPR:$b))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000158
Johnny Chen714b9c72010-02-08 19:41:48 +0000159def VCMPD : ADuI<0b11101, 0b11, 0b0100, 0b01, 0, (outs), (ins DPR:$a, DPR:$b),
160 IIC_fpCMP64, "vcmp", ".f64\t$a, $b",
161 [/* For disassembly only; pattern left blank */]>;
162
Johnny Chenf363f2b2010-01-29 23:21:10 +0000163def VCMPES : ASuI<0b11101, 0b11, 0b0100, 0b11, 0, (outs), (ins SPR:$a, SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000164 IIC_fpCMP32, "vcmpe", ".f32\t$a, $b",
Evan Cheng11838a82008-11-12 07:18:38 +0000165 [(arm_cmpfp SPR:$a, SPR:$b)]>;
Johnny Chen714b9c72010-02-08 19:41:48 +0000166
167def VCMPS : ASuI<0b11101, 0b11, 0b0100, 0b01, 0, (outs), (ins SPR:$a, SPR:$b),
168 IIC_fpCMP32, "vcmp", ".f32\t$a, $b",
169 [/* For disassembly only; pattern left blank */]>;
Evan Chengdf6703e2009-07-20 02:12:31 +0000170}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000171
Johnny Chenf363f2b2010-01-29 23:21:10 +0000172def VDIVD : ADbI<0b11101, 0b00, 0, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000173 IIC_fpDIV64, "vdiv", ".f64\t$dst, $a, $b",
Chris Lattner4e624722010-03-08 18:51:21 +0000174 [(set DPR:$dst, (fdiv DPR:$a, (f64 DPR:$b)))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000175
Johnny Chenf363f2b2010-01-29 23:21:10 +0000176def VDIVS : ASbI<0b11101, 0b00, 0, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000177 IIC_fpDIV32, "vdiv", ".f32\t$dst, $a, $b",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000178 [(set SPR:$dst, (fdiv SPR:$a, SPR:$b))]>;
179
Johnny Chenf363f2b2010-01-29 23:21:10 +0000180def VMULD : ADbI<0b11100, 0b10, 0, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000181 IIC_fpMUL64, "vmul", ".f64\t$dst, $a, $b",
Chris Lattner4e624722010-03-08 18:51:21 +0000182 [(set DPR:$dst, (fmul DPR:$a, (f64 DPR:$b)))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000183
Johnny Chenf363f2b2010-01-29 23:21:10 +0000184def VMULS : ASbIn<0b11100, 0b10, 0, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000185 IIC_fpMUL32, "vmul", ".f32\t$dst, $a, $b",
David Goodwindd19ce42009-08-04 17:53:06 +0000186 [(set SPR:$dst, (fmul SPR:$a, SPR:$b))]>;
Jim Grosbache2fda532009-11-09 00:11:35 +0000187
Johnny Chenf363f2b2010-01-29 23:21:10 +0000188def VNMULD : ADbI<0b11100, 0b10, 1, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000189 IIC_fpMUL64, "vnmul", ".f64\t$dst, $a, $b",
Chris Lattner4e624722010-03-08 18:51:21 +0000190 [(set DPR:$dst, (fneg (fmul DPR:$a, (f64 DPR:$b))))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000191
Johnny Chenf363f2b2010-01-29 23:21:10 +0000192def VNMULS : ASbI<0b11100, 0b10, 1, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000193 IIC_fpMUL32, "vnmul", ".f32\t$dst, $a, $b",
Johnny Chenf363f2b2010-01-29 23:21:10 +0000194 [(set SPR:$dst, (fneg (fmul SPR:$a, SPR:$b)))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000195
196// Match reassociated forms only if not sign dependent rounding.
Chris Lattner4e624722010-03-08 18:51:21 +0000197def : Pat<(fmul (fneg DPR:$a), (f64 DPR:$b)),
Jim Grosbache2fda532009-11-09 00:11:35 +0000198 (VNMULD DPR:$a, DPR:$b)>, Requires<[NoHonorSignDependentRounding]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000199def : Pat<(fmul (fneg SPR:$a), SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000200 (VNMULS SPR:$a, SPR:$b)>, Requires<[NoHonorSignDependentRounding]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000201
202
Johnny Chenf363f2b2010-01-29 23:21:10 +0000203def VSUBD : ADbI<0b11100, 0b11, 1, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000204 IIC_fpALU64, "vsub", ".f64\t$dst, $a, $b",
Chris Lattner4e624722010-03-08 18:51:21 +0000205 [(set DPR:$dst, (fsub DPR:$a, (f64 DPR:$b)))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000206
Johnny Chenf363f2b2010-01-29 23:21:10 +0000207def VSUBS : ASbIn<0b11100, 0b11, 1, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000208 IIC_fpALU32, "vsub", ".f32\t$dst, $a, $b",
Johnny Chenf363f2b2010-01-29 23:21:10 +0000209 [(set SPR:$dst, (fsub SPR:$a, SPR:$b))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000210
211//===----------------------------------------------------------------------===//
212// FP Unary Operations.
213//
214
Johnny Chenf363f2b2010-01-29 23:21:10 +0000215def VABSD : ADuI<0b11101, 0b11, 0b0000, 0b11, 0, (outs DPR:$dst), (ins DPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000216 IIC_fpUNA64, "vabs", ".f64\t$dst, $a",
Chris Lattner4e624722010-03-08 18:51:21 +0000217 [(set DPR:$dst, (fabs (f64 DPR:$a)))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000218
Johnny Chenf363f2b2010-01-29 23:21:10 +0000219def VABSS : ASuIn<0b11101, 0b11, 0b0000, 0b11, 0,(outs SPR:$dst), (ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000220 IIC_fpUNA32, "vabs", ".f32\t$dst, $a",
David Goodwinbc7c05e2009-08-04 20:39:05 +0000221 [(set SPR:$dst, (fabs SPR:$a))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000222
Evan Chengdf6703e2009-07-20 02:12:31 +0000223let Defs = [FPSCR] in {
Johnny Chenf363f2b2010-01-29 23:21:10 +0000224def VCMPEZD : ADuI<0b11101, 0b11, 0b0101, 0b11, 0, (outs), (ins DPR:$a),
Jim Grosbachcdc49802009-11-09 15:27:51 +0000225 IIC_fpCMP64, "vcmpe", ".f64\t$a, #0",
Chris Lattner4e624722010-03-08 18:51:21 +0000226 [(arm_cmpfp0 (f64 DPR:$a))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000227
Johnny Chen714b9c72010-02-08 19:41:48 +0000228def VCMPZD : ADuI<0b11101, 0b11, 0b0101, 0b01, 0, (outs), (ins DPR:$a),
229 IIC_fpCMP64, "vcmp", ".f64\t$a, #0",
230 [/* For disassembly only; pattern left blank */]>;
231
Johnny Chenf363f2b2010-01-29 23:21:10 +0000232def VCMPEZS : ASuI<0b11101, 0b11, 0b0101, 0b11, 0, (outs), (ins SPR:$a),
Jim Grosbachcdc49802009-11-09 15:27:51 +0000233 IIC_fpCMP32, "vcmpe", ".f32\t$a, #0",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000234 [(arm_cmpfp0 SPR:$a)]>;
Johnny Chen714b9c72010-02-08 19:41:48 +0000235
236def VCMPZS : ASuI<0b11101, 0b11, 0b0101, 0b01, 0, (outs), (ins SPR:$a),
237 IIC_fpCMP32, "vcmp", ".f32\t$a, #0",
238 [/* For disassembly only; pattern left blank */]>;
Evan Chengdf6703e2009-07-20 02:12:31 +0000239}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000240
Johnny Chenf363f2b2010-01-29 23:21:10 +0000241def VCVTDS : ASuI<0b11101, 0b11, 0b0111, 0b11, 0, (outs DPR:$dst), (ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000242 IIC_fpCVTDS, "vcvt", ".f64.f32\t$dst, $a",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000243 [(set DPR:$dst, (fextend SPR:$a))]>;
244
Evan Chengc63e15e2008-11-11 02:11:05 +0000245// Special case encoding: bits 11-8 is 0b1011.
Jim Grosbache2fda532009-11-09 00:11:35 +0000246def VCVTSD : VFPAI<(outs SPR:$dst), (ins DPR:$a), VFPUnaryFrm,
247 IIC_fpCVTSD, "vcvt", ".f32.f64\t$dst, $a",
David Goodwince9fbbe2009-07-10 17:03:29 +0000248 [(set SPR:$dst, (fround DPR:$a))]> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000249 let Inst{27-23} = 0b11101;
250 let Inst{21-16} = 0b110111;
251 let Inst{11-8} = 0b1011;
Johnny Chenf363f2b2010-01-29 23:21:10 +0000252 let Inst{7-6} = 0b11;
253 let Inst{4} = 0;
Evan Chengc63e15e2008-11-11 02:11:05 +0000254}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000255
Johnny Chen2e1f0092010-02-09 17:21:56 +0000256// Between half-precision and single-precision. For disassembly only.
257
258def VCVTBSH : ASuI<0b11101, 0b11, 0b0010, 0b01, 0, (outs SPR:$dst), (ins SPR:$a),
259 /* FIXME */ IIC_fpCVTDS, "vcvtb", ".f32.f16\t$dst, $a",
Anton Korobeynikovc761f632010-03-18 22:35:37 +0000260 [/* For disassembly only; pattern left blank */]>;
261
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000262def : VFPPat<(f32_to_f16 SPR:$a),
263 (i32 (COPY_TO_REGCLASS (VCVTBSH SPR:$a), GPR))>,
264 Requires<[HasVFP3, HasFP16]>;
Johnny Chen2e1f0092010-02-09 17:21:56 +0000265
266def VCVTBHS : ASuI<0b11101, 0b11, 0b0011, 0b01, 0, (outs SPR:$dst), (ins SPR:$a),
267 /* FIXME */ IIC_fpCVTDS, "vcvtb", ".f16.f32\t$dst, $a",
Anton Korobeynikovc761f632010-03-18 22:35:37 +0000268 [/* For disassembly only; pattern left blank */]>;
269
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000270def : VFPPat<(f16_to_f32 GPR:$a),
271 (VCVTBHS (COPY_TO_REGCLASS GPR:$a, SPR))>,
272 Requires<[HasVFP3, HasFP16]>;
Johnny Chen2e1f0092010-02-09 17:21:56 +0000273
274def VCVTTSH : ASuI<0b11101, 0b11, 0b0010, 0b11, 0, (outs SPR:$dst), (ins SPR:$a),
275 /* FIXME */ IIC_fpCVTDS, "vcvtt", ".f32.f16\t$dst, $a",
276 [/* For disassembly only; pattern left blank */]>;
277
278def VCVTTHS : ASuI<0b11101, 0b11, 0b0011, 0b11, 0, (outs SPR:$dst), (ins SPR:$a),
279 /* FIXME */ IIC_fpCVTDS, "vcvtt", ".f16.f32\t$dst, $a",
280 [/* For disassembly only; pattern left blank */]>;
281
Evan Chengd97d7142009-06-12 20:46:18 +0000282let neverHasSideEffects = 1 in {
Johnny Chenf363f2b2010-01-29 23:21:10 +0000283def VMOVD: ADuI<0b11101, 0b11, 0b0000, 0b01, 0, (outs DPR:$dst), (ins DPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000284 IIC_fpUNA64, "vmov", ".f64\t$dst, $a", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000285
Johnny Chenf363f2b2010-01-29 23:21:10 +0000286def VMOVS: ASuI<0b11101, 0b11, 0b0000, 0b01, 0, (outs SPR:$dst), (ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000287 IIC_fpUNA32, "vmov", ".f32\t$dst, $a", []>;
Evan Chengd97d7142009-06-12 20:46:18 +0000288} // neverHasSideEffects
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000289
Johnny Chenf363f2b2010-01-29 23:21:10 +0000290def VNEGD : ADuI<0b11101, 0b11, 0b0001, 0b01, 0, (outs DPR:$dst), (ins DPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000291 IIC_fpUNA64, "vneg", ".f64\t$dst, $a",
Chris Lattner4e624722010-03-08 18:51:21 +0000292 [(set DPR:$dst, (fneg (f64 DPR:$a)))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000293
Johnny Chenf363f2b2010-01-29 23:21:10 +0000294def VNEGS : ASuIn<0b11101, 0b11, 0b0001, 0b01, 0,(outs SPR:$dst), (ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000295 IIC_fpUNA32, "vneg", ".f32\t$dst, $a",
David Goodwinbc7c05e2009-08-04 20:39:05 +0000296 [(set SPR:$dst, (fneg SPR:$a))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000297
Johnny Chenf363f2b2010-01-29 23:21:10 +0000298def VSQRTD : ADuI<0b11101, 0b11, 0b0001, 0b11, 0, (outs DPR:$dst), (ins DPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000299 IIC_fpSQRT64, "vsqrt", ".f64\t$dst, $a",
Chris Lattner4e624722010-03-08 18:51:21 +0000300 [(set DPR:$dst, (fsqrt (f64 DPR:$a)))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000301
Johnny Chenf363f2b2010-01-29 23:21:10 +0000302def VSQRTS : ASuI<0b11101, 0b11, 0b0001, 0b11, 0, (outs SPR:$dst), (ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000303 IIC_fpSQRT32, "vsqrt", ".f32\t$dst, $a",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000304 [(set SPR:$dst, (fsqrt SPR:$a))]>;
305
306//===----------------------------------------------------------------------===//
307// FP <-> GPR Copies. Int <-> FP Conversions.
308//
309
Jim Grosbache2fda532009-11-09 00:11:35 +0000310def VMOVRS : AVConv2I<0b11100001, 0b1010, (outs GPR:$dst), (ins SPR:$src),
311 IIC_VMOVSI, "vmov", "\t$dst, $src",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000312 [(set GPR:$dst, (bitconvert SPR:$src))]>;
313
Jim Grosbache2fda532009-11-09 00:11:35 +0000314def VMOVSR : AVConv4I<0b11100000, 0b1010, (outs SPR:$dst), (ins GPR:$src),
315 IIC_VMOVIS, "vmov", "\t$dst, $src",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000316 [(set SPR:$dst, (bitconvert GPR:$src))]>;
317
Jim Grosbache2fda532009-11-09 00:11:35 +0000318def VMOVRRD : AVConv3I<0b11000101, 0b1011,
Evan Chengb43a20e2009-10-01 01:33:39 +0000319 (outs GPR:$wb, GPR:$dst2), (ins DPR:$src),
Jim Grosbache2fda532009-11-09 00:11:35 +0000320 IIC_VMOVDI, "vmov", "\t$wb, $dst2, $src",
Johnny Chen92a90ab2010-02-05 18:04:58 +0000321 [/* FIXME: Can't write pattern for multiple result instr*/]> {
322 let Inst{7-6} = 0b00;
323}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000324
Johnny Chenbbe77262010-02-08 17:26:09 +0000325def VMOVRRS : AVConv3I<0b11000101, 0b1010,
326 (outs GPR:$wb, GPR:$dst2), (ins SPR:$src1, SPR:$src2),
327 IIC_VMOVDI, "vmov", "\t$wb, $dst2, $src1, $src2",
328 [/* For disassembly only; pattern left blank */]> {
329 let Inst{7-6} = 0b00;
330}
331
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000332// FMDHR: GPR -> SPR
333// FMDLR: GPR -> SPR
334
Jim Grosbache2fda532009-11-09 00:11:35 +0000335def VMOVDRR : AVConv5I<0b11000100, 0b1011,
Evan Cheng74165932008-12-11 22:02:02 +0000336 (outs DPR:$dst), (ins GPR:$src1, GPR:$src2),
Jim Grosbache2fda532009-11-09 00:11:35 +0000337 IIC_VMOVID, "vmov", "\t$dst, $src1, $src2",
Johnny Chen92a90ab2010-02-05 18:04:58 +0000338 [(set DPR:$dst, (arm_fmdrr GPR:$src1, GPR:$src2))]> {
339 let Inst{7-6} = 0b00;
340}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000341
Johnny Chenbbe77262010-02-08 17:26:09 +0000342def VMOVSRR : AVConv5I<0b11000100, 0b1010,
343 (outs SPR:$dst1, SPR:$dst2), (ins GPR:$src1, GPR:$src2),
344 IIC_VMOVID, "vmov", "\t$dst1, $dst2, $src1, $src2",
345 [/* For disassembly only; pattern left blank */]> {
346 let Inst{7-6} = 0b00;
347}
348
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000349// FMRDH: SPR -> GPR
350// FMRDL: SPR -> GPR
351// FMRRS: SPR -> GPR
352// FMRX : SPR system reg -> GPR
353
354// FMSRR: GPR -> SPR
355
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000356// FMXR: GPR -> VFP Sstem reg
357
358
359// Int to FP:
360
Johnny Chenf363f2b2010-01-29 23:21:10 +0000361def VSITOD : AVConv1I<0b11101, 0b11, 0b1000, 0b1011,
362 (outs DPR:$dst), (ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000363 IIC_fpCVTID, "vcvt", ".f64.s32\t$dst, $a",
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000364 [/* For disassembly only; pattern left blank */]> {
Johnny Chenf363f2b2010-01-29 23:21:10 +0000365 let Inst{7} = 1; // s32
Evan Cheng9d3cc182008-11-11 19:40:26 +0000366}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000367
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000368def : VFPPat<(f64 (sint_to_fp GPR:$a)),
369 (VSITOD (COPY_TO_REGCLASS GPR:$a, SPR))>;
370
Johnny Chenf363f2b2010-01-29 23:21:10 +0000371def VSITOS : AVConv1In<0b11101, 0b11, 0b1000, 0b1010,
372 (outs SPR:$dst),(ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000373 IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a",
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000374 [/* For disassembly only; pattern left blank */]> {
Johnny Chenf363f2b2010-01-29 23:21:10 +0000375 let Inst{7} = 1; // s32
Evan Cheng9d3cc182008-11-11 19:40:26 +0000376}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000377
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000378def : VFPPat<(f32 (sint_to_fp GPR:$a)),
379 (VSITOS (COPY_TO_REGCLASS GPR:$a, SPR))>,
380 Requires<[DontUseNEONForFP, HasVFP2]>;
381
Johnny Chenf363f2b2010-01-29 23:21:10 +0000382def VUITOD : AVConv1I<0b11101, 0b11, 0b1000, 0b1011,
383 (outs DPR:$dst), (ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000384 IIC_fpCVTID, "vcvt", ".f64.u32\t$dst, $a",
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000385 [/* For disassembly only; pattern left blank */]> {
Johnny Chenf363f2b2010-01-29 23:21:10 +0000386 let Inst{7} = 0; // u32
387}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000388
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000389def : VFPPat<(f64 (uint_to_fp GPR:$a)),
390 (VUITOD (COPY_TO_REGCLASS GPR:$a, SPR))>;
391
Johnny Chenf363f2b2010-01-29 23:21:10 +0000392def VUITOS : AVConv1In<0b11101, 0b11, 0b1000, 0b1010,
393 (outs SPR:$dst), (ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000394 IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a",
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000395 [/* For disassembly only; pattern left blank */]> {
Johnny Chenf363f2b2010-01-29 23:21:10 +0000396 let Inst{7} = 0; // u32
397}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000398
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000399def : VFPPat<(f32 (uint_to_fp GPR:$a)),
400 (VUITOS (COPY_TO_REGCLASS GPR:$a, SPR))>,
401 Requires<[DontUseNEONForFP, HasVFP2]>;
402
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000403// FP to Int:
404// Always set Z bit in the instruction, i.e. "round towards zero" variants.
405
Johnny Chenf363f2b2010-01-29 23:21:10 +0000406def VTOSIZD : AVConv1I<0b11101, 0b11, 0b1101, 0b1011,
Evan Cheng9d3cc182008-11-11 19:40:26 +0000407 (outs SPR:$dst), (ins DPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000408 IIC_fpCVTDI, "vcvt", ".s32.f64\t$dst, $a",
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000409 [/* For disassembly only; pattern left blank */]> {
Evan Cheng9d3cc182008-11-11 19:40:26 +0000410 let Inst{7} = 1; // Z bit
411}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000412
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000413def : VFPPat<(i32 (fp_to_sint (f64 DPR:$a))),
414 (COPY_TO_REGCLASS (VTOSIZD DPR:$a), GPR)>;
415
Johnny Chenf363f2b2010-01-29 23:21:10 +0000416def VTOSIZS : AVConv1In<0b11101, 0b11, 0b1101, 0b1010,
David Goodwin4b358db2009-08-10 22:17:39 +0000417 (outs SPR:$dst), (ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000418 IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a",
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000419 [/* For disassembly only; pattern left blank */]> {
Evan Cheng9d3cc182008-11-11 19:40:26 +0000420 let Inst{7} = 1; // Z bit
421}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000422
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000423def : VFPPat<(i32 (fp_to_sint SPR:$a)),
424 (COPY_TO_REGCLASS (VTOSIZS SPR:$a), GPR)>,
425 Requires<[DontUseNEONForFP, HasVFP2]>;
426
Johnny Chenf363f2b2010-01-29 23:21:10 +0000427def VTOUIZD : AVConv1I<0b11101, 0b11, 0b1100, 0b1011,
Evan Cheng9d3cc182008-11-11 19:40:26 +0000428 (outs SPR:$dst), (ins DPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000429 IIC_fpCVTDI, "vcvt", ".u32.f64\t$dst, $a",
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000430 [/* For disassembly only; pattern left blank */]> {
Evan Cheng9d3cc182008-11-11 19:40:26 +0000431 let Inst{7} = 1; // Z bit
432}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000433
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000434def : VFPPat<(i32 (fp_to_uint (f64 DPR:$a))),
435 (COPY_TO_REGCLASS (VTOUIZD DPR:$a), GPR)>;
436
Johnny Chenf363f2b2010-01-29 23:21:10 +0000437def VTOUIZS : AVConv1In<0b11101, 0b11, 0b1100, 0b1010,
David Goodwin4b358db2009-08-10 22:17:39 +0000438 (outs SPR:$dst), (ins SPR:$a),
Jim Grosbache2fda532009-11-09 00:11:35 +0000439 IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a",
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000440 [/* For disassembly only; pattern left blank */]> {
Evan Cheng9d3cc182008-11-11 19:40:26 +0000441 let Inst{7} = 1; // Z bit
442}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000443
Anton Korobeynikov2d588092010-03-18 22:35:45 +0000444def : VFPPat<(i32 (fp_to_uint SPR:$a)),
445 (COPY_TO_REGCLASS (VTOUIZS SPR:$a), GPR)>,
446 Requires<[DontUseNEONForFP, HasVFP2]>;
447
Johnny Chen00b26de2010-02-08 22:02:41 +0000448// And the Z bit '0' variants, i.e. use the rounding mode specified by FPSCR.
449// For disassembly only.
450
451def VTOSIRD : AVConv1I<0b11101, 0b11, 0b1101, 0b1011,
452 (outs SPR:$dst), (ins DPR:$a),
453 IIC_fpCVTDI, "vcvtr", ".s32.f64\t$dst, $a",
454 [/* For disassembly only; pattern left blank */]> {
455 let Inst{7} = 0; // Z bit
456}
457
458def VTOSIRS : AVConv1In<0b11101, 0b11, 0b1101, 0b1010,
459 (outs SPR:$dst), (ins SPR:$a),
460 IIC_fpCVTSI, "vcvtr", ".s32.f32\t$dst, $a",
461 [/* For disassembly only; pattern left blank */]> {
462 let Inst{7} = 0; // Z bit
463}
464
465def VTOUIRD : AVConv1I<0b11101, 0b11, 0b1100, 0b1011,
466 (outs SPR:$dst), (ins DPR:$a),
467 IIC_fpCVTDI, "vcvtr", ".u32.f64\t$dst, $a",
468 [/* For disassembly only; pattern left blank */]> {
469 let Inst{7} = 0; // Z bit
470}
471
472def VTOUIRS : AVConv1In<0b11101, 0b11, 0b1100, 0b1010,
473 (outs SPR:$dst), (ins SPR:$a),
474 IIC_fpCVTSI, "vcvtr", ".u32.f32\t$dst, $a",
475 [/* For disassembly only; pattern left blank */]> {
476 let Inst{7} = 0; // Z bit
477}
478
Johnny Chen3dd3f802010-02-11 18:17:16 +0000479// Convert between floating-point and fixed-point
480// Data type for fixed-point naming convention:
481// S16 (U=0, sx=0) -> SH
482// U16 (U=1, sx=0) -> UH
483// S32 (U=0, sx=1) -> SL
484// U32 (U=1, sx=1) -> UL
485
486let Constraints = "$a = $dst" in {
487
488// FP to Fixed-Point:
489
490def VTOSHS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 0,
491 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
492 IIC_fpCVTSI, "vcvt", ".s16.f32\t$dst, $a, $fbits",
493 [/* For disassembly only; pattern left blank */]>;
494
495def VTOUHS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 0,
496 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
497 IIC_fpCVTSI, "vcvt", ".u16.f32\t$dst, $a, $fbits",
498 [/* For disassembly only; pattern left blank */]>;
499
500def VTOSLS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 1,
501 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
502 IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a, $fbits",
503 [/* For disassembly only; pattern left blank */]>;
504
505def VTOULS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 1,
506 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
507 IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a, $fbits",
508 [/* For disassembly only; pattern left blank */]>;
509
510def VTOSHD : AVConv1XI<0b11101, 0b11, 0b1110, 0b1011, 0,
511 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
512 IIC_fpCVTDI, "vcvt", ".s16.f64\t$dst, $a, $fbits",
513 [/* For disassembly only; pattern left blank */]>;
514
515def VTOUHD : AVConv1XI<0b11101, 0b11, 0b1111, 0b1011, 0,
516 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
517 IIC_fpCVTDI, "vcvt", ".u16.f64\t$dst, $a, $fbits",
518 [/* For disassembly only; pattern left blank */]>;
519
520def VTOSLD : AVConv1XI<0b11101, 0b11, 0b1110, 0b1011, 1,
521 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
522 IIC_fpCVTDI, "vcvt", ".s32.f64\t$dst, $a, $fbits",
523 [/* For disassembly only; pattern left blank */]>;
524
525def VTOULD : AVConv1XI<0b11101, 0b11, 0b1111, 0b1011, 1,
526 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
527 IIC_fpCVTDI, "vcvt", ".u32.f64\t$dst, $a, $fbits",
528 [/* For disassembly only; pattern left blank */]>;
529
530// Fixed-Point to FP:
531
532def VSHTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 0,
533 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
534 IIC_fpCVTIS, "vcvt", ".f32.s16\t$dst, $a, $fbits",
535 [/* For disassembly only; pattern left blank */]>;
536
537def VUHTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 0,
538 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
539 IIC_fpCVTIS, "vcvt", ".f32.u16\t$dst, $a, $fbits",
540 [/* For disassembly only; pattern left blank */]>;
541
542def VSLTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 1,
543 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
544 IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a, $fbits",
545 [/* For disassembly only; pattern left blank */]>;
546
547def VULTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 1,
548 (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits),
549 IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a, $fbits",
550 [/* For disassembly only; pattern left blank */]>;
551
552def VSHTOD : AVConv1XI<0b11101, 0b11, 0b1010, 0b1011, 0,
553 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
554 IIC_fpCVTID, "vcvt", ".f64.s16\t$dst, $a, $fbits",
555 [/* For disassembly only; pattern left blank */]>;
556
557def VUHTOD : AVConv1XI<0b11101, 0b11, 0b1011, 0b1011, 0,
558 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
559 IIC_fpCVTID, "vcvt", ".f64.u16\t$dst, $a, $fbits",
560 [/* For disassembly only; pattern left blank */]>;
561
562def VSLTOD : AVConv1XI<0b11101, 0b11, 0b1010, 0b1011, 1,
563 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
564 IIC_fpCVTID, "vcvt", ".f64.s32\t$dst, $a, $fbits",
565 [/* For disassembly only; pattern left blank */]>;
566
567def VULTOD : AVConv1XI<0b11101, 0b11, 0b1011, 0b1011, 1,
568 (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits),
569 IIC_fpCVTID, "vcvt", ".f64.u32\t$dst, $a, $fbits",
570 [/* For disassembly only; pattern left blank */]>;
571
572} // End of 'let Constraints = "$src = $dst" in'
573
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000574//===----------------------------------------------------------------------===//
575// FP FMA Operations.
576//
577
Johnny Chenf363f2b2010-01-29 23:21:10 +0000578def VMLAD : ADbI<0b11100, 0b00, 0, 0,
579 (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000580 IIC_fpMAC64, "vmla", ".f64\t$dst, $a, $b",
Chris Lattner4e624722010-03-08 18:51:21 +0000581 [(set DPR:$dst, (fadd (fmul DPR:$a, DPR:$b),
582 (f64 DPR:$dstin)))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000583 RegConstraint<"$dstin = $dst">;
584
Johnny Chenf363f2b2010-01-29 23:21:10 +0000585def VMLAS : ASbIn<0b11100, 0b00, 0, 0,
586 (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000587 IIC_fpMAC32, "vmla", ".f32\t$dst, $a, $b",
David Goodwindd19ce42009-08-04 17:53:06 +0000588 [(set SPR:$dst, (fadd (fmul SPR:$a, SPR:$b), SPR:$dstin))]>,
589 RegConstraint<"$dstin = $dst">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000590
Johnny Chenf363f2b2010-01-29 23:21:10 +0000591def VNMLSD : ADbI<0b11100, 0b01, 0, 0,
592 (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000593 IIC_fpMAC64, "vnmls", ".f64\t$dst, $a, $b",
Chris Lattner4e624722010-03-08 18:51:21 +0000594 [(set DPR:$dst, (fsub (fmul DPR:$a, DPR:$b),
595 (f64 DPR:$dstin)))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000596 RegConstraint<"$dstin = $dst">;
597
Johnny Chenf363f2b2010-01-29 23:21:10 +0000598def VNMLSS : ASbI<0b11100, 0b01, 0, 0,
599 (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000600 IIC_fpMAC32, "vnmls", ".f32\t$dst, $a, $b",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000601 [(set SPR:$dst, (fsub (fmul SPR:$a, SPR:$b), SPR:$dstin))]>,
602 RegConstraint<"$dstin = $dst">;
603
Johnny Chenf363f2b2010-01-29 23:21:10 +0000604def VMLSD : ADbI<0b11100, 0b00, 1, 0,
605 (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000606 IIC_fpMAC64, "vmls", ".f64\t$dst, $a, $b",
Chris Lattner4e624722010-03-08 18:51:21 +0000607 [(set DPR:$dst, (fadd (fneg (fmul DPR:$a, DPR:$b)),
608 (f64 DPR:$dstin)))]>,
Johnny Chenf363f2b2010-01-29 23:21:10 +0000609 RegConstraint<"$dstin = $dst">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000610
Johnny Chenf363f2b2010-01-29 23:21:10 +0000611def VMLSS : ASbIn<0b11100, 0b00, 1, 0,
612 (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000613 IIC_fpMAC32, "vmls", ".f32\t$dst, $a, $b",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000614 [(set SPR:$dst, (fadd (fneg (fmul SPR:$a, SPR:$b)), SPR:$dstin))]>,
Johnny Chenf363f2b2010-01-29 23:21:10 +0000615 RegConstraint<"$dstin = $dst">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000616
Chris Lattner4e624722010-03-08 18:51:21 +0000617def : Pat<(fsub DPR:$dstin, (fmul DPR:$a, (f64 DPR:$b))),
Jim Grosbache2fda532009-11-09 00:11:35 +0000618 (VMLSD DPR:$dstin, DPR:$a, DPR:$b)>, Requires<[DontUseNEONForFP]>;
David Goodwinf31748c2009-08-04 18:44:29 +0000619def : Pat<(fsub SPR:$dstin, (fmul SPR:$a, SPR:$b)),
Jim Grosbache2fda532009-11-09 00:11:35 +0000620 (VMLSS SPR:$dstin, SPR:$a, SPR:$b)>, Requires<[DontUseNEONForFP]>;
David Goodwinf31748c2009-08-04 18:44:29 +0000621
Johnny Chenf363f2b2010-01-29 23:21:10 +0000622def VNMLAD : ADbI<0b11100, 0b01, 1, 0,
623 (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000624 IIC_fpMAC64, "vnmla", ".f64\t$dst, $a, $b",
Chris Lattner4e624722010-03-08 18:51:21 +0000625 [(set DPR:$dst, (fsub (fneg (fmul DPR:$a, DPR:$b)),
626 (f64 DPR:$dstin)))]>,
Johnny Chenf363f2b2010-01-29 23:21:10 +0000627 RegConstraint<"$dstin = $dst">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000628
Johnny Chenf363f2b2010-01-29 23:21:10 +0000629def VNMLAS : ASbI<0b11100, 0b01, 1, 0,
630 (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b),
Jim Grosbache2fda532009-11-09 00:11:35 +0000631 IIC_fpMAC32, "vnmla", ".f32\t$dst, $a, $b",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000632 [(set SPR:$dst, (fsub (fneg (fmul SPR:$a, SPR:$b)), SPR:$dstin))]>,
Johnny Chenf363f2b2010-01-29 23:21:10 +0000633 RegConstraint<"$dstin = $dst">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000634
635//===----------------------------------------------------------------------===//
636// FP Conditional moves.
637//
638
Johnny Chenf363f2b2010-01-29 23:21:10 +0000639def VMOVDcc : ADuI<0b11101, 0b11, 0b0000, 0b01, 0,
Evan Cheng9d3cc182008-11-11 19:40:26 +0000640 (outs DPR:$dst), (ins DPR:$false, DPR:$true),
Jim Grosbache2fda532009-11-09 00:11:35 +0000641 IIC_fpUNA64, "vmov", ".f64\t$dst, $true",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000642 [/*(set DPR:$dst, (ARMcmov DPR:$false, DPR:$true, imm:$cc))*/]>,
643 RegConstraint<"$false = $dst">;
644
Johnny Chenf363f2b2010-01-29 23:21:10 +0000645def VMOVScc : ASuI<0b11101, 0b11, 0b0000, 0b01, 0,
Evan Cheng9d3cc182008-11-11 19:40:26 +0000646 (outs SPR:$dst), (ins SPR:$false, SPR:$true),
Jim Grosbache2fda532009-11-09 00:11:35 +0000647 IIC_fpUNA32, "vmov", ".f32\t$dst, $true",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000648 [/*(set SPR:$dst, (ARMcmov SPR:$false, SPR:$true, imm:$cc))*/]>,
649 RegConstraint<"$false = $dst">;
650
Johnny Chenf363f2b2010-01-29 23:21:10 +0000651def VNEGDcc : ADuI<0b11101, 0b11, 0b0001, 0b01, 0,
Evan Cheng9d3cc182008-11-11 19:40:26 +0000652 (outs DPR:$dst), (ins DPR:$false, DPR:$true),
Jim Grosbache2fda532009-11-09 00:11:35 +0000653 IIC_fpUNA64, "vneg", ".f64\t$dst, $true",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000654 [/*(set DPR:$dst, (ARMcneg DPR:$false, DPR:$true, imm:$cc))*/]>,
655 RegConstraint<"$false = $dst">;
656
Johnny Chenf363f2b2010-01-29 23:21:10 +0000657def VNEGScc : ASuI<0b11101, 0b11, 0b0001, 0b01, 0,
Evan Cheng9d3cc182008-11-11 19:40:26 +0000658 (outs SPR:$dst), (ins SPR:$false, SPR:$true),
Jim Grosbache2fda532009-11-09 00:11:35 +0000659 IIC_fpUNA32, "vneg", ".f32\t$dst, $true",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000660 [/*(set SPR:$dst, (ARMcneg SPR:$false, SPR:$true, imm:$cc))*/]>,
661 RegConstraint<"$false = $dst">;
Evan Cheng9d3cc182008-11-11 19:40:26 +0000662
663
664//===----------------------------------------------------------------------===//
665// Misc.
666//
667
Evan Cheng979c7ab2009-11-10 19:44:56 +0000668// APSR is the application level alias of CPSR. This FPSCR N, Z, C, V flags
669// to APSR.
Evan Chengdf6703e2009-07-20 02:12:31 +0000670let Defs = [CPSR], Uses = [FPSCR] in
Jim Grosbache2fda532009-11-09 00:11:35 +0000671def FMSTAT : VFPAI<(outs), (ins), VFPMiscFrm, IIC_fpSTAT, "vmrs",
Jim Grosbach0b6f9872009-11-13 01:17:22 +0000672 "\tapsr_nzcv, fpscr",
Evan Chengc1db4e52009-10-27 00:20:49 +0000673 [(arm_fmstat)]> {
Evan Chengbb786b32008-11-11 21:48:44 +0000674 let Inst{27-20} = 0b11101111;
675 let Inst{19-16} = 0b0001;
676 let Inst{15-12} = 0b1111;
677 let Inst{11-8} = 0b1010;
678 let Inst{7} = 0;
679 let Inst{4} = 1;
680}
Evan Cheng7c7a3ff2009-10-28 01:44:26 +0000681
Johnny Chen1bfdc742010-02-09 22:35:38 +0000682// FPSCR <-> GPR (for disassembly only)
683
684let Uses = [FPSCR] in {
685def VMRS : VFPAI<(outs GPR:$dst), (ins), VFPMiscFrm, IIC_fpSTAT, "vmrs",
686 "\t$dst, fpscr",
687 [/* For disassembly only; pattern left blank */]> {
688 let Inst{27-20} = 0b11101111;
689 let Inst{19-16} = 0b0001;
690 let Inst{11-8} = 0b1010;
691 let Inst{7} = 0;
692 let Inst{4} = 1;
693}
694}
695
696let Defs = [FPSCR] in {
697def VMSR : VFPAI<(outs), (ins GPR:$src), VFPMiscFrm, IIC_fpSTAT, "vmsr",
698 "\tfpscr, $src",
699 [/* For disassembly only; pattern left blank */]> {
700 let Inst{27-20} = 0b11101110;
701 let Inst{19-16} = 0b0001;
702 let Inst{11-8} = 0b1010;
703 let Inst{7} = 0;
704 let Inst{4} = 1;
705}
706}
Evan Cheng7c7a3ff2009-10-28 01:44:26 +0000707
708// Materialize FP immediates. VFP3 only.
Jim Grosbache2fda532009-11-09 00:11:35 +0000709let isReMaterializable = 1 in {
710def FCONSTD : VFPAI<(outs DPR:$dst), (ins vfp_f64imm:$imm),
711 VFPMiscFrm, IIC_VMOVImm,
Evan Cheng9f433ab2009-11-24 01:05:23 +0000712 "vmov", ".f64\t$dst, $imm",
Jim Grosbache2fda532009-11-09 00:11:35 +0000713 [(set DPR:$dst, vfp_f64imm:$imm)]>, Requires<[HasVFP3]> {
714 let Inst{27-23} = 0b11101;
715 let Inst{21-20} = 0b11;
716 let Inst{11-9} = 0b101;
717 let Inst{8} = 1;
718 let Inst{7-4} = 0b0000;
719}
720
Evan Cheng7c7a3ff2009-10-28 01:44:26 +0000721def FCONSTS : VFPAI<(outs SPR:$dst), (ins vfp_f32imm:$imm),
722 VFPMiscFrm, IIC_VMOVImm,
Evan Cheng9f433ab2009-11-24 01:05:23 +0000723 "vmov", ".f32\t$dst, $imm",
Evan Cheng7c7a3ff2009-10-28 01:44:26 +0000724 [(set SPR:$dst, vfp_f32imm:$imm)]>, Requires<[HasVFP3]> {
725 let Inst{27-23} = 0b11101;
726 let Inst{21-20} = 0b11;
727 let Inst{11-9} = 0b101;
728 let Inst{8} = 0;
729 let Inst{7-4} = 0b0000;
730}
Evan Cheng7c7a3ff2009-10-28 01:44:26 +0000731}