ext_vector_comparisons.c 1.1 KB

123456789101112131415161718192021222324252627282930
  1. // RUN: %clang_cc1 -fsyntax-only -verify -Wno-unreachable-code %s
  2. typedef __attribute__(( ext_vector_type(4) )) int int4;
  3. static int4 test1() {
  4. int4 vec, rv;
  5. // comparisons to self...
  6. return vec == vec; // expected-warning{{self-comparison always evaluates to a constant}}
  7. return vec != vec; // expected-warning{{self-comparison always evaluates to a constant}}
  8. return vec < vec; // expected-warning{{self-comparison always evaluates to a constant}}
  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. }
  13. typedef __attribute__(( ext_vector_type(4) )) float float4;
  14. static int4 test2() {
  15. float4 vec, rv;
  16. // comparisons to self. no warning, they're floats
  17. return vec == vec; // no-warning
  18. return vec != vec; // no-warning
  19. return vec < vec; // no-warning
  20. return vec <= vec; // no-warning
  21. return vec > vec; // no-warning
  22. return vec >= vec; // no-warning
  23. }