Path: blob/21.2-virgl/src/intel/compiler/brw_eu_util.c
4550 views
/*1Copyright (C) Intel Corp. 2006. All Rights Reserved.2Intel funded Tungsten Graphics to3develop this 3D driver.45Permission is hereby granted, free of charge, to any person obtaining6a copy of this software and associated documentation files (the7"Software"), to deal in the Software without restriction, including8without limitation the rights to use, copy, modify, merge, publish,9distribute, sublicense, and/or sell copies of the Software, and to10permit persons to whom the Software is furnished to do so, subject to11the following conditions:1213The above copyright notice and this permission notice (including the14next paragraph) shall be included in all copies or substantial15portions of the Software.1617THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,18EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.20IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE21LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION22OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION23WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.2425**********************************************************************/26/*27* Authors:28* Keith Whitwell <[email protected]>29*/303132#include "brw_eu_defines.h"33#include "brw_eu.h"343536void brw_math_invert( struct brw_codegen *p,37struct brw_reg dst,38struct brw_reg src)39{40gfx4_math(p,41dst,42BRW_MATH_FUNCTION_INV,430,44src,45BRW_MATH_PRECISION_FULL);46}47484950void brw_copy4(struct brw_codegen *p,51struct brw_reg dst,52struct brw_reg src,53unsigned count)54{55unsigned i;5657dst = vec4(dst);58src = vec4(src);5960for (i = 0; i < count; i++)61{62unsigned delta = i*32;63brw_MOV(p, byte_offset(dst, delta), byte_offset(src, delta));64brw_MOV(p, byte_offset(dst, delta+16), byte_offset(src, delta+16));65}66}676869void brw_copy8(struct brw_codegen *p,70struct brw_reg dst,71struct brw_reg src,72unsigned count)73{74unsigned i;7576dst = vec8(dst);77src = vec8(src);7879for (i = 0; i < count; i++)80{81unsigned delta = i*32;82brw_MOV(p, byte_offset(dst, delta), byte_offset(src, delta));83}84}858687void brw_copy_indirect_to_indirect(struct brw_codegen *p,88struct brw_indirect dst_ptr,89struct brw_indirect src_ptr,90unsigned count)91{92unsigned i;9394for (i = 0; i < count; i++)95{96unsigned delta = i*32;97brw_MOV(p, deref_4f(dst_ptr, delta), deref_4f(src_ptr, delta));98brw_MOV(p, deref_4f(dst_ptr, delta+16), deref_4f(src_ptr, delta+16));99}100}101102103void brw_copy_from_indirect(struct brw_codegen *p,104struct brw_reg dst,105struct brw_indirect ptr,106unsigned count)107{108unsigned i;109110dst = vec4(dst);111112for (i = 0; i < count; i++)113{114unsigned delta = i*32;115brw_MOV(p, byte_offset(dst, delta), deref_4f(ptr, delta));116brw_MOV(p, byte_offset(dst, delta+16), deref_4f(ptr, delta+16));117}118}119120121