[PATCH] D124093: [PowerPC] Fixing implicit castings in altivec for -fno-lax-vector-conversions

Nemanja Ivanovic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 18:43:20 PDT 2022


nemanjai requested changes to this revision.
nemanjai added a comment.
This revision now requires changes to proceed.

Also, please run `clang-format` on the changes.



================
Comment at: clang/lib/Headers/altivec.h:19051
 #ifdef __LITTLE_ENDIAN__
-  return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a);
+  return __builtin_altivec_vstribl_p(__CR6_EQ, (vector char)__a);
 #else
----------------
We should never cast anything to an integral vector type that doesn't include `signed/unsigned/bool`.


================
Comment at: clang/test/CodeGen/PowerPC/builtins-ppc-p10vector.c:1955
   // CHECK: sub <1 x i128>
-  // CHECK-NEXT: lshr <1 x i128>
+  // CHECK-NEXT: ashr <1 x i128>
   // CHECK-NEXT: or <1 x i128>
----------------
This is not good. We are changing semantics here - turning a logical shift into an arithmetic shift.


================
Comment at: clang/test/CodeGen/PowerPC/builtins-ppc-quadword-noi128.c:10
 // RUN: %clang_cc1 -O2 -target-feature +altivec -target-feature +power8-vector \
-// RUN:   -triple powerpc-aix-unknown -emit-llvm %s -o - | FileCheck \
+// RUN:   -triple powerpc-aix-unknown -emit-llvm -fforce-enable-int128 %s -o - | FileCheck \
 // RUN:   %s -check-prefix=CHECK-AIX
----------------
Why is this addition needed? Seems like something is wrong if we need to force enable int128 in order to compile something with `altivec.h`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124093/new/

https://reviews.llvm.org/D124093



More information about the cfe-commits mailing list