Damien Lespiau | 45d87d7 | 2013-02-01 13:29:48 +0000 | [diff] [blame^] | 1 | /* |
| 2 | Copyright (C) Intel Corp. 2006. All Rights Reserved. |
| 3 | Intel funded Tungsten Graphics (http://www.tungstengraphics.com) 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 <keith@tungstengraphics.com> |
| 30 | */ |
| 31 | |
| 32 | #include "brw_eu.h" |
| 33 | |
| 34 | void brw_print_reg( struct brw_reg hwreg ) |
| 35 | { |
| 36 | static const char *file[] = { |
| 37 | "arf", |
| 38 | "grf", |
| 39 | "msg", |
| 40 | "imm" |
| 41 | }; |
| 42 | |
| 43 | static const char *type[] = { |
| 44 | "ud", |
| 45 | "d", |
| 46 | "uw", |
| 47 | "w", |
| 48 | "ub", |
| 49 | "vf", |
| 50 | "hf", |
| 51 | "f" |
| 52 | }; |
| 53 | |
| 54 | printf("%s%s", |
| 55 | hwreg.abs ? "abs/" : "", |
| 56 | hwreg.negate ? "-" : ""); |
| 57 | |
| 58 | if (hwreg.file == BRW_GENERAL_REGISTER_FILE && |
| 59 | hwreg.nr % 2 == 0 && |
| 60 | hwreg.subnr == 0 && |
| 61 | hwreg.vstride == BRW_VERTICAL_STRIDE_8 && |
| 62 | hwreg.width == BRW_WIDTH_8 && |
| 63 | hwreg.hstride == BRW_HORIZONTAL_STRIDE_1 && |
| 64 | hwreg.type == BRW_REGISTER_TYPE_F) { |
| 65 | /* vector register */ |
| 66 | printf("vec%d", hwreg.nr); |
| 67 | } |
| 68 | else if (hwreg.file == BRW_GENERAL_REGISTER_FILE && |
| 69 | hwreg.vstride == BRW_VERTICAL_STRIDE_0 && |
| 70 | hwreg.width == BRW_WIDTH_1 && |
| 71 | hwreg.hstride == BRW_HORIZONTAL_STRIDE_0 && |
| 72 | hwreg.type == BRW_REGISTER_TYPE_F) { |
| 73 | /* "scalar" register */ |
| 74 | printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4); |
| 75 | } |
| 76 | else if (hwreg.file == BRW_IMMEDIATE_VALUE) { |
| 77 | printf("imm %f", hwreg.dw1.f); |
| 78 | } |
| 79 | else { |
| 80 | printf("%s%d.%d<%d;%d,%d>:%s", |
| 81 | file[hwreg.file], |
| 82 | hwreg.nr, |
| 83 | hwreg.subnr / type_sz(hwreg.type), |
| 84 | hwreg.vstride ? (1<<(hwreg.vstride-1)) : 0, |
| 85 | 1<<hwreg.width, |
| 86 | hwreg.hstride ? (1<<(hwreg.hstride-1)) : 0, |
| 87 | type[hwreg.type]); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | |
| 92 | |