[PATCH] Add missing builtins to altivec.h for ABI compliance (vol. 1)

Nemanja Ivanovic nemanja.i.ibm at gmail.com
Tue Jun 23 00:48:53 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/Headers/altivec.h:780
@@ -748,1 +779,3 @@
 #ifdef __VSX__
+vector double __ATTRS_o_ai vec_and(vector bool long long __a, vector double __b) {
+  vector unsigned long long __res =
----------------
Not sure how I missed this here, but I've updated it in my patch: the missing "static"

================
Comment at: lib/Headers/altivec.h:1120
@@ -1070,1 +1119,3 @@
 #ifdef __VSX__
+vector double __ATTRS_o_ai
+vec_andc(vector bool long long __a, vector double __b) {
----------------
Similar issue with missing "static"

================
Comment at: lib/Headers/altivec.h:1689
@@ -1541,3 +1688,3 @@
                                                vector signed char __b) {
-  return (vector bool char)__builtin_altivec_vcmpgtsb(__b, __a);
+  return vec_cmpgt(__b, __a);
 }
----------------
Since the vector float version of this has a VSX and non-VSX version, I updated all of them to just forward the other function. In case we end up with VSX versions for the others as well, the logic does not have to be repeated.

================
Comment at: test/CodeGen/builtins-ppc-p8vector.c:4
@@ -3,3 +3,3 @@
 // RUN: %clang_cc1 -faltivec -target-feature +power8-vector -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-LE
-// RUN: not %clang_cc1 -faltivec -triple powerpc64-unknown-unknown -emit-llvm %s -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PPC
+// RUN: not %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64-unknown-unknown -emit-llvm %s -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PPC
 
----------------
Added -target-feature +vsx to avoid errors about "vector double" and to generate the correct errors for functions that are only overloaded with __VSX__ (vec_cmpge, vec_cmple).

http://reviews.llvm.org/D10637

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list