[PATCH] D33053: [PowerPC] Implement vec_xxpermdi builtin.

Tony Jiang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 23 11:18:05 PDT 2017


jtony added inline comments.


================
Comment at: lib/Sema/SemaChecking.cpp:3900
+// vector short vec_xxsldwi(vector short, vector short, int);
+bool Sema::SemaBuiltinVSX(CallExpr *TheCall, unsigned NumArgs) {
+  if (TheCall->getNumArgs() < NumArgs)
----------------
nemanjai wrote:
> I assume that we won't even need this at all if we're not diagnosing the range of the third argument.
Changed to just check it is Compile Time constant without check the range.


================
Comment at: test/CodeGen/builtins-ppc-error.c:23
+void testXXPERMDI(void) {
+  int index = 5;
+  vec_xxpermdi(vsi); //expected-error {{too few arguments to function call, expected at least 3, have 1}}
----------------
inouehrs wrote:
> I am not sure we can assure that clang always do a constant propagation to resolve `index` as a compile time constant. But it seems that an existing test case above already assumes clang does it. 
> IMO, `const unsigned index = 5;` is a little better.
Hi Hiroshi, the index is used as a non-constant variable test input to test the diagnostic message. We want it to be a variable here. But I guess I can leave it uninitialized to be clear.


https://reviews.llvm.org/D33053





More information about the cfe-commits mailing list