File: affinity-3.c

package info (click to toggle)
gcc-arm-none-eabi 15%3A12.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 959,712 kB
  • sloc: cpp: 3,275,382; ansic: 2,061,766; ada: 840,956; f90: 208,513; makefile: 76,132; asm: 73,433; xml: 50,448; exp: 34,146; sh: 32,436; objc: 15,637; fortran: 14,012; python: 11,991; pascal: 6,787; awk: 4,779; perl: 3,054; yacc: 338; ml: 285; lex: 201; haskell: 122
file content (77 lines) | stat: -rw-r--r-- 2,656 bytes parent folder | download | duplicates (2)
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
/* { dg-additional-options "-Wno-volatile" { target c++ } } */

int arr[64], arr2[64];
struct S { int a[4]; } k;
short arr4[4];
volatile int v;
#define TEST_EQ(x,y) ({ int o[x == y ? 1 : -1]; 0; })

void
foo (unsigned char i, signed char j)
{
  #pragma omp task affinity (iterator (j=6:2:-2) : \
	arr[TEST_EQ (sizeof (j), sizeof (int)), \
	    TEST_EQ (sizeof (i), sizeof (unsigned char)), \
	    TEST_EQ (sizeof (k), sizeof (struct S)), j], \
	arr2[TEST_EQ (((__typeof (j)) -1) < 0, 1), \
	     TEST_EQ (((__typeof (i)) -1) < 0, 0), \
	     TEST_EQ (((__typeof (k.a[0])) -1) < 0, 1), j]) \
	affinity(arr[0]) \
	affinity (iterator (long long i=__LONG_LONG_MAX__ - 4:__LONG_LONG_MAX__ - 2:2, \
			  unsigned short j=~0U-16:~0U-8:3, \
			  short *k=&arr4[1]:&arr4[2]:1) : \
	arr[TEST_EQ (sizeof (i), sizeof (long long)), \
	    TEST_EQ (sizeof (j), sizeof (unsigned short)), \
	    TEST_EQ (sizeof (k), sizeof (short *)), \
	    TEST_EQ (sizeof (*k), sizeof (short)), i - __LONG_LONG_MAX__ + 4], \
	arr2[TEST_EQ (((__typeof (i)) -1) < 0, 1), \
	     TEST_EQ (((__typeof (j)) -1) < 0, 0), \
	     TEST_EQ (((__typeof (*k)) -1) < 0, 1), j - (~0U-16)], \
	arr2[k - &arr4[0]]) \
	affinity( k)
    v++;
}

void
bar (unsigned char i, signed char j)
{
  int m = j;
  int n = j + 2;
  #pragma omp task affinity (iterator (j=6:2:m) : \
	arr[TEST_EQ (sizeof (j), sizeof (int)), \
	    TEST_EQ (sizeof (i), sizeof (unsigned char)), \
	    TEST_EQ (sizeof (k), sizeof (struct S)), j], \
	arr2[TEST_EQ (((__typeof (j)) -1) < 0, 1), \
	     TEST_EQ (((__typeof (i)) -1) < 0, 0), \
	     TEST_EQ (((__typeof (k.a[0])) -1) < 0, 1), j]) \
	affinity( arr[0]) \
	affinity (iterator (long long i=__LONG_LONG_MAX__ - 4 - n:__LONG_LONG_MAX__ - 2:2, \
			  unsigned short j=~0U-16:~0U-8-n:3, \
			  short *k=&arr4[1]:&arr4[n + 2]:1) : \
	arr[TEST_EQ (sizeof (i), sizeof (long long)), \
	    TEST_EQ (sizeof (j), sizeof (unsigned short)), \
	    TEST_EQ (sizeof (k), sizeof (short *)), \
	    TEST_EQ (sizeof (*k), sizeof (short)), i - __LONG_LONG_MAX__ + 4], \
	arr2[TEST_EQ (((__typeof (i)) -1) < 0, 1), \
	     TEST_EQ (((__typeof (j)) -1) < 0, 0), \
	     TEST_EQ (((__typeof (*k)) -1) < 0, 1), j - (~0U-16)], \
	arr2[k - &arr4[0]:10]) \
	affinity( k)
    v++;
}

void
baz (void)
{
  #pragma omp parallel
  #pragma omp master
  {
    #pragma omp task affinity(iterator(unsigned long int k = 0 : 2) : \
	arr[TEST_EQ (sizeof (k), sizeof (unsigned long)), \
	    TEST_EQ (((__typeof (k)) -1) < 0, 0), k]) \
	affinity(iterator(signed char s = -3 : -12 : -1) : \
	arr[TEST_EQ (sizeof (s), sizeof (signed char)), \
	    TEST_EQ (((__typeof (s)) -1) < 0, 1), s + 12])
      v++;
  }
}