format-strings-fixit.cl 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // RUN: cp %s %t
  2. // RUN: %clang_cc1 -cl-std=CL1.2 -pedantic -Wall -fixit %t -triple x86_64-unknown-linux-gnu
  3. // RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -pedantic -Wall -Werror %t -triple x86_64-unknown-linux-gnu
  4. // RUN: %clang_cc1 -cl-std=CL1.2 -E -o - %t -triple x86_64-unknown-linux-gnu | FileCheck %s
  5. #pragma OPENCL EXTENSION cl_khr_fp64 : enable
  6. typedef __attribute__((ext_vector_type(4))) char char4;
  7. typedef __attribute__((ext_vector_type(4))) short short4;
  8. typedef __attribute__((ext_vector_type(4))) int int4;
  9. typedef __attribute__((ext_vector_type(4))) unsigned int uint4;
  10. typedef __attribute__((ext_vector_type(8))) int int8;
  11. typedef __attribute__((ext_vector_type(4))) long long4;
  12. typedef __attribute__((ext_vector_type(4))) float float4;
  13. typedef __attribute__((ext_vector_type(4))) double double4;
  14. int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)));
  15. void vector_fixits() {
  16. printf("%v4f", (int4) 123);
  17. // CHECK: printf("%v4hld", (int4) 123);
  18. printf("%v8d", (int4) 123);
  19. // CHECK: printf("%v4hld", (int4) 123);
  20. printf("%v4d", (int8) 123);
  21. // CHECK: printf("%v8hld", (int8) 123);
  22. printf("%v4f", (int8) 123);
  23. // CHECK: printf("%v8hld", (int8) 123);
  24. printf("%v4ld", (int8) 123);
  25. // CHECK: printf("%v8hld", (int8) 123);
  26. printf("%v4hlf", (int4) 123);
  27. // CHECK: printf("%v4hld", (int4) 123);
  28. printf("%v8hld", (int4) 123);
  29. // CHECK: printf("%v4hld", (int4) 123);
  30. printf("%v4hld", (int8) 123);
  31. // CHECK: printf("%v8hld", (int8) 123);
  32. printf("%v4hlf", (int8) 123);
  33. // CHECK: printf("%v8hld", (int8) 123);
  34. printf("%v4hd", (int4) 123);
  35. // CHECK: printf("%v4hld", (int4) 123);
  36. printf("%v4hld", (short4) 123);
  37. // CHECK: printf("%v4hd", (short4) 123);
  38. printf("%v4ld", (short4) 123);
  39. // CHECK: printf("%v4hd", (short4) 123);
  40. printf("%v4hld", (long4) 123);
  41. // CHECK: printf("%v4ld", (long4) 123);
  42. printf("%v8f", (float4) 2.0f);
  43. // CHECK: printf("%v4hlf", (float4) 2.0f);
  44. printf("%v4f", (float4) 2.0f);
  45. // CHECK: printf("%v4hlf", (float4) 2.0f);
  46. printf("%v4lf", (double4) 2.0);
  47. // CHECK: printf("%v4lf", (double4) 2.0);
  48. /// FIXME: This should be fixed
  49. printf("%v4hhd", (int4) 123);
  50. // CHECK: printf("%v4hhd", (int4) 123);
  51. /// FIXME: This should be fixed
  52. printf("%v4hhd", (int8) 123);
  53. // CHECK: printf("%v4hhd", (int8) 123);
  54. }