On Wed, 6 Aug 2025 05:42:55 -0400, David Cole <[email protected]> wrote:

>In Principles:
>   - LB loads a byte into a register and sign-extends it.
>   - LLC also loads a byte into a register but then zero pads it.
>That's all pretty clear, but...
>
>Why use B in one case and C in the other?
>   - Why not LC instead of LB?
>   - Or why not LLB instead of LLC?

I would *think* (untested) that if you had a byte that contained for example 
X'C1' then LB would give you FFFFFFC1 and LLC would give you 000000C1.

The C language treats "chars" as binary integers. Implementations vary, but in 
most C compilers, an int is 32 bits, a short is 16 bits, and a char is 8 bits 
-- all binary integers. Either may be signed or unsigned.

I would *guess* that the C compiler team wanted a quick way to fetch either a 
signed or an unsigned char from storage for subsequent arithmetic. They would 
use LB for a signed char and LLC for an unsigned char.

I don't know Java but it may well be similar.

Assembler programmers are welcome to come along for the ride.

Charles

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to