bc1t

Branch if FP condition true

Branches to label if the FP condition flag (flag 0 by default) is true, as set by a preceding compare instruction.

Used in

Forms

  • bc1t
  • bc1t ,

    Branches to 'label' if the FP condition flag specified by the immediate operand is true (1). Allows branching on any of the 8 condition flags set by FP compare instructions.

Operands

label
A named address in the program, such as the start of a loop or a variable in .data.
cc
A floating-point condition flag number, 0 to 7. Comparisons set these flags; bc1t and bc1f test them.

Set by a preceding FP compare instruction such as 'c.eq.s' or 'c.lt.d'. Note: mnemonic is BC1T (branch Coprocessor-1 True), not BCLT.

.data
less: .float 1.0
greater: .float 2.0
.text
# Compare 1.0 and 2.0, then the reverse. A taken branch skips the assignment of 1; inspect $t2/$t3 for markers 2 (taken) and 1 (fall-through).
l.s $f0, less
l.s $f2, greater
c.lt.s $f0, $f2
li $t2, 0
bc1t 0, first_taken
li $t2, 1
b first_done # Skip the other marker unconditionally.
first_taken: li $t2, 2
first_done:
c.lt.s $f2, $f0
li $t3, 0
bc1t 0, second_taken
li $t3, 1
b second_done # Skip the other marker unconditionally.
second_taken: li $t3, 2
second_done: