[PATCH] rs6000: Generate _Decimal128 to _Decimal32 hardware conversion instructions
Segher Boessenkool
segher@kernel.crashing.org
Fri Jul 17 21:32:55 GMT 2020
On Fri, Jul 17, 2020 at 04:18:55PM -0500, Peter Bergner wrote:
> On 7/17/20 3:23 PM, Segher Boessenkool wrote:
> > On ISA 3.0B and later you can do
> >
> > mffscdrni %3,7
> > drdpq %2,%1
> > mffscdrn %3,%3
> > drsp %0,%2
> >
> > (saving one insn, and using somewhat cheaper insns). But that is only
> > on newer machines, so is this worth it at all? :-)
>
> So something like the following?
>
> Peter
>
>
> (define_insn "trunctdsd2"
> [(set (match_operand:SD 0 "gpc_reg_operand" "=d")
> (float_truncate:SD (match_operand:TD 1 "gpc_reg_operand" "d")))
> (clobber (match_scratch:TD 2 "=&d"))
> (clobber (match_scratch:DF 3 "=&d"))]
> "TARGET_DFP"
> {
> if (TARGET_MODULO)
> return "mffscdrni %3,7\;drdpq %2,%1\;mffscdrn %3,%3\;drsp %0,%2";
> else
> return "mffs %3\;mtfsfi 7,7,1\;drdpq %2,%1\;mtfsf 0xff,%3,1,0\;drsp %0,%2";
> }
> [(set_attr "type" "dfp")
> (set (attr "length")
> (if_then_else
> (match_test "TARGET_MODULO")
> (const_string "16")
> (const_string "20")))])
Well, just make an "isa" value of "p9"? Then you can just do
(define_insn "trunctdsd2"
[(set (match_operand:SD 0 "gpc_reg_operand" "=d")
(float_truncate:SD (match_operand:TD 1 "gpc_reg_operand" "d")))
(clobber (match_scratch:TD 2 "=&d"))
(clobber (match_scratch:DF 3 "=&d"))]
"TARGET_DFP"
"@
mffscdrni %3,7\;drdpq %2,%1\;mffscdrn %3,%3\;drsp %0,%2
mffs %3\;mtfsfi 7,7,1\;drdpq %2,%1\;mtfsf 0xff,%3,1,0\;drsp %0,%2"
[(set_attr "type" "dfp")
(set_attr "isa" "p9,*")
(set_attr "length" "16,20")])
Segher
More information about the Gcc-patches
mailing list