[dpdk-dev] [PATCH 1/3] eal: add 128-bit cmpset (x86-64 only)
Varghese, Vipin
vipin.varghese at intel.com
Wed Jan 16 05:34:00 CET 2019
Thanks Gage for clarifying and correcting. Appreciate the same.
> -----Original Message-----
> From: Eads, Gage
> Sent: Monday, January 14, 2019 9:17 PM
> To: Varghese, Vipin <vipin.varghese at intel.com>; Andrew Rybchenko
> <arybchenko at solarflare.com>; dev at dpdk.org
> Cc: olivier.matz at 6wind.com; Richardson, Bruce <bruce.richardson at intel.com>;
> Ananyev, Konstantin <konstantin.ananyev at intel.com>
> Subject: RE: [dpdk-dev] [PATCH 1/3] eal: add 128-bit cmpset (x86-64 only)
>
>
>
> > -----Original Message-----
> > From: Varghese, Vipin
> > Sent: Sunday, January 13, 2019 10:29 PM
> > To: Andrew Rybchenko <arybchenko at solarflare.com>; Eads, Gage
> > <gage.eads at intel.com>; dev at dpdk.org
> > Cc: olivier.matz at 6wind.com; Richardson, Bruce
> > <bruce.richardson at intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev at intel.com>
> > Subject: RE: [dpdk-dev] [PATCH 1/3] eal: add 128-bit cmpset (x86-64
> > only)
> >
> > Hi Gage,
> >
> > snipped
> > > > @@ -208,4 +209,25 @@ static inline void
> > > rte_atomic64_clear(rte_atomic64_t *v)
> > > > }
> > > > #endif
> > > >
> > > > +static inline int
> > > > +rte_atomic128_cmpset(volatile uint64_t *dst, uint64_t *exp,
> > > > +uint64_t
> > > > +*src) {
> > > > + uint8_t res;
> > > > +
> > > > + asm volatile (
> > > > + MPLOCKED
> > > > + "cmpxchg16b %[dst];"
> > > > + " sete %[res]"
> > > > + : [dst] "=m" (*dst),
> > > > + [res] "=r" (res)
> > > > + : "c" (src[1]),
> > > > + "b" (src[0]),
> > > > + "m" (*dst),
> > > > + "d" (exp[1]),
> > > > + "a" (exp[0])
> > > > + : "memory");
> > Since update depends upon on the 'set|unset' value of ZF, should we
> > first set ZF to 0?
> >
> > Apologies in advance if it is internally taken care by 'sete'.
>
> cmpxchg16b will set the ZF if the compared values are equal, else it will clear the
> ZF, so there's no need to initialize the ZF.
>
> Source: https://www.felixcloutier.com/x86/cmpxchg8b:cmpxchg16b
>
> Thanks,
> Gage
More information about the dev
mailing list