You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Power10] Implement custom codegen for the vec_replace_elt and vec_replace_unaligned builtins.
This patch implements custom codegen for the vec_replace_elt and
vec_replace_unaligned builtins.
These builtins map to the @llvm.ppc.altivec.vinsw and @llvm.ppc.altivec.vinsd
intrinsics depending on the arguments. The main motivation for doing custom
codegen for these intrinsics is because there are float and double versions of
the builtin. Normally, the converting the float to an integer would be done via
fptoui in the IR. This is incorrect as fptoui truncates the value and we must
ensure the value is not truncated. Therefore, we provide custom codegen to utilize
bitcast instead as bitcasts do not truncate.
Differential Revision: https://reviews.llvm.org/D83500
returnvec_replace_elt(vsia, sia, 13); // expected-error {{argument value 13 is outside the valid range [0, 12]}}
25
+
}
26
+
27
+
vector unsignedinttest_vec_replace_elt_ui(void) {
28
+
returnvec_replace_elt(vuia, sia, 1); // expected-error {{arguments are of different types ('unsigned int' vs 'int')}}
29
+
}
30
+
31
+
vectorfloattest_vec_replace_elt_f(void) {
32
+
returnvec_replace_elt(vfa, fa, 20); // expected-error {{argument value 20 is outside the valid range [0, 12]}}
33
+
}
34
+
35
+
vectorfloattest_vec_replace_elt_f_2(void) {
36
+
returnvec_replace_elt(vfa, da, 0); // expected-error {{arguments are of different types ('float' vs 'double')}}
37
+
}
38
+
39
+
vector signed long longtest_vec_replace_elt_sll(void) {
40
+
returnvec_replace_elt(vslla, slla, 9); // expected-error {{argument value 9 is outside the valid range [0, 8]}}
41
+
}
42
+
43
+
vector unsigned long longtest_vec_replace_elt_ull(void) {
44
+
returnvec_replace_elt(vulla, vda, 0); // expected-error {{arguments are of different types ('unsigned long long' vs '__vector double' (vector of 2 'double' values))}}
45
+
}
46
+
47
+
vector unsigned long longtest_vec_replace_elt_ull_2(void) {
48
+
returnvec_replace_elt(vulla, vulla, vsia); // expected-error {{argument to '__builtin_altivec_vec_replace_elt' must be a constant integer}}
49
+
}
50
+
51
+
vectordoubletest_vec_replace_elt_d(void) {
52
+
returnvec_replace_elt(vda, da, 33); // expected-error {{argument value 33 is outside the valid range [0, 8]}}
0 commit comments