OSDN Git Service

* config/bfin/bfin.c (override_options): Reorder tests so that
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / dfp.md
1 ;; Decimal Floating Point (DFP) patterns.
2 ;; Copyright (C) 2007
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Ben Elliston (bje@au.ibm.com) and Peter Bergner
5 ;; (bergner@vnet.ibm.com).
6
7 ;; This file is part of GCC.
8
9 ;; GCC is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 3, or (at your
12 ;; option) any later version.
13
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
17 ;; License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3.  If not see
21 ;; <http://www.gnu.org/licenses/>.
22
23 (define_expand "negdd2"
24   [(set (match_operand:DD 0 "gpc_reg_operand" "")
25         (neg:DD (match_operand:DD 1 "gpc_reg_operand" "")))]
26   "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
27   "")
28
29 (define_insn "*negdd2_fpr"
30   [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
31         (neg:DD (match_operand:DD 1 "gpc_reg_operand" "f")))]
32   "TARGET_HARD_FLOAT && TARGET_FPRS"
33   "fneg %0,%1"
34   [(set_attr "type" "fp")])
35
36 (define_expand "absdd2"
37   [(set (match_operand:DD 0 "gpc_reg_operand" "")
38         (abs:DD (match_operand:DD 1 "gpc_reg_operand" "")))]
39   "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
40   "")
41
42 (define_insn "*absdd2_fpr"
43   [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
44         (abs:DD (match_operand:DD 1 "gpc_reg_operand" "f")))]
45   "TARGET_HARD_FLOAT && TARGET_FPRS"
46   "fabs %0,%1"
47   [(set_attr "type" "fp")])
48
49 (define_insn "*nabsdd2_fpr"
50   [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
51         (neg:DD (abs:DD (match_operand:DF 1 "gpc_reg_operand" "f"))))]
52   "TARGET_HARD_FLOAT && TARGET_FPRS"
53   "fnabs %0,%1"
54   [(set_attr "type" "fp")])
55
56 (define_expand "movdd"
57   [(set (match_operand:DD 0 "nonimmediate_operand" "")
58         (match_operand:DD 1 "any_operand" ""))]
59   ""
60   "{ rs6000_emit_move (operands[0], operands[1], DDmode); DONE; }")
61
62 (define_split
63   [(set (match_operand:DD 0 "gpc_reg_operand" "")
64         (match_operand:DD 1 "const_int_operand" ""))]
65   "! TARGET_POWERPC64 && reload_completed
66    && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
67        || (GET_CODE (operands[0]) == SUBREG
68            && GET_CODE (SUBREG_REG (operands[0])) == REG
69            && REGNO (SUBREG_REG (operands[0])) <= 31))"
70   [(set (match_dup 2) (match_dup 4))
71    (set (match_dup 3) (match_dup 1))]
72   "
73 {
74   int endian = (WORDS_BIG_ENDIAN == 0);
75   HOST_WIDE_INT value = INTVAL (operands[1]);
76
77   operands[2] = operand_subword (operands[0], endian, 0, DDmode);
78   operands[3] = operand_subword (operands[0], 1 - endian, 0, DDmode);
79 #if HOST_BITS_PER_WIDE_INT == 32
80   operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
81 #else
82   operands[4] = GEN_INT (value >> 32);
83   operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
84 #endif
85 }")
86
87 (define_split
88   [(set (match_operand:DD 0 "gpc_reg_operand" "")
89         (match_operand:DD 1 "const_double_operand" ""))]
90   "! TARGET_POWERPC64 && reload_completed
91    && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
92        || (GET_CODE (operands[0]) == SUBREG
93            && GET_CODE (SUBREG_REG (operands[0])) == REG
94            && REGNO (SUBREG_REG (operands[0])) <= 31))"
95   [(set (match_dup 2) (match_dup 4))
96    (set (match_dup 3) (match_dup 5))]
97   "
98 {
99   int endian = (WORDS_BIG_ENDIAN == 0);
100   long l[2];
101   REAL_VALUE_TYPE rv;
102
103   REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
104   REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
105
106   operands[2] = operand_subword (operands[0], endian, 0, DDmode);
107   operands[3] = operand_subword (operands[0], 1 - endian, 0, DDmode);
108   operands[4] = gen_int_mode (l[endian], SImode);
109   operands[5] = gen_int_mode (l[1 - endian], SImode);
110 }")
111
112 (define_split
113   [(set (match_operand:DD 0 "gpc_reg_operand" "")
114         (match_operand:DD 1 "const_double_operand" ""))]
115   "TARGET_POWERPC64 && reload_completed
116    && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
117        || (GET_CODE (operands[0]) == SUBREG
118            && GET_CODE (SUBREG_REG (operands[0])) == REG
119            && REGNO (SUBREG_REG (operands[0])) <= 31))"
120   [(set (match_dup 2) (match_dup 3))]
121   "
122 {
123   int endian = (WORDS_BIG_ENDIAN == 0);
124   long l[2];
125   REAL_VALUE_TYPE rv;
126 #if HOST_BITS_PER_WIDE_INT >= 64
127   HOST_WIDE_INT val;
128 #endif
129
130   REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
131   REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
132
133   operands[2] = gen_lowpart (DImode, operands[0]);
134   /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN.  */
135 #if HOST_BITS_PER_WIDE_INT >= 64
136   val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
137          | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
138
139   operands[3] = gen_int_mode (val, DImode);
140 #else
141   operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
142 #endif
143 }")
144
145 ;; Don't have reload use general registers to load a constant.  First,
146 ;; it might not work if the output operand is the equivalent of
147 ;; a non-offsettable memref, but also it is less efficient than loading
148 ;; the constant into an FP register, since it will probably be used there.
149 ;; The "??" is a kludge until we can figure out a more reasonable way
150 ;; of handling these non-offsettable values.
151 (define_insn "*movdd_hardfloat32"
152   [(set (match_operand:DD 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
153         (match_operand:DD 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
154   "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
155    && (gpc_reg_operand (operands[0], DDmode)
156        || gpc_reg_operand (operands[1], DDmode))"
157   "*
158 {
159   switch (which_alternative)
160     {
161     default:
162       gcc_unreachable ();
163     case 0:
164       /* We normally copy the low-numbered register first.  However, if
165          the first register operand 0 is the same as the second register
166          of operand 1, we must copy in the opposite order.  */
167       if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
168         return \"mr %L0,%L1\;mr %0,%1\";
169       else
170         return \"mr %0,%1\;mr %L0,%L1\";
171     case 1:
172       if (rs6000_offsettable_memref_p (operands[1])
173           || (GET_CODE (operands[1]) == MEM
174               && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
175                   || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
176                   || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
177         {
178           /* If the low-address word is used in the address, we must load
179              it last.  Otherwise, load it first.  Note that we cannot have
180              auto-increment in that case since the address register is
181              known to be dead.  */
182           if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
183                                  operands[1], 0))
184             return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
185           else
186             return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
187         }
188       else
189         {
190           rtx addreg;
191
192           addreg = find_addr_reg (XEXP (operands[1], 0));
193           if (refers_to_regno_p (REGNO (operands[0]),
194                                  REGNO (operands[0]) + 1,
195                                  operands[1], 0))
196             {
197               output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
198               output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
199               output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
200               return \"{lx|lwzx} %0,%1\";
201             }
202           else
203             {
204               output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
205               output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
206               output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
207               output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
208               return \"\";
209             }
210         }
211     case 2:
212       if (rs6000_offsettable_memref_p (operands[0])
213           || (GET_CODE (operands[0]) == MEM
214               && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
215                   || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
216                   || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
217         return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
218       else
219         {
220           rtx addreg;
221
222           addreg = find_addr_reg (XEXP (operands[0], 0));
223           output_asm_insn (\"{stx|stwx} %1,%0\", operands);
224           output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
225           output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
226           output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
227           return \"\";
228         }
229     case 3:
230       return \"fmr %0,%1\";
231     case 4:
232       return \"lfd%U1%X1 %0,%1\";
233     case 5:
234       return \"stfd%U0%X0 %1,%0\";
235     case 6:
236     case 7:
237     case 8:
238       return \"#\";
239     }
240 }"
241   [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
242    (set_attr "length" "8,16,16,4,4,4,8,12,16")])
243
244 (define_insn "*movdd_softfloat32"
245   [(set (match_operand:DD 0 "nonimmediate_operand" "=r,r,m,r,r,r")
246         (match_operand:DD 1 "input_operand" "r,m,r,G,H,F"))]
247   "! TARGET_POWERPC64 && TARGET_SOFT_FLOAT
248    && (gpc_reg_operand (operands[0], DDmode)
249        || gpc_reg_operand (operands[1], DDmode))"
250   "*
251 {
252   switch (which_alternative)
253     {
254     default:
255       gcc_unreachable ();
256     case 0:
257       /* We normally copy the low-numbered register first.  However, if
258          the first register operand 0 is the same as the second register of
259          operand 1, we must copy in the opposite order.  */
260       if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
261         return \"mr %L0,%L1\;mr %0,%1\";
262       else
263         return \"mr %0,%1\;mr %L0,%L1\";
264     case 1:
265       /* If the low-address word is used in the address, we must load
266          it last.  Otherwise, load it first.  Note that we cannot have
267          auto-increment in that case since the address register is
268          known to be dead.  */
269       if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
270                              operands[1], 0))
271         return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
272       else
273         return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
274     case 2:
275       return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
276     case 3:
277     case 4:
278     case 5:
279       return \"#\";
280     }
281 }"
282   [(set_attr "type" "two,load,store,*,*,*")
283    (set_attr "length" "8,8,8,8,12,16")])
284
285 ; ld/std require word-aligned displacements -> 'Y' constraint.
286 ; List Y->r and r->Y before r->r for reload.
287 (define_insn "*movdd_hardfloat64_mfpgpr"
288   [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
289         (match_operand:DD 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
290   "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
291    && (gpc_reg_operand (operands[0], DDmode)
292        || gpc_reg_operand (operands[1], DDmode))"
293   "@
294    std%U0%X0 %1,%0
295    ld%U1%X1 %0,%1
296    mr %0,%1
297    fmr %0,%1
298    lfd%U1%X1 %0,%1
299    stfd%U0%X0 %1,%0
300    mt%0 %1
301    mf%1 %0
302    {cror 0,0,0|nop}
303    #
304    #
305    #
306    mftgpr %0,%1
307    mffgpr %0,%1"
308   [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
309    (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
310
311 ; ld/std require word-aligned displacements -> 'Y' constraint.
312 ; List Y->r and r->Y before r->r for reload.(define_insn "*movdd_hardfloat64"
313 (define_insn "*movdd_hardfloat64"
314   [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
315         (match_operand:DD 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
316   "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
317    && (gpc_reg_operand (operands[0], DDmode)
318        || gpc_reg_operand (operands[1], DDmode))"
319   "@
320    std%U0%X0 %1,%0
321    ld%U1%X1 %0,%1
322    mr %0,%1
323    fmr %0,%1
324    lfd%U1%X1 %0,%1
325    stfd%U0%X0 %1,%0
326    mt%0 %1
327    mf%1 %0
328    {cror 0,0,0|nop}
329    #
330    #
331    #"
332   [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
333    (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
334
335 (define_insn "*movdd_softfloat64"
336   [(set (match_operand:DD 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
337         (match_operand:DD 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
338   "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
339    && (gpc_reg_operand (operands[0], DDmode)
340        || gpc_reg_operand (operands[1], DDmode))"
341   "@
342    ld%U1%X1 %0,%1
343    std%U0%X0 %1,%0
344    mr %0,%1
345    mt%0 %1
346    mf%1 %0
347    #
348    #
349    #
350    {cror 0,0,0|nop}"
351   [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
352    (set_attr "length" "4,4,4,4,4,8,12,16,4")])
353
354 (define_expand "negtd2"
355   [(set (match_operand:TD 0 "gpc_reg_operand" "")
356         (neg:TD (match_operand:TD 1 "gpc_reg_operand" "")))]
357   "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
358   "")
359
360 (define_insn "*negtd2_fpr"
361   [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
362         (neg:TD (match_operand:TD 1 "gpc_reg_operand" "f")))]
363   "TARGET_HARD_FLOAT && TARGET_FPRS"
364   "fneg %0,%1"
365   [(set_attr "type" "fp")])
366
367 (define_expand "abstd2"
368   [(set (match_operand:TD 0 "gpc_reg_operand" "")
369         (abs:TD (match_operand:TD 1 "gpc_reg_operand" "")))]
370   "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
371   "")
372
373 (define_insn "*abstd2_fpr"
374   [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
375         (abs:TD (match_operand:TD 1 "gpc_reg_operand" "f")))]
376   "TARGET_HARD_FLOAT && TARGET_FPRS"
377   "fabs %0,%1"
378   [(set_attr "type" "fp")])
379
380 (define_insn "*nabstd2_fpr"
381   [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
382         (neg:TD (abs:TD (match_operand:DF 1 "gpc_reg_operand" "f"))))]
383   "TARGET_HARD_FLOAT && TARGET_FPRS"
384   "fnabs %0,%1"
385   [(set_attr "type" "fp")])
386
387 (define_expand "movtd"
388   [(set (match_operand:TD 0 "general_operand" "")
389         (match_operand:TD 1 "any_operand" ""))]
390   "TARGET_HARD_FLOAT && TARGET_FPRS"
391   "{ rs6000_emit_move (operands[0], operands[1], TDmode); DONE; }")
392
393 ; It's important to list the o->f and f->o moves before f->f because
394 ; otherwise reload, given m->f, will try to pick f->f and reload it,
395 ; which doesn't make progress.  Likewise r->Y must be before r->r.
396 (define_insn_and_split "*movtd_internal"
397   [(set (match_operand:TD 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
398         (match_operand:TD 1 "input_operand"         "f,o,f,YGHF,r,r"))]
399   "TARGET_HARD_FLOAT && TARGET_FPRS
400    && (gpc_reg_operand (operands[0], TDmode)
401        || gpc_reg_operand (operands[1], TDmode))"
402   "#"
403   "&& reload_completed"
404   [(pc)]
405 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
406   [(set_attr "length" "8,8,8,20,20,16")])
407
408 ;; Hardware support for decimal floating point operations.
409
410 (define_insn "extendddtd2"
411   [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
412         (float_extend:TD (match_operand:DD 1 "gpc_reg_operand" "f")))]
413   "TARGET_DFP"
414   "dctqpq %0,%1"
415   [(set_attr "type" "fp")])
416
417 ;; The result of drdpq is an even/odd register pair with the converted
418 ;; value in the even register and zero in the odd register.
419 ;; FIXME: Avoid the register move by using a reload constraint to ensure
420 ;; that the result is the first of the pair receiving the result of drdpq.
421
422 (define_insn "trunctddd2"
423   [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
424         (float_truncate:DD (match_operand:TD 1 "gpc_reg_operand" "f")))
425    (clobber (match_scratch:TD 2 "=f"))]
426   "TARGET_DFP"
427   "drdpq %2,%1\;fmr %0,%2"
428   [(set_attr "type" "fp")])
429
430 (define_insn "adddd3"
431   [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
432         (plus:DD (match_operand:DD 1 "gpc_reg_operand" "%f")
433                  (match_operand:DD 2 "gpc_reg_operand" "f")))]
434   "TARGET_DFP"
435   "dadd %0,%1,%2"
436   [(set_attr "type" "fp")])
437
438 (define_insn "addtd3"
439   [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
440         (plus:TD (match_operand:TD 1 "gpc_reg_operand" "%f")
441                  (match_operand:TD 2 "gpc_reg_operand" "f")))]
442   "TARGET_DFP"
443   "daddq %0,%1,%2"
444   [(set_attr "type" "fp")])
445
446 (define_insn "subdd3"
447   [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
448         (minus:DD (match_operand:DD 1 "gpc_reg_operand" "f")
449                   (match_operand:DD 2 "gpc_reg_operand" "f")))]
450   "TARGET_DFP"
451   "dsub %0,%1,%2"
452   [(set_attr "type" "fp")])
453
454 (define_insn "subtd3"
455   [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
456         (minus:TD (match_operand:TD 1 "gpc_reg_operand" "f")
457                   (match_operand:TD 2 "gpc_reg_operand" "f")))]
458   "TARGET_DFP"
459   "dsubq %0,%1,%2"
460   [(set_attr "type" "fp")])
461
462 (define_insn "muldd3"
463   [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
464         (mult:DD (match_operand:DD 1 "gpc_reg_operand" "%f")
465                  (match_operand:DD 2 "gpc_reg_operand" "f")))]
466   "TARGET_DFP"
467   "dmul %0,%1,%2"
468   [(set_attr "type" "fp")])
469
470 (define_insn "multd3"
471   [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
472         (mult:TD (match_operand:TD 1 "gpc_reg_operand" "%f")
473                  (match_operand:TD 2 "gpc_reg_operand" "f")))]
474   "TARGET_DFP"
475   "dmulq %0,%1,%2"
476   [(set_attr "type" "fp")])
477
478 (define_insn "divdd3"
479   [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
480         (div:DD (match_operand:DD 1 "gpc_reg_operand" "f")
481                 (match_operand:DD 2 "gpc_reg_operand" "f")))]
482   "TARGET_DFP"
483   "ddiv %0,%1,%2"
484   [(set_attr "type" "fp")])
485
486 (define_insn "divtd3"
487   [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
488         (div:TD (match_operand:TD 1 "gpc_reg_operand" "f")
489                 (match_operand:TD 2 "gpc_reg_operand" "f")))]
490   "TARGET_DFP"
491   "ddivq %0,%1,%2"
492   [(set_attr "type" "fp")])
493
494 (define_insn "*cmpdd_internal1"
495   [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
496         (compare:CCFP (match_operand:DD 1 "gpc_reg_operand" "f")
497                       (match_operand:DD 2 "gpc_reg_operand" "f")))]
498   "TARGET_DFP"
499   "dcmpu %0,%1,%2"
500   [(set_attr "type" "fpcompare")])
501
502 (define_insn "*cmptd_internal1"
503   [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
504         (compare:CCFP (match_operand:TD 1 "gpc_reg_operand" "f")
505                       (match_operand:TD 2 "gpc_reg_operand" "f")))]
506   "TARGET_DFP"
507   "dcmpuq %0,%1,%2"
508   [(set_attr "type" "fpcompare")])
509
510 (define_insn "floatditd2"
511   [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
512         (float:TD (match_operand:DI 1 "gpc_reg_operand" "f")))]
513   "TARGET_DFP"
514   "dcffixq %0,%1"
515   [(set_attr "type" "fp")])
516
517 ;; Convert a decimal64 to a decimal64 whose value is an integer.
518 ;; This is the first stage of converting it to an integer type.
519
520 (define_insn "ftruncdd2"
521   [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
522         (fix:DD (match_operand:DD 1 "gpc_reg_operand" "f")))]
523   "TARGET_DFP"
524   "drintn. 0,%0,%1,1"
525   [(set_attr "type" "fp")])
526
527 ;; Convert a decimal64 whose value is an integer to an actual integer.
528 ;; This is the second stage of converting decimal float to integer type.
529
530 (define_insn "fixdddi2"
531   [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
532         (fix:DI (match_operand:DD 1 "gpc_reg_operand" "f")))]
533   "TARGET_DFP"
534   "dctfix %0,%1"
535   [(set_attr "type" "fp")])
536
537 ;; Convert a decimal128 to a decimal128 whose value is an integer.
538 ;; This is the first stage of converting it to an integer type.
539
540 (define_insn "ftrunctd2"
541   [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
542         (fix:TD (match_operand:TD 1 "gpc_reg_operand" "f")))]
543   "TARGET_DFP"
544   "drintnq. 0,%0,%1,1"
545   [(set_attr "type" "fp")])
546
547 ;; Convert a decimal128 whose value is an integer to an actual integer.
548 ;; This is the second stage of converting decimal float to integer type.
549
550 (define_insn "fixtddi2"
551   [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
552         (fix:DI (match_operand:TD 1 "gpc_reg_operand" "f")))]
553   "TARGET_DFP"
554   "dctfixq %0,%1"
555   [(set_attr "type" "fp")])