85 lines · c
1// REQUIRES: powerpc-registered-target2// RUN: %clang_cc1 -target-feature +altivec -target-feature +htm \3// RUN: -triple powerpc64-unknown-unknown -DTEST_HTM -fsyntax-only \4// RUN: -verify %s5 6// RUN: %clang_cc1 -target-feature +altivec -target-feature +crypto \7// RUN: -triple powerpc64le-unknown-unknown -DTEST_CRYPTO -fsyntax-only \8// RUN: -verify %s9// RUN: %clang_cc1 -target-feature +altivec -target-feature +crypto \10// RUN: -triple powerpc64le-unknown-unknown -DTEST_CRYPTO -fsyntax-only \11// RUN: -target-feature +vsx -verify %s12 13// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -DTEST_MAXMIN -fsyntax-only \14// RUN: -verify %s15 16// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -DTEST_MAXMIN -fsyntax-only \17// RUN: -verify %s18 19#ifdef TEST_HTM20void test_htm() {21 __builtin_tbegin(4); // expected-error-re {{argument value {{.*}} is outside the valid range}}22 __builtin_tend(-1); // expected-error-re {{argument value {{.*}} is outside the valid range}}23 __builtin_tsr(55); // expected-error-re {{argument value {{.*}} is outside the valid range}}24 __builtin_tabortwc(-5, 2, 3); // expected-error-re {{argument value {{.*}} is outside the valid range}} 25 __builtin_tabortdc(55, 2, 3); // expected-error-re {{argument value {{.*}} is outside the valid range}}26 __builtin_tabortwci(-5, 2, 5); // expected-error-re {{argument value {{.*}} is outside the valid range}}27 __builtin_tabortwci(5, 2, 55); // expected-error-re {{argument value {{.*}} is outside the valid range}} 28 __builtin_tabortdci(-5, 2, 5); // expected-error-re {{argument value {{.*}} is outside the valid range}}29 __builtin_tabortdci(5, 2, 55); // expected-error-re {{argument value {{.*}} is outside the valid range}}30}31#endif32 33 34#ifdef TEST_CRYPTO35#include <altivec.h>36 37#define W_INIT { 0x01020304, 0x05060708, 0x090A0B0C, 0x0D0E0F10 };38#define D_INIT { 0x0102030405060708, 0x090A0B0C0D0E0F10 };39vector unsigned int test_vshasigmaw_or(void)40{41 vector unsigned int a = W_INIT42 vector unsigned int b = __builtin_crypto_vshasigmaw(a, 2, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}43 vector unsigned int c = __builtin_crypto_vshasigmaw(a, -1, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}44 vector unsigned int d = __builtin_crypto_vshasigmaw(a, 0, 85); // expected-error-re {{argument value {{.*}} is outside the valid range}}45 vector unsigned int e = __builtin_crypto_vshasigmaw(a, 1, -15); // expected-error-re {{argument value {{.*}} is outside the valid range}}46 return __builtin_crypto_vshasigmaw(a, 1, 15);47}48 49#ifdef __VSX__50vector unsigned long long test_vshasigmad_or(void)51{52 vector unsigned long long a = D_INIT53 vector unsigned long long b = __builtin_crypto_vshasigmad(a, 2, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}54 vector unsigned long long c = __builtin_crypto_vshasigmad(a, -1, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}55 vector unsigned long long d = __builtin_crypto_vshasigmad(a, 0, 85); // expected-error-re {{argument value {{.*}} is outside the valid range}}56 vector unsigned long long e = __builtin_crypto_vshasigmad(a, 1, -15); // expected-error-re {{argument value {{.*}} is outside the valid range}}57 return __builtin_crypto_vshasigmad(a, 0, 15);58}59#endif60 61#endif62 63#ifdef TEST_MAXMIN64void test_maxmin() {65 long double fe;66 double fl;67 float fs;68#ifdef _AIX69 __builtin_ppc_maxfe(fe, fe, fe, fe); // expected-error-re {{builtin requires 128 bit size 'long double' type support, but target {{.*}} does not support it}}70 __builtin_ppc_minfe(fe, fe, fe, fe); // expected-error-re {{builtin requires 128 bit size 'long double' type support, but target {{.*}} does not support it}}71 __builtin_ppc_maxfl(fs, fs, fs, fs); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}72 __builtin_ppc_minfl(fs, fs, fs, fs); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}73 __builtin_ppc_maxfs(fe, fe, fe, fe); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}74 __builtin_ppc_minfs(fe, fe, fe, fe); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}75#else76 __builtin_ppc_maxfe(fl, fl, fl, fl); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}77 __builtin_ppc_minfe(fl, fl, fl, fl); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}78 __builtin_ppc_maxfl(fs, fs, fs, fs); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}79 __builtin_ppc_minfl(fs, fs, fs, fs); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}80 __builtin_ppc_maxfs(fe, fe, fe, fe); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}81 __builtin_ppc_minfs(fe, fe, fe, fe); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}82#endif83}84#endif85