blob: 605ba6c55e33326c7dd195cdba1a13d3b95023ed [file] [log] [blame]
Douglas Gregor5d8e67e2010-06-08 19:50:34 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unreachable-code %s
2
3typedef __attribute__(( ext_vector_type(4) )) int int4;
4
5static int4 test1() {
6 int4 vec, rv;
7
8 // comparisons to self...
9 return vec == vec; // expected-warning{{self-comparison always evaluates to a constant}}
10 return vec != vec; // expected-warning{{self-comparison always evaluates to a constant}}
11 return vec < vec; // expected-warning{{self-comparison always evaluates to a constant}}
12 return vec <= vec; // expected-warning{{self-comparison always evaluates to a constant}}
13 return vec > vec; // expected-warning{{self-comparison always evaluates to a constant}}
14 return vec >= vec; // expected-warning{{self-comparison always evaluates to a constant}}
15}
16
17
18typedef __attribute__(( ext_vector_type(4) )) float float4;
19
20static int4 test2() {
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}