[PATCH] D25950: [PPC] add float and double overloads for vec_orc and vec_nand in altivec.h

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 25 14:51:28 PDT 2016


echristo added inline comments.


================
Comment at: lib/Headers/altivec.h:5273-5278
+static __inline__ vector float __ATTRS_o_ai
+vec_nand(vector float __a, vector float __b) {
+  return (vector float)(~((vector unsigned int)__a &
+                          (vector unsigned int)__b));
+}
+
----------------
nemanjai wrote:
> amehsan wrote:
> > amehsan wrote:
> > > @kbarton Using C-style cast here, violates strict aliasing. Is that correct? Could it lead to functional problems if someone compiles their code WITHOUT  -fno-strict-aliasing while using this built-ins? For example if this built-in is used in a context where __a and __b are deferenced pointers? Note that this will be inlined. 
> > used in a context where 
> > ```
> > __a and __b
> > ```
> > Sorry for bad format of the comment.
> > @nemanjai what do you think?
> I may be wrong, but I don't think it does still. I think the semantics of the cast are always equivalent to a static_cast rather than a reinterpret_cast.
The semantics of the cast should be equivalent to static_cast and not reinterpret_cast. It's overall a weird set of fallback rules and there's really nothing to say what happens in the spec.

Also, FWIW, we do this all over the place in the x86 intrinsics.


Repository:
  rL LLVM

https://reviews.llvm.org/D25950





More information about the llvm-commits mailing list