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.vargh...@intel.com>; Andrew Rybchenko > <arybche...@solarflare.com>; dev@dpdk.org > Cc: olivier.m...@6wind.com; Richardson, Bruce <bruce.richard...@intel.com>; > Ananyev, Konstantin <konstantin.anan...@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 <arybche...@solarflare.com>; Eads, Gage > > <gage.e...@intel.com>; dev@dpdk.org > > Cc: olivier.m...@6wind.com; Richardson, Bruce > > <bruce.richard...@intel.com>; Ananyev, Konstantin > > <konstantin.anan...@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