[PATCH] rs6000: Generate _Decimal128 to _Decimal32 hardware conversion instructions

Peter Bergner bergner@linux.ibm.com
Fri Jul 17 21:18:55 GMT 2020


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")))])


More information about the Gcc-patches mailing list