VarAction2: Infer that multiplying two bools results in bool
This commit is contained in:
@@ -1015,6 +1015,9 @@ void OptimiseVarAction2Adjust(VarAction2OptimiseState &state, const GrfSpecFeatu
|
|||||||
adjust.adjust_flags |= DSGAF_JUMP_INS_HINT;
|
adjust.adjust_flags |= DSGAF_JUMP_INS_HINT;
|
||||||
group->dsg_flags |= DSGF_CHECK_INSERT_JUMP;
|
group->dsg_flags |= DSGF_CHECK_INSERT_JUMP;
|
||||||
}
|
}
|
||||||
|
if (adjust.operation == DSGA_OP_MUL && (prev_inference & VA2AIF_ONE_OR_ZERO)) {
|
||||||
|
state.inference |= VA2AIF_SIGNED_NON_NEGATIVE | VA2AIF_ONE_OR_ZERO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (adjust.operation == DSGA_OP_RST && adjust.type == DSGA_TYPE_MOD && adjust.divmod_val == 2) {
|
if (adjust.operation == DSGA_OP_RST && adjust.type == DSGA_TYPE_MOD && adjust.divmod_val == 2) {
|
||||||
/* Non-negative value % 2 implies VA2AIF_ONE_OR_ZERO */
|
/* Non-negative value % 2 implies VA2AIF_ONE_OR_ZERO */
|
||||||
@@ -1330,6 +1333,9 @@ void OptimiseVarAction2Adjust(VarAction2OptimiseState &state, const GrfSpecFeatu
|
|||||||
if ((prev_inference & VA2AIF_ONE_OR_ZERO) || (non_const_var_inference & VA2AIF_ONE_OR_ZERO)) {
|
if ((prev_inference & VA2AIF_ONE_OR_ZERO) || (non_const_var_inference & VA2AIF_ONE_OR_ZERO)) {
|
||||||
state.inference |= VA2AIF_MUL_BOOL;
|
state.inference |= VA2AIF_MUL_BOOL;
|
||||||
}
|
}
|
||||||
|
if ((prev_inference & VA2AIF_ONE_OR_ZERO) && (non_const_var_inference & VA2AIF_ONE_OR_ZERO)) {
|
||||||
|
state.inference |= VA2AIF_SIGNED_NON_NEGATIVE | VA2AIF_ONE_OR_ZERO;
|
||||||
|
}
|
||||||
if (non_const_var_inference & VA2AIF_ONE_OR_ZERO) {
|
if (non_const_var_inference & VA2AIF_ONE_OR_ZERO) {
|
||||||
adjust.adjust_flags |= DSGAF_JUMP_INS_HINT;
|
adjust.adjust_flags |= DSGAF_JUMP_INS_HINT;
|
||||||
group->dsg_flags |= DSGF_CHECK_INSERT_JUMP;
|
group->dsg_flags |= DSGF_CHECK_INSERT_JUMP;
|
||||||
|
Reference in New Issue
Block a user