Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / ext_vector_comparisons.c
blob406c1c4cb8da031e3d90002bc7e5f9cae40cb09f
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-unreachable-code %s
3 typedef __attribute__(( ext_vector_type(4) )) int int4;
5 static int4 test1(void) {
6 int4 vec, rv;
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}}
18 typedef __attribute__(( ext_vector_type(4) )) float float4;
20 static int4 test2(void) {
21 float4 vec, rv;
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
32 static int4 test3(void) {
33 int4 i0, i1;
35 return i0 > i1 ? i0 : i1; // no-error
36 return i0 ? i0 : i1; // no-error
39 static float4 test4(void) {
40 float4 f0, f1;
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}}