00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "brw_context.h"
00034 #include "brw_defines.h"
00035 #include "brw_eu.h"
00036
00037
00038
00039
00040
00041
00042 void brw_set_predicate_control_flag_value( struct brw_compile *p, unsigned value )
00043 {
00044 p->current->header.predicate_control = BRW_PREDICATE_NONE;
00045
00046 if (value != 0xff) {
00047 if (value != p->flag_value) {
00048 brw_push_insn_state(p);
00049 brw_MOV(p, brw_flag_reg(), brw_imm_uw(value));
00050 p->flag_value = value;
00051 brw_pop_insn_state(p);
00052 }
00053
00054 p->current->header.predicate_control = BRW_PREDICATE_NORMAL;
00055 }
00056 }
00057
00058 void brw_set_predicate_control( struct brw_compile *p, unsigned pc )
00059 {
00060 p->current->header.predicate_control = pc;
00061 }
00062
00063 void brw_set_conditionalmod( struct brw_compile *p, unsigned conditional )
00064 {
00065 p->current->header.destreg__conditonalmod = conditional;
00066 }
00067
00068 void brw_set_access_mode( struct brw_compile *p, unsigned access_mode )
00069 {
00070 p->current->header.access_mode = access_mode;
00071 }
00072
00073 void brw_set_compression_control( struct brw_compile *p, boolean compression_control )
00074 {
00075 p->current->header.compression_control = compression_control;
00076 }
00077
00078 void brw_set_mask_control( struct brw_compile *p, unsigned value )
00079 {
00080 p->current->header.mask_control = value;
00081 }
00082
00083 void brw_set_saturate( struct brw_compile *p, unsigned value )
00084 {
00085 p->current->header.saturate = value;
00086 }
00087
00088 void brw_push_insn_state( struct brw_compile *p )
00089 {
00090 assert(p->current != &p->stack[BRW_EU_MAX_INSN_STACK-1]);
00091 memcpy(p->current+1, p->current, sizeof(struct brw_instruction));
00092 p->current++;
00093 }
00094
00095 void brw_pop_insn_state( struct brw_compile *p )
00096 {
00097 assert(p->current != p->stack);
00098 p->current--;
00099 }
00100
00101
00102
00103
00104 void brw_init_compile( struct brw_compile *p )
00105 {
00106 p->nr_insn = 0;
00107 p->current = p->stack;
00108 memset(p->current, 0, sizeof(p->current[0]));
00109
00110
00111
00112 brw_set_mask_control(p, BRW_MASK_ENABLE);
00113 brw_set_saturate(p, 0);
00114 brw_set_compression_control(p, BRW_COMPRESSION_NONE);
00115 brw_set_predicate_control_flag_value(p, 0xff);
00116 }
00117
00118
00119 const unsigned *brw_get_program( struct brw_compile *p,
00120 unsigned *sz )
00121 {
00122 unsigned i;
00123
00124 for (i = 0; i < 8; i++)
00125 brw_NOP(p);
00126
00127 *sz = p->nr_insn * sizeof(struct brw_instruction);
00128 return (const unsigned *)p->store;
00129 }
00130