add support for math instruction on Sandybridge

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
This commit is contained in:
Xiang, Haihao 2010-10-27 09:42:56 +08:00 committed by Damien Lespiau
parent f1f5208e1e
commit 5405532ffc
3 changed files with 23 additions and 2 deletions

View File

@ -584,6 +584,7 @@
#define BRW_OPCODE_POP 47 #define BRW_OPCODE_POP 47
#define BRW_OPCODE_WAIT 48 #define BRW_OPCODE_WAIT 48
#define BRW_OPCODE_SEND 49 #define BRW_OPCODE_SEND 49
#define BRW_OPCODE_MATH 56
#define BRW_OPCODE_ADD 64 #define BRW_OPCODE_ADD 64
#define BRW_OPCODE_MUL 65 #define BRW_OPCODE_MUL 65
#define BRW_OPCODE_AVG 66 #define BRW_OPCODE_AVG 66

View 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> 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> SEND NOP JMPI IF IFF WHILE ELSE BREAK CONT HALT MSAVE
%token <integer> PUSH MREST POP WAIT DO ENDIF ILLEGAL %token <integer> PUSH MREST POP WAIT DO ENDIF ILLEGAL
%token <integer> MATH_INST
%token NULL_TOKEN MATH SAMPLER GATEWAY READ WRITE URB THREAD_SPAWNER %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> breakinstruction syncinstruction specialinstruction
%type <instruction> msgtarget %type <instruction> msgtarget
%type <instruction> instoptions instoption_list predicate %type <instruction> instoptions instoption_list predicate
%type <instruction> mathinstruction
%type <string> label %type <string> label
%type <program> instrseq %type <program> instrseq
%type <integer> instoption %type <integer> instoption
@ -235,6 +237,7 @@ instruction: unaryinstruction
| breakinstruction | breakinstruction
| syncinstruction | syncinstruction
| specialinstruction | specialinstruction
| mathinstruction
; ;
unaryinstruction: 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 breakinstruction: breakop locationstackcontrol
{ {
struct direct_reg dst; struct direct_reg dst;

View File

@ -8,7 +8,7 @@
#include "string.h" #include "string.h"
int saved_state = 0; int saved_state = 0;
extern char *input_filename; extern char *input_filename;
extern long int gen_level;
%} %}
%x BLOCK_COMMENT %x BLOCK_COMMENT
%x LINENUMBER %x LINENUMBER
@ -101,7 +101,7 @@ extern char *input_filename;
/* send argument tokens */ /* send argument tokens */
"mlen" { return MSGLEN; } "mlen" { return MSGLEN; }
"rlen" { return RETURNLEN; } "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; } "sampler" { return SAMPLER; }
"gateway" { return GATEWAY; } "gateway" { return GATEWAY; }
"read" { return READ; } "read" { return READ; }