It's most likely optimized in the hardware, so it wouldn't matter if you used XC or MVHI in terms of performance.
However, if you're setting a fullword in storage intended for math operations to 0 (i.e. "int elephants = 0;" in C), MVHI makes more sense than XC in my mind since the MVHI instruction itself is more self-documenting than XC to describe what you're doing. If you were trying to mentally reverse engineer the XC instruction back to C code, it would look something like "int elephants; elephants = elephants ^ elephants;" That's confusing! -----Original Message----- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of John McKown Sent: Thursday, January 12, 2017 9:43 AM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: curious: MVHI vs XC to "zero" a halfword. Why am I asking this? Because I just installed a product on our, very old, z9BC. Said product's documentation said it was supported on a Z9. But it abended S0C1 on the instruction: E54C 1000 0000 (MVHI 0(1),0). I looked this up and it appears to be part of the "general instructions extension facility", which came in on the z10 class. Now, I know this code was likely generated by the C compiler (given the, unnamed by me, vendor). But this seems to be what I would expect to be from something like the C code: short int somevar=0; So I guess that is the reason: a general template which uses MVHI to set a halfword integer to a constant value. But, in the case of hand crafted assembler, would an MVHI be "better" than an "old style" XC for some reason? I am thinking speed, having the operand in the i-cache, and so forth. Or is an XC of a region with itself "optimized" in the hardware to not actually fetch the data and do an XC operation because the result is always b'000...' regardless of the operand? -- There’s no obfuscated Perl contest because it’s pointless. —Jeff Polk Maranatha! <>< John McKown