Rename TGSI LOOP instruction to better match theri usage.

The LOOP/ENDLOOP pair is renamed to BGNFOR/ENDFOR as its behaviour
is similar to a C language for-loop.

The BGNLOOP2/ENDLOOP2 pair is renamed to BGNLOOP/ENDLOOP as now
there is no name collision.
This commit is contained in:
Michal Krol 2009-07-31 18:12:53 +02:00
parent dc516d6e2a
commit cb90c43676
14 changed files with 47 additions and 47 deletions

View File

@ -516,7 +516,7 @@ translate_instruction(llvm::Module *module,
return; //just update the state
}
break;
case TGSI_OPCODE_LOOP:
case TGSI_OPCODE_BGNFOR:
break;
case TGSI_OPCODE_REP:
break;
@ -532,7 +532,7 @@ translate_instruction(llvm::Module *module,
return; //just update the state
}
break;
case TGSI_OPCODE_ENDLOOP:
case TGSI_OPCODE_ENDFOR:
break;
case TGSI_OPCODE_ENDREP:
break;
@ -574,7 +574,7 @@ translate_instruction(llvm::Module *module,
break;
case TGSI_OPCODE_ENDPRIM:
break;
case TGSI_OPCODE_BGNLOOP2: {
case TGSI_OPCODE_BGNLOOP: {
instr->beginLoop();
storage->setCurrentBlock(instr->currentBlock());
return;
@ -587,7 +587,7 @@ translate_instruction(llvm::Module *module,
return;
}
break;
case TGSI_OPCODE_ENDLOOP2: {
case TGSI_OPCODE_ENDLOOP: {
instr->endLoop();
storage->setCurrentBlock(instr->currentBlock());
return;
@ -890,7 +890,7 @@ translate_instructionir(llvm::Module *module,
case TGSI_OPCODE_IF: {
}
break;
case TGSI_OPCODE_LOOP:
case TGSI_OPCODE_BGNFOR:
break;
case TGSI_OPCODE_REP:
break;
@ -900,7 +900,7 @@ translate_instructionir(llvm::Module *module,
case TGSI_OPCODE_ENDIF: {
}
break;
case TGSI_OPCODE_ENDLOOP:
case TGSI_OPCODE_ENDFOR:
break;
case TGSI_OPCODE_ENDREP:
break;
@ -941,13 +941,13 @@ translate_instructionir(llvm::Module *module,
break;
case TGSI_OPCODE_ENDPRIM:
break;
case TGSI_OPCODE_BGNLOOP2: {
case TGSI_OPCODE_BGNLOOP: {
}
break;
case TGSI_OPCODE_BGNSUB: {
}
break;
case TGSI_OPCODE_ENDLOOP2: {
case TGSI_OPCODE_ENDLOOP: {
}
break;
case TGSI_OPCODE_ENDSUB: {

View File

@ -665,14 +665,14 @@ TGSI Instruction Specification
TBD
1.9.8 LOOP - Loop
1.9.8 BGNFOR - Begin a For-Loop
dst.x = floor(src.x)
dst.y = floor(src.y)
dst.z = floor(src.z)
if (dst.y <= 0)
pc = [matching ENDLOOP] + 1
pc = [matching ENDFOR] + 1
endif
Note: The destination must be a loop register.
@ -694,13 +694,13 @@ TGSI Instruction Specification
TBD
1.9.12 ENDLOOP - End Loop
1.9.12 ENDFOR - End a For-Loop
dst.x = dst.x + dst.z
dst.y = dst.y - 1.0
if (dst.y > 0)
pc = [matching LOOP instruction] + 1
pc = [matching BGNFOR instruction] + 1
endif
Note: The destination must be a loop register.
@ -856,7 +856,7 @@ TGSI Instruction Specification
----------
1.13.1 BGNLOOP2 - Begin Loop
1.13.1 BGNLOOP - Begin a Loop
TBD
@ -866,7 +866,7 @@ TGSI Instruction Specification
TBD
1.13.3 ENDLOOP2 - End Loop
1.13.3 ENDLOOP - End a Loop
TBD

View File

@ -473,8 +473,8 @@ iter_instruction(
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_IF:
case TGSI_OPCODE_ELSE:
case TGSI_OPCODE_BGNLOOP2:
case TGSI_OPCODE_ENDLOOP2:
case TGSI_OPCODE_BGNLOOP:
case TGSI_OPCODE_ENDLOOP:
case TGSI_OPCODE_CAL:
TXT( " :" );
UID( inst->InstructionExtLabel.Label );

View File

@ -3087,9 +3087,9 @@ exec_instruction(
mach->Primitives[mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0]] = 0;
break;
case TGSI_OPCODE_LOOP:
case TGSI_OPCODE_BGNFOR:
/* fall-through (for now) */
case TGSI_OPCODE_BGNLOOP2:
case TGSI_OPCODE_BGNLOOP:
/* push LoopMask and ContMasks */
assert(mach->LoopStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
mach->LoopStack[mach->LoopStackTop++] = mach->LoopMask;
@ -3097,9 +3097,9 @@ exec_instruction(
mach->ContStack[mach->ContStackTop++] = mach->ContMask;
break;
case TGSI_OPCODE_ENDLOOP:
case TGSI_OPCODE_ENDFOR:
/* fall-through (for now at least) */
case TGSI_OPCODE_ENDLOOP2:
case TGSI_OPCODE_ENDLOOP:
/* Restore ContMask, but don't pop */
assert(mach->ContStackTop > 0);
mach->ContMask = mach->ContStack[mach->ContStackTop - 1];

View File

@ -106,11 +106,11 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 2, 1, 0, "TXL", TGSI_OPCODE_TXL },
{ 0, 0, 0, 0, "BRK", TGSI_OPCODE_BRK },
{ 0, 1, 0, 1, "IF", TGSI_OPCODE_IF },
{ 1, 1, 0, 0, "LOOP", TGSI_OPCODE_LOOP },
{ 1, 1, 0, 0, "BGNFOR", TGSI_OPCODE_BGNFOR },
{ 0, 1, 0, 0, "REP", TGSI_OPCODE_REP },
{ 0, 0, 0, 1, "ELSE", TGSI_OPCODE_ELSE },
{ 0, 0, 0, 0, "ENDIF", TGSI_OPCODE_ENDIF },
{ 1, 0, 0, 0, "ENDLOOP", TGSI_OPCODE_ENDLOOP },
{ 1, 0, 0, 0, "ENDFOR", TGSI_OPCODE_ENDFOR },
{ 0, 0, 0, 0, "ENDREP", TGSI_OPCODE_ENDREP },
{ 0, 1, 0, 0, "PUSHA", TGSI_OPCODE_PUSHA },
{ 1, 0, 0, 0, "POPA", TGSI_OPCODE_POPA },
@ -130,9 +130,9 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 0, 0, 0, 0, "CONT", TGSI_OPCODE_CONT },
{ 0, 0, 0, 0, "EMIT", TGSI_OPCODE_EMIT },
{ 0, 0, 0, 0, "ENDPRIM", TGSI_OPCODE_ENDPRIM },
{ 0, 0, 0, 1, "BGNLOOP2", TGSI_OPCODE_BGNLOOP2 },
{ 0, 0, 0, 1, "BGNLOOP", TGSI_OPCODE_BGNLOOP },
{ 0, 0, 0, 0, "BGNSUB", TGSI_OPCODE_BGNSUB },
{ 0, 0, 0, 1, "ENDLOOP2", TGSI_OPCODE_ENDLOOP2 },
{ 0, 0, 0, 1, "ENDLOOP", TGSI_OPCODE_ENDLOOP },
{ 0, 0, 0, 0, "ENDSUB", TGSI_OPCODE_ENDSUB },
{ 1, 1, 0, 0, "NOISE1", TGSI_OPCODE_NOISE1 },
{ 1, 1, 0, 0, "NOISE2", TGSI_OPCODE_NOISE2 },

View File

@ -242,8 +242,8 @@ iter_instruction(
}
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_LOOP:
case TGSI_OPCODE_ENDLOOP:
case TGSI_OPCODE_BGNFOR:
case TGSI_OPCODE_ENDFOR:
if (inst->FullDstRegisters[0].DstRegister.File != TGSI_FILE_LOOP ||
inst->FullDstRegisters[0].DstRegister.Index != 0) {
report_error(ctx, "Destination register must be LOOP[0]");
@ -252,7 +252,7 @@ iter_instruction(
}
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_LOOP:
case TGSI_OPCODE_BGNFOR:
if (inst->FullSrcRegisters[0].SrcRegister.File != TGSI_FILE_CONSTANT &&
inst->FullSrcRegisters[0].SrcRegister.File != TGSI_FILE_IMMEDIATE) {
report_error(ctx, "Source register file must be either CONST or IMM");

View File

@ -2531,7 +2531,7 @@ emit_instruction(
return 0;
break;
case TGSI_OPCODE_LOOP:
case TGSI_OPCODE_BGNFOR:
return 0;
break;
@ -2547,7 +2547,7 @@ emit_instruction(
return 0;
break;
case TGSI_OPCODE_ENDLOOP:
case TGSI_OPCODE_ENDFOR:
return 0;
break;

View File

@ -1834,9 +1834,9 @@ emit_instruction(struct codegen *gen,
case TGSI_OPCODE_ENDIF:
return emit_ENDIF(gen, inst);
case TGSI_OPCODE_BGNLOOP2:
case TGSI_OPCODE_BGNLOOP:
return emit_BGNLOOP(gen, inst);
case TGSI_OPCODE_ENDLOOP2:
case TGSI_OPCODE_ENDLOOP:
return emit_ENDLOOP(gen, inst);
case TGSI_OPCODE_BRK:
return emit_BRK(gen, inst);

View File

@ -1758,9 +1758,9 @@ exec_instruction(
mach->Primitives[mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0]] = 0;
break;
case TGSI_OPCODE_LOOP:
case TGSI_OPCODE_BGNFOR:
/* fall-through (for now) */
case TGSI_OPCODE_BGNLOOP2:
case TGSI_OPCODE_BGNLOOP:
/* push LoopMask and ContMasks */
ASSERT(mach->LoopStackTop < TGSI_EXEC_MAX_LOOP_NESTING);
mach->LoopStack[mach->LoopStackTop++] = mach->LoopMask;
@ -1768,9 +1768,9 @@ exec_instruction(
mach->ContStack[mach->ContStackTop++] = mach->ContMask;
break;
case TGSI_OPCODE_ENDLOOP:
case TGSI_OPCODE_ENDFOR:
/* fall-through (for now at least) */
case TGSI_OPCODE_ENDLOOP2:
case TGSI_OPCODE_ENDLOOP:
/* Restore ContMask, but don't pop */
ASSERT(mach->ContStackTop > 0);
mach->ContMask = mach->ContStack[mach->ContStackTop - 1];

View File

@ -947,7 +947,7 @@ static void brw_wm_emit_instruction( struct brw_wm_compile *c,
#endif
break;
case TGSI_OPCODE_LOOP:
case TGSI_OPCODE_BGNFOR:
c->loop_inst[c->loop_insn++] = brw_DO(p, BRW_EXECUTE_8);
break;
case TGSI_OPCODE_BRK:
@ -958,11 +958,11 @@ static void brw_wm_emit_instruction( struct brw_wm_compile *c,
brw_CONT(p);
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
break;
case TGSI_OPCODE_ENDLOOP:
case TGSI_OPCODE_ENDFOR:
c->loop_insn--;
c->inst0 = c->inst1 = brw_WHILE(p, c->loop_inst[c->loop_insn]);
/* patch all the BREAK instructions from
last BEGINLOOP */
last BGNFOR */
while (c->inst0 > c->loop_inst[c->loop_insn]) {
c->inst0--;
if (c->inst0->header.opcode == BRW_OPCODE_BREAK) {

View File

@ -238,11 +238,11 @@ union tgsi_immediate_data
#define TGSI_OPCODE_TXL 72
#define TGSI_OPCODE_BRK 73
#define TGSI_OPCODE_IF 74
#define TGSI_OPCODE_LOOP 75
#define TGSI_OPCODE_BGNFOR 75
#define TGSI_OPCODE_REP 76
#define TGSI_OPCODE_ELSE 77
#define TGSI_OPCODE_ENDIF 78
#define TGSI_OPCODE_ENDLOOP 79
#define TGSI_OPCODE_ENDFOR 79
#define TGSI_OPCODE_ENDREP 80
#define TGSI_OPCODE_PUSHA 81
#define TGSI_OPCODE_POPA 82
@ -262,9 +262,9 @@ union tgsi_immediate_data
#define TGSI_OPCODE_CONT 96
#define TGSI_OPCODE_EMIT 97
#define TGSI_OPCODE_ENDPRIM 98
#define TGSI_OPCODE_BGNLOOP2 99
#define TGSI_OPCODE_BGNLOOP 99
#define TGSI_OPCODE_BGNSUB 100
#define TGSI_OPCODE_ENDLOOP2 101
#define TGSI_OPCODE_ENDLOOP 101
#define TGSI_OPCODE_ENDSUB 102
#define TGSI_OPCODE_NOISE1 103
#define TGSI_OPCODE_NOISE2 104

View File

@ -60,7 +60,7 @@ static const char convolution_asm[] =
"DCL SAMP[0], CONSTANT\n"
"0: MOV TEMP[0], CONST[0].xxxx\n"
"1: MOV TEMP[1], CONST[0].xxxx\n"
"2: BGNLOOP2 :14\n"
"2: BGNLOOP :14\n"
"3: SGE TEMP[0].z, TEMP[0].yyyy, CONST[1].xxxx\n"
"4: IF TEMP[0].zzzz :7\n"
"5: BRK\n"
@ -72,7 +72,7 @@ static const char convolution_asm[] =
"11: MOV TEMP[3], CONST[ADDR[0]+%d]\n"
"12: MAD TEMP[1], TEMP[2], TEMP[3], TEMP[1]\n"
"13: ADD TEMP[0].y, TEMP[0].yyyy, CONST[0].yyyy\n"
"14: ENDLOOP2 :2\n"
"14: ENDLOOP :2\n"
"15: MAD OUT[0], TEMP[1], CONST[1].yyyy, CONST[1].zzzz\n"
"16: END\n";

View File

@ -3007,7 +3007,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
loop_depth--;
inst0 = inst1 = brw_WHILE(p, loop_inst[loop_depth]);
/* patch all the BREAK/CONT instructions from last BEGINLOOP */
/* patch all the BREAK/CONT instructions from last BGNLOOP */
while (inst0 > loop_inst[loop_depth]) {
inst0--;
if (inst0->header.opcode == BRW_OPCODE_BREAK) {

View File

@ -368,7 +368,7 @@ compile_instruction(
fullinst->Instruction.Opcode = TGSI_OPCODE_ADD;
break;
case OPCODE_BGNLOOP:
fullinst->Instruction.Opcode = TGSI_OPCODE_BGNLOOP2;
fullinst->Instruction.Opcode = TGSI_OPCODE_BGNLOOP;
fullinst->InstructionExtLabel.Label = inst->BranchTarget + preamble_size;
break;
case OPCODE_BGNSUB:
@ -426,7 +426,7 @@ compile_instruction(
fullinst->Instruction.Opcode = TGSI_OPCODE_ENDIF;
break;
case OPCODE_ENDLOOP:
fullinst->Instruction.Opcode = TGSI_OPCODE_ENDLOOP2;
fullinst->Instruction.Opcode = TGSI_OPCODE_ENDLOOP;
fullinst->InstructionExtLabel.Label = inst->BranchTarget + preamble_size;
break;
case OPCODE_ENDSUB: