Author: rsmith
Date: Mon Sep 16 20:56:26 2019
New Revision: 372061

URL: http://llvm.org/viewvc/llvm-project?rev=372061&view=rev
Log:
Remove reliance on lax vector conversions from altivec.h in VSX mode.

Modified:
    cfe/trunk/lib/Headers/altivec.h
    cfe/trunk/test/CodeGen/altivec-ct.c
    cfe/trunk/test/CodeGen/builtins-ppc-error.c
    cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c
    cfe/trunk/test/CodeGen/builtins-ppc-vsx.c

Modified: cfe/trunk/lib/Headers/altivec.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=372061&r1=372060&r2=372061&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/altivec.h (original)
+++ cfe/trunk/lib/Headers/altivec.h Mon Sep 16 20:56:26 2019
@@ -2761,8 +2761,8 @@ static __inline__ vector double __ATTRS_
   return (vector double)__builtin_vsx_lxvl(__a, (__b << 56));
 }
 
-static __inline__ vector double __ATTRS_o_ai vec_xl_len_r(unsigned char *__a,
-                                                          size_t __b) {
+static __inline__ vector unsigned char __ATTRS_o_ai
+vec_xl_len_r(unsigned char *__a, size_t __b) {
   vector unsigned char __res =
       (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56));
 #ifdef __LITTLE_ENDIAN__
@@ -2912,10 +2912,11 @@ static __inline__ vector double __ATTRS_
 #ifdef __VSX__
 #define vec_cts(__a, __b)                                                      
\
   _Generic((__a), vector float                                                 
\
-           : __builtin_altivec_vctsxs((__a), (__b)), vector double             
\
+           : __builtin_altivec_vctsxs((vector float)(__a), (__b)),             
\
+             vector double                                                     
\
            : __extension__({                                                   
\
              vector double __ret =                                             
\
-                 (__a) *                                                       
\
+                 (vector double)(__a) *                                        
\
                  (vector double)(vector unsigned long long)((0x3ffULL + (__b)) 
\
                                                             << 52);            
\
              __builtin_convertvector(__ret, vector signed long long);          
\
@@ -2933,10 +2934,11 @@ static __inline__ vector double __ATTRS_
 #ifdef __VSX__
 #define vec_ctu(__a, __b)                                                      
\
   _Generic((__a), vector float                                                 
\
-           : __builtin_altivec_vctuxs((__a), (__b)), vector double             
\
+           : __builtin_altivec_vctuxs((vector float)(__a), (__b)),             
\
+             vector double                                                     
\
            : __extension__({                                                   
\
              vector double __ret =                                             
\
-                 (__a) *                                                       
\
+                 (vector double)(__a) *                                        
\
                  (vector double)(vector unsigned long long)((0x3ffULL + __b)   
\
                                                             << 52);            
\
              __builtin_convertvector(__ret, vector unsigned long long);        
\
@@ -6301,19 +6303,20 @@ static __inline__ vector float __ATTRS_o
 #ifdef __VSX__
 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
                                                     vector double __b) {
-  return (vector unsigned long long)__a | (vector unsigned long long)__b;
+  return (vector double)((vector unsigned long long)__a |
+                         (vector unsigned long long)__b);
 }
 
 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
                                                     vector bool long long __b) 
{
-  return (vector unsigned long long)__a | (vector unsigned long long)__b;
+  return (vector double)((vector unsigned long long)__a |
+                         (vector unsigned long long)__b);
 }
 
 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
                                                     vector double __b) {
-  vector unsigned long long __res =
-      (vector unsigned long long)__a | (vector unsigned long long)__b;
-  return (vector double)__res;
+  return (vector double)((vector unsigned long long)__a |
+                         (vector unsigned long long)__b);
 }
 
 static __inline__ vector signed long long __ATTRS_o_ai
@@ -14781,7 +14784,7 @@ static __inline__ int __ATTRS_o_ai vec_a
 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
                                               vector float __b) {
 #ifdef __VSX__
-  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
+  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, (vector double)__a, (vector 
double)__b);
 #else
   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
 #endif
@@ -16671,13 +16674,13 @@ static __inline__ void __ATTRS_o_ai vec_
 #endif
 
 #ifdef __POWER9_VECTOR__
-#define vec_test_data_class(__a, __b)                                      \
-        _Generic((__a),                                                    \
-           vector float:                                                   \
-             (vector bool int)__builtin_vsx_xvtstdcsp((__a), (__b)),       \
-           vector double:                                                  \
-             (vector bool long long)__builtin_vsx_xvtstdcdp((__a), (__b))  \
-        )
+#define vec_test_data_class(__a, __b)                                          
\
+  _Generic(                                                                    
\
+      (__a), vector float                                                      
\
+      : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)),  
\
+        vector double                                                          
\
+      : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a),   
\
+                                                       (__b)))
 
 #endif /* #ifdef __POWER9_VECTOR__ */
 

