qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 06/10] target/hexagon: prepare input for the idef-parser


From: Paolo Montesel
Subject: Re: [PATCH v2 06/10] target/hexagon: prepare input for the idef-parser
Date: Mon, 1 Mar 2021 17:26:31 +0100

> > +/* Copy rules */
> > +#define fLSBOLD(VAL) (fGETBIT(0, VAL))
> > +#define fSATH(VAL) fSATN(16, VAL)
> > +#define fSATUH(VAL) fSATUN(16, VAL)
> > +#define fVSATH(VAL) fVSATN(16, VAL)
> > +#define fVSATUH(VAL) fVSATUN(16, VAL)
> > +#define fSATUB(VAL) fSATUN(8, VAL)
> > +#define fSATB(VAL) fSATN(8, VAL)
> > +#define fVSATUB(VAL) fVSATUN(8, VAL)
> > +#define fVSATB(VAL) fVSATN(8, VAL)
> > +#define fCALL(A) fWRITE_LR(fREAD_NPC()); fWRITE_NPC(A);
> > +#define fCALLR(A) fWRITE_LR(fREAD_NPC()); fWRITE_NPC(A);
> > +#define fCAST2_8s(A) fSXTN(16, 64, A)
> > +#define fCAST2_8u(A) fZXTN(16, 64, A)
> > +#define fCAST8S_16S(A) (fSXTN(64, 128, A))
> > +#define fCAST16S_8S(A) (fSXTN(128, 64, A))
> > +#define fVSATW(A) fVSATN(32, fCAST8_8s(A))
> > +#define fSATW(A) fSATN(32, fCAST8_8s(A))
> > +#define fVSAT(A) fVSATN(32, A)
> > +#define fSAT(A) fSATN(32, A)
> > +
> > +/* Ease parsing */
> > +#define f8BITSOF(VAL) ((VAL) ? 0xff : 0x00)
> > +#define fREAD_GP() (Constant_extended ? (0) : GP)
> > +#define fCLIP(DST, SRC, U) (DST = fMIN((1 << U) - 1, fMAX(SRC, -(1 << U))))
>
> I guess this is what's in the manual, but my reading of this expression is
> "saturate", not "clip".  How does it differ from
>
>   fSATN(U, SRC)
>
> ?

Their semantics are different.
E.g.:
- fCLIP(dst, 0x80, 8) => dst = 0x80
- fSATN(8, 0x80) => 0x7F

Take a look at `target/hexagon/macros.h` to see their slow
(macro/helper-based) implementation, which is basically our reference.

As for the naming, it's not up to us.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]