diff --git a/src/intel/compiler/elk/elk_asm.h b/src/intel/compiler/elk/elk_asm.h index 9ad5942797a..00080c1aa2e 100644 --- a/src/intel/compiler/elk/elk_asm.h +++ b/src/intel/compiler/elk/elk_asm.h @@ -72,6 +72,7 @@ struct options { unsigned access_mode:1; unsigned compression_control:2; unsigned thread_control:2; + unsigned branch_control:1; unsigned no_dd_check:1; // Dependency control unsigned no_dd_clear:1; // Dependency control unsigned mask_control:1; diff --git a/src/intel/compiler/elk/elk_disasm.c b/src/intel/compiler/elk/elk_disasm.c index 33635f0d3ab..68c4a6f5a2d 100644 --- a/src/intel/compiler/elk/elk_disasm.c +++ b/src/intel/compiler/elk/elk_disasm.c @@ -64,8 +64,8 @@ elk_has_uip(const struct intel_device_info *devinfo, enum elk_opcode opcode) opcode == ELK_OPCODE_HALT; } -static bool -has_branch_ctrl(const struct intel_device_info *devinfo, enum elk_opcode opcode) +bool +elk_has_branch_ctrl(const struct intel_device_info *devinfo, enum elk_opcode opcode) { if (devinfo->ver < 8) return false; @@ -2000,7 +2000,7 @@ elk_disassemble_inst(FILE *file, const struct elk_isa_info *isa, err |= control(file, "thread control", thread_ctrl, elk_inst_thread_control(devinfo, inst), &space); - if (has_branch_ctrl(devinfo, opcode)) { + if (elk_has_branch_ctrl(devinfo, opcode)) { err |= control(file, "branch ctrl", branch_ctrl, elk_inst_branch_control(devinfo, inst), &space); } else if (devinfo->ver >= 6) { diff --git a/src/intel/compiler/elk/elk_eu.h b/src/intel/compiler/elk/elk_eu.h index b56e34946a4..e4aab13a66a 100644 --- a/src/intel/compiler/elk/elk_eu.h +++ b/src/intel/compiler/elk/elk_eu.h @@ -175,6 +175,7 @@ void elk_init_codegen(const struct elk_isa_info *isa, struct elk_codegen *p, void *mem_ctx); bool elk_has_jip(const struct intel_device_info *devinfo, enum elk_opcode opcode); bool elk_has_uip(const struct intel_device_info *devinfo, enum elk_opcode opcode); +bool elk_has_branch_ctrl(const struct intel_device_info *devinfo, enum elk_opcode opcode); const struct elk_shader_reloc *elk_get_shader_relocs(struct elk_codegen *p, unsigned *num_relocs); const unsigned *elk_get_program( struct elk_codegen *p, unsigned *sz ); diff --git a/src/intel/compiler/elk/elk_gram.y b/src/intel/compiler/elk/elk_gram.y index 8cf0a2efe12..89cbd31b352 100644 --- a/src/intel/compiler/elk/elk_gram.y +++ b/src/intel/compiler/elk/elk_gram.y @@ -294,9 +294,18 @@ i965_asm_set_instruction_options(struct elk_codegen *p, options.no_dd_clear); elk_inst_set_debug_control(p->devinfo, elk_last_inst, options.debug_control); - if (p->devinfo->ver >= 6) + if (elk_has_branch_ctrl(p->devinfo, elk_inst_opcode(p->isa, elk_last_inst))) { + if (options.acc_wr_control) + error(NULL, "Instruction does not support AccWrEnable\n"); + + elk_inst_set_branch_control(p->devinfo, elk_last_inst, + options.branch_control); + } else if (options.branch_control) { + error(NULL, "Instruction does not support BranchCtrl\n"); + } else if (p->devinfo->ver >= 6) { elk_inst_set_acc_wr_control(p->devinfo, elk_last_inst, options.acc_wr_control); + } elk_inst_set_cmpt_control(p->devinfo, elk_last_inst, options.compaction); } @@ -455,6 +464,9 @@ add_label(struct elk_codegen *p, const char* label_name, enum instr_label_type t /* thread control */ %token ATOMIC SWITCH +/* branch control */ +%token BRANCH_CTRL + /* quater control */ %token QTR_2Q QTR_3Q QTR_4Q QTR_2H QTR_2N QTR_3N QTR_4N QTR_5N %token QTR_6N QTR_7N QTR_8N @@ -566,6 +578,9 @@ add_instruction_option(struct options *options, struct instoption opt) case ATOMIC: options->thread_control |= ELK_THREAD_ATOMIC; break; + case BRANCH_CTRL: + options->branch_control = true; + break; case NODDCHK: options->no_dd_check = true; break; @@ -2284,7 +2299,12 @@ instoption_list: instoption: ALIGN1 { $$.uint_value = ALIGN1;} | ALIGN16 { $$.uint_value = ALIGN16; } - | ACCWREN { $$.uint_value = ACCWREN; } + | ACCWREN + { + if (p->devinfo->ver < 6) + error(&@1, "AccWrEnable not supported before Gfx6\n"); + $$.uint_value = ACCWREN; + } | SECHALF { $$.uint_value = SECHALF; } | COMPR { $$.uint_value = COMPR; } | COMPR4 { $$.uint_value = COMPR4; } @@ -2295,6 +2315,12 @@ instoption: | EOT { $$.uint_value = EOT; } | SWITCH { $$.uint_value = SWITCH; } | ATOMIC { $$.uint_value = ATOMIC; } + | BRANCH_CTRL + { + if (p->devinfo->ver < 8) + error(&@1, "BranchCtrl not supported before Gfx8\n"); + $$.uint_value = BRANCH_CTRL; + } | CMPTCTRL { $$.uint_value = CMPTCTRL; } | WECTRL { $$.uint_value = WECTRL; } | QTR_2Q { $$.uint_value = QTR_2Q; } diff --git a/src/intel/compiler/elk/elk_lex.l b/src/intel/compiler/elk/elk_lex.l index e7b702b1f2a..4e1a10a659a 100644 --- a/src/intel/compiler/elk/elk_lex.l +++ b/src/intel/compiler/elk/elk_lex.l @@ -277,6 +277,9 @@ nomask { return MASK_DISABLE; } atomic { return ATOMIC; } switch { return SWITCH; } + /* Branch control */ +BranchCtrl { return BRANCH_CTRL; } + /* compression control */ compr { return COMPR; } compr4 { return COMPR4; }