You would use MVHI where appropriate, but the MVHI immediate operand is a 
SIGNED halfword, so:

          MVC   XL4a,=C'FULL'

would be coded as:

          MVHHI XL4a+0,C'FU'
          MVHHI XL4a+2,C'LL'

And:

          MVC   XL4b,=F'48000'

would be coded as:

          MVHHI XL4a+0,0
          MVHHI XL4a+2,48000

And:

          MVC   XL4b,=F'65537'

would be coded as:

          MVHHI XL4a+0,65537>>16             i.e. 1
          MVHHI XL4a+2,65537                    which HLASM conveniently 
truncates to 1 for us

There no actual SHIFT operator, so (in general) this is implemented as an 
arithmetic expression.

Robert Ngan
DXC Lusoft

-----Original Message-----
From: IBM Mainframe Assembler List <[email protected]> On Behalf 
Of João Reginato
Sent: Saturday, August 23, 2025 07:53
To: [email protected]
Subject: RES: Execute-Type Instructions
Importance: Low

[Algumas pessoas que receberam esta mensagem geralmente não receberão emails de 
[email protected]. Saiba por que isso é 
importante em https://aka.ms/LearnAboutSenderIdentification ]

Why not just one MVHI instead of two MVHHI?

-----Mensagem original-----
De: IBM Mainframe Assembler List <[email protected]> Em nome de 
Jon Perryman Enviada em: sábado, 23 de agosto de 2025 00:12
Para: [email protected]
Assunto: Re: Execute-Type Instructions

On Fri, 22 Aug 2025 17:00:33 +0000, Ngan, Robert <[email protected]> wrote:

>I noticed the COBOL compile generated two MVHHI's to set a fullword
>field with a constant value, but did an MVC with an 8-byte constant
>when setting two adjacent fullwords.

This makes sense because data is in the pipeline instead of moving from L1.

With inline constants, you eliminated the extra fetch from storage. Ask 
yourself if it's worth the effort to eliminate the extra L1 access. You're 
running C, Java, Python and ??? where you can save a few dollars instead of a 
few penniess.

Reply via email to