5.1.2.4 choice Instruction Block

This instruction block has the format

        choice
        case    ...
        case    ...
        ...
        end     choice

or

arr_def choice
        case    ...
        case    ...
        ...
        end     choice

or

arr_def choice
        case    ...
        case    ...
        ...
arr_def end     choice

It consists of a choice instruction, at least one case instruction, and an end choice instruction. The instruction block can declare a probabilities array arr_def, where arr_def is a data label. The instructions case and end choice must not have location labels assigned.

Each case instruction must have one of the following forms:

        case    number, loc_label
var_def case    number, loc_label
        case    var_use, loc_label

The case instructions specify control transfer to a location label loc_label with probability number or with profile probability stored in a previously defined variable var_use. A data label var_def defines a probability variable var_def with initial value number. The parameter number must be in the range 0 to 1 inclusive. The assembler supports fixed-point and exponential notation for number. If a choice instruction has a location label assigned, you must not use the location label as the second argument of case instructions in the choice instruction block.

The choice instruction block effectively sets profile probabilities in the action emission matrix or state transition matrix:

In contrast to a contiguous block of jprob instructions, a choice instruction block allows you to specify jump probabilities in a direct way. Let us consider a choice instruction block like this:

        choice
        case    prob1, L1
        case    prob2, L2
        case    prob3, L3
        end     choice

The probabilities of jumps to various destinations are the following:

Jump DestinationProbability Value
The location label L1prob1
The location label L2prob2
The location label L3prob3
An instruction following the choice instruction block1−prob1prob2prob3

Compare this example to the example with a block of jprob instructions in jprob Instruction.