[Hexagon] Adding encodings for v5 floating point instructions.
[oota-llvm.git] / lib / Target / Hexagon / HexagonInstrInfoV5.td
1 //=- HexagonInstrInfoV5.td - Target Desc. for Hexagon Target -*- tablegen -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes the Hexagon V5 instructions in TableGen format.
11 //
12 //===----------------------------------------------------------------------===//
13
14 //===----------------------------------------------------------------------===//
15 // XTYPE/MPY
16 //===----------------------------------------------------------------------===//
17
18 let isCodeGenOnly = 0 in
19 def S2_asr_i_p_rnd : S_2OpInstImm<"asr", 0b110, 0b111, u6Imm,
20       [(set I64:$dst,
21             (sra (i64 (add (i64 (sra I64:$src1, u6ImmPred:$src2)), 1)),
22                  (i32 1)))], 1>,
23       Requires<[HasV5T]> {
24   bits<6> src2;
25   let Inst{13-8} = src2;
26 }
27
28 let isCodeGenOnly = 0 in
29 def C4_fastcorner9 : T_LOGICAL_2OP<"fastcorner9", 0b000, 0, 0>,
30   Requires<[HasV5T]> {
31   let Inst{13,7,4} = 0b111;
32 }
33
34 let isCodeGenOnly = 0 in
35 def C4_fastcorner9_not : T_LOGICAL_2OP<"!fastcorner9", 0b000, 0, 0>,
36   Requires<[HasV5T]> {
37   let Inst{20,13,7,4} = 0b1111;
38 }
39
40 def SDTHexagonFCONST32 : SDTypeProfile<1, 1, [
41                                             SDTCisVT<0, f32>,
42                                             SDTCisPtrTy<1>]>;
43 def HexagonFCONST32 : SDNode<"HexagonISD::FCONST32",     SDTHexagonFCONST32>;
44
45 let isReMaterializable = 1, isMoveImm = 1 in
46 def FCONST32_nsdata : LDInst<(outs IntRegs:$dst), (ins globaladdress:$global),
47               "$dst = CONST32(#$global)",
48               [(set (f32 IntRegs:$dst),
49               (HexagonFCONST32 tglobaladdr:$global))]>,
50                Requires<[HasV5T]>;
51
52 let isReMaterializable = 1, isMoveImm = 1 in
53 def CONST64_Float_Real : LDInst<(outs DoubleRegs:$dst), (ins f64imm:$src1),
54                        "$dst = CONST64(#$src1)",
55                        [(set DoubleRegs:$dst, fpimm:$src1)]>,
56           Requires<[HasV5T]>;
57
58 let isReMaterializable = 1, isMoveImm = 1 in
59 def CONST32_Float_Real : LDInst<(outs IntRegs:$dst), (ins f32imm:$src1),
60                        "$dst = CONST32(#$src1)",
61                        [(set IntRegs:$dst, fpimm:$src1)]>,
62           Requires<[HasV5T]>;
63
64 // Transfer immediate float.
65 // Only works with single precision fp value.
66 // For double precision, use CONST64_float_real, as 64bit transfer
67 // can only hold 40-bit values - 32 from const ext + 8 bit immediate.
68 // Make sure that complexity is more than the CONST32 pattern in
69 // HexagonInstrInfo.td patterns.
70 let isExtended = 1, opExtendable = 1, isMoveImm = 1, isReMaterializable = 1,
71 isPredicable = 1, AddedComplexity = 30, validSubTargets = HasV5SubT,
72 isCodeGenOnly = 1 in
73 def TFRI_f : ALU32_ri<(outs IntRegs:$dst), (ins f32Ext:$src1),
74            "$dst = #$src1",
75            [(set IntRegs:$dst, fpimm:$src1)]>,
76           Requires<[HasV5T]>;
77
78 let isExtended = 1, opExtendable = 2, isPredicated = 1,
79 hasSideEffects = 0, validSubTargets = HasV5SubT in
80 def TFRI_cPt_f : ALU32_ri<(outs IntRegs:$dst),
81                           (ins PredRegs:$src1, f32Ext:$src2),
82            "if ($src1) $dst = #$src2",
83            []>,
84           Requires<[HasV5T]>;
85
86 let isExtended = 1, opExtendable = 2, isPredicated = 1, isPredicatedFalse = 1,
87 hasSideEffects = 0, validSubTargets = HasV5SubT in
88 def TFRI_cNotPt_f : ALU32_ri<(outs IntRegs:$dst),
89                              (ins PredRegs:$src1, f32Ext:$src2),
90            "if (!$src1) $dst =#$src2",
91            []>,
92           Requires<[HasV5T]>;
93
94 def SDTHexagonI32I64: SDTypeProfile<1, 1, [SDTCisVT<0, i32>,
95                                            SDTCisVT<1, i64>]>;
96
97 def HexagonPOPCOUNT: SDNode<"HexagonISD::POPCOUNT", SDTHexagonI32I64>;
98
99 let hasNewValue = 1, validSubTargets = HasV5SubT, isCodeGenOnly = 0 in
100 def S5_popcountp : ALU64_rr<(outs IntRegs:$Rd), (ins DoubleRegs:$Rss),
101   "$Rd = popcount($Rss)",
102   [(set I32:$Rd, (HexagonPOPCOUNT I64:$Rss))], "", S_2op_tc_2_SLOT23>,
103   Requires<[HasV5T]> {
104     bits<5> Rd;
105     bits<5> Rss;
106
107     let IClass = 0b1000;
108
109     let Inst{27-21} = 0b1000011;
110     let Inst{7-5} = 0b011;
111     let Inst{4-0} = Rd;
112     let Inst{20-16} = Rss;
113   }
114
115 let Uses = [USR], isFP = 1, hasNewValue = 1, opNewValue = 0 in
116 class T_MInstFloat <string mnemonic, bits<3> MajOp, bits<3> MinOp>
117   : MInst<(outs IntRegs:$Rd),
118           (ins IntRegs:$Rs, IntRegs:$Rt),
119   "$Rd = "#mnemonic#"($Rs, $Rt)", [],
120   "" , M_tc_3or4x_SLOT23 > ,
121   Requires<[HasV5T]> {
122     bits<5> Rd;
123     bits<5> Rs;
124     bits<5> Rt;
125
126     let IClass = 0b1110;
127
128     let Inst{27-24} = 0b1011;
129     let Inst{23-21} = MajOp;
130     let Inst{20-16} = Rs;
131     let Inst{13} = 0b0;
132     let Inst{12-8} = Rt;
133     let Inst{7-5} = MinOp;
134     let Inst{4-0} = Rd;
135   }
136
137 let isCommutable = 1, isCodeGenOnly = 0 in {
138   def F2_sfadd : T_MInstFloat < "sfadd", 0b000, 0b000>;
139   def F2_sfmpy : T_MInstFloat < "sfmpy", 0b010, 0b000>;
140 }
141
142 let isCodeGenOnly = 0 in
143 def F2_sfsub : T_MInstFloat < "sfsub", 0b000, 0b001>;
144
145 let Itinerary = M_tc_3x_SLOT23, isCodeGenOnly = 0 in {
146   def F2_sfmax : T_MInstFloat < "sfmax", 0b100, 0b000>;
147   def F2_sfmin : T_MInstFloat < "sfmin", 0b100, 0b001>;
148 }
149
150 let isCodeGenOnly = 0 in {
151 def F2_sffixupn : T_MInstFloat < "sffixupn", 0b110, 0b000>;
152 def F2_sffixupd : T_MInstFloat < "sffixupd", 0b110, 0b001>;
153 }
154
155 // F2_sfrecipa: Reciprocal approximation for division.
156 let Uses = [USR], isPredicateLate = 1, isFP = 1,
157 hasSideEffects = 0, hasNewValue = 1, isCodeGenOnly = 0 in
158 def F2_sfrecipa: MInst <
159   (outs IntRegs:$Rd, PredRegs:$Pe),
160   (ins IntRegs:$Rs, IntRegs:$Rt),
161   "$Rd, $Pe = sfrecipa($Rs, $Rt)">,
162   Requires<[HasV5T]> {
163     bits<5> Rd;
164     bits<2> Pe;
165     bits<5> Rs;
166     bits<5> Rt;
167
168     let IClass = 0b1110;
169     let Inst{27-21} = 0b1011111;
170     let Inst{20-16} = Rs;
171     let Inst{13}    = 0b0;
172     let Inst{12-8}  = Rt;
173     let Inst{7}     = 0b1;
174     let Inst{6-5}   = Pe;
175     let Inst{4-0}   = Rd;
176   }
177
178 // F2_dfcmpeq: Floating point compare for equal.
179 let Uses = [USR], isCompare = 1, isFP = 1 in
180 class T_fcmp <string mnemonic, RegisterClass RC, bits<3> MinOp,
181               list<dag> pattern = [] >
182   : ALU64Inst <(outs PredRegs:$dst), (ins RC:$src1, RC:$src2),
183   "$dst = "#mnemonic#"($src1, $src2)", pattern,
184   "" , ALU64_tc_2early_SLOT23 > ,
185   Requires<[HasV5T]> {
186     bits<2> dst;
187     bits<5> src1;
188     bits<5> src2;
189
190     let IClass = 0b1101;
191
192     let Inst{27-21} = 0b0010111;
193     let Inst{20-16} = src1;
194     let Inst{12-8}  = src2;
195     let Inst{7-5}   = MinOp;
196     let Inst{1-0}   = dst;
197   }
198
199 class T_fcmp64 <string mnemonic, PatFrag OpNode, bits<3> MinOp>
200   : T_fcmp <mnemonic, DoubleRegs, MinOp,
201   [(set  I1:$dst, (OpNode F64:$src1, F64:$src2))]> {
202   let IClass = 0b1101;
203   let Inst{27-21} = 0b0010111;
204 }
205
206 class T_fcmp32 <string mnemonic, PatFrag OpNode, bits<3> MinOp>
207   : T_fcmp <mnemonic, IntRegs, MinOp,
208   [(set  I1:$dst, (OpNode F32:$src1, F32:$src2))]> {
209   let IClass = 0b1100;
210   let Inst{27-21} = 0b0111111;
211 }
212
213 let isCodeGenOnly = 0 in {
214 def F2_dfcmpeq : T_fcmp64<"dfcmp.eq", setoeq, 0b000>;
215 def F2_dfcmpgt : T_fcmp64<"dfcmp.gt", setogt, 0b001>;
216 def F2_dfcmpge : T_fcmp64<"dfcmp.ge", setoge, 0b010>;
217 def F2_dfcmpuo : T_fcmp64<"dfcmp.uo", setuo,  0b011>;
218
219 def F2_sfcmpge : T_fcmp32<"sfcmp.ge", setoge, 0b000>;
220 def F2_sfcmpuo : T_fcmp32<"sfcmp.uo", setuo,  0b001>;
221 def F2_sfcmpeq : T_fcmp32<"sfcmp.eq", setoeq, 0b011>;
222 def F2_sfcmpgt : T_fcmp32<"sfcmp.gt", setogt, 0b100>;
223 }
224
225 // F2 convert template classes:
226 let Uses = [USR], isFP = 1 in
227 class F2_RDD_RSS_CONVERT<string mnemonic, bits<3> MinOp,
228                          SDNode Op, PatLeaf RCOut, PatLeaf RCIn,
229                          string chop ="">
230   : SInst <(outs DoubleRegs:$Rdd), (ins DoubleRegs:$Rss),
231    "$Rdd = "#mnemonic#"($Rss)"#chop,
232    [(set RCOut:$Rdd, (Op RCIn:$Rss))], "",
233    S_2op_tc_3or4x_SLOT23> {
234      bits<5> Rdd;
235      bits<5> Rss;
236
237      let IClass = 0b1000;
238
239      let Inst{27-21} = 0b0000111;
240      let Inst{20-16} = Rss;
241      let Inst{7-5} = MinOp;
242      let Inst{4-0} = Rdd;
243   }
244
245 let Uses = [USR], isFP = 1 in
246 class F2_RDD_RS_CONVERT<string mnemonic, bits<3> MinOp,
247                         SDNode Op, PatLeaf RCOut, PatLeaf RCIn,
248                         string chop ="">
249   : SInst <(outs DoubleRegs:$Rdd), (ins IntRegs:$Rs),
250    "$Rdd = "#mnemonic#"($Rs)"#chop,
251    [(set RCOut:$Rdd, (Op RCIn:$Rs))], "",
252    S_2op_tc_3or4x_SLOT23> {
253      bits<5> Rdd;
254      bits<5> Rs;
255
256      let IClass = 0b1000;
257
258      let Inst{27-21} = 0b0100100;
259      let Inst{20-16} = Rs;
260      let Inst{7-5} = MinOp;
261      let Inst{4-0} = Rdd;
262   }
263
264 let Uses = [USR], isFP = 1, hasNewValue = 1 in
265 class F2_RD_RSS_CONVERT<string mnemonic, bits<3> MinOp,
266                         SDNode Op, PatLeaf RCOut, PatLeaf RCIn,
267                         string chop ="">
268   : SInst <(outs IntRegs:$Rd), (ins DoubleRegs:$Rss),
269    "$Rd = "#mnemonic#"($Rss)"#chop,
270    [(set RCOut:$Rd, (Op RCIn:$Rss))], "",
271    S_2op_tc_3or4x_SLOT23> {
272      bits<5> Rd;
273      bits<5> Rss;
274
275      let IClass = 0b1000;
276
277      let Inst{27-24} = 0b1000;
278      let Inst{23-21} = MinOp;
279      let Inst{20-16} = Rss;
280      let Inst{7-5} = 0b001;
281      let Inst{4-0} = Rd;
282   }
283
284 let Uses = [USR], isFP = 1, hasNewValue = 1 in
285 class F2_RD_RS_CONVERT<string mnemonic, bits<3> MajOp, bits<3> MinOp,
286                         SDNode Op, PatLeaf RCOut, PatLeaf RCIn,
287                         string chop ="">
288   : SInst <(outs IntRegs:$Rd), (ins IntRegs:$Rs),
289    "$Rd = "#mnemonic#"($Rs)"#chop,
290    [(set RCOut:$Rd, (Op RCIn:$Rs))], "",
291    S_2op_tc_3or4x_SLOT23> {
292      bits<5> Rd;
293      bits<5> Rs;
294
295      let IClass = 0b1000;
296
297      let Inst{27-24} = 0b1011;
298      let Inst{23-21} = MajOp;
299      let Inst{20-16} = Rs;
300      let Inst{7-5} = MinOp;
301      let Inst{4-0} = Rd;
302   }
303
304 // Convert single precision to double precision and vice-versa.
305 let isCodeGenOnly = 0 in {
306 def F2_conv_sf2df : F2_RDD_RS_CONVERT <"convert_sf2df", 0b000,
307                                        fextend, F64, F32>;
308
309 def F2_conv_df2sf : F2_RD_RSS_CONVERT <"convert_df2sf", 0b000,
310                                        fround, F32, F64>;
311
312 // Convert Integer to Floating Point.
313 def F2_conv_d2sf : F2_RD_RSS_CONVERT <"convert_d2sf", 0b010,
314                                        sint_to_fp, F32, I64>;
315 def F2_conv_ud2sf : F2_RD_RSS_CONVERT <"convert_ud2sf", 0b001,
316                                        uint_to_fp, F32, I64>;
317 def F2_conv_uw2sf : F2_RD_RS_CONVERT <"convert_uw2sf", 0b001, 0b000,
318                                        uint_to_fp, F32, I32>;
319 def F2_conv_w2sf : F2_RD_RS_CONVERT <"convert_w2sf", 0b010, 0b000,
320                                        sint_to_fp, F32, I32>;
321 def F2_conv_d2df : F2_RDD_RSS_CONVERT <"convert_d2df", 0b011,
322                                        sint_to_fp, F64, I64>;
323 def F2_conv_ud2df : F2_RDD_RSS_CONVERT <"convert_ud2df", 0b010,
324                                         uint_to_fp, F64, I64>;
325 def F2_conv_uw2df : F2_RDD_RS_CONVERT <"convert_uw2df", 0b001,
326                                        uint_to_fp, F64, I32>;
327 def F2_conv_w2df : F2_RDD_RS_CONVERT <"convert_w2df", 0b010,
328                                        sint_to_fp, F64, I32>;
329
330 // Convert Floating Point to Integer - default.
331 def F2_conv_df2uw_chop : F2_RD_RSS_CONVERT <"convert_df2uw", 0b101,
332                                             fp_to_uint, I32, F64, ":chop">;
333 def F2_conv_df2w_chop : F2_RD_RSS_CONVERT <"convert_df2w", 0b111,
334                                             fp_to_sint, I32, F64, ":chop">;
335 def F2_conv_sf2uw_chop : F2_RD_RS_CONVERT <"convert_sf2uw", 0b011, 0b001,
336                                        fp_to_uint, I32, F32, ":chop">;
337 def F2_conv_sf2w_chop : F2_RD_RS_CONVERT <"convert_sf2w", 0b100, 0b001,
338                                        fp_to_sint, I32, F32, ":chop">;
339 def F2_conv_df2d_chop : F2_RDD_RSS_CONVERT <"convert_df2d", 0b110,
340                                             fp_to_sint, I64, F64, ":chop">;
341 def F2_conv_df2ud_chop : F2_RDD_RSS_CONVERT <"convert_df2ud", 0b111,
342                                              fp_to_uint, I64, F64, ":chop">;
343 def F2_conv_sf2d_chop : F2_RDD_RS_CONVERT <"convert_sf2d", 0b110,
344                                        fp_to_sint, I64, F32, ":chop">;
345 def F2_conv_sf2ud_chop : F2_RDD_RS_CONVERT <"convert_sf2ud", 0b101,
346                                             fp_to_uint, I64, F32, ":chop">;
347
348 // Convert Floating Point to Integer: non-chopped.
349 let AddedComplexity = 20, Predicates = [HasV5T, IEEERndNearV5T] in {
350   def F2_conv_df2d : F2_RDD_RSS_CONVERT <"convert_df2d", 0b000,
351                                          fp_to_sint, I64, F64>;
352   def F2_conv_df2ud : F2_RDD_RSS_CONVERT <"convert_df2ud", 0b001,
353                                           fp_to_uint, I64, F64>;
354   def F2_conv_sf2ud : F2_RDD_RS_CONVERT <"convert_sf2ud", 0b011,
355                                          fp_to_uint, I64, F32>;
356   def F2_conv_sf2d : F2_RDD_RS_CONVERT <"convert_sf2d", 0b100,
357                                          fp_to_sint, I64, F32>;
358   def F2_conv_df2uw : F2_RD_RSS_CONVERT <"convert_df2uw", 0b011,
359                                          fp_to_uint, I32, F64>;
360   def F2_conv_df2w : F2_RD_RSS_CONVERT <"convert_df2w", 0b100,
361                                          fp_to_sint, I32, F64>;
362   def F2_conv_sf2uw : F2_RD_RS_CONVERT <"convert_sf2uw", 0b011, 0b000,
363                                          fp_to_uint, I32, F32>;
364   def F2_conv_sf2w : F2_RD_RS_CONVERT <"convert_sf2w", 0b100, 0b000,
365                                          fp_to_sint, I32, F32>;
366 }
367 }
368
369 // Fix up radicand.
370 let Uses = [USR], isFP = 1, hasNewValue = 1, isCodeGenOnly = 0 in
371 def F2_sffixupr: SInst<(outs IntRegs:$Rd), (ins IntRegs:$Rs),
372   "$Rd = sffixupr($Rs)",
373   [], "" , S_2op_tc_3or4x_SLOT23>, Requires<[HasV5T]> {
374     bits<5> Rd;
375     bits<5> Rs;
376
377     let IClass = 0b1000;
378
379     let Inst{27-21} = 0b1011101;
380     let Inst{20-16} = Rs;
381     let Inst{7-5}   = 0b000;
382     let Inst{4-0}   = Rd;
383   }
384
385 // F2_sffma: Floating-point fused multiply add.
386 let Uses = [USR], isFP = 1, hasNewValue = 1 in
387 class T_sfmpy_acc <bit isSub, bit isLib>
388   : MInst<(outs IntRegs:$Rx),
389           (ins IntRegs:$dst2, IntRegs:$Rs, IntRegs:$Rt),
390   "$Rx "#!if(isSub, "-=","+=")#" sfmpy($Rs, $Rt)"#!if(isLib, ":lib",""),
391   [], "$dst2 = $Rx" , M_tc_3_SLOT23 > ,
392   Requires<[HasV5T]> {
393     bits<5> Rx;
394     bits<5> Rs;
395     bits<5> Rt;
396
397     let IClass = 0b1110;
398
399     let Inst{27-21} = 0b1111000;
400     let Inst{20-16} = Rs;
401     let Inst{13}    = 0b0;
402     let Inst{12-8}  = Rt;
403     let Inst{7}     = 0b1;
404     let Inst{6}     = isLib;
405     let Inst{5}     = isSub;
406     let Inst{4-0}   = Rx;
407   }
408
409 let isCodeGenOnly = 0 in {
410 def F2_sffma: T_sfmpy_acc <0, 0>;
411 def F2_sffms: T_sfmpy_acc <1, 0>;
412 def F2_sffma_lib: T_sfmpy_acc <0, 1>;
413 def F2_sffms_lib: T_sfmpy_acc <1, 1>;
414 }
415
416 // Floating-point fused multiply add w/ additional scaling (2**pu).
417 let Uses = [USR], isFP = 1, hasNewValue = 1, isCodeGenOnly = 0 in
418 def F2_sffma_sc: MInst <
419   (outs IntRegs:$Rx),
420   (ins IntRegs:$dst2, IntRegs:$Rs, IntRegs:$Rt, PredRegs:$Pu),
421   "$Rx += sfmpy($Rs, $Rt, $Pu):scale" ,
422   [], "$dst2 = $Rx" , M_tc_3_SLOT23 > ,
423   Requires<[HasV5T]> {
424     bits<5> Rx;
425     bits<5> Rs;
426     bits<5> Rt;
427     bits<2> Pu;
428
429     let IClass = 0b1110;
430
431     let Inst{27-21} = 0b1111011;
432     let Inst{20-16} = Rs;
433     let Inst{13}    = 0b0;
434     let Inst{12-8}  = Rt;
435     let Inst{7}     = 0b1;
436     let Inst{6-5}   = Pu;
437     let Inst{4-0}   = Rx;
438   }
439
440
441 // Convert single precision to double precision and vice-versa.
442 def CONVERT_sf2df : ALU64_rr<(outs DoubleRegs:$dst), (ins IntRegs:$src),
443                 "$dst = convert_sf2df($src)",
444                 [(set DoubleRegs:$dst, (fextend IntRegs:$src))]>,
445           Requires<[HasV5T]>;
446
447 def CONVERT_df2sf : ALU64_rr<(outs IntRegs:$dst), (ins DoubleRegs:$src),
448                 "$dst = convert_df2sf($src)",
449                 [(set IntRegs:$dst, (fround DoubleRegs:$src))]>,
450           Requires<[HasV5T]>;
451
452
453 // Load.
454 def LDrid_f : LDInst<(outs DoubleRegs:$dst),
455             (ins MEMri:$addr),
456             "$dst = memd($addr)",
457             [(set DoubleRegs:$dst, (f64 (load ADDRriS11_3:$addr)))]>,
458           Requires<[HasV5T]>;
459
460
461 let AddedComplexity = 20 in
462 def LDrid_indexed_f : LDInst<(outs DoubleRegs:$dst),
463             (ins IntRegs:$src1, s11_3Imm:$offset),
464             "$dst = memd($src1+#$offset)",
465             [(set DoubleRegs:$dst, (f64 (load (add IntRegs:$src1,
466                                               s11_3ImmPred:$offset))))]>,
467           Requires<[HasV5T]>;
468
469 def LDriw_f : LDInst<(outs IntRegs:$dst),
470             (ins MEMri:$addr), "$dst = memw($addr)",
471             [(set IntRegs:$dst, (f32 (load ADDRriS11_2:$addr)))]>,
472           Requires<[HasV5T]>;
473
474
475 let AddedComplexity = 20 in
476 def LDriw_indexed_f : LDInst<(outs IntRegs:$dst),
477             (ins IntRegs:$src1, s11_2Imm:$offset),
478             "$dst = memw($src1+#$offset)",
479             [(set IntRegs:$dst, (f32 (load (add IntRegs:$src1,
480                                            s11_2ImmPred:$offset))))]>,
481           Requires<[HasV5T]>;
482
483 // Store.
484 def STriw_f : STInst<(outs),
485             (ins MEMri:$addr, IntRegs:$src1),
486             "memw($addr) = $src1",
487             [(store (f32 IntRegs:$src1), ADDRriS11_2:$addr)]>,
488           Requires<[HasV5T]>;
489
490 let AddedComplexity = 10 in
491 def STriw_indexed_f : STInst<(outs),
492             (ins IntRegs:$src1, s11_2Imm:$src2, IntRegs:$src3),
493             "memw($src1+#$src2) = $src3",
494             [(store (f32 IntRegs:$src3),
495                 (add IntRegs:$src1, s11_2ImmPred:$src2))]>,
496           Requires<[HasV5T]>;
497
498 def STrid_f : STInst<(outs),
499             (ins MEMri:$addr, DoubleRegs:$src1),
500             "memd($addr) = $src1",
501             [(store (f64 DoubleRegs:$src1), ADDRriS11_2:$addr)]>,
502           Requires<[HasV5T]>;
503
504 // Indexed store double word.
505 let AddedComplexity = 10 in
506 def STrid_indexed_f : STInst<(outs),
507             (ins IntRegs:$src1, s11_3Imm:$src2,  DoubleRegs:$src3),
508             "memd($src1+#$src2) = $src3",
509             [(store (f64 DoubleRegs:$src3),
510                                 (add IntRegs:$src1, s11_3ImmPred:$src2))]>,
511           Requires<[HasV5T]>;
512
513
514 // Add
515 let isCommutable = 1 in
516 def fADD_rr : ALU64_rr<(outs IntRegs:$dst),
517             (ins IntRegs:$src1, IntRegs:$src2),
518             "$dst = sfadd($src1, $src2)",
519             [(set IntRegs:$dst, (fadd IntRegs:$src1, IntRegs:$src2))]>,
520           Requires<[HasV5T]>;
521
522 let isCommutable = 1 in
523 def fADD64_rr : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1,
524                                                      DoubleRegs:$src2),
525                "$dst = dfadd($src1, $src2)",
526                [(set DoubleRegs:$dst, (fadd DoubleRegs:$src1,
527                                            DoubleRegs:$src2))]>,
528           Requires<[HasV5T]>;
529
530 def fSUB_rr : ALU64_rr<(outs IntRegs:$dst),
531             (ins IntRegs:$src1, IntRegs:$src2),
532             "$dst = sfsub($src1, $src2)",
533             [(set IntRegs:$dst, (fsub IntRegs:$src1, IntRegs:$src2))]>,
534           Requires<[HasV5T]>;
535
536 def fSUB64_rr : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1,
537                                                      DoubleRegs:$src2),
538                "$dst = dfsub($src1, $src2)",
539                [(set DoubleRegs:$dst, (fsub DoubleRegs:$src1,
540                                            DoubleRegs:$src2))]>,
541                Requires<[HasV5T]>;
542
543 let isCommutable = 1 in
544 def fMUL_rr : ALU64_rr<(outs IntRegs:$dst),
545             (ins IntRegs:$src1, IntRegs:$src2),
546             "$dst = sfmpy($src1, $src2)",
547             [(set IntRegs:$dst, (fmul IntRegs:$src1, IntRegs:$src2))]>,
548             Requires<[HasV5T]>;
549
550 let isCommutable = 1 in
551 def fMUL64_rr : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1,
552                                                      DoubleRegs:$src2),
553                "$dst = dfmpy($src1, $src2)",
554                [(set DoubleRegs:$dst, (fmul DoubleRegs:$src1,
555                                            DoubleRegs:$src2))]>,
556                Requires<[HasV5T]>;
557
558 // Compare.
559 let isCompare = 1 in {
560 multiclass FCMP64_rr<string OpcStr, PatFrag OpNode> {
561   def _rr : ALU64_rr<(outs PredRegs:$dst), (ins DoubleRegs:$b, DoubleRegs:$c),
562                  !strconcat("$dst = ", !strconcat(OpcStr, "($b, $c)")),
563                  [(set PredRegs:$dst,
564                         (OpNode (f64 DoubleRegs:$b), (f64 DoubleRegs:$c)))]>,
565                  Requires<[HasV5T]>;
566 }
567
568 multiclass FCMP32_rr<string OpcStr, PatFrag OpNode> {
569   def _rr : ALU64_rr<(outs PredRegs:$dst), (ins IntRegs:$b, IntRegs:$c),
570                  !strconcat("$dst = ", !strconcat(OpcStr, "($b, $c)")),
571                  [(set PredRegs:$dst,
572                         (OpNode (f32 IntRegs:$b), (f32 IntRegs:$c)))]>,
573                  Requires<[HasV5T]>;
574 }
575 }
576
577 defm FCMPOEQ64 : FCMP64_rr<"dfcmp.eq", setoeq>;
578 defm FCMPUEQ64 : FCMP64_rr<"dfcmp.eq", setueq>;
579 defm FCMPOGT64 : FCMP64_rr<"dfcmp.gt", setogt>;
580 defm FCMPUGT64 : FCMP64_rr<"dfcmp.gt", setugt>;
581 defm FCMPOGE64 : FCMP64_rr<"dfcmp.ge", setoge>;
582 defm FCMPUGE64 : FCMP64_rr<"dfcmp.ge", setuge>;
583
584 defm FCMPOEQ32 : FCMP32_rr<"sfcmp.eq", setoeq>;
585 defm FCMPUEQ32 : FCMP32_rr<"sfcmp.eq", setueq>;
586 defm FCMPOGT32 : FCMP32_rr<"sfcmp.gt", setogt>;
587 defm FCMPUGT32 : FCMP32_rr<"sfcmp.gt", setugt>;
588 defm FCMPOGE32 : FCMP32_rr<"sfcmp.ge", setoge>;
589 defm FCMPUGE32 : FCMP32_rr<"sfcmp.ge", setuge>;
590
591 // olt.
592 def : Pat <(i1 (setolt (f32 IntRegs:$src1), (f32 IntRegs:$src2))),
593       (i1 (FCMPOGT32_rr IntRegs:$src2, IntRegs:$src1))>,
594       Requires<[HasV5T]>;
595
596 def : Pat <(i1 (setolt (f32 IntRegs:$src1), (fpimm:$src2))),
597       (i1 (FCMPOGT32_rr (f32 (TFRI_f fpimm:$src2)), (f32 IntRegs:$src1)))>,
598       Requires<[HasV5T]>;
599
600 def : Pat <(i1 (setolt (f64 DoubleRegs:$src1), (f64 DoubleRegs:$src2))),
601       (i1 (FCMPOGT64_rr DoubleRegs:$src2, DoubleRegs:$src1))>,
602       Requires<[HasV5T]>;
603
604 def : Pat <(i1 (setolt (f64 DoubleRegs:$src1), (fpimm:$src2))),
605       (i1 (FCMPOGT64_rr (f64 (CONST64_Float_Real fpimm:$src2)),
606                         (f64 DoubleRegs:$src1)))>,
607       Requires<[HasV5T]>;
608
609 // gt.
610 def : Pat <(i1 (setugt (f64 DoubleRegs:$src1), (fpimm:$src2))),
611       (i1 (FCMPUGT64_rr (f64 DoubleRegs:$src1),
612                         (f64 (CONST64_Float_Real fpimm:$src2))))>,
613       Requires<[HasV5T]>;
614
615 def : Pat <(i1 (setugt (f32 IntRegs:$src1), (fpimm:$src2))),
616       (i1 (FCMPUGT32_rr (f32 IntRegs:$src1), (f32 (TFRI_f fpimm:$src2))))>,
617       Requires<[HasV5T]>;
618
619 // ult.
620 def : Pat <(i1 (setult (f32 IntRegs:$src1), (f32 IntRegs:$src2))),
621       (i1 (FCMPUGT32_rr IntRegs:$src2, IntRegs:$src1))>,
622       Requires<[HasV5T]>;
623
624 def : Pat <(i1 (setult (f32 IntRegs:$src1), (fpimm:$src2))),
625       (i1 (FCMPUGT32_rr (f32 (TFRI_f fpimm:$src2)), (f32 IntRegs:$src1)))>,
626       Requires<[HasV5T]>;
627
628 def : Pat <(i1 (setult (f64 DoubleRegs:$src1), (f64 DoubleRegs:$src2))),
629       (i1 (FCMPUGT64_rr DoubleRegs:$src2, DoubleRegs:$src1))>,
630       Requires<[HasV5T]>;
631
632 def : Pat <(i1 (setult (f64 DoubleRegs:$src1), (fpimm:$src2))),
633       (i1 (FCMPUGT64_rr (f64 (CONST64_Float_Real fpimm:$src2)),
634                         (f64 DoubleRegs:$src1)))>,
635       Requires<[HasV5T]>;
636
637 // le.
638 // rs <= rt -> rt >= rs.
639 def : Pat<(i1 (setole (f32 IntRegs:$src1), (f32 IntRegs:$src2))),
640       (i1 (FCMPOGE32_rr IntRegs:$src2, IntRegs:$src1))>,
641       Requires<[HasV5T]>;
642
643 def : Pat<(i1 (setole (f32 IntRegs:$src1), (fpimm:$src2))),
644       (i1 (FCMPOGE32_rr (f32 (TFRI_f fpimm:$src2)), IntRegs:$src1))>,
645       Requires<[HasV5T]>;
646
647
648 // Rss <= Rtt -> Rtt >= Rss.
649 def : Pat<(i1 (setole (f64 DoubleRegs:$src1), (f64 DoubleRegs:$src2))),
650       (i1 (FCMPOGE64_rr DoubleRegs:$src2, DoubleRegs:$src1))>,
651       Requires<[HasV5T]>;
652
653 def : Pat<(i1 (setole (f64 DoubleRegs:$src1), (fpimm:$src2))),
654       (i1 (FCMPOGE64_rr (f64 (CONST64_Float_Real fpimm:$src2)),
655                                 DoubleRegs:$src1))>,
656       Requires<[HasV5T]>;
657
658 // rs <= rt -> rt >= rs.
659 def : Pat<(i1 (setule (f32 IntRegs:$src1), (f32 IntRegs:$src2))),
660       (i1 (FCMPUGE32_rr IntRegs:$src2, IntRegs:$src1))>,
661       Requires<[HasV5T]>;
662
663 def : Pat<(i1 (setule (f32 IntRegs:$src1), (fpimm:$src2))),
664       (i1 (FCMPUGE32_rr (f32 (TFRI_f fpimm:$src2)), IntRegs:$src1))>,
665       Requires<[HasV5T]>;
666
667 // Rss <= Rtt -> Rtt >= Rss.
668 def : Pat<(i1 (setule (f64 DoubleRegs:$src1), (f64 DoubleRegs:$src2))),
669       (i1 (FCMPUGE64_rr DoubleRegs:$src2, DoubleRegs:$src1))>,
670       Requires<[HasV5T]>;
671
672 def : Pat<(i1 (setule (f64 DoubleRegs:$src1), (fpimm:$src2))),
673       (i1 (FCMPUGE64_rr (f64 (CONST64_Float_Real fpimm:$src2)),
674                                 DoubleRegs:$src1))>,
675       Requires<[HasV5T]>;
676
677 // ne.
678 def : Pat<(i1 (setone (f32 IntRegs:$src1), (f32 IntRegs:$src2))),
679       (i1 (C2_not (FCMPOEQ32_rr IntRegs:$src1, IntRegs:$src2)))>,
680       Requires<[HasV5T]>;
681
682 def : Pat<(i1 (setone (f64 DoubleRegs:$src1), (f64 DoubleRegs:$src2))),
683       (i1 (C2_not (FCMPOEQ64_rr DoubleRegs:$src1, DoubleRegs:$src2)))>,
684       Requires<[HasV5T]>;
685
686 def : Pat<(i1 (setune (f32 IntRegs:$src1), (f32 IntRegs:$src2))),
687       (i1 (C2_not (FCMPUEQ32_rr IntRegs:$src1, IntRegs:$src2)))>,
688       Requires<[HasV5T]>;
689
690 def : Pat<(i1 (setune (f64 DoubleRegs:$src1), (f64 DoubleRegs:$src2))),
691       (i1 (C2_not (FCMPUEQ64_rr DoubleRegs:$src1, DoubleRegs:$src2)))>,
692       Requires<[HasV5T]>;
693
694 def : Pat<(i1 (setone (f32 IntRegs:$src1), (fpimm:$src2))),
695       (i1 (C2_not (FCMPOEQ32_rr IntRegs:$src1, (f32 (TFRI_f fpimm:$src2)))))>,
696       Requires<[HasV5T]>;
697
698 def : Pat<(i1 (setone (f64 DoubleRegs:$src1), (fpimm:$src2))),
699       (i1 (C2_not (FCMPOEQ64_rr DoubleRegs:$src1,
700                               (f64 (CONST64_Float_Real fpimm:$src2)))))>,
701       Requires<[HasV5T]>;
702
703 def : Pat<(i1 (setune (f32 IntRegs:$src1), (fpimm:$src2))),
704       (i1 (C2_not (FCMPUEQ32_rr IntRegs:$src1,  (f32 (TFRI_f fpimm:$src2)))))>,
705       Requires<[HasV5T]>;
706
707 def : Pat<(i1 (setune (f64 DoubleRegs:$src1), (fpimm:$src2))),
708       (i1 (C2_not (FCMPUEQ64_rr DoubleRegs:$src1,
709                               (f64 (CONST64_Float_Real fpimm:$src2)))))>,
710       Requires<[HasV5T]>;
711
712 // Convert Integer to Floating Point.
713 def CONVERT_d2sf : ALU64_rr<(outs IntRegs:$dst), (ins DoubleRegs:$src),
714               "$dst = convert_d2sf($src)",
715               [(set (f32 IntRegs:$dst), (sint_to_fp (i64 DoubleRegs:$src)))]>,
716               Requires<[HasV5T]>;
717
718 def CONVERT_ud2sf : ALU64_rr<(outs IntRegs:$dst), (ins DoubleRegs:$src),
719               "$dst = convert_ud2sf($src)",
720               [(set (f32 IntRegs:$dst), (uint_to_fp (i64 DoubleRegs:$src)))]>,
721               Requires<[HasV5T]>;
722
723 def CONVERT_uw2sf : ALU64_rr<(outs IntRegs:$dst), (ins IntRegs:$src),
724               "$dst = convert_uw2sf($src)",
725               [(set (f32 IntRegs:$dst), (uint_to_fp (i32 IntRegs:$src)))]>,
726               Requires<[HasV5T]>;
727
728 def CONVERT_w2sf : ALU64_rr<(outs IntRegs:$dst), (ins IntRegs:$src),
729               "$dst = convert_w2sf($src)",
730               [(set (f32 IntRegs:$dst), (sint_to_fp (i32 IntRegs:$src)))]>,
731               Requires<[HasV5T]>;
732
733 def CONVERT_d2df : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src),
734               "$dst = convert_d2df($src)",
735               [(set (f64 DoubleRegs:$dst), (sint_to_fp (i64 DoubleRegs:$src)))]>,
736               Requires<[HasV5T]>;
737
738 def CONVERT_ud2df : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src),
739               "$dst = convert_ud2df($src)",
740               [(set (f64 DoubleRegs:$dst), (uint_to_fp (i64 DoubleRegs:$src)))]>,
741               Requires<[HasV5T]>;
742
743 def CONVERT_uw2df : ALU64_rr<(outs DoubleRegs:$dst), (ins IntRegs:$src),
744               "$dst = convert_uw2df($src)",
745               [(set (f64 DoubleRegs:$dst), (uint_to_fp (i32 IntRegs:$src)))]>,
746               Requires<[HasV5T]>;
747
748 def CONVERT_w2df : ALU64_rr<(outs DoubleRegs:$dst), (ins IntRegs:$src),
749               "$dst = convert_w2df($src)",
750               [(set (f64 DoubleRegs:$dst), (sint_to_fp (i32 IntRegs:$src)))]>,
751               Requires<[HasV5T]>;
752
753 // Convert Floating Point to Integer - default.
754 def CONVERT_df2uw : ALU64_rr<(outs IntRegs:$dst), (ins DoubleRegs:$src),
755               "$dst = convert_df2uw($src):chop",
756               [(set (i32 IntRegs:$dst), (fp_to_uint (f64 DoubleRegs:$src)))]>,
757               Requires<[HasV5T]>;
758
759 def CONVERT_df2w : ALU64_rr<(outs IntRegs:$dst), (ins DoubleRegs:$src),
760               "$dst = convert_df2w($src):chop",
761               [(set (i32 IntRegs:$dst), (fp_to_sint (f64 DoubleRegs:$src)))]>,
762               Requires<[HasV5T]>;
763
764 def CONVERT_sf2uw : ALU64_rr<(outs IntRegs:$dst), (ins IntRegs:$src),
765               "$dst = convert_sf2uw($src):chop",
766               [(set (i32 IntRegs:$dst), (fp_to_uint (f32 IntRegs:$src)))]>,
767               Requires<[HasV5T]>;
768
769 def CONVERT_sf2w : ALU64_rr<(outs IntRegs:$dst), (ins IntRegs:$src),
770               "$dst = convert_sf2w($src):chop",
771               [(set (i32 IntRegs:$dst), (fp_to_sint (f32 IntRegs:$src)))]>,
772               Requires<[HasV5T]>;
773
774 def CONVERT_df2d : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src),
775               "$dst = convert_df2d($src):chop",
776               [(set (i64 DoubleRegs:$dst), (fp_to_sint (f64 DoubleRegs:$src)))]>,
777               Requires<[HasV5T]>;
778
779 def CONVERT_df2ud : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src),
780               "$dst = convert_df2ud($src):chop",
781               [(set (i64 DoubleRegs:$dst), (fp_to_uint (f64 DoubleRegs:$src)))]>,
782               Requires<[HasV5T]>;
783
784 def CONVERT_sf2d : ALU64_rr<(outs DoubleRegs:$dst), (ins IntRegs:$src),
785               "$dst = convert_sf2d($src):chop",
786               [(set (i64 DoubleRegs:$dst), (fp_to_sint (f32 IntRegs:$src)))]>,
787               Requires<[HasV5T]>;
788
789 def CONVERT_sf2ud : ALU64_rr<(outs DoubleRegs:$dst), (ins IntRegs:$src),
790               "$dst = convert_sf2ud($src):chop",
791               [(set (i64 DoubleRegs:$dst), (fp_to_uint (f32 IntRegs:$src)))]>,
792               Requires<[HasV5T]>;
793
794 // Convert Floating Point to Integer: non-chopped.
795 let AddedComplexity = 20 in
796 def CONVERT_df2uw_nchop : ALU64_rr<(outs IntRegs:$dst), (ins DoubleRegs:$src),
797               "$dst = convert_df2uw($src)",
798               [(set (i32 IntRegs:$dst), (fp_to_uint (f64 DoubleRegs:$src)))]>,
799               Requires<[HasV5T, IEEERndNearV5T]>;
800
801 let AddedComplexity = 20 in
802 def CONVERT_df2w_nchop : ALU64_rr<(outs IntRegs:$dst), (ins DoubleRegs:$src),
803               "$dst = convert_df2w($src)",
804               [(set (i32 IntRegs:$dst), (fp_to_sint (f64 DoubleRegs:$src)))]>,
805               Requires<[HasV5T, IEEERndNearV5T]>;
806
807 let AddedComplexity = 20 in
808 def CONVERT_sf2uw_nchop : ALU64_rr<(outs IntRegs:$dst), (ins IntRegs:$src),
809               "$dst = convert_sf2uw($src)",
810               [(set (i32 IntRegs:$dst), (fp_to_uint (f32 IntRegs:$src)))]>,
811               Requires<[HasV5T, IEEERndNearV5T]>;
812
813 let AddedComplexity = 20 in
814 def CONVERT_sf2w_nchop : ALU64_rr<(outs IntRegs:$dst), (ins IntRegs:$src),
815               "$dst = convert_sf2w($src)",
816               [(set (i32 IntRegs:$dst), (fp_to_sint (f32 IntRegs:$src)))]>,
817               Requires<[HasV5T, IEEERndNearV5T]>;
818
819 let AddedComplexity = 20 in
820 def CONVERT_df2d_nchop : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src),
821               "$dst = convert_df2d($src)",
822               [(set (i64 DoubleRegs:$dst), (fp_to_sint (f64 DoubleRegs:$src)))]>,
823               Requires<[HasV5T, IEEERndNearV5T]>;
824
825 let AddedComplexity = 20 in
826 def CONVERT_df2ud_nchop : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src),
827               "$dst = convert_df2ud($src)",
828               [(set (i64 DoubleRegs:$dst), (fp_to_uint (f64 DoubleRegs:$src)))]>,
829               Requires<[HasV5T, IEEERndNearV5T]>;
830
831 let AddedComplexity = 20 in
832 def CONVERT_sf2d_nchop : ALU64_rr<(outs DoubleRegs:$dst), (ins IntRegs:$src),
833               "$dst = convert_sf2d($src)",
834               [(set (i64 DoubleRegs:$dst), (fp_to_sint (f32 IntRegs:$src)))]>,
835               Requires<[HasV5T, IEEERndNearV5T]>;
836
837 let AddedComplexity = 20 in
838 def CONVERT_sf2ud_nchop : ALU64_rr<(outs DoubleRegs:$dst), (ins IntRegs:$src),
839               "$dst = convert_sf2ud($src)",
840               [(set (i64 DoubleRegs:$dst), (fp_to_uint (f32 IntRegs:$src)))]>,
841               Requires<[HasV5T, IEEERndNearV5T]>;
842
843
844
845 // Bitcast is different than [fp|sint|uint]_to_[sint|uint|fp].
846 def : Pat <(i32 (bitconvert (f32 IntRegs:$src))),
847            (i32 (A2_tfr IntRegs:$src))>,
848           Requires<[HasV5T]>;
849
850 def : Pat <(f32 (bitconvert (i32 IntRegs:$src))),
851            (f32 (A2_tfr IntRegs:$src))>,
852           Requires<[HasV5T]>;
853
854 def : Pat <(i64 (bitconvert (f64 DoubleRegs:$src))),
855            (i64 (A2_tfrp DoubleRegs:$src))>,
856           Requires<[HasV5T]>;
857
858 def : Pat <(f64 (bitconvert (i64 DoubleRegs:$src))),
859            (f64 (A2_tfrp DoubleRegs:$src))>,
860           Requires<[HasV5T]>;
861
862 def FMADD_sp : ALU64_acc<(outs IntRegs:$dst),
863                   (ins IntRegs:$src1, IntRegs:$src2, IntRegs:$src3),
864               "$dst += sfmpy($src2, $src3)",
865               [(set (f32 IntRegs:$dst),
866                   (fma IntRegs:$src2, IntRegs:$src3, IntRegs:$src1))],
867                   "$src1 = $dst">,
868               Requires<[HasV5T]>;
869
870
871 // Floating point max/min.
872
873 let AddedComplexity = 100 in
874 def FMAX_sp : ALU64_rr<(outs IntRegs:$dst),
875                   (ins IntRegs:$src1, IntRegs:$src2),
876               "$dst = sfmax($src1, $src2)",
877               [(set IntRegs:$dst, (f32 (select (i1 (setolt IntRegs:$src2,
878                                                         IntRegs:$src1)),
879                                              IntRegs:$src1,
880                                              IntRegs:$src2)))]>,
881                Requires<[HasV5T]>;
882
883 let AddedComplexity = 100 in
884 def FMIN_sp : ALU64_rr<(outs IntRegs:$dst),
885                   (ins IntRegs:$src1, IntRegs:$src2),
886               "$dst = sfmin($src1, $src2)",
887               [(set IntRegs:$dst, (f32 (select (i1 (setogt IntRegs:$src2,
888                                                         IntRegs:$src1)),
889                                              IntRegs:$src1,
890                                              IntRegs:$src2)))]>,
891                Requires<[HasV5T]>;
892
893 // Pseudo instruction to encode a set of conditional transfers.
894 // This instruction is used instead of a mux and trades-off codesize
895 // for performance. We conduct this transformation optimistically in
896 // the hope that these instructions get promoted to dot-new transfers.
897 let AddedComplexity = 100, isPredicated = 1 in
898 def TFR_condset_rr_f : ALU32_rr<(outs IntRegs:$dst), (ins PredRegs:$src1,
899                                                         IntRegs:$src2,
900                                                         IntRegs:$src3),
901                      "Error; should not emit",
902                      [(set IntRegs:$dst, (f32 (select PredRegs:$src1,
903                                                  IntRegs:$src2,
904                                                  IntRegs:$src3)))]>,
905                Requires<[HasV5T]>;
906
907 let AddedComplexity = 100, isPredicated = 1 in
908 def TFR_condset_rr64_f : ALU32_rr<(outs DoubleRegs:$dst), (ins PredRegs:$src1,
909                                                         DoubleRegs:$src2,
910                                                         DoubleRegs:$src3),
911                      "Error; should not emit",
912                      [(set DoubleRegs:$dst, (f64 (select PredRegs:$src1,
913                                                  DoubleRegs:$src2,
914                                                  DoubleRegs:$src3)))]>,
915                Requires<[HasV5T]>;
916
917
918
919 let AddedComplexity = 100, isPredicated = 1 in
920 def TFR_condset_ri_f : ALU32_rr<(outs IntRegs:$dst),
921             (ins PredRegs:$src1, IntRegs:$src2, f32imm:$src3),
922             "Error; should not emit",
923             [(set IntRegs:$dst,
924              (f32 (select PredRegs:$src1, IntRegs:$src2, fpimm:$src3)))]>,
925                Requires<[HasV5T]>;
926
927 let AddedComplexity = 100, isPredicated = 1 in
928 def TFR_condset_ir_f : ALU32_rr<(outs IntRegs:$dst),
929             (ins PredRegs:$src1, f32imm:$src2, IntRegs:$src3),
930             "Error; should not emit",
931             [(set IntRegs:$dst,
932              (f32 (select PredRegs:$src1, fpimm:$src2, IntRegs:$src3)))]>,
933                Requires<[HasV5T]>;
934
935 let AddedComplexity = 100, isPredicated = 1 in
936 def TFR_condset_ii_f : ALU32_rr<(outs IntRegs:$dst),
937                               (ins PredRegs:$src1, f32imm:$src2, f32imm:$src3),
938                      "Error; should not emit",
939                      [(set IntRegs:$dst, (f32 (select PredRegs:$src1,
940                                                  fpimm:$src2,
941                                                  fpimm:$src3)))]>,
942                Requires<[HasV5T]>;
943
944
945 def : Pat <(select (i1 (setult (f32 IntRegs:$src1), (f32 IntRegs:$src2))),
946                    (f32 IntRegs:$src3),
947                    (f32 IntRegs:$src4)),
948     (TFR_condset_rr_f (FCMPUGT32_rr IntRegs:$src2, IntRegs:$src1), IntRegs:$src4,
949                       IntRegs:$src3)>, Requires<[HasV5T]>;
950
951 def : Pat <(select (i1 (setult (f64 DoubleRegs:$src1), (f64 DoubleRegs:$src2))),
952                    (f64 DoubleRegs:$src3),
953                    (f64 DoubleRegs:$src4)),
954       (TFR_condset_rr64_f (FCMPUGT64_rr DoubleRegs:$src2, DoubleRegs:$src1),
955                 DoubleRegs:$src4, DoubleRegs:$src3)>, Requires<[HasV5T]>;
956
957 // Map from p0 = pnot(p0); r0 = mux(p0, #i, #j) => r0 = mux(p0, #j, #i).
958 def : Pat <(select (not PredRegs:$src1), fpimm:$src2, fpimm:$src3),
959       (TFR_condset_ii_f PredRegs:$src1, fpimm:$src3, fpimm:$src2)>;
960
961 // Map from p0 = pnot(p0); r0 = select(p0, #i, r1)
962 // => r0 = TFR_condset_ri(p0, r1, #i)
963 def : Pat <(select (not PredRegs:$src1), fpimm:$src2, IntRegs:$src3),
964       (TFR_condset_ri_f PredRegs:$src1, IntRegs:$src3, fpimm:$src2)>;
965
966 // Map from p0 = pnot(p0); r0 = mux(p0, r1, #i)
967 // => r0 = TFR_condset_ir(p0, #i, r1)
968 def : Pat <(select (not PredRegs:$src1), IntRegs:$src2, fpimm:$src3),
969       (TFR_condset_ir_f PredRegs:$src1, fpimm:$src3, IntRegs:$src2)>;
970
971 def : Pat <(i32 (fp_to_sint (f64 DoubleRegs:$src1))),
972           (i32 (EXTRACT_SUBREG (i64 (CONVERT_df2d (f64 DoubleRegs:$src1))), subreg_loreg))>,
973           Requires<[HasV5T]>;
974
975 def : Pat <(fabs (f32 IntRegs:$src1)),
976            (S2_clrbit_i (f32 IntRegs:$src1), 31)>,
977           Requires<[HasV5T]>;
978
979 def : Pat <(fneg (f32 IntRegs:$src1)),
980            (S2_togglebit_i (f32 IntRegs:$src1), 31)>,
981           Requires<[HasV5T]>;
982
983 /*
984 def : Pat <(fabs (f64 DoubleRegs:$src1)),
985           (S2_clrbit_i (f32 (EXTRACT_SUBREG DoubleRegs:$src1, subreg_hireg)), 31)>,
986           Requires<[HasV5T]>;
987
988 def : Pat <(fabs (f64 DoubleRegs:$src1)),
989           (S2_clrbit_i (f32 (EXTRACT_SUBREG DoubleRegs:$src1, subreg_hireg)), 31)>,
990           Requires<[HasV5T]>;
991           */