File: builtins-ppc.c

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (84 lines) | stat: -rw-r--r-- 5,031 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -target-feature +altivec -target-feature +htm                       \
// RUN: -triple powerpc64-unknown-unknown -DTEST_HTM -fsyntax-only      \
// RUN: -verify %s

// RUN: %clang_cc1 -target-feature +altivec -target-feature +crypto                    \
// RUN: -triple powerpc64le-unknown-unknown -DTEST_CRYPTO -fsyntax-only      \
// RUN: -verify %s
// RUN: %clang_cc1 -target-feature +altivec -target-feature +crypto \
// RUN: -triple powerpc64le-unknown-unknown -DTEST_CRYPTO -fsyntax-only \
// RUN: -target-feature +vsx -verify %s

// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -DTEST_MAXMIN -fsyntax-only \
// RUN: -verify %s

// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -DTEST_MAXMIN -fsyntax-only \
// RUN: -verify %s

#ifdef TEST_HTM
void test_htm() {
  __builtin_tbegin(4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  __builtin_tend(-1);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
  __builtin_tsr(55);   // expected-error-re {{argument value {{.*}} is outside the valid range}}
  __builtin_tabortwc(-5, 2, 3); // expected-error-re {{argument value {{.*}} is outside the valid range}} 
  __builtin_tabortdc(55, 2, 3); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  __builtin_tabortwci(-5, 2, 5); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  __builtin_tabortwci(5, 2, 55); // expected-error-re {{argument value {{.*}} is outside the valid range}}  
  __builtin_tabortdci(-5, 2, 5); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  __builtin_tabortdci(5, 2, 55); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
#endif


#ifdef TEST_CRYPTO
#include <altivec.h>

#define W_INIT { 0x01020304, 0x05060708, 0x090A0B0C, 0x0D0E0F10 };
#define D_INIT { 0x0102030405060708, 0x090A0B0C0D0E0F10 };
vector unsigned int test_vshasigmaw_or(void)
{
  vector unsigned int a = W_INIT
  vector unsigned int b = __builtin_crypto_vshasigmaw(a, 2, 15);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
  vector unsigned int c = __builtin_crypto_vshasigmaw(a, -1, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  vector unsigned int d = __builtin_crypto_vshasigmaw(a, 0, 85);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
  vector unsigned int e = __builtin_crypto_vshasigmaw(a, 1, -15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  return __builtin_crypto_vshasigmaw(a, 1, 15);
}

#ifdef __VSX__
vector unsigned long long test_vshasigmad_or(void)
{
  vector unsigned long long a = D_INIT
  vector unsigned long long b = __builtin_crypto_vshasigmad(a, 2, 15);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
  vector unsigned long long c = __builtin_crypto_vshasigmad(a, -1, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  vector unsigned long long d = __builtin_crypto_vshasigmad(a, 0, 85);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
  vector unsigned long long e = __builtin_crypto_vshasigmad(a, 1, -15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  return __builtin_crypto_vshasigmad(a, 0, 15);
}
#endif

#endif

#ifdef TEST_MAXMIN
void test_maxmin() {
  long double fe;
  double fl;
  float fs;
#ifdef _AIX
  __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}}
  __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}}
  __builtin_ppc_maxfl(fs, fs, fs, fs); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}
  __builtin_ppc_minfl(fs, fs, fs, fs); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}
  __builtin_ppc_maxfs(fe, fe, fe, fe); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}
  __builtin_ppc_minfs(fe, fe, fe, fe); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}
#else
  __builtin_ppc_maxfe(fl, fl, fl, fl); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}
  __builtin_ppc_minfe(fl, fl, fl, fl); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}
  __builtin_ppc_maxfl(fs, fs, fs, fs); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}
  __builtin_ppc_minfl(fs, fs, fs, fs); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}
  __builtin_ppc_maxfs(fe, fe, fe, fe); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}
  __builtin_ppc_minfs(fe, fe, fe, fe); // expected-error-re {{passing {{.*}} to parameter of incompatible type {{.*}}}}
#endif
}
#endif