Set a registers bit according to another registers bit PRU

Hello!

I want to set a register’s bit to the value of another registers bit in PRU.
I have the following code (which is working) but i want to know if there is a more beatiful option to do this:

QBBS SENDHIGH, r0.t0
QBBC SENDLOW, r0.t0

SENDHIGH:
SET r29.t1

SENDLOW:
CLR r29.t1

I am just now starting to read assembly, so this may not be correct:

QBBS SENDHIGH, r0.t0
CLR r29.t1

SENDHIGH:
SET r29.t1

That removes 2 lines. I think.
In pseudo C code:

if r0.t0 = 1
r29.t1 =1;
else
r29.t1 = 0;

Regards,
Greg

None of the codes will work, since the last executed instruction is always

CLR r29.t1
in the first code or

SET r29.t1
in the second code. This will always clear or set the bit, independend from r0.t0.

Either use

`

QBBS SENDHIGH, r0.t0
CLR r29.t1

JMP Finish

SENDHIGH:
SET r29.t1

Finish:

`

But, does this simple solution don’t work?

`
MOV r29.t1, r0.t0

`

The smallest value the MOV instruction will work with is a byte.

See "Syntax Terms and Definitions", section 5.3.2.5.6 of the PRU
Reference Guide (SPRUHF8). The MOV instruction works with any
register field from 8 to 32 bits, but not with single bits.

Yes exactly that is the problem. What should work is the OR operator, combining the two registers:

r29: 0010 0000
r0: 0000 0001

When performing a LSL on r0:

r0: 0000 0010

and combining the two with the OR operation r29 becomes:

r29: 0010 0010

but anyways this takes too long for my usecase.
I might need to play around with what I’ve got in the code already, because it is working, but i wanted a “nicer” solution.