sb

Speculation Barrier (A32)

SB

Prevents speculative execution across the barrier (v8.0).

Details

Speculation Barrier (v8.0) prevents speculative execution from crossing the barrier in either direction, creating a serialization point for instruction execution. This instruction acts as a full execution barrier that completes all prior instructions before allowing subsequent instructions to execute speculatively. Available in A32 instruction set; does not modify condition flags.

Pseudocode Operation

// Serialize execution; prevent speculative execution across this point
SpeculationBarrier()
// All prior instructions complete before any subsequent instruction executes speculatively

Example

SB

Encoding

Binary Layout
111101010111
1
1
1
1
1
1
1
1
0
0
0
0
0111
0000
 
Format System Hint
Opcode 0xF57FF070
Extension A32 (v8.0)

Operands

Reference (Arm AArch32 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0xF57FF070 SB{<q>} A32 111101010111 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0111 | 0000
0xF3BF8F70 SB{<q>} T32 111100111011 | 1 | 1 | 1 | 1 | 10 | 0 | 0 | 1 | 1 | 1 | 1 | 0111 | 0000

Description

Speculation Barrier is a barrier that controls speculation. The semantics of the Speculation Barrier are that the execution, until the barrier completes, of any instruction that appears later in the program order than the barrier: In particular, any instruction that appears later in the program order than the barrier cannot cause a speculative allocation into any caching structure where the allocation of that entry could be indicative of any data value present in memory or in the registers. The SB instruction: When the prediction of the instruction stream is not informed by data taken from the register outputs of the speculative execution of instructions appearing in program order after an uncompleted SB instruction, the SB instruction has no effect on the use of prediction resources to predict the instruction stream that is being fetched.

Operation

if ConditionPassed() then
    EncodingSpecificOperations();
    SpeculationBarrier();