1 // RUN: %clang_cc1 -Wno-error=vec-elem-size -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -Wno-error=vec-elem-size -DEXT -emit-llvm %s -o - | FileCheck %s
5 typedef __attribute__((__ext_vector_type__(8))) char vector_char8
;
6 typedef __attribute__((__ext_vector_type__(8))) short vector_short8
;
7 typedef __attribute__((__ext_vector_type__(8))) int vector_int8
;
8 typedef __attribute__((__ext_vector_type__(8))) unsigned char vector_uchar8
;
9 typedef __attribute__((__ext_vector_type__(8))) unsigned short vector_ushort8
;
10 typedef __attribute__((__ext_vector_type__(8))) unsigned int vector_uint8
;
11 typedef __attribute__((__ext_vector_type__(4))) char vector_char4
;
12 typedef __attribute__((__ext_vector_type__(4))) short vector_short4
;
13 typedef __attribute__((__ext_vector_type__(4))) int vector_int4
;
14 typedef __attribute__((__ext_vector_type__(4))) unsigned char vector_uchar4
;
15 typedef __attribute__((__ext_vector_type__(4))) unsigned short vector_ushort4
;
16 typedef __attribute__((__ext_vector_type__(4))) unsigned int vector_uint4
;
18 typedef __attribute__((vector_size(8))) char vector_char8
;
19 typedef __attribute__((vector_size(16))) short vector_short8
;
20 typedef __attribute__((vector_size(32))) int vector_int8
;
21 typedef __attribute__((vector_size(8))) unsigned char vector_uchar8
;
22 typedef __attribute__((vector_size(16))) unsigned short vector_ushort8
;
23 typedef __attribute__((vector_size(32))) unsigned int vector_uint8
;
24 typedef __attribute__((vector_size(4))) char vector_char4
;
25 typedef __attribute__((vector_size(4))) short vector_short4
;
26 typedef __attribute__((vector_size(16))) int vector_int4
;
27 typedef __attribute__((vector_size(4))) unsigned char vector_uchar4
;
28 typedef __attribute__((vector_size(8))) unsigned short vector_ushort4
;
29 typedef __attribute__((vector_size(16))) unsigned int vector_uint4
;
53 // CHECK: [[t0:%.+]] = load <8 x i8>, ptr {{@.+}},
54 // CHECK: shl <8 x i8> splat (i8 1), [[t0]]
56 // CHECK: [[t1:%.+]] = load <8 x i8>, ptr {{@.+}},
57 // CHECK: shl <8 x i8> splat (i8 1), [[t1]]
59 // CHECK: [[t2:%.+]] = load <8 x i32>, ptr {{@.+}},
60 // CHECK: shl <8 x i32> splat (i32 1), [[t2]]
62 // CHECK: [[t3:%.+]] = load <8 x i32>, ptr {{@.+}},
63 // CHECK: shl <8 x i32> splat (i32 1), [[t3]]
65 // CHECK: [[t4:%.+]] = load <8 x i16>, ptr {{@.+}},
66 // CHECK: shl <8 x i16> splat (i16 1), [[t4]]
68 // CHECK: [[t5:%.+]] = load <8 x i16>, ptr {{@.+}},
69 // CHECK: shl <8 x i16> splat (i16 1), [[t5]]
72 // CHECK: [[t6:%.+]] = load i8, ptr @c,
73 // CHECK: [[splat_splatinsert:%.+]] = insertelement <8 x i8> poison, i8 [[t6]], i64 0
74 // CHECK: [[splat_splat:%.+]] = shufflevector <8 x i8> [[splat_splatinsert]], <8 x i8> poison, <8 x i32> zeroinitializer
75 // CHECK: [[t7:%.+]] = load <8 x i8>, ptr {{@.+}},
76 // CHECK: shl <8 x i8> [[splat_splat]], [[t7]]
78 // CHECK: [[t8:%.+]] = load i32, ptr @i,
79 // CHECK: [[tconv:%.+]] = trunc i32 [[t8]] to i8
80 // CHECK: [[splat_splatinsert7:%.+]] = insertelement <8 x i8> poison, i8 [[tconv]], i64 0
81 // CHECK: [[splat_splat8:%.+]] = shufflevector <8 x i8> [[splat_splatinsert7]], <8 x i8> poison, <8 x i32> zeroinitializer
82 // CHECK: [[t9:%.+]] = load <8 x i8>, ptr {{@.+}},
83 // CHECK: shl <8 x i8> [[splat_splat8]], [[t9]]
85 // CHECK: [[t10:%.+]] = load i8, ptr @uc,
86 // CHECK: [[conv10:%.+]] = zext i8 [[t10]] to i32
87 // CHECK: [[splat_splatinsert11:%.+]] = insertelement <8 x i32> poison, i32 [[conv10]], i64 0
88 // CHECK: [[splat_splat12:%.+]] = shufflevector <8 x i32> [[splat_splatinsert11]], <8 x i32> poison, <8 x i32> zeroinitializer
89 // CHECK: [[t11:%.+]] = load <8 x i32>, ptr {{@.+}},
90 // CHECK: shl <8 x i32> [[splat_splat12]], [[t11]]
92 // CHECK: [[t12:%.+]] = load i16, ptr @us,
93 // CHECK: [[conv14:%.+]] = zext i16 [[t12]] to i32
94 // CHECK: [[splat_splatinsert15:%.+]] = insertelement <8 x i32> poison, i32 [[conv14]], i64 0
95 // CHECK: [[splat_splat16:%.+]] = shufflevector <8 x i32> [[splat_splatinsert15]], <8 x i32> poison, <8 x i32> zeroinitializer
96 // CHECK: [[t13:%.+]] = load <8 x i32>, ptr {{@.+}},
97 // CHECK: shl <8 x i32> [[splat_splat16]], [[t13]]
99 // CHECK: [[t14:%.+]] = load i32, ptr @ui,
100 // CHECK: [[conv18:%.+]] = trunc i32 [[t14]] to i16
101 // CHECK: [[splat_splatinsert19:%.+]] = insertelement <8 x i16> poison, i16 [[conv18]], i64 0
102 // CHECK: [[splat_splat20:%.+]] = shufflevector <8 x i16> [[splat_splatinsert19]], <8 x i16> poison, <8 x i32> zeroinitializer
103 // CHECK: [[t15:%.+]] = load <8 x i16>, ptr {{@.+}},
104 // CHECK: shl <8 x i16> [[splat_splat20]], [[t15]]
106 // CHECK: [[t16:%.+]] = load <8 x i16>, ptr {{@.+}},
107 // CHECK: [[shl22:%.+]] = shl <8 x i16> splat (i16 1), [[t16]]
110 // CHECK: [[t17:%.+]] = load <8 x i8>, ptr {{@.+}},
111 // CHECK: [[t18:%.+]] = load <8 x i8>, ptr {{@.+}},
112 // CHECK: shl <8 x i8> [[t17]], [[t18]]
114 // CHECK: [[t19:%.+]] = load <8 x i32>, ptr {{@.+}},
115 // CHECK: [[t20:%.+]] = load <8 x i8>, ptr {{@.+}},
116 // CHECK: [[shprom:%.+]] = zext <8 x i8> [[t20]] to <8 x i32>
117 // CHECK: shl <8 x i32> [[t19]], [[shprom]]
119 // CHECK: [[t21:%.+]] = load <8 x i8>, ptr {{@.+}},
120 // CHECK: [[t22:%.+]] = load <8 x i32>, ptr {{@.+}},
121 // CHECK: [[sh_prom25:%.+]] = trunc <8 x i32> [[t22]] to <8 x i8>
122 // CHECK: shl <8 x i8> [[t21]], [[sh_prom25]]
124 // CHECK: [[t23:%.+]] = load <8 x i16>, ptr {{@.+}},
125 // CHECK: [[t24:%.+]] = load <8 x i32>, ptr {{@.+}},
126 // CHECK: [[sh_prom27:%.+]] = trunc <8 x i32> [[t24]] to <8 x i16>
127 // CHECK: shl <8 x i16> [[t23]], [[sh_prom27]]
129 // CHECK: [[t25:%.+]] = load <8 x i32>, ptr {{@.+}},
130 // CHECK: [[t26:%.+]] = load <8 x i16>, ptr {{@.+}},
131 // CHECK: [[sh_prom29:%.+]] = zext <8 x i16> [[t26]] to <8 x i32>
132 // CHECK: shl <8 x i32> [[t25]], [[sh_prom29]]
135 // CHECK: [[t27:%.+]] = load i16, ptr @s,
136 // CHECK: [[conv40:%.+]] = sext i16 [[t27]] to i32
137 // CHECK: [[splat_splatinsert41:%.+]] = insertelement <8 x i32> poison, i32 [[conv40]], i64 0
138 // CHECK: [[splat_splat42:%.+]] = shufflevector <8 x i32> [[splat_splatinsert41]], <8 x i32> poison, <8 x i32> zeroinitializer
139 // CHECK: [[t28:%.+]] = load <8 x i32>, ptr {{@.+}},
140 // CHECK: shl <8 x i32> [[t28]], [[splat_splat42]]
142 // CHECK: [[t29:%.+]] = load i16, ptr @us,
143 // CHECK: [[conv44:%.+]] = zext i16 [[t29]] to i32
144 // CHECK: [[splat_splatinsert45:%.+]] = insertelement <8 x i32> poison, i32 [[conv44]], i64 0
145 // CHECK: [[splat_splat46:%.+]] = shufflevector <8 x i32> [[splat_splatinsert45]], <8 x i32> poison, <8 x i32> zeroinitializer
146 // CHECK: [[t30:%.+]] = load <8 x i32>, ptr {{@.+}},
147 // CHECK: shl <8 x i32> [[t30]], [[splat_splat46]]
149 // CHECK: [[t31:%.+]] = load i32, ptr @i,
150 // CHECK: [[splat_splatinsert48:%.+]] = insertelement <8 x i32> poison, i32 [[t31]], i64 0
151 // CHECK: [[splat_splat49:%.+]] = shufflevector <8 x i32> [[splat_splatinsert48]], <8 x i32> poison, <8 x i32> zeroinitializer
152 // CHECK: [[t32:%.+]] = load <8 x i16>, ptr {{@.+}},
153 // CHECK: [[sh_prom50:%.+]] = trunc <8 x i32> [[splat_splat49]] to <8 x i16>
154 // CHECK: shl <8 x i16> [[t32]], [[sh_prom50]]
156 // CHECK: [[t33:%.+]] = load i32, ptr @ui,
157 // CHECK: [[splat_splatinsert52:%.+]] = insertelement <8 x i32> poison, i32 [[t33]], i64 0
158 // CHECK: [[splat_splat53:%.+]] = shufflevector <8 x i32> [[splat_splatinsert52]], <8 x i32> poison, <8 x i32> zeroinitializer
159 // CHECK: [[t34:%.+]] = load <8 x i16>, ptr {{@.+}},
160 // CHECK: [[sh_prom54:%.+]] = trunc <8 x i32> [[splat_splat53]] to <8 x i16>
161 // CHECK: shl <8 x i16> [[t34]], [[sh_prom54]]