diff options
author | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2014-10-31 19:19:24 +0000 |
---|---|---|
committer | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2014-10-31 19:19:24 +0000 |
commit | 691e01d94e53957dc4061f06634f6044ff4cab5f (patch) | |
tree | 684ee0005ad631a7882ba7e81834cf5ff0487a87 /clang/test/Parser/cxx-altivec.cpp | |
parent | 1ca69fa64da40e7286f5f9d8e577017cd64b782c (diff) | |
download | bcm5719-llvm-691e01d94e53957dc4061f06634f6044ff4cab5f.tar.gz bcm5719-llvm-691e01d94e53957dc4061f06634f6044ff4cab5f.zip |
[PowerPC] Initial VSX intrinsic support, with min/max for vector double
Now that we have initial support for VSX, we can begin adding
intrinsics for programmer access to VSX instructions. This patch
performs the necessary enablement in the front end, and tests it by
implementing intrinsics for minimum and maximum using the vector
double data type.
The main change in the front end is to no longer disallow "vector" and
"double" in the same declaration (lib/Sema/DeclSpec.cpp), but "vector"
and "long double" must still be disallowed. The new intrinsics are
accessed via vec_max and vec_min with changes in
lib/Headers/altivec.h. Note that for v4f32, we already access
corresponding VMX builtins, but with VSX enabled we should use the
forms that allow all 64 vector registers.
The new built-ins are defined in include/clang/Basic/BuiltinsPPC.def.
I've added a new test in test/CodeGen/builtins-ppc-vsx.c that is
similar to, but much smaller than, builtins-ppc-altivec.c. This
allows us to test VSX IR generation without duplicating CHECK lines
for the existing bazillion Altivec tests.
Since vector double is now legal when VSX is available, I've modified
the error message, and changed where we test for it and for vector
long double, since the target machine isn't visible in the old place.
This serendipitously removed a not-pertinent warning about 'long'
being deprecated when used with 'vector', when "vector long double" is
encountered and we just want to issue an error. The existing tests
test/Parser/altivec.c and test/Parser/cxx-altivec.cpp have been
updated accordingly, and I've added test/Parser/vsx.c to verify that
"vector double" is now legitimate with VSX enabled.
There is a companion patch for LLVM.
llvm-svn: 220989
Diffstat (limited to 'clang/test/Parser/cxx-altivec.cpp')
-rw-r--r-- | clang/test/Parser/cxx-altivec.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/test/Parser/cxx-altivec.cpp b/clang/test/Parser/cxx-altivec.cpp index 23a6acd86be..f2ba28b641a 100644 --- a/clang/test/Parser/cxx-altivec.cpp +++ b/clang/test/Parser/cxx-altivec.cpp @@ -61,14 +61,14 @@ vector unsigned long v_ul; // expected-warning {{Use of 'long' with '__ vector long int v_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}} vector signed long int v_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} vector unsigned long int v_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} -__vector long double vv_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} -vector long double v_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +__vector long double vv_ld; // expected-error {{cannot use 'long double' with '__vector'}} +vector long double v_ld; // expected-error {{cannot use 'long double' with '__vector'}} // These should have errors. -__vector double vv_d1; // expected-error {{cannot use 'double' with '__vector'}} -vector double v_d2; // expected-error {{cannot use 'double' with '__vector'}} -__vector long double vv_ld3; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} -vector long double v_ld4; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +__vector double vv_d1; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}} +vector double v_d2; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}} +__vector long double vv_ld3; // expected-error {{cannot use 'long double' with '__vector'}} +vector long double v_ld4; // expected-error {{cannot use 'long double' with '__vector'}} vector bool v_b; // expected-error {{C++ requires a type specifier for all declarations}} vector bool float v_bf; // expected-error {{cannot use 'float' with '__vector bool'}} vector bool double v_bd; // expected-error {{cannot use 'double' with '__vector bool'}} |