1module &module:1:0:$full:$large:$default;
2
3/* A test for vector operands. */
4
5/* { dg-do compile } */
6/* { dg-options "-fdump-tree-original" } */
7
8prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
9{
10        ld_kernarg_u64 $d0, [%input_ptr];
11	ld_v2_global_f32 ($s0, $s1), [$d0];
12	ld_v3_global_f32 ($s2, $s3, $s4), [$d0 + 8];
13	ld_v4_global_f32 ($s5, $s6, $s7, $s8), [$d0 + 20];
14
15	add_f32 $s9, $s0, $s1;
16	combine_v2_b64_b32 $d2, ($s1, $s0);
17	combine_v2_b64_b32 $d3, ($s2, $s3);
18
19	add_pp_f32x2 $d4, $d2, $d3;
20
21	expand_v2_b32_b64 ($s0, $s3), $d4;
22
23        ld_kernarg_u64 $d1, [%output_ptr];
24        st_v2_global_f32 ($s0, $s1), [$d1];
25        st_v3_global_f32 ($s2, $s3, $s4), [$d1 + 8];
26        st_v4_global_f32 ($s5, $s6, $s7, $s8), [$d1 + 20];
27
28        ret;
29};
30
31/* The v2 load is done via casting to a vector datatype ptr. */
32/* { dg-final { scan-tree-dump " = MEM\\\[\\\(vector\\\(2\\\) <float:32> \\\*\\\)" "original"} } */
33
34/* The v3 load is scalarized (at the moment) due to gcc requiring 2's exponent wide vectors. */
35/* { dg-final { scan-tree-dump "s0 = .*BIT_FIELD_REF <mem_read.\[0-9\]+, 32, 0>\\\)?;\[\n ]+s1 = .*BIT_FIELD_REF <mem_read.\[0-9\]+, 32, 32>\\\)?;" "original"} } */
36
37/* The v4 load is done via casting to a vector datatype ptr. */
38/* { dg-final { scan-tree-dump " = MEM\\\[\\\(vector\\\(4\\\) <float:32> \\\*\\\)" "original"} } */
39
40/* The combines are generated to vector constructors. */
41/* { dg-final { scan-tree-dump "{.*s1\\\)?, .*s0\\\)?}" "original"} } */
42/* { dg-final { scan-tree-dump "{.*s2\\\)?, .*s3\\\)?}" "original"} } */
43
44/* Expands to BIT_FIELD_REFs. */
45/* { dg-final { scan-tree-dump "s0 = \(VIEW_CONVERT_EXPR.*\\\(\)?BIT_FIELD_REF <d4, 32, 0>\\\)?;" "original"} } */
46/* { dg-final { scan-tree-dump "s3 = \(VIEW_CONVERT_EXPR.*\\\(\)?BIT_FIELD_REF <d4, 32, 32>\\\)?;" "original"} } */
47
48/* The v1 store is done via casting to a vector datatype ptr and constructing a vector from the inputs. */
49/* { dg-final { scan-tree-dump "MEM\\\[\\\(vector\\\(2\\\) <float:32> \\\*\\\)\\\(<float:32> \\\*\\\) d1\\\] = " "original"} } */
50
51/* The v3 store is scalarized (at the moment) due to gcc requiring 2's exponent wide vectors. */
52/* { dg-final { scan-tree-dump "\\\*\\\(<float:32> \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 8\\\) \\\+ 0 = VIEW_CONVERT_EXPR<<float:32>>\\\(s2\\\);" "original"} } */
53/* { dg-final { scan-tree-dump "\\\*\\\(<float:32> \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 8\\\) \\\+ 4 = VIEW_CONVERT_EXPR<<float:32>>\\\(s3\\\);" "original"} } */
54/* { dg-final { scan-tree-dump "\\\*\\\(<float:32> \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 8\\\) \\\+ 8 = VIEW_CONVERT_EXPR<<float:32>>\\\(s4\\\);" "original"} } */
55
56/* The v4 store is done via casting to a vector datatype and constructing a vector from the inputs. */
57/* { dg-final { scan-tree-dump "MEM\\\[\\\(vector\\\(4\\\) <float:32> \\\*\\\)\\\(<float:32> \\\*\\\) \\\(\\\(sizetype\\\) d1 \\\+ 20\\\)\\\] = {VIEW_CONVERT_EXPR<<float:32>>\\\(s5\\\), VIEW_CONVERT_EXPR<<float:32>>\\\(s6\\\), VIEW_CONVERT_EXPR<<float:32>>\\\(s7\\\), VIEW_CONVERT_EXPR<<float:32>>\\\(s8\\\)};" "original"} } */
58