[OpenACC] Treat 'delete' as a valid clause during parsing in C++ mode
[llvm-project.git] / clang / test / CodeGen / X86 / x86_64-floatvectors.c
blobef5b5334a31752f540aa0c49fb1dace9bba927b5
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | \
2 // RUN: FileCheck %s
4 // This test validates that the inreg branch generation for __builtin_va_arg
5 // does not exceed the alloca size of the type, which can cause the SROA pass to
6 // eliminate the assignment.
8 typedef struct { float x, y, z; } vec3f;
10 double Vec3FTest(__builtin_va_list ap) {
11 vec3f vec = __builtin_va_arg(ap, vec3f);
12 return vec.x + vec.y + vec.z;
14 // CHECK: define{{.*}} double @Vec3FTest
15 // CHECK: vaarg.in_reg:
16 // CHECK: [[Vec3FLoad1:%.*]] = load <2 x float>, ptr
17 // CHECK: [[Vec3FGEP1:%.*]] = getelementptr inbounds nuw { <2 x float>, float }, ptr {{%.*}}, i32 0, i32 0
18 // CHECK: store <2 x float> [[Vec3FLoad1]], ptr [[Vec3FGEP1]]
19 // CHECK: [[Vec3FLoad2:%.*]] = load float, ptr
20 // CHECK: [[Vec3FGEP2:%.*]] = getelementptr inbounds nuw { <2 x float>, float }, ptr {{%.*}}, i32 0, i32 1
21 // CHECK: store float [[Vec3FLoad2]], ptr [[Vec3FGEP2]]
22 // CHECK: vaarg.in_mem:
25 typedef struct { float x, y, z, q; } vec4f;
27 double Vec4FTest(__builtin_va_list ap) {
28 vec4f vec = __builtin_va_arg(ap, vec4f);
29 return vec.x + vec.y + vec.z + vec.q;
31 // CHECK: define{{.*}} double @Vec4FTest
32 // CHECK: vaarg.in_reg:
33 // CHECK: [[Vec4FLoad1:%.*]] = load <2 x float>, ptr
34 // CHECK: [[Vec4FGEP1:%.*]] = getelementptr inbounds nuw { <2 x float>, <2 x float> }, ptr {{%.*}}, i32 0, i32 0
35 // CHECK: store <2 x float> [[Vec4FLoad1]], ptr [[Vec4FGEP1]]
36 // CHECK: [[Vec4FLoad2:%.*]] = load <2 x float>, ptr
37 // CHECK: [[Vec4FGEP2:%.*]] = getelementptr inbounds nuw { <2 x float>, <2 x float> }, ptr {{%.*}}, i32 0, i32 1
38 // CHECK: store <2 x float> [[Vec4FLoad2]], ptr [[Vec4FGEP2]]
39 // CHECK: vaarg.in_mem:
41 typedef struct { double x, y; } vec2d;
43 double Vec2DTest(__builtin_va_list ap) {
44 vec2d vec = __builtin_va_arg(ap, vec2d);
45 return vec.x + vec.y;
47 // CHECK: define{{.*}} double @Vec2DTest
48 // CHECK: vaarg.in_reg:
49 // CHECK: [[Vec2DLoad1:%.*]] = load double, ptr
50 // CHECK: [[Vec2DGEP1:%.*]] = getelementptr inbounds nuw { double, double }, ptr {{%.*}}, i32 0, i32 0
51 // CHECK: store double [[Vec2DLoad1]], ptr [[Vec2DGEP1]]
52 // CHECK: [[Vec2DLoad2:%.*]] = load double, ptr
53 // CHECK: [[Vec2DGEP2:%.*]] = getelementptr inbounds nuw { double, double }, ptr {{%.*}}, i32 0, i32 1
54 // CHECK: store double [[Vec2DLoad2]], ptr [[Vec2DGEP2]]
55 // CHECK: vaarg.in_mem:
57 typedef struct {
58 float x, y;
59 double z;
60 } vec2f1d;
62 double Vec2F1DTest(__builtin_va_list ap) {
63 vec2f1d vec = __builtin_va_arg(ap, vec2f1d);
64 return vec.x + vec.y + vec.z;
66 // CHECK: define{{.*}} double @Vec2F1DTest
67 // CHECK: vaarg.in_reg:
68 // CHECK: [[Vec2F1DLoad1:%.*]] = load <2 x float>, ptr
69 // CHECK: [[Vec2F1DGEP1:%.*]] = getelementptr inbounds nuw { <2 x float>, double }, ptr {{%.*}}, i32 0, i32 0
70 // CHECK: store <2 x float> [[Vec2F1DLoad1]], ptr [[Vec2F1DGEP1]]
71 // CHECK: [[Vec2F1DLoad2:%.*]] = load double, ptr
72 // CHECK: [[Vec2F1DGEP2:%.*]] = getelementptr inbounds nuw { <2 x float>, double }, ptr {{%.*}}, i32 0, i32 1
73 // CHECK: store double [[Vec2F1DLoad2]], ptr [[Vec2F1DGEP2]]
74 // CHECK: vaarg.in_mem:
76 typedef struct {
77 double x;
78 float y, z;
79 } vec1d2f;
81 double Vec1D2FTest(__builtin_va_list ap) {
82 vec1d2f vec = __builtin_va_arg(ap, vec1d2f);
83 return vec.x + vec.y + vec.z;
85 // CHECK: define{{.*}} double @Vec1D2FTest
86 // CHECK: vaarg.in_reg:
87 // CHECK: [[Vec1D2FLoad1:%.*]] = load double, ptr
88 // CHECK: [[Vec1D2FGEP1:%.*]] = getelementptr inbounds nuw { double, <2 x float> }, ptr {{%.*}}, i32 0, i32 0
89 // CHECK: store double [[Vec1D2FLoad1]], ptr [[Vec1D2FGEP1]]
90 // CHECK: [[Vec1D2FLoad2:%.*]] = load <2 x float>, ptr
91 // CHECK: [[Vec1D2FGEP2:%.*]] = getelementptr inbounds nuw { double, <2 x float> }, ptr {{%.*}}, i32 0, i32 1
92 // CHECK: store <2 x float> [[Vec1D2FLoad2]], ptr [[Vec1D2FGEP2]]
93 // CHECK: vaarg.in_mem:
95 typedef struct {
96 float x;
97 double z;
98 } vec1f1d;
100 double Vec1F1DTest(__builtin_va_list ap) {
101 vec1f1d vec = __builtin_va_arg(ap, vec1f1d);
102 return vec.x + vec.z;
104 // CHECK: define{{.*}} double @Vec1F1DTest
105 // CHECK: vaarg.in_reg:
106 // CHECK: [[Vec1F1DLoad1:%.*]] = load float, ptr
107 // CHECK: [[Vec1F1DGEP1:%.*]] = getelementptr inbounds nuw { float, double }, ptr {{%.*}}, i32 0, i32 0
108 // CHECK: store float [[Vec1F1DLoad1]], ptr [[Vec1F1DGEP1]]
109 // CHECK: [[Vec1F1DLoad2:%.*]] = load double, ptr
110 // CHECK: [[Vec1F1DGEP2:%.*]] = getelementptr inbounds nuw { float, double }, ptr {{%.*}}, i32 0, i32 1
111 // CHECK: store double [[Vec1F1DLoad2]], ptr [[Vec1F1DGEP2]]
112 // CHECK: vaarg.in_mem:
114 typedef struct {
115 double x;
116 float z;
117 } vec1d1f;
119 double Vec1D1FTest(__builtin_va_list ap) {
120 vec1d1f vec = __builtin_va_arg(ap, vec1d1f);
121 return vec.x + vec.z;
123 // CHECK: define{{.*}} double @Vec1D1FTest
124 // CHECK: vaarg.in_reg:
125 // CHECK: [[Vec1D1FLoad1:%.*]] = load double, ptr
126 // CHECK: [[Vec1D1FGEP1:%.*]] = getelementptr inbounds nuw { double, float }, ptr {{%.*}}, i32 0, i32 0
127 // CHECK: store double [[Vec1D1FLoad1]], ptr [[Vec1D1FGEP1]]
128 // CHECK: [[Vec1D1FLoad2:%.*]] = load float, ptr
129 // CHECK: [[Vec1D1FGEP2:%.*]] = getelementptr inbounds nuw { double, float }, ptr {{%.*}}, i32 0, i32 1
130 // CHECK: store float [[Vec1D1FLoad2]], ptr [[Vec1D1FGEP2]]
131 // CHECK: vaarg.in_mem: