C/C++

C/C++

C/C++

Your one-stop destination to learn and collaborate about the latest innovations in IBM C/C++ for z/OS compilers to develop high-performing C/C++ applications and system programs on z/OS while maximizing hardware use and improving application performance.

 View Only
Expand all | Collapse all

NOPR instructions with z/OS 2.2 __asm()

  • 1.  NOPR instructions with z/OS 2.2 __asm()

    Posted Fri October 23, 2015 06:54 AM

    Copied from IBMMAIN. I'm interested to why the compiler generates a NOPR instruction after __asm() inlines. It seems odd.

     

    Just "for fun and profit" (learning), I inserted an unnecessary HLASMstatement into a C program (helloworld.c type). I am curious about thegenerated code. Mainly that the compiler inserted an NOPR 0 after my simplecommand. The statement was the first executable in main() and output in thecompiler listing looks like:                           000008 |       *      char word[]="123456"; 00006E  D206  D0B4  1000  000008 |                 MVC word$init$0(7,r13,180),+CONSTANT_AREA(r1,0)                           000009 |       *      __asm(" L1,%0":"=m"(i3)::"r1"); *000000 581D 00B0            000B0     8          L     1,176(13)                                        000009 *000004 0700                           9          NOPR  0                                        000009 000074  581D  00B0        000009 |                 L        r1,176(r13,) 000078  0700              000009 |                 NOPR     0                           000010 |       *      printf("%.*s\n",i1,word);The compile was done on z/OS UNIX shell invocation of xlc:xlc  -qaggregate -qasm -qchars=unsigned -qevents=hello.events -qexpmac-qinfo -qlanglvl=extc1x -qoffset -qshowinc -qlist -qskipsrc=hide-qsource=hello.lst hello.cThe compiler said it was: "5650ZOS V2.1.1 z/OS XL C"This is just curiosity on my part. It is not a "bug" or a complaint.
    DaveyC


  • 2.  Re: NOPR instructions with z/OS 2.2 __asm()

    Posted Tue November 03, 2015 06:35 PM

    Hello,

    This new feature in V2.1.1 was a collaboration between z/OS XL C/C++ compiler and HLASM.  The compiler constructs CSECTS for the assembler source snippets and passes down the CSECTs to HLASM, on return from the HLASM the compiler inserts the machine code into its respective place in the binary.

    Having said how the feature works, the NOPR was a fix to make a constructed test case work around  a HLASM requirement.

    Although the test models a specific case, the fix, seems to have been pervasive.  We are amending the compiler code to only insert NOPR when necessary.

    The future PTFs of z/OS XL C/C++ V2.1.1 and V2.2 will have this change.

    Thanks for bringing this to our attention.

    Visda

    Visda