On 1/13/2019 4:08 AM, David Crayford wrote:
On 13/01/2019 7:06 pm, Tony Thigpen wrote:
I have seen some reports that current C compilers, which understand the z-hardware pipeline, can actually produce object that is faster running than an assembler. Mainly because no sane assembler programmer would produce great pipe-line code because it would be un-maintanable.

It's well established that that's been true for a well over a decade now. Not just C but all compilers including COBOL which got a new optimizer a few releases back.


Far, far less true now than it used to be.

Back in the old days, things ran a lot faster if you interleaved unrelated things in an "unfriendly" way. For example, this code fragment:

|    LGF  R0,Field1   Increment Field1
|    AGHI R0,1        (same)
|    ST   R0,Field1   (same)
|    LGF  R0,Field2   Increment Field2
|    AGHI R0,1        (same)
|    ST   R0,Field2   (same)
|    LGF  R0,Field3   Increment Field3
|    AGHI R0,1        (same)
|    ST   R0,Field3   (same)
|    LGF  R0,Field4   Increment Field4
|    AGHI R0,1        (same)
|    ST   R0,Field4   (same)

ran much faster when coded this way (which is not how a programmer would usually write things):

|    LGF  R0,Field1   Increment Field1
|    LGF  R1,Field2   Increment Field2
|    LGF  R2,Field3   Increment Field3
|    LGF  R3,Field4   Increment Field4
|    AGHI R0,1        (same)
|    AGHI R1,1        (same)
|    AGHI R2,1        (same)
|    AGHI R3,1        (same)
|    ST   R0,Field1   (same)
|    ST   R1,Field2   (same)
|    ST   R2,Field3   (same)
|    ST   R3,Field5   (same)

But once OOO execution came on the scene with z196, you could get the same enhanced performance from this easy-to-code and easy-to-read version:

|    LGF  R0,Field1   Increment Field1
|    AGHI R0,1        (same)
|    ST   R0,Field1   (same)
|    LGF  R1,Field2   Increment Field2
|    AGHI R1,1        (same)
|    ST   R1,Field2   (same)
|    LGF  R2,Field3   Increment Field3
|    AGHI R2,1        (same)
|    ST   R2,Field3   (same)
|    LGF  R3,Field4   Increment Field4
|    AGHI R3,1        (same)
|    ST   R3,Field4   (same)

These days, many performance improvements are realized by the compiler using newer instructions that replace older ones. For example, on z10 and higher, this very same code can be replaced with:

|    ASI  Field1,1    Increment Field1
|    ASI  Field2,1    Increment Field1
|    ASI  Field3,1    Increment Field1
|    ASI  Field4,1    Increment Field1

Of course, an HLASM programmer can do exactly the same thing. But changing old code to use new instructions requires relatively-expensive programmer resources whereas simply recompiling programs targeting a new machine is a relatively-inexpensive proposition.


--
Phoenix Software International
Edward E. Jaffe
831 Parkview Drive North
El Segundo, CA 90245
https://www.phoenixsoftware.com/


--------------------------------------------------------------------------------
This e-mail message, including any attachments, appended messages and the
information contained therein, is for the sole use of the intended
recipient(s). If you are not an intended recipient or have otherwise
received this email message in error, any use, dissemination, distribution,
review, storage or copying of this e-mail message and the information
contained therein is strictly prohibited. If you are not an intended
recipient, please contact the sender by reply e-mail and destroy all copies
of this email message and do not otherwise utilize or retain this email
message or any or all of the information contained therein. Although this
email message and any attachments or appended messages are believed to be
free of any virus or other defect that might affect any computer system into
which it is received and opened, it is the responsibility of the recipient
to ensure that it is virus free and no responsibility is accepted by the
sender for any loss or damage arising in any way from its opening or use.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to