The name lookup for "__rotatel4" did not find a declaration

390 views Asked by At

I'm working on GCC111 from the compile farm. The machine is AIX 7.1, POWER7 with IBM XLC 12.1. I'm trying to use __rotatel4:

$ cat test.cxx
#include <cstdlib>

unsigned int Foo (unsigned int x)
{
  return __rotatel4(x, 4U);
}

A compile results in:

$ xlC -O3 -c test.cxx
"test.cxx", line 5.10: 1540-0274 (S) The name lookup for "__rotatel4" did not find a declaration.

According to the compiler manual IBM XL C/C++ for AIX, V12.1 (p. 486) the intrinsics should be available. Here is the prototype, and it does not have restrictions like POWER6:

unsigned int __rotatel4 (unsigned int rs, unsigned int shift)

Adding -qarch=pwr7 and/or -D_XOPEN_SOURCE=600 resulted in the same error. I found Unexpected name lookup error "1540-0274 (S)" when compiling code with templates, but it does not seem to apply here.

How does one use __rotatel4 in a program?


gcc111$ oslevel -s
7100-03-02-1412

gcc111$ xlC -qversion
IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72)
Version: 12.01.0000.0000
1

There are 1 answers

2
Rafik Zurob On BEST ANSWER

For XL C/C++ V12.1, you'll need to include <builtins.h>:

$ cat aaa.cpp
#include <cstdlib>

unsigned int Foo (unsigned int x)
{
  return __rotatel4(x, 4U);
}
$ xlC aaa.cpp -c
"aaa.cpp", line 5.10: 1540-0274 (S) The name lookup for "__rotatel4" did not find a declaration.
$ cat aaa.cpp
#include <cstdlib>
#include <builtins.h>

unsigned int Foo (unsigned int x)
{
  return __rotatel4(x, 4U);
}
$ xlC aaa.cpp -c
$

For the upcoming 16.1 release, which is in beta, you don't need it. (It will work with and without it.)