blob: aa6e9843f6575738c88b931d6c7c00f95151b9c9 [file] [log] [blame]
Kit Bartone50adcb2015-03-30 19:40:59 +00001// REQUIRES: powerpc-registered-target
Eric Christopher758aad72017-03-21 22:06:18 +00002// RUN: %clang_cc1 -target-feature +altivec -target-feature +htm \
Kit Bartone50adcb2015-03-30 19:40:59 +00003// RUN: -triple powerpc64-unknown-unknown -DTEST_HTM -fsyntax-only \
4// RUN: -verify %s
5
Eric Christopher758aad72017-03-21 22:06:18 +00006// RUN: %clang_cc1 -target-feature +altivec -target-feature +crypto \
Kit Bartone50adcb2015-03-30 19:40:59 +00007// RUN: -triple powerpc64le-unknown-unknown -DTEST_CRYPTO -fsyntax-only \
8// RUN: -verify %s
9
10#ifdef TEST_HTM
11void test_htm() {
Chandler Carruth16e6bc22018-06-21 23:46:09 +000012 __builtin_tbegin(4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
13 __builtin_tend(-1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
14 __builtin_tsr(55); // expected-error-re {{argument value {{.*}} is outside the valid range}}
15 __builtin_tabortwc(-5, 2, 3); // expected-error-re {{argument value {{.*}} is outside the valid range}}
16 __builtin_tabortdc(55, 2, 3); // expected-error-re {{argument value {{.*}} is outside the valid range}}
17 __builtin_tabortwci(-5, 2, 5); // expected-error-re {{argument value {{.*}} is outside the valid range}}
18 __builtin_tabortwci(5, 2, 55); // expected-error-re {{argument value {{.*}} is outside the valid range}}
19 __builtin_tabortdci(-5, 2, 5); // expected-error-re {{argument value {{.*}} is outside the valid range}}
20 __builtin_tabortdci(5, 2, 55); // expected-error-re {{argument value {{.*}} is outside the valid range}}
Kit Bartone50adcb2015-03-30 19:40:59 +000021}
22#endif
23
24
25#ifdef TEST_CRYPTO
26#include <altivec.h>
27
28#define W_INIT { 0x01020304, 0x05060708, 0x090A0B0C, 0x0D0E0F10 };
29#define D_INIT { 0x0102030405060708, 0x090A0B0C0D0E0F10 };
30vector unsigned int test_vshasigmaw_or(void)
31{
32 vector unsigned int a = W_INIT
Chandler Carruth16e6bc22018-06-21 23:46:09 +000033 vector unsigned int b = __builtin_crypto_vshasigmaw(a, 2, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
34 vector unsigned int c = __builtin_crypto_vshasigmaw(a, -1, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
35 vector unsigned int d = __builtin_crypto_vshasigmaw(a, 0, 85); // expected-error-re {{argument value {{.*}} is outside the valid range}}
36 vector unsigned int e = __builtin_crypto_vshasigmaw(a, 1, -15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
Kit Bartone50adcb2015-03-30 19:40:59 +000037 return __builtin_crypto_vshasigmaw(a, 1, 15);
38}
39
40vector unsigned long long test_vshasigmad_or(void)
41{
42 vector unsigned long long a = D_INIT
Chandler Carruth16e6bc22018-06-21 23:46:09 +000043 vector unsigned long long b = __builtin_crypto_vshasigmad(a, 2, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
44 vector unsigned long long c = __builtin_crypto_vshasigmad(a, -1, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
45 vector unsigned long long d = __builtin_crypto_vshasigmad(a, 0, 85); // expected-error-re {{argument value {{.*}} is outside the valid range}}
46 vector unsigned long long e = __builtin_crypto_vshasigmad(a, 1, -15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
Kit Bartone50adcb2015-03-30 19:40:59 +000047 return __builtin_crypto_vshasigmad(a, 0, 15);
48}
49
50#endif
51