19f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/* 29f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Copyright (C) Intel Corp. 2006. All Rights Reserved. 39f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to 49f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt develop this 3D driver. 59f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 69f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Permission is hereby granted, free of charge, to any person obtaining 79f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt a copy of this software and associated documentation files (the 89f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "Software"), to deal in the Software without restriction, including 99f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt without limitation the rights to use, copy, modify, merge, publish, 109f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt distribute, sublicense, and/or sell copies of the Software, and to 119f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt permit persons to whom the Software is furnished to do so, subject to 129f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt the following conditions: 139f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 149f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt The above copyright notice and this permission notice (including the 159f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt next paragraph) shall be included in all copies or substantial 169f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt portions of the Software. 179f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 189f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 199f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 209f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 219f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 229f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 239f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 249f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 259f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 269f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt **********************************************************************/ 279f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt /* 289f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * Authors: 299f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt * Keith Whitwell <keith@tungstengraphics.com> 309f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt */ 319f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 329f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 33ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/mtypes.h" 34ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/imports.h" 359f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#include "brw_eu.h" 369f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 379f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_print_reg( struct brw_reg hwreg ) 389f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt{ 399f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt static const char *file[] = { 409f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "arf", 419f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "grf", 429f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "msg", 439f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "imm" 449f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt }; 459f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 469f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt static const char *type[] = { 479f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "ud", 489f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "d", 499f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "uw", 509f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "w", 519f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "ub", 529f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "vf", 539f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "hf", 549f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "f" 559f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt }; 569f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 57298be2b028263b2c343a707662c6fbfa18293cb2Kristian Høgsberg printf("%s%s", 58298be2b028263b2c343a707662c6fbfa18293cb2Kristian Høgsberg hwreg.abs ? "abs/" : "", 59298be2b028263b2c343a707662c6fbfa18293cb2Kristian Høgsberg hwreg.negate ? "-" : ""); 609f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 619f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt if (hwreg.file == BRW_GENERAL_REGISTER_FILE && 629f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.nr % 2 == 0 && 639f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.subnr == 0 && 649f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.vstride == BRW_VERTICAL_STRIDE_8 && 659f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.width == BRW_WIDTH_8 && 669f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.hstride == BRW_HORIZONTAL_STRIDE_1 && 679f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.type == BRW_REGISTER_TYPE_F) { 68ed8f54aa65eed2cdef79ddc110dad217d3955ec7Brian Paul /* vector register */ 69298be2b028263b2c343a707662c6fbfa18293cb2Kristian Høgsberg printf("vec%d", hwreg.nr); 709f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 719f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt else if (hwreg.file == BRW_GENERAL_REGISTER_FILE && 729f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.vstride == BRW_VERTICAL_STRIDE_0 && 739f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.width == BRW_WIDTH_1 && 749f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.hstride == BRW_HORIZONTAL_STRIDE_0 && 759f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.type == BRW_REGISTER_TYPE_F) { 76ed8f54aa65eed2cdef79ddc110dad217d3955ec7Brian Paul /* "scalar" register */ 77298be2b028263b2c343a707662c6fbfa18293cb2Kristian Høgsberg printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4); 789f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 79ed8f54aa65eed2cdef79ddc110dad217d3955ec7Brian Paul else if (hwreg.file == BRW_IMMEDIATE_VALUE) { 80298be2b028263b2c343a707662c6fbfa18293cb2Kristian Høgsberg printf("imm %f", hwreg.dw1.f); 81ed8f54aa65eed2cdef79ddc110dad217d3955ec7Brian Paul } 829f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt else { 83298be2b028263b2c343a707662c6fbfa18293cb2Kristian Høgsberg printf("%s%d.%d<%d;%d,%d>:%s", 849f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt file[hwreg.file], 859f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.nr, 869f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.subnr / type_sz(hwreg.type), 879f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.vstride ? (1<<(hwreg.vstride-1)) : 0, 889f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 1<<hwreg.width, 899f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt hwreg.hstride ? (1<<(hwreg.hstride-1)) : 0, 909f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt type[hwreg.type]); 919f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt } 929f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt} 939f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 949f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 959f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt 96