| 1 |
// RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-apple-darwin9 |
| 2 |
|
| 3 |
typedef float float4 __attribute__((ext_vector_type(4))); |
| 4 |
typedef int int3 __attribute__((ext_vector_type(3))); |
| 5 |
typedef unsigned unsigned4 __attribute__((ext_vector_type(4))); |
| 6 |
|
| 7 |
struct Foo { |
| 8 |
char *p; |
| 9 |
}; |
| 10 |
|
| 11 |
void test_builtin_reduce_max(int i, float4 v, int3 iv) { |
| 12 |
struct Foo s = __builtin_reduce_max(iv); |
| 13 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 14 |
|
| 15 |
i = __builtin_reduce_max(v, v); |
| 16 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 17 |
|
| 18 |
i = __builtin_reduce_max(); |
| 19 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 20 |
|
| 21 |
i = __builtin_reduce_max(i); |
| 22 |
// expected-error@-1 {{1st argument must be a vector type (was 'int')}} |
| 23 |
} |
| 24 |
|
| 25 |
void test_builtin_reduce_min(int i, float4 v, int3 iv) { |
| 26 |
struct Foo s = __builtin_reduce_min(iv); |
| 27 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 28 |
|
| 29 |
i = __builtin_reduce_min(v, v); |
| 30 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 31 |
|
| 32 |
i = __builtin_reduce_min(); |
| 33 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 34 |
|
| 35 |
i = __builtin_reduce_min(i); |
| 36 |
// expected-error@-1 {{1st argument must be a vector type (was 'int')}} |
| 37 |
} |
| 38 |
|
| 39 |
void test_builtin_reduce_add(int i, float4 v, int3 iv) { |
| 40 |
struct Foo s = __builtin_reduce_add(iv); |
| 41 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 42 |
|
| 43 |
i = __builtin_reduce_add(); |
| 44 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 45 |
|
| 46 |
i = __builtin_reduce_add(iv, iv); |
| 47 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 48 |
|
| 49 |
i = __builtin_reduce_add(i); |
| 50 |
// expected-error@-1 {{1st argument must be a vector of integer types (was 'int')}} |
| 51 |
|
| 52 |
i = __builtin_reduce_add(v); |
| 53 |
// expected-error@-1 {{1st argument must be a vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 54 |
} |
| 55 |
|
| 56 |
void test_builtin_reduce_mul(int i, float4 v, int3 iv) { |
| 57 |
struct Foo s = __builtin_reduce_mul(iv); |
| 58 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 59 |
|
| 60 |
i = __builtin_reduce_mul(); |
| 61 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 62 |
|
| 63 |
i = __builtin_reduce_mul(iv, iv); |
| 64 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 65 |
|
| 66 |
i = __builtin_reduce_mul(i); |
| 67 |
// expected-error@-1 {{1st argument must be a vector of integer types (was 'int')}} |
| 68 |
|
| 69 |
i = __builtin_reduce_mul(v); |
| 70 |
// expected-error@-1 {{1st argument must be a vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 71 |
} |
| 72 |
|
| 73 |
void test_builtin_reduce_xor(int i, float4 v, int3 iv) { |
| 74 |
struct Foo s = __builtin_reduce_xor(iv); |
| 75 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 76 |
|
| 77 |
i = __builtin_reduce_xor(); |
| 78 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 79 |
|
| 80 |
i = __builtin_reduce_xor(iv, iv); |
| 81 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 82 |
|
| 83 |
i = __builtin_reduce_xor(i); |
| 84 |
// expected-error@-1 {{1st argument must be a vector of integer types (was 'int')}} |
| 85 |
|
| 86 |
i = __builtin_reduce_xor(v); |
| 87 |
// expected-error@-1 {{1st argument must be a vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 88 |
} |
| 89 |
|
| 90 |
void test_builtin_reduce_or(int i, float4 v, int3 iv) { |
| 91 |
struct Foo s = __builtin_reduce_or(iv); |
| 92 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 93 |
|
| 94 |
i = __builtin_reduce_or(); |
| 95 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 96 |
|
| 97 |
i = __builtin_reduce_or(iv, iv); |
| 98 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 99 |
|
| 100 |
i = __builtin_reduce_or(i); |
| 101 |
// expected-error@-1 {{1st argument must be a vector of integer types (was 'int')}} |
| 102 |
|
| 103 |
i = __builtin_reduce_or(v); |
| 104 |
// expected-error@-1 {{1st argument must be a vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 105 |
} |
| 106 |
|
| 107 |
void test_builtin_reduce_and(int i, float4 v, int3 iv) { |
| 108 |
struct Foo s = __builtin_reduce_and(iv); |
| 109 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}} |
| 110 |
|
| 111 |
i = __builtin_reduce_and(); |
| 112 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 113 |
|
| 114 |
i = __builtin_reduce_and(iv, iv); |
| 115 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 116 |
|
| 117 |
i = __builtin_reduce_and(i); |
| 118 |
// expected-error@-1 {{1st argument must be a vector of integer types (was 'int')}} |
| 119 |
|
| 120 |
i = __builtin_reduce_and(v); |
| 121 |
// expected-error@-1 {{1st argument must be a vector of integer types (was 'float4' (vector of 4 'float' values))}} |
| 122 |
} |
| 123 |
|
| 124 |
void test_builtin_reduce_maximum(int i, float4 v, int3 iv) { |
| 125 |
struct Foo s = __builtin_reduce_maximum(v); |
| 126 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 127 |
|
| 128 |
i = __builtin_reduce_maximum(v, v); |
| 129 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 130 |
|
| 131 |
i = __builtin_reduce_maximum(); |
| 132 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 133 |
|
| 134 |
i = __builtin_reduce_maximum(i); |
| 135 |
// expected-error@-1 {{1st argument must be a vector of floating-point types (was 'int')}} |
| 136 |
} |
| 137 |
|
| 138 |
void test_builtin_reduce_minimum(int i, float4 v, int3 iv) { |
| 139 |
struct Foo s = __builtin_reduce_minimum(v); |
| 140 |
// expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}} |
| 141 |
|
| 142 |
i = __builtin_reduce_minimum(v, v); |
| 143 |
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}} |
| 144 |
|
| 145 |
i = __builtin_reduce_minimum(); |
| 146 |
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}} |
| 147 |
|
| 148 |
i = __builtin_reduce_minimum(i); |
| 149 |
// expected-error@-1 {{1st argument must be a vector of floating-point types (was 'int')}} |
| 150 |
} |