Sorry, I had saved this code snippet a while ago (years), and did not document 
what version of the compiler it came from at that time so I don't know.

Robert

-----Original Message-----
From: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> On Behalf 
Of Ian Worthington
Sent: Wednesday, August 20, 2025 14:17
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: Execute-Type Instructions

Robert --
That's quite astonishing.  Which was the previous compiler, and were the target 
and optimisation level set the same?

Best wishes / Mejores deseos /  Meilleurs vœux

Ian ...

    On Wednesday, August 20, 2025 at 08:50:53 PM GMT+2, Ngan, Robert 
<robert.n...@dxc.com> wrote:

 Speaking of optimizations, a while back I noticed the COBOL compiler generated 
the following code to edit a PIC 9(4) BINARY value into a PIX ZZZZ9 field

          MVC    496(6,R13),1851(R3)  #  TS2=119                +185
          LLH    R2,8(,R2)            #  U010-CO-ID
          VCVD    VRF16,R2,0x85,0
          VUPKZ  VRF16,1005(,R13),0x4  #
          CDZT    FP0,1005(5,R13),0x8  #
          ESDTR  R2,FP0
          VL      VRF17,2224(,R3),0    #
          VL      VRF18,2240(,R3),0    #
          VLRL    VRF20,1005(,R13),0x4  #
          VGBM    VRF19,0x0
          VLEIB  VRF19,0xf0,15
          VO      VRF20,VRF20,VRF19
          VPERM  VRF16,VRF17,VRF20,VRF18
          LHI    R4,0x5
          VSTL    VRF16,R4,496(,R13)    #  TS2=119
          VREPIB  VRF20,0x40
          LLC    R4,2256(R2,R3)        #
          LTR    R4,R4
          JE      L0642
          AHI    R4,0xffff
          VSTL    VRF20,R4,497(,R13)    #  TS2=119
L0642:    EQU    *
          L      R2,108(,R8)          #  BLL_9
          MVC    8(5,R2),497(R13)      #  U016-CO-ID-DISPLAY  TS2=119

I thought "All those vector instructions are better than an a single ED? I'd 
better learn what that's doing so I can use that technique myself".
Today, I decided to recompile the module to see if it generates better code 
since I noticed some of the above code could be further optimized. Our current 
COBOL 6.4 compiler generated:

          MVC    536(6,R13),2403(R3)  #  TS2=119                  +2403
          LLH    R2,8(,R2)            #  U010-CO-ID
          CVD    R2,1050(,R13)        #
          ED      536(6,R13),1055(R13)  #  TS2=119
          L      R2,88(,R8)            #  BLL_9
          MVC    8(5,R2),537(R13)      #  U016-CO-ID-DISPLAY      TS2=119

Robert Ngan
DXC Luxoft

[snipping again!]

Reply via email to