| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unreachable-code %s |
| 2 |
|
| 3 |
typedef __attribute__(( ext_vector_type(4) )) int int4; |
| 4 |
|
| 5 |
static int4 test1(void) { |
| 6 |
int4 vec, rv; |
| 7 |
|
| 8 |
// comparisons to self... |
| 9 |
return vec == vec; // expected-warning{{self-comparison always evaluates to true}} |
| 10 |
return vec != vec; // expected-warning{{self-comparison always evaluates to false}} |
| 11 |
return vec < vec; // expected-warning{{self-comparison always evaluates to false}} |
| 12 |
return vec <= vec; // expected-warning{{self-comparison always evaluates to true}} |
| 13 |
return vec > vec; // expected-warning{{self-comparison always evaluates to false}} |
| 14 |
return vec >= vec; // expected-warning{{self-comparison always evaluates to true}} |
| 15 |
} |
| 16 |
|
| 17 |
|
| 18 |
typedef __attribute__(( ext_vector_type(4) )) float float4; |
| 19 |
|
| 20 |
static int4 test2(void) { |
| 21 |
float4 vec, rv; |
| 22 |
|
| 23 |
// comparisons to self. no warning, they're floats |
| 24 |
return vec == vec; // no-warning |
| 25 |
return vec != vec; // no-warning |
| 26 |
return vec < vec; // no-warning |
| 27 |
return vec <= vec; // no-warning |
| 28 |
return vec > vec; // no-warning |
| 29 |
return vec >= vec; // no-warning |
| 30 |
} |
| 31 |
|
| 32 |
static int4 test3(void) { |
| 33 |
int4 i0, i1; |
| 34 |
|
| 35 |
return i0 > i1 ? i0 : i1; // no-error |
| 36 |
return i0 ? i0 : i1; // no-error |
| 37 |
} |
| 38 |
|
| 39 |
static float4 test4(void) { |
| 40 |
float4 f0, f1; |
| 41 |
|
| 42 |
// This would actually generate implicit casting warning |
| 43 |
// under Weverything flag but we don't really care here |
| 44 |
return f0 > f1 ? f0 : f1; // no-error |
| 45 |
return f0 ? f0 : f1; // expected-error {{used type 'float4' (vector of 4 'float' values) where floating point type is not allowed}} |
| 46 |
} |