add support for math instruction on Sandybridge
authorXiang, Haihao <haihao.xiang@intel.com>
Wed, 27 Oct 2010 01:42:56 +0000 (09:42 +0800)
committerDamien Lespiau <damien.lespiau@intel.com>
Mon, 4 Mar 2013 15:54:28 +0000 (15:54 +0000)
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
assembler/src/brw_defines.h
assembler/src/gram.y
assembler/src/lex.l

index 7e8650a..1bff9c4 100644 (file)
 #define BRW_OPCODE_POP        47
 #define BRW_OPCODE_WAIT       48
 #define BRW_OPCODE_SEND       49
+#define BRW_OPCODE_MATH       56
 #define BRW_OPCODE_ADD        64
 #define BRW_OPCODE_MUL        65
 #define BRW_OPCODE_AVG        66
index d50e6fa..18fc394 100644 (file)
@@ -104,6 +104,7 @@ void set_direct_src_operand(struct src_operand *src, struct direct_reg *reg,
 %token <integer> AVG ADD SEL AND OR XOR SHR SHL ASR CMP CMPN PLN
 %token <integer> SEND NOP JMPI IF IFF WHILE ELSE BREAK CONT HALT MSAVE
 %token <integer> PUSH MREST POP WAIT DO ENDIF ILLEGAL
+%token <integer> MATH_INST
 
 %token NULL_TOKEN MATH SAMPLER GATEWAY READ WRITE URB THREAD_SPAWNER
 
@@ -128,6 +129,7 @@ void set_direct_src_operand(struct src_operand *src, struct direct_reg *reg,
 %type <instruction> breakinstruction syncinstruction specialinstruction
 %type <instruction> msgtarget
 %type <instruction> instoptions instoption_list predicate
+%type <instruction> mathinstruction
 %type <string> label
 %type <program> instrseq
 %type <integer> instoption
@@ -235,6 +237,7 @@ instruction:        unaryinstruction
                | breakinstruction
                | syncinstruction
                | specialinstruction
+               | mathinstruction
 ;
 
 unaryinstruction:
@@ -483,6 +486,23 @@ elseinstruction: ELSE relativelocation
                }
 ;
 
+mathinstruction: predicate MATH_INST execsize dst src srcimm math_function instoptions
+               {
+                 bzero(&$$, sizeof($$));
+                 $$.header.opcode = $2;
+                 $$.header.sfid_destreg__conditionalmod = $7;
+                 $$.header.execution_size = $3;
+                 set_instruction_options(&$$, &$8);
+                 set_instruction_predicate(&$$, &$1);
+                 if (set_instruction_dest(&$$, &$4) != 0)
+                   YYERROR;
+                 if (set_instruction_src0(&$$, &$5) != 0)
+                   YYERROR;
+                 if (set_instruction_src1(&$$, &$6) != 0)
+                   YYERROR;
+               }
+;
+
 breakinstruction: breakop locationstackcontrol
                {
                  struct direct_reg dst;
index 482d68e..23b5f4b 100644 (file)
@@ -8,7 +8,7 @@
 #include "string.h"
 int saved_state = 0;
 extern char *input_filename;
-
+extern long int gen_level;
 %}
 %x BLOCK_COMMENT
 %x LINENUMBER
@@ -101,7 +101,7 @@ extern char *input_filename;
  /* send argument tokens */
 "mlen" { return MSGLEN; }
 "rlen" { return RETURNLEN; }
-"math" { return MATH; }
+"math" { if (gen_level >= 6) { yylval.integer = BRW_OPCODE_MATH; return MATH_INST; } else return MATH; }
 "sampler" { return SAMPLER; }
 "gateway" { return GATEWAY; }
 "read" { return READ; }