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


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

Yes, I tried basically every combination I could think of, just not
with the "isa attr". Now, I have the following code and it is still
seems not to be working. Am I missing any options to pass?

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

with the code, I pass -O2 foo.c :
float
foo (double x, double y)
{
   return __builtin_fadd (x, y);
}

Thanks,
Tejas


On Thu, 22 Aug 2019 at 00:47, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Wed, Aug 21, 2019 at 01:28:52PM -0500, Segher Boessenkool wrote:
> > (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")])
>
> And not <Ff>...  f, d, d respectively (f for SF, d for DF).
>
>
> Segher


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