File: builtins-reduction-math.c

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (122 lines) | stat: -rw-r--r-- 4,811 bytes parent folder | download | duplicates (12)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-apple-darwin9

typedef float float4 __attribute__((ext_vector_type(4)));
typedef int int3 __attribute__((ext_vector_type(3)));
typedef unsigned unsigned4 __attribute__((ext_vector_type(4)));

struct Foo {
  char *p;
};

void test_builtin_reduce_max(int i, float4 v, int3 iv) {
  struct Foo s = __builtin_reduce_max(iv);
  // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}

  i = __builtin_reduce_max(v, v);
  // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}

  i = __builtin_reduce_max();
  // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}

  i = __builtin_reduce_max(i);
  // expected-error@-1 {{1st argument must be a vector type (was 'int')}}
}

void test_builtin_reduce_min(int i, float4 v, int3 iv) {
  struct Foo s = __builtin_reduce_min(iv);
  // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}

  i = __builtin_reduce_min(v, v);
  // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}

  i = __builtin_reduce_min();
  // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}

  i = __builtin_reduce_min(i);
  // expected-error@-1 {{1st argument must be a vector type (was 'int')}}
}

void test_builtin_reduce_add(int i, float4 v, int3 iv) {
  struct Foo s = __builtin_reduce_add(iv);
  // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}

  i = __builtin_reduce_add();
  // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}

  i = __builtin_reduce_add(iv, iv);
  // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}

  i = __builtin_reduce_add(i);
  // expected-error@-1 {{1st argument must be a vector of integers (was 'int')}}

  i = __builtin_reduce_add(v);
  // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
}

void test_builtin_reduce_mul(int i, float4 v, int3 iv) {
  struct Foo s = __builtin_reduce_mul(iv);
  // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}

  i = __builtin_reduce_mul();
  // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}

  i = __builtin_reduce_mul(iv, iv);
  // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}

  i = __builtin_reduce_mul(i);
  // expected-error@-1 {{1st argument must be a vector of integers (was 'int')}}

  i = __builtin_reduce_mul(v);
  // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
}

void test_builtin_reduce_xor(int i, float4 v, int3 iv) {
  struct Foo s = __builtin_reduce_xor(iv);
  // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}

  i = __builtin_reduce_xor();
  // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}

  i = __builtin_reduce_xor(iv, iv);
  // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}

  i = __builtin_reduce_xor(i);
  // expected-error@-1 {{1st argument must be a vector of integers (was 'int')}}

  i = __builtin_reduce_xor(v);
  // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
}

void test_builtin_reduce_or(int i, float4 v, int3 iv) {
  struct Foo s = __builtin_reduce_or(iv);
  // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}

  i = __builtin_reduce_or();
  // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}

  i = __builtin_reduce_or(iv, iv);
  // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}

  i = __builtin_reduce_or(i);
  // expected-error@-1 {{1st argument must be a vector of integers (was 'int')}}

  i = __builtin_reduce_or(v);
  // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
}

void test_builtin_reduce_and(int i, float4 v, int3 iv) {
  struct Foo s = __builtin_reduce_and(iv);
  // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}

  i = __builtin_reduce_and();
  // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}

  i = __builtin_reduce_and(iv, iv);
  // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}

  i = __builtin_reduce_and(i);
  // expected-error@-1 {{1st argument must be a vector of integers (was 'int')}}

  i = __builtin_reduce_and(v);
  // expected-error@-1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
}