annotate gcc/testsuite/brig.dg/test/gimple/packed.hsail @ 131:84e7813d76e9

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