summaryrefslogtreecommitdiff
path: root/assembler
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-01-21 14:45:46 +0000
committerDamien Lespiau <damien.lespiau@intel.com>2013-03-04 15:54:37 +0000
commitc716e2bdb43023cffb652582aeb21c9af228931e (patch)
treee56b68afa148563e7d9f90384a5e6646f38459e8 /assembler
parent8322802acba537777d8877fc7e74115df3a9bdef (diff)
assembler: Simplify get_subreg_address()
This function can only be called to resolve subreg_nr in direct mode (there is an other function for the indirect case) and it makes no sense to call it with an immediate operand. Express those facts with asserts and simplify the logic. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'assembler')
-rw-r--r--assembler/gram.y17
1 files changed, 5 insertions, 12 deletions
diff --git a/assembler/gram.y b/assembler/gram.y
index 844904dd..f608d825 100644
--- a/assembler/gram.y
+++ b/assembler/gram.y
@@ -2716,18 +2716,11 @@ static int get_subreg_address(GLuint regfile, GLuint type, GLuint subreg, GLuint
{
int unit_size = 1;
- if (address_mode == BRW_ADDRESS_DIRECT) {
- if (advanced_flag == 1) {
- if ((regfile == BRW_GENERAL_REGISTER_FILE ||
- regfile == BRW_MESSAGE_REGISTER_FILE ||
- regfile == BRW_ARCHITECTURE_REGISTER_FILE)) {
-
- unit_size = get_type_size(type);
- }
- }
- } else {
- unit_size = 1;
- }
+ assert(address_mode == BRW_ADDRESS_DIRECT);
+ assert(regfile != BRW_IMMEDIATE_VALUE);
+
+ if (advanced_flag)
+ unit_size = get_type_size(type);
return subreg * unit_size;
}