• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
3  Intel funded Tungsten Graphics to
4  develop this 3D driver.
5 
6  Permission is hereby granted, free of charge, to any person obtaining
7  a copy of this software and associated documentation files (the
8  "Software"), to deal in the Software without restriction, including
9  without limitation the rights to use, copy, modify, merge, publish,
10  distribute, sublicense, and/or sell copies of the Software, and to
11  permit persons to whom the Software is furnished to do so, subject to
12  the following conditions:
13 
14  The above copyright notice and this permission notice (including the
15  next paragraph) shall be included in all copies or substantial
16  portions of the Software.
17 
18  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 
26  **********************************************************************/
27  /*
28   * Authors:
29   *   Keith Whitwell <keithw@vmware.com>
30   */
31 
32 
33 #include "brw_eu_defines.h"
34 #include "brw_eu.h"
35 
36 
brw_math_invert(struct brw_codegen * p,struct brw_reg dst,struct brw_reg src)37 void brw_math_invert( struct brw_codegen *p,
38 			     struct brw_reg dst,
39 			     struct brw_reg src)
40 {
41    gen4_math(p,
42 	     dst,
43 	     BRW_MATH_FUNCTION_INV,
44 	     0,
45 	     src,
46 	     BRW_MATH_PRECISION_FULL);
47 }
48 
49 
50 
brw_copy4(struct brw_codegen * p,struct brw_reg dst,struct brw_reg src,unsigned count)51 void brw_copy4(struct brw_codegen *p,
52 	       struct brw_reg dst,
53 	       struct brw_reg src,
54 	       unsigned count)
55 {
56    unsigned i;
57 
58    dst = vec4(dst);
59    src = vec4(src);
60 
61    for (i = 0; i < count; i++)
62    {
63       unsigned delta = i*32;
64       brw_MOV(p, byte_offset(dst, delta),    byte_offset(src, delta));
65       brw_MOV(p, byte_offset(dst, delta+16), byte_offset(src, delta+16));
66    }
67 }
68 
69 
brw_copy8(struct brw_codegen * p,struct brw_reg dst,struct brw_reg src,unsigned count)70 void brw_copy8(struct brw_codegen *p,
71 	       struct brw_reg dst,
72 	       struct brw_reg src,
73 	       unsigned count)
74 {
75    unsigned i;
76 
77    dst = vec8(dst);
78    src = vec8(src);
79 
80    for (i = 0; i < count; i++)
81    {
82       unsigned delta = i*32;
83       brw_MOV(p, byte_offset(dst, delta),    byte_offset(src, delta));
84    }
85 }
86 
87 
brw_copy_indirect_to_indirect(struct brw_codegen * p,struct brw_indirect dst_ptr,struct brw_indirect src_ptr,unsigned count)88 void brw_copy_indirect_to_indirect(struct brw_codegen *p,
89 				   struct brw_indirect dst_ptr,
90 				   struct brw_indirect src_ptr,
91 				   unsigned count)
92 {
93    unsigned i;
94 
95    for (i = 0; i < count; i++)
96    {
97       unsigned delta = i*32;
98       brw_MOV(p, deref_4f(dst_ptr, delta),    deref_4f(src_ptr, delta));
99       brw_MOV(p, deref_4f(dst_ptr, delta+16), deref_4f(src_ptr, delta+16));
100    }
101 }
102 
103 
brw_copy_from_indirect(struct brw_codegen * p,struct brw_reg dst,struct brw_indirect ptr,unsigned count)104 void brw_copy_from_indirect(struct brw_codegen *p,
105 			    struct brw_reg dst,
106 			    struct brw_indirect ptr,
107 			    unsigned count)
108 {
109    unsigned i;
110 
111    dst = vec4(dst);
112 
113    for (i = 0; i < count; i++)
114    {
115       unsigned delta = i*32;
116       brw_MOV(p, byte_offset(dst, delta),    deref_4f(ptr, delta));
117       brw_MOV(p, byte_offset(dst, delta+16), deref_4f(ptr, delta+16));
118    }
119 }
120