r344611 - [SystemZ] Actually enable -mzvector keywords
Ulrich Weigand via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 16 07:57:20 PDT 2018
Author: uweigand
Date: Tue Oct 16 07:57:20 2018
New Revision: 344611
URL: http://llvm.org/viewvc/llvm-project?rev=344611&view=rev
Log:
[SystemZ] Actually enable -mzvector keywords
It appears when initially committing the support for the IBM Z vector
extension language, one critical line was lost, causing the specific
keywords __vector, __bool, and vec_step to not actually be enabled.
(Note that this does not affect "vector" and "bool"!)
Unfortunately, this was not caught by any tests either. (All existing
Z vector tests just use the regular "vector" and "bool" keywords ...)
Fixed by adding the missing line and updating the tests.
Modified:
cfe/trunk/lib/Basic/IdentifierTable.cpp
cfe/trunk/test/Sema/zvector.c
cfe/trunk/test/Sema/zvector2.c
Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=344611&r1=344610&r2=344611&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/lib/Basic/IdentifierTable.cpp Tue Oct 16 07:57:20 2018
@@ -155,6 +155,7 @@ static KeywordStatus getKeywordStatus(co
if (LangOpts.WChar && (Flags & WCHARSUPPORT)) return KS_Enabled;
if (LangOpts.Char8 && (Flags & CHAR8SUPPORT)) return KS_Enabled;
if (LangOpts.AltiVec && (Flags & KEYALTIVEC)) return KS_Enabled;
+ if (LangOpts.ZVector && (Flags & KEYZVECTOR)) return KS_Enabled;
if (LangOpts.OpenCL && !LangOpts.OpenCLCPlusPlus && (Flags & KEYOPENCLC))
return KS_Enabled;
if (LangOpts.OpenCLCPlusPlus && (Flags & KEYOPENCLCXX)) return KS_Enabled;
Modified: cfe/trunk/test/Sema/zvector.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/zvector.c?rev=344611&r1=344610&r2=344611&view=diff
==============================================================================
--- cfe/trunk/test/Sema/zvector.c (original)
+++ cfe/trunk/test/Sema/zvector.c Tue Oct 16 07:57:20 2018
@@ -37,6 +37,49 @@ unsigned long ul_scalar;
double fd_scalar;
+// Verify that __vector is also recognized
+__vector signed char sc3;
+__vector unsigned char uc3;
+__vector bool char bc3;
+__vector signed short ss3;
+__vector unsigned short us3;
+__vector bool short bs3;
+__vector signed int si3;
+__vector unsigned int ui3;
+__vector bool int bi3;
+__vector signed long long sl3;
+__vector unsigned long long ul3;
+__vector bool long long bl3;
+__vector double fd3;
+__vector long ll3; // expected-error {{cannot use 'long' with '__vector'}}
+__vector float ff3; // expected-error {{cannot use 'float' with '__vector'}}
+
+// Likewise for __bool
+vector __bool char bc4;
+vector __bool short bs4;
+vector __bool int bi4;
+vector __bool long long bl4;
+__vector __bool char bc5;
+__vector __bool short bs5;
+__vector __bool int bi5;
+__vector __bool long long bl5;
+
+// Verify operation of vec_step
+int res_sc[vec_step(sc) == 16 ? 1 : -1];
+int res_uc[vec_step(uc) == 16 ? 1 : -1];
+int res_bc[vec_step(bc) == 16 ? 1 : -1];
+int res_ss[vec_step(ss) == 8 ? 1 : -1];
+int res_us[vec_step(us) == 8 ? 1 : -1];
+int res_bs[vec_step(bs) == 8 ? 1 : -1];
+int res_si[vec_step(si) == 4 ? 1 : -1];
+int res_ui[vec_step(ui) == 4 ? 1 : -1];
+int res_bi[vec_step(bi) == 4 ? 1 : -1];
+int res_sl[vec_step(sl) == 2 ? 1 : -1];
+int res_ul[vec_step(ul) == 2 ? 1 : -1];
+int res_bl[vec_step(bl) == 2 ? 1 : -1];
+int res_fd[vec_step(fd) == 2 ? 1 : -1];
+
+
void foo(void)
{
// -------------------------------------------------------------------------
Modified: cfe/trunk/test/Sema/zvector2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/zvector2.c?rev=344611&r1=344610&r2=344611&view=diff
==============================================================================
--- cfe/trunk/test/Sema/zvector2.c (original)
+++ cfe/trunk/test/Sema/zvector2.c Tue Oct 16 07:57:20 2018
@@ -22,6 +22,13 @@ vector double fd, fd2;
vector float ff, ff2;
+// Verify that __vector is also recognized
+__vector float ff3;
+
+// Verify operation of vec_step
+int res_ff[vec_step(ff) == 4 ? 1 : -1];
+
+
void foo(void)
{
// -------------------------------------------------------------------------
More information about the cfe-commits
mailing list