1/*
2 * Copyright © 2008 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 * Author:
24 *    Zou Nan hai <nanhai.zou@intel.com>
25 *    Zhang Hua jun <huajun.zhang@intel.com>
26 *    Xing Dong sheng <dongsheng.xing@intel.com>
27 *
28 */
29mov (8) g1.0<1>UD g76.0<8,8,1>UD{align1};
30//mov (8) g2.0<1>UD g77.0<8,8,1>UD{align1};
31
32mov (16) g44.1<2>UB 0W {align1};
33mov (16) g45.1<2>UB 0W {align1};
34mov (16) g46.1<2>UB 0W {align1};
35mov (16) g47.1<2>UB 0W {align1};
36mov (16) g48.1<2>UB 0W {align1};
37mov (16) g49.1<2>UB 0W {align1};
38mov (16) g50.1<2>UB 0W {align1};
39mov (16) g51.1<2>UB 0W {align1};
40
41and.nz (1) null g1.30<1,1,1>UB 1UW {align1};       //dct_type
42(f0) jmpi field_dct;
43//jmpi field_dct;
44add (16) g28.0<1>W g3.0<16,16,1>W g28.0<16,16,2>UB {align1};
45add (16) g29.0<1>W g4.0<16,16,1>W g29.0<16,16,2>UB {align1};
46add (16) g30.0<1>W g5.0<16,16,1>W g30.0<16,16,2>UB {align1};
47add (16) g31.0<1>W g6.0<16,16,1>W g31.0<16,16,2>UB {align1};
48add (16) g32.0<1>W g7.0<16,16,1>W g32.0<16,16,2>UB {align1};
49add (16) g33.0<1>W g8.0<16,16,1>W g33.0<16,16,2>UB {align1};
50add (16) g34.0<1>W g9.0<16,16,1>W g34.0<16,16,2>UB {align1};
51add (16) g35.0<1>W g10.0<16,16,1>W g35.0<16,16,2>UB {align1};
52add (16) g36.0<1>W g11.0<16,16,1>W g36.0<16,16,2>UB {align1};
53add (16) g37.0<1>W g12.0<16,16,1>W g37.0<16,16,2>UB {align1};
54add (16) g38.0<1>W g13.0<16,16,1>W g38.0<16,16,2>UB {align1};
55add (16) g39.0<1>W g14.0<16,16,1>W g39.0<16,16,2>UB {align1};
56add (16) g40.0<1>W g15.0<16,16,1>W g40.0<16,16,2>UB {align1};
57add (16) g41.0<1>W g16.0<16,16,1>W g41.0<16,16,2>UB {align1};
58add (16) g42.0<1>W g17.0<16,16,1>W g42.0<16,16,2>UB {align1};
59add (16) g43.0<1>W g18.0<16,16,1>W g43.0<16,16,2>UB {align1};
60jmpi write_back;
61
62field_dct:
63add (16) g28.0<1>W g3.0<16,16,1>W g28.0<16,16,2>UB {align1};
64add (16) g29.0<1>W g11.0<16,16,1>W g29.0<16,16,2>UB {align1};
65add (16) g30.0<1>W g4.0<16,16,1>W g30.0<16,16,2>UB {align1};
66add (16) g31.0<1>W g12.0<16,16,1>W g31.0<16,16,2>UB {align1};
67add (16) g32.0<1>W g5.0<16,16,1>W g32.0<16,16,2>UB {align1};
68add (16) g33.0<1>W g13.0<16,16,1>W g33.0<16,16,2>UB {align1};
69add (16) g34.0<1>W g6.0<16,16,1>W g34.0<16,16,2>UB {align1};
70add (16) g35.0<1>W g14.0<16,16,1>W g35.0<16,16,2>UB {align1};
71add (16) g36.0<1>W g7.0<16,16,1>W g36.0<16,16,2>UB {align1};
72add (16) g37.0<1>W g15.0<16,16,1>W g37.0<16,16,2>UB {align1};
73add (16) g38.0<1>W g8.0<16,16,1>W g38.0<16,16,2>UB {align1};
74add (16) g39.0<1>W g16.0<16,16,1>W g39.0<16,16,2>UB {align1};
75add (16) g40.0<1>W g9.0<16,16,1>W g40.0<16,16,2>UB {align1};
76add (16) g41.0<1>W g17.0<16,16,1>W g41.0<16,16,2>UB {align1};
77add (16) g42.0<1>W g10.0<16,16,1>W g42.0<16,16,2>UB {align1};
78add (16) g43.0<1>W g18.0<16,16,1>W g43.0<16,16,2>UB {align1};
79
80write_back:
81mov (1) g1.8<1>UD 0x00F000FUD {align1};
82mov.sat (16) g28.0<2>UB g28.0<16,16,1>W {align1};
83mov.sat (16) g29.0<2>UB g29.0<16,16,1>W {align1};
84mov.sat (16) g30.0<2>UB g30.0<16,16,1>W {align1};
85mov.sat (16) g31.0<2>UB g31.0<16,16,1>W {align1};
86mov.sat (16) g32.0<2>UB g32.0<16,16,1>W {align1};
87mov.sat (16) g33.0<2>UB g33.0<16,16,1>W {align1};
88mov.sat (16) g34.0<2>UB g34.0<16,16,1>W {align1};
89mov.sat (16) g35.0<2>UB g35.0<16,16,1>W {align1};
90mov.sat (16) g36.0<2>UB g36.0<16,16,1>W {align1};
91mov.sat (16) g37.0<2>UB g37.0<16,16,1>W {align1};
92mov.sat (16) g38.0<2>UB g38.0<16,16,1>W {align1};
93mov.sat (16) g39.0<2>UB g39.0<16,16,1>W {align1};
94mov.sat (16) g40.0<2>UB g40.0<16,16,1>W {align1};
95mov.sat (16) g41.0<2>UB g41.0<16,16,1>W {align1};
96mov.sat (16) g42.0<2>UB g42.0<16,16,1>W {align1};
97mov.sat (16) g43.0<2>UB g43.0<16,16,1>W {align1};
98
99mov (16) m1.0<1>UB g28.0<16,16,2>UB {align1};
100mov (16) m1.16<1>UB g29.0<16,16,2>UB {align1};
101mov (16) m2.0<1>UB g30.0<16,16,2>UB {align1};
102mov (16) m2.16<1>UB g31.0<16,16,2>UB {align1};
103mov (16) m3.0<1>UB g32.0<16,16,2>UB {align1};
104mov (16) m3.16<1>UB g33.0<16,16,2>UB {align1};
105mov (16) m4.0<1>UB g34.0<16,16,2>UB {align1};
106mov (16) m4.16<1>UB g35.0<16,16,2>UB {align1};
107mov (16) m5.0<1>UB g36.0<16,16,2>UB {align1};
108mov (16) m5.16<1>UB g37.0<16,16,2>UB {align1};
109mov (16) m6.0<1>UB g38.0<16,16,2>UB {align1};
110mov (16) m6.16<1>UB g39.0<16,16,2>UB {align1};
111mov (16) m7.0<1>UB g40.0<16,16,2>UB {align1};
112mov (16) m7.16<1>UB g41.0<16,16,2>UB {align1};
113mov (16) m8.0<1>UB g42.0<16,16,2>UB {align1};
114mov (16) m8.16<1>UB g43.0<16,16,2>UB {align1};
115send (16) 0 acc0<1>UW g1<8,8,1>UW write(0,0,2,0) mlen 9 rlen 0 {align1};
116
117//U
118mov (1) g1.8<1>UD 0x0070007UD  { align1 };
119shr (2) g1.0<1>UD g1.0<2,2,1>UD 1D {align1};
120add (16) g44.0<1>UW g19.0<16,16,1>W g44.0<16,16,1>UW {align1};
121add (16) g45.0<1>UW g20.0<16,16,1>W g45.0<16,16,1>UW {align1};
122add (16) g46.0<1>UW g21.0<16,16,1>W g46.0<16,16,1>UW {align1};
123add (16) g47.0<1>UW g22.0<16,16,1>W g47.0<16,16,1>UW {align1};
124mov.sat (16) g44.0<2>UB g44.0<16,16,1>UW {align1};
125mov.sat (16) g45.0<2>UB g45.0<16,16,1>UW {align1};
126mov.sat (16) g46.0<2>UB g46.0<16,16,1>UW {align1};
127mov.sat (16) g47.0<2>UB g47.0<16,16,1>UW {align1};
128
129mov (16) m1.0<1>UB g44.0<16,16,2>UB {align1};
130mov (16) m1.16<1>UB g45.0<16,16,2>UB {align1};
131mov (16) m2.0<1>UB g46.0<16,16,2>UB {align1};
132mov (16) m2.16<1>UB g47.0<16,16,2>UB {align1};
133send (16) 0 acc0<1>UW g1<8,8,1>UW write(1, 0, 2, 0) mlen 3 rlen 0 { align1 };
134
135//V
136add (16) g48.0<1>UW g23.0<16,16,1>W g48.0<16,16,1>UW {align1};
137add (16) g49.0<1>UW g24.0<16,16,1>W g49.0<16,16,1>UW {align1};
138add (16) g50.0<1>UW g25.0<16,16,1>W g50.0<16,16,1>UW {align1};
139add (16) g51.0<1>UW g26.0<16,16,1>W g51.0<16,16,1>UW {align1};
140mov.sat (16) g48.0<2>UB g48.0<16,16,1>UW {align1};
141mov.sat (16) g49.0<2>UB g49.0<16,16,1>UW {align1};
142mov.sat (16) g50.0<2>UB g50.0<16,16,1>UW {align1};
143mov.sat (16) g51.0<2>UB g51.0<16,16,1>UW {align1};
144
145mov (16) m1.0<1>UB g48.0<16,16,2>UB {align1};
146mov (16) m1.16<1>UB g49.0<16,16,2>UB {align1};
147mov (16) m2.0<1>UB g50.0<16,16,2>UB {align1};
148mov (16) m2.16<1>UB g51.0<16,16,2>UB {align1};
149send (16) 0 acc0<1>UW g1<8,8,1>UW write(2, 0, 2, 0) mlen 3 rlen 0 { align1 };
150
151send (16) 0 acc0<1>UW g0<8,8,1>UW
152        thread_spawner(0, 0, 0) mlen 1 rlen 0 { align1 EOT};
153