r349751 - [SystemZ] Fix wrong codegen caused by typos in vecintrin.h
Ulrich Weigand via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 20 05:09:09 PST 2018
Author: uweigand
Date: Thu Dec 20 05:09:09 2018
New Revision: 349751
URL: http://llvm.org/viewvc/llvm-project?rev=349751&view=rev
Log:
[SystemZ] Fix wrong codegen caused by typos in vecintrin.h
The following two bugs in SystemZ high-level vector intrinsics are
fixes by this patch:
- The float case of vec_insert_and_zero should generate a VLLEZF
pattern, but currently erroneously generates VLLEZLF.
- The float and double versions of vec_orc erroneously generate
and-with-complement instead of or-with-complement.
The patch also fixes a couple of typos in the associated test.
Modified:
cfe/trunk/lib/Headers/vecintrin.h
cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c
Modified: cfe/trunk/lib/Headers/vecintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/vecintrin.h?rev=349751&r1=349750&r2=349751&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/vecintrin.h (original)
+++ cfe/trunk/lib/Headers/vecintrin.h Thu Dec 20 05:09:09 2018
@@ -381,7 +381,7 @@ vec_insert_and_zero(const unsigned long
static inline __ATTRS_o_ai vector float
vec_insert_and_zero(const float *__ptr) {
vector float __vec = (vector float)0;
- __vec[0] = *__ptr;
+ __vec[1] = *__ptr;
return __vec;
}
#endif
@@ -5942,13 +5942,13 @@ vec_orc(vector unsigned long long __a, v
static inline __ATTRS_o_ai vector float
vec_orc(vector float __a, vector float __b) {
- return (vector float)((vector unsigned int)__a &
+ return (vector float)((vector unsigned int)__a |
~(vector unsigned int)__b);
}
static inline __ATTRS_o_ai vector double
vec_orc(vector double __a, vector double __b) {
- return (vector double)((vector unsigned long long)__a &
+ return (vector double)((vector unsigned long long)__a |
~(vector unsigned long long)__b);
}
#endif
Modified: cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c?rev=349751&r1=349750&r2=349751&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c (original)
+++ cfe/trunk/test/CodeGen/builtins-systemz-zvector2.c Thu Dec 20 05:09:09 2018
@@ -65,9 +65,9 @@ void test_core(void) {
d = vec_extract(vd, idx);
// CHECK: extractelement <2 x double> %{{.*}}, i32 %{{.*}}
- vf = vec_insert(d, vf, idx);
+ vf = vec_insert(f, vf, idx);
// CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 %{{.*}}
- vd = vec_insert(f, vd, idx);
+ vd = vec_insert(d, vd, idx);
// CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 %{{.*}}
vf = vec_promote(f, idx);
@@ -76,7 +76,7 @@ void test_core(void) {
// CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}}
vf = vec_insert_and_zero(cptrf);
- // CHECK: insertelement <4 x float> <float undef, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float %{{.*}}, i32 0
+ // CHECK: insertelement <4 x float> <float 0.000000e+00, float undef, float 0.000000e+00, float 0.000000e+00>, float %{{.*}}, i32 1
vd = vec_insert_and_zero(cptrd);
// CHECK: insertelement <2 x double> <double undef, double 0.000000e+00>, double %{{.*}}, i32 0
@@ -227,8 +227,8 @@ void test_compare(void) {
idx = vec_all_lt(vd, vd);
// CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchdbs(<2 x double> %{{.*}}, <2 x double> %{{.*}})
- idx = vec_all_nge(vd, vd);
- // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}})
+ idx = vec_all_nge(vf, vf);
+ // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}})
idx = vec_all_nge(vd, vd);
// CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}})
More information about the cfe-commits
mailing list