2020-08-07 01:11:00 +00:00
|
|
|
#if defined(__GNUC__)
|
|
|
|
# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10)
|
2020-08-06 22:30:17 +00:00
|
|
|
#endif
|
2020-08-06 21:45:35 +00:00
|
|
|
|
2020-08-07 05:12:27 +00:00
|
|
|
#if defined(__clang__) && defined(__apple_build_version__)
|
2020-08-07 01:11:00 +00:00
|
|
|
# undef GNUC_VERSION
|
2020-08-06 21:49:39 +00:00
|
|
|
# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10)
|
2020-08-07 05:12:27 +00:00
|
|
|
#elif defined(__clang__)
|
2020-08-07 01:11:00 +00:00
|
|
|
# undef GNUC_VERSION
|
2020-08-06 21:49:39 +00:00
|
|
|
# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10)
|
2020-08-06 21:45:35 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000)
|
2019-10-24 09:18:12 +00:00
|
|
|
# pragma GCC diagnostic ignored "-Wdeprecated"
|
|
|
|
#endif
|
|
|
|
|
2019-10-25 13:35:27 +00:00
|
|
|
// XL C++ on AIX does not define VSX and does not
|
|
|
|
// provide an option to set it. We have to set it
|
|
|
|
// for the code below. This define must stay in
|
2021-04-20 08:44:21 +00:00
|
|
|
// sync with the define in test_ppc_power7.cpp.
|
2019-10-25 13:35:27 +00:00
|
|
|
#if defined(_AIX) && defined(_ARCH_PWR7) && defined(__xlC__)
|
|
|
|
# define __VSX__ 1
|
|
|
|
#endif
|
|
|
|
|
2018-11-13 18:48:38 +00:00
|
|
|
#include <altivec.h>
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
2020-04-05 01:07:01 +00:00
|
|
|
#if defined(_ARCH_PWR7) && defined(__VSX__)
|
2019-10-25 03:30:05 +00:00
|
|
|
// PWR7
|
2019-10-24 09:18:12 +00:00
|
|
|
__vector unsigned int a = {1,2,3,4};
|
2019-10-24 19:36:39 +00:00
|
|
|
__vector unsigned int b = vec_ld(0, (unsigned int*)argv[0]);
|
2019-10-24 09:18:12 +00:00
|
|
|
__vector unsigned int c = vec_xor(a, b);
|
|
|
|
|
2019-10-25 03:30:05 +00:00
|
|
|
// VSX
|
2019-10-24 09:18:12 +00:00
|
|
|
__vector unsigned int x = {5,6,7,8};
|
2019-10-24 19:36:39 +00:00
|
|
|
__vector unsigned int y = vec_xl(0, (unsigned int*)argv[0]);
|
2019-10-23 22:15:47 +00:00
|
|
|
__vector unsigned int z = vec_xor(x, y);
|
2020-05-12 02:24:16 +00:00
|
|
|
__vector unsigned long long xx = {1,2};
|
|
|
|
__vector unsigned long long yy = (__vector unsigned long long)y;
|
2018-11-19 23:29:46 +00:00
|
|
|
#else
|
2019-10-23 17:10:04 +00:00
|
|
|
int x[-1];
|
2018-11-13 18:48:38 +00:00
|
|
|
#endif
|
2019-10-23 17:10:04 +00:00
|
|
|
return 0;
|
2018-11-13 18:48:38 +00:00
|
|
|
}
|