Home | History | Annotate | Download | only in Sema
      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() {
      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 
     18 typedef __attribute__(( ext_vector_type(4) )) float float4;
     19 
     20 static 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 }
     31