From: Eric Anholt Date: Fri, 25 Aug 2006 16:36:28 +0000 (-0700) Subject: Add syntax for extended math send functions, and adjust packed_yuv_sf for it. X-Git-Tag: intel-gpu-tools-1.4~751 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3d36079ae3f9cab993b7bbec68f6fa2fbfb60136;p=profile%2Fextras%2Fintel-gpu-tools.git Add syntax for extended math send functions, and adjust packed_yuv_sf for it. --- diff --git a/assembler/gram.y b/assembler/gram.y index 425d27b..0609d90 100644 --- a/assembler/gram.y +++ b/assembler/gram.y @@ -78,6 +78,10 @@ %token INTEGER %token NUMBER +%token INV LOG EXP SQRT RSQ POW SIN COS SINCOS INTDIV INTMOD +%token INTDIVMOD +%token SIGNED SCALAR + %type instruction unaryinstruction binaryinstruction %type binaryaccinstruction triinstruction sendinstruction %type specialinstruction @@ -92,6 +96,7 @@ %type regtype srcimmtype execsize dstregion %type subregnum sampler_datatype %type urb_swizzle urb_allocate urb_used urb_complete +%type math_function math_signed math_scalar %type region %type directgenreg directmsgreg addrreg accreg flagreg maskreg %type nullreg @@ -263,9 +268,17 @@ msgtarget: NULL_TOKEN break; } } - | MATH + | MATH math_function saturate math_signed math_scalar { $$.bits3.generic.msg_target = BRW_MESSAGE_TARGET_MATH; + $$.bits3.math.function = $2; + if ($3 == BRW_INSTRUCTION_SATURATE) + $$.bits3.math.saturate = 1; + else + $$.bits3.math.saturate = 0; + $$.bits3.math.int_type = $4; + $$.bits3.math.precision = BRW_MATH_PRECISION_FULL; + $$.bits3.math.data_type = $5; } | GATEWAY { @@ -311,25 +324,41 @@ msgtarget: NULL_TOKEN urb_allocate: ALLOCATE { $$ = 1; } | /* empty */ { $$ = 0; } +; urb_used: USED { $$ = 1; } | /* empty */ { $$ = 0; } +; urb_complete: COMPLETE { $$ = 1; } | /* empty */ { $$ = 0; } +; urb_swizzle: TRANSPOSE { $$ = BRW_URB_SWIZZLE_TRANSPOSE; } | INTERLEAVE { $$ = BRW_URB_SWIZZLE_INTERLEAVE; } | /* empty */ { $$ = BRW_URB_SWIZZLE_NONE; } +; sampler_datatype: TYPE_F | TYPE_UD | TYPE_D +; + +math_function: INV | LOG | EXP | SQRT | POW | SIN | COS | SINCOS | INTDIV + | INTMOD | INTDIVMOD +; + +math_signed: /* empty */ { $$ = 0; } + | SIGNED { $$ = 1; } + +math_scalar: /* empty */ { $$ = 0; } + | SCALAR { $$ = 1; } /* 1.4.2: Destination register */ dst: dstoperand | dstoperandex +; /* XXX: dstregion writemask */ dstoperand: dstreg dstregion regtype diff --git a/assembler/lex.l b/assembler/lex.l index 6bca52d..8982df5 100644 --- a/assembler/lex.l +++ b/assembler/lex.l @@ -2,6 +2,7 @@ %{ #include "gen4asm.h" #include "y.tab.h" +#include "brw_defines.h" int saved_state = INITIAL; @@ -121,6 +122,32 @@ int saved_state = INITIAL; "mask_disable" { return MASK_DISABLE; } "EOT" { return EOT; } + /* extended math functions */ +"inv" { yylval.integer = BRW_MATH_FUNCTION_INV; return SIN; } +"log" { yylval.integer = BRW_MATH_FUNCTION_LOG; return LOG; } +"exp" { yylval.integer = BRW_MATH_FUNCTION_EXP; return EXP; } +"sqrt" { yylval.integer = BRW_MATH_FUNCTION_SQRT; return SQRT; } +"rsq" { yylval.integer = BRW_MATH_FUNCTION_RSQ; return RSQ; } +"pow" { yylval.integer = BRW_MATH_FUNCTION_POW; return POW; } +"sin" { yylval.integer = BRW_MATH_FUNCTION_SIN; return SIN; } +"cos" { yylval.integer = BRW_MATH_FUNCTION_COS; return COS; } +"sincos" { yylval.integer = BRW_MATH_FUNCTION_SINCOS; return SINCOS; } +"intdiv" { + yylval.integer = BRW_MATH_FUNCTION_INT_DIV_QUOTIENT; + return INTDIV; +} +"intmod" { + yylval.integer = BRW_MATH_FUNCTION_INT_DIV_REMAINDER; + return INTMOD; +} +"intdivmod" { + yylval.integer = BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER; + return INTDIVMOD; +} + +"signed" { return SIGNED; } +"scalar" { return SCALAR; } + [0-9]* { yylval.integer = atoi(yytext); return INTEGER; diff --git a/assembler/packed_yuv_sf.g4a b/assembler/packed_yuv_sf.g4a index 1b2d84f..0e37782 100644 --- a/assembler/packed_yuv_sf.g4a +++ b/assembler/packed_yuv_sf.g4a @@ -1,5 +1,5 @@ -send (1) 0 g6<1>F g1.12<0,1,0>F math mlen 1 rlen 1 { align1 }; -send (1) 0 g6.4<1>F g1.20<0,1,0>F math mlen 1 rlen 1 { align1 }; +send (1) 0 g6<1>F g1.12<0,1,0>F math inv scalar mlen 1 rlen 1 { align1 }; +send (1) 0 g6.4<1>F g1.20<0,1,0>F math inv scalar mlen 1 rlen 1 { align1 }; add (8) g7<1>F g4<8,8,1>F g3<8,8,1>F { align1 }; mul (1) g7<1>F g7<0,1,0>F g6<0,1,0>F { align1 }; mul (1) g7.4<1>F g7.4<0,1,0>F g6.4<0,1,0>F { align1 };