{
public:
INLINE BranchInstruction(Opcode op, LabelIndex labelIndex, Register predicate) {
- GBE_ASSERT(op == OP_BRA);
+ GBE_ASSERT(op == OP_BRA || op == OP_IF);
this->opcode = op;
this->predicate = predicate;
this->labelIndex = labelIndex;
this->hasLabel = true;
}
INLINE BranchInstruction(Opcode op, LabelIndex labelIndex) {
- GBE_ASSERT(op == OP_BRA);
- this->opcode = OP_BRA;
+ GBE_ASSERT(op == OP_BRA || op == OP_ELSE || op == OP_ENDIF);
+ this->opcode = op;
this->labelIndex = labelIndex;
this->hasPredicate = false;
this->hasLabel = true;
}
INLINE BranchInstruction(Opcode op) {
GBE_ASSERT(op == OP_RET);
- this->opcode = OP_RET;
+ this->opcode = op;
this->hasPredicate = false;
this->hasLabel = false;
}
return internal::BranchInstruction(OP_BRA, labelIndex, pred).convert();
}
+ // IF
+ Instruction IF(LabelIndex labelIndex, Register pred) {
+ return internal::BranchInstruction(OP_IF, labelIndex, pred).convert();
+ }
+
+ // ELSE
+ Instruction ELSE(LabelIndex labelIndex) {
+ return internal::BranchInstruction(OP_ELSE, labelIndex).convert();
+ }
+ // ENDIF
+ Instruction ENDIF(LabelIndex labelIndex) {
+ return internal::BranchInstruction(OP_ENDIF, labelIndex).convert();
+ }
+
// RET
Instruction RET(void) {
return internal::BranchInstruction(OP_RET).convert();
Instruction BRA(LabelIndex labelIndex);
/*! (pred) bra labelIndex */
Instruction BRA(LabelIndex labelIndex, Register pred);
+ /*! (pred) if labelIndex */
+ Instruction IF(LabelIndex labelIndex, Register pred);
+ /*! else labelIndex */
+ Instruction ELSE(LabelIndex labelIndex);
+ /*! endif */
+ Instruction ENDIF(LabelIndex labelIndex);
/*! ret */
Instruction RET(void);
/*! load.type.space {dst1,...,dst_valueNum} offset value */
DECL_INSN(UPSAMPLE_LONG, BinaryInstruction)
DECL_INSN(I64MADSAT, TernaryInstruction)
DECL_INSN(MAD, TernaryInstruction)
+DECL_INSN(IF, BranchInstruction)
+DECL_INSN(ENDIF, BranchInstruction)
+DECL_INSN(ELSE, BranchInstruction)