Modified: cfe/trunk/test/CodeGen/altivec-ct.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/altivec-ct.c?rev=372061&r1=372060&r2=372061&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/altivec-ct.c (original)
+++ cfe/trunk/test/CodeGen/altivec-ct.c Mon Sep 16 20:56:26 2019
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple powerpc64le-linux-gnu -S -O0 -o - %s 
-target-feature +altivec -target-feature +vsx | FileCheck %s 
-check-prefix=CHECK -check-prefix=VSX
-// RUN: %clang_cc1 -triple powerpc-linux-gnu -S -O0 -o - %s -target-feature 
+altivec -target-feature -vsx | FileCheck %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -triple powerpc64le-linux-gnu 
-S -O0 -o - %s -target-feature +altivec -target-feature +vsx | FileCheck %s 
-check-prefix=CHECK -check-prefix=VSX
+// RUN: %clang_cc1 -flax-vector-conversions=none -triple powerpc-linux-gnu -S 
-O0 -o - %s -target-feature +altivec -target-feature -vsx | FileCheck %s
 
 // REQUIRES: powerpc-registered-target
 

Modified: cfe/trunk/test/CodeGen/builtins-ppc-error.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-error.c?rev=372061&r1=372060&r2=372061&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-ppc-error.c (original)
+++ cfe/trunk/test/CodeGen/builtins-ppc-error.c Mon Sep 16 20:56:26 2019
@@ -2,10 +2,19 @@
 
 // RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
 // RUN:   -triple powerpc64-unknown-unknown -fsyntax-only   \
+// RUN: -flax-vector-conversions=integer \
 // RUN: -Wall -Werror -verify %s
 
 // RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector  \
 // RUN: -triple powerpc64le-unknown-unknown -fsyntax-only    \
+// RUN: -flax-vector-conversions=integer \
+// RUN: -Wall -Werror -verify %s
+
+// FIXME: Fix <altivec.h> so this test also passes under
+// -flax-vector-conversions=none (this last test exists to produce an error if
+// we change the default to that without fixing <altivec.h>).
+// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
+// RUN:   -triple powerpc64-unknown-unknown -fsyntax-only   \
 // RUN: -Wall -Werror -verify %s
 
 #include <altivec.h>

Modified: cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c?rev=372061&r1=372060&r2=372061&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c (original)
+++ cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c Mon Sep 16 20:56:26 2019
@@ -1,12 +1,20 @@
 // REQUIRES: powerpc-registered-target
 // RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
 // RUN:   -triple powerpc64-unknown-unknown -emit-llvm %s \
+// RUN:   -flax-vector-conversions=integer \
 // RUN:   -o - | FileCheck %s -check-prefix=CHECK-BE
 
 // RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
 // RUN:   -triple powerpc64le-unknown-unknown -emit-llvm %s \
+// RUN:   -flax-vector-conversions=integer \
 // RUN:   -o - | FileCheck %s
 
+// FIXME: This last test is intended to fail if the default is changed to
+// -flax-vector-conversions=none and <altivec.h> isn't fixed first.
+// RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
+// RUN:   -triple powerpc64-unknown-unknown -emit-llvm %s \
+// RUN:   -o - | FileCheck %s -check-prefix=CHECK-BE
+
 #include <altivec.h>
 
 vector signed char vsca, vscb;
@@ -919,7 +927,7 @@ vector double test80(void) {
 // CHECK: insertelement <2 x double>
   return vec_unpackl(vfa);
 }
-vector double test81(void) {
+vector float test81(void) {
   // CHECK: extractelement <2 x double>
   // CHECK: fptrunc double
   // CHECK: insertelement <4 x float>

Modified: cfe/trunk/test/CodeGen/builtins-ppc-vsx.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-vsx.c?rev=372061&r1=372060&r2=372061&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-ppc-vsx.c (original)
+++ cfe/trunk/test/CodeGen/builtins-ppc-vsx.c Mon Sep 16 20:56:26 2019
@@ -882,7 +882,7 @@ void test1() {
 // CHECK: call void @dummy()
 // CHECK-LE: call void @dummy()
 
-  res_vf = vec_sel(vd, vd, vbll);
+  res_vd = vec_sel(vd, vd, vbll);
 // CHECK: xor <2 x i64> %{{[0-9]+}}, <i64 -1, i64 -1>
 // CHECK: and <2 x i64> %{{[0-9]+}},
 // CHECK: and <2 x i64> %{{[0-9]+}}, %{{[0-9]+}}


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to