tst1


Tests bit.

[Syntax]

-

tst1 bit#3, disp[reg1]

-

tst1 reg2, [reg1]

 

The following can be specified for disp:

-

Absolute expression having a value of up to 32 bits

-

Relative expression

-

Either of the above expressions with LOWW applied

Caution

The disp cannot be specified in syntax "tst1 reg2, [reg1]".

[Function]

-

Syntax "tst1 bit#3, disp[reg1]"

Sets only a flag according to the value of the bit specified by the first operand of the data indicated by the address specified by the second operand. The value of the second operand and the specified bit are not changed.

-

Syntax "tst1 reg2, [reg1]"

Sets only a flag according to the value of the bit of the register value specified by the first operand of the data indicated by the address specified by the second operand. The value of the second operand and the specified bit are not changed.

[Description]

-

If the following is specified for disp, the assembler generates one tst1 machine instructionNote.

(a)

Absolute expression having a value in the range of -32,768 to +32,767

tst1    bit#3, disp16[reg1]
tst1    bit#3, disp16[reg1]

(b)

Relative expression having $label for a label having a definition in the sdata/sbss-attribute section

tst1    bit#3, $label[reg1]
tst1    bit#3, $label[reg1]

(c)

Relative expression having !label or %label

tst1    bit#3, !label[reg1]
tst1    bit#3, !label[reg1]
tst1    bit#3, %label[reg1]
tst1    bit#3, %label[reg1]

(d)

Expression with LOWW

tst1    bit#3, HIGHW(value)[reg1]
tst1    bit#3, HIGHW(value)[reg1]
tst1    bit#3, LOWW(value)[reg1]
tst1    bit#3, LOWW(value)[reg1]
tst1    bit#3, HIGHW1(value)[reg1]
tst1    bit#3, HIGHW1(value)[reg1]

Note

The tst1 machine instruction takes an immediate value in the range of -32,768 to +32,767 (0xFFFF8000 to 0x7FFF) as the displacement.

 

-

If any of the following is specified as disp, the assembler executes instruction expansion to generate multiple machine instructions.

(a)

Absolute expression having a value exceeding the range of -32,768 to +32,767

tst1    bit#3, disp[reg1]
movhi   HIGHW1(disp), reg1, r1
tst1    bit#3, LOWW(disp)[r1]

(b)

Relative expression having #label or label, or that having $label for a label having no definition in the sdata/sbss-attribute section

tst1    bit#3, #label[reg1]
movhi   HIGHW1(#label), reg1, r1
tst1    bit#3, LOWW(#label)[r1]
tst1    bit#3, label[reg1]
movhi   HIGHW1(label), reg1, r1
tst1    bit#3, LOWW(label)[r1]
tst1    bit#3, $label[reg1]
movhi   HIGHW1($label), reg1, r1
tst1    bit#3, LOWW($label)[r1]

-

If disp is omitted, the assembler assumes 0.

-

If a relative expression with #label, or a relative expression with #label and with LOWW applied is specified as disp, [reg1] can be omitted. If omitted, the assembler assumes that [r0] is specified.

-

If a relative expression with $label, or a relative expression with $label and with LOWW applied is specified as disp, [reg1] can be omitted. If omitted, the assembler assumes that [gp] is specified.

-

If a relative expression with %label, or a relative expression with %label and with LOWW applied is specified as disp, [reg1] can be omitted. If omitted, the assembler assumes that [ep] is specified.

[Flag]

CY

---

OV

---

S

---

Z

1 if the specified bit is 0, 0 if not

SAT

---