111
|
1 module &module:1:0:$full:$large:$default;
|
|
2
|
|
3 /* Test for different cases of packed instruction controls. */
|
|
4
|
|
5 /* { dg-do compile } */
|
|
6 /* { dg-options "-fdump-tree-gimple -fdump-tree-original" } */
|
|
7
|
|
8 prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr)
|
|
9 {
|
|
10 ld_kernarg_u64 $d0, [%input_ptr];
|
|
11 ld_global_b128 $q0, [$d0];
|
|
12
|
|
13 add_pp_u8x16 $q1, $q0, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
|
14
|
|
15 /* Broadcast the 15 as it's the lowest element (pos 0) in the resulting vector. */
|
|
16 add_ps_u8x16 $q2, $q1, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
|
17
|
|
18 /* Broadcast the lowest element of q1. */
|
|
19 add_sp_u8x16 $q3, $q1, $q2;
|
|
20
|
|
21 /* Perform a scalar computation with the lowest element of both inputs and store it to the lowest element of dest. */
|
|
22 add_ss_u8x16 $q4, $q2, $q3;
|
|
23
|
|
24 /* Saturating arithmetics variations. */
|
|
25 add_pp_sat_u8x16 $q5, $q4, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
|
26
|
|
27 /* Broadcast the 15 as it's the lowest element (pos 0) in the resulting vector. */
|
|
28 add_ps_sat_u8x16 $q6, $q5, u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
|
29
|
|
30 /* Broadcast the lowest element of q1. */
|
|
31 add_sp_sat_u8x16 $q7, $q6, $q5;
|
|
32
|
|
33 /* Perform a scalar computation with the lowest element of both inputs and store it to the lowest element of dest. */
|
|
34 add_ss_sat_u8x16 $q8, $q7, $q6;
|
|
35
|
|
36 /* Single operand vector computation. */
|
|
37 neg_p_s16x8 $q9, $q8;
|
|
38
|
|
39 ld_kernarg_u64 $d0, [%output_ptr];
|
|
40 st_global_b128 $q8, [$d0];
|
|
41
|
|
42 ret;
|
|
43 };
|
|
44
|
131
|
45 /* The b128 load is done using uint128_t*. */
|
111
|
46 /* { dg-final { scan-tree-dump "q0 = VIEW_CONVERT_EXPR<uint128_t>\\\(mem_read.\[0-9\]+\\\);" "original"} } */
|
|
47
|
|
48 /* Before arithmetics, the uint128_t is casted to a vector datatype. */
|
|
49 /* { dg-final { scan-tree-dump "<vector\\\(16\\\) unsigned char>\\\(q0\\\) \\\+ \\\{" "original"} } */
|
|
50
|
|
51 /* The u8x16 constant is generated to an array with elements in reverse order */
|
|
52 /* in comparison to the HSAIL syntax. */
|
|
53 /* { dg-final { scan-tree-dump "\\\+ { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }" "original"} } */
|
|
54
|
|
55 /* Broadcasted the constant vector's lowest element and summed it up in the next line. */
|
131
|
56 /* { dg-final { scan-tree-dump "= { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 };\[\n \]+\[a-z0-9_\]+ = \[a-z0-9_\]+ \\\+ \[a-z0-9_\]+;" "gimple"} } */
|
111
|
57
|
|
58 /* Broadcasted the registers lowest element via a VEC_PERM_EXPR that has an all-zeros mask. */
|
131
|
59 /* { dg-final { scan-tree-dump "VEC_PERM_EXPR <\[a-z0-9_\]+, \[a-z0-9_\]+, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }>;" "gimple" } } */
|
111
|
60
|
|
61 /* For the add_ss we assume performing the computation over the whole vector is cheaper than */
|
|
62 /* extracting the scalar and performing a scalar operation. This aims to stay in the vector
|
|
63 /* datapath as long as possible. */
|
131
|
64 /* { dg-final { scan-tree-dump "_\[0-9\]+ = q2 \\\+ q3;" "gimple" } } */
|
111
|
65
|
|
66 /* Insert the lowest element of the result to the lowest element of the result register. */
|
131
|
67 /* { dg-final { scan-tree-dump "= VEC_PERM_EXPR <\[a-z0-9_\]+, new_output.\[0-9\]+_\[0-9\]+, { 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }>;" "gimple" } } */
|
111
|
68
|
131
|
69 /* FIXME */
|
|
70 /* { dg-final { scan-tree-dump "q4 = \(VIEW_CONVERT_EXPR<uint128_t>\\\()?s_output.\[0-9\]+\(_\[0-9\]+\)*\\\)?;" "gimple" } } */
|
111
|
71
|
|
72 /* The saturating arithmetics are (curently) implemented using scalar builtin calls. */
|
|
73 /* { dg-final { scan-tree-dump-times "= __builtin___hsail_sat_add_u8" 64 "gimple" } } */
|
|
74
|
|
75 /* A single operand vector instr (neg.) */
|
131
|
76 /* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<vector\\\(8\\\) signed short>\\\(\(s_output.\[0-9\]+_\[0-9\]+|q8\)\\\);\[\n \]+q9 = -_\[0-9\]+;\[\n \]+" "gimple" } } */
|