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
6#pragma OPENCL EXTENSION cl_khr_fp64 : enable
7
8typedef __attribute__((ext_vector_type(4))) char char4;
9typedef __attribute__((ext_vector_type(4))) short short4;
10typedef __attribute__((ext_vector_type(4))) int int4;
11typedef __attribute__((ext_vector_type(4))) unsigned int uint4;
12typedef __attribute__((ext_vector_type(8))) int int8;
13typedef __attribute__((ext_vector_type(4))) long long4;
14typedef __attribute__((ext_vector_type(4))) float float4;
15typedef __attribute__((ext_vector_type(4))) double double4;
16
17int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)));
18
19
20void vector_fixits() {
21  printf("%v4f", (int4) 123);
22  // CHECK: printf("%v4hld", (int4) 123);
23
24  printf("%v8d", (int4) 123);
25  // CHECK: printf("%v4hld", (int4) 123);
26
27  printf("%v4d", (int8) 123);
28  // CHECK: printf("%v8hld", (int8) 123);
29
30  printf("%v4f", (int8) 123);
31  // CHECK: printf("%v8hld", (int8) 123);
32
33  printf("%v4ld", (int8) 123);
34  // CHECK: printf("%v8hld", (int8) 123);
35
36  printf("%v4hlf", (int4) 123);
37  // CHECK: printf("%v4hld", (int4) 123);
38
39  printf("%v8hld", (int4) 123);
40  // CHECK: printf("%v4hld", (int4) 123);
41
42  printf("%v4hld", (int8) 123);
43  // CHECK: printf("%v8hld", (int8) 123);
44
45  printf("%v4hlf", (int8) 123);
46  // CHECK: printf("%v8hld", (int8) 123);
47
48  printf("%v4hd", (int4) 123);
49  // CHECK: printf("%v4hld", (int4) 123);
50
51  printf("%v4hld", (short4) 123);
52  // CHECK: printf("%v4hd", (short4) 123);
53
54  printf("%v4ld", (short4) 123);
55  // CHECK: printf("%v4hd", (short4) 123);
56
57  printf("%v4hld", (long4) 123);
58  // CHECK: printf("%v4ld", (long4) 123);
59
60  printf("%v8f", (float4) 2.0f);
61  // CHECK: printf("%v4hlf", (float4) 2.0f);
62
63  printf("%v4f", (float4) 2.0f);
64  // CHECK: printf("%v4hlf", (float4) 2.0f);
65
66  printf("%v4lf", (double4) 2.0);
67  // CHECK: printf("%v4lf", (double4) 2.0);
68
69  /// FIXME: This should be fixed
70  printf("%v4hhd", (int4) 123);
71  // CHECK: printf("%v4hhd", (int4) 123);
72
73  /// FIXME: This should be fixed
74  printf("%v4hhd", (int8) 123);
75  // CHECK: printf("%v4hhd", (int8) 123);
76}
77