This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Expansion of narrowing math built-ins into power instructions


Hi Tejas,

On Wed, Aug 21, 2019 at 10:56:51PM +0530, Tejas Joshi wrote:
> I have the following code which uses unspec but I am really missing
> something here. Does unspec not work encapsulating plus? Or I have
> some more places to make changes to?
> 
> (define_insn "add_truncdfsf3"
>   [(set (match_operand:SF 0 "gpc_reg_operand" "=<Ff>,wa")
>        (unspec:SF
>        [(plus:DF (match_operand:DF 1 "gpc_reg_operand" "%<Ff>,wa")
>                  (match_operand:DF 2 "gpc_reg_operand" "<Ff>,wa"))]
>                   UNSPEC_ADD_TRUNCATE))]
>   "TARGET_HARD_FLOAT"
>   "@
>    fadds %0,%1,%2
>    xsaddsp %x0,%x1,%x2"
>   [(set_attr "type" "fp")])

This does almost exactly the same as what the proposed float_narrow
would do.  Instead, write it as

(define_insn "add_truncdfsf3"
  [(set (match_operand:SF 0 "gpc_reg_operand" "=<Ff>,wa")
	(unspec:SF [(match_operand:DF 1 "gpc_reg_operand" "%<Ff>,wa")
		    (match_operand:DF 2 "gpc_reg_operand" "<Ff>,wa")]
		   UNSPEC_ADD_TRUNCATE)]
  "TARGET_HARD_FLOAT"
  "@
   fadds %0,%1,%2
   xsaddsp %x0,%x1,%x2"
  [(set_attr "type" "fp")
   (set_attr "isa" "*,p8v")])

(note the "isa" attribute)


to prevent any folding etc. from happening to it.

> and an UNSPEC_ADD_TRUNCATE in unspec enum.

UNSPEC_ADD_NARROWING?


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]