Fixes are available
April 2013 Update for XL C/C++ for Linux, V12.1
XL C/C++ for Linux Fix Pack 8 (October 2015 Update) for 12.1
XL C/C++ for Linux Fix Pack 4 (October 2013 Update) for 12.1
XL C/C++ for Linux Fix Pack 5 (December 2013 Update) for 12.1
XL C/C++ for Linux Fix Pack 6 (February 2014 Update) for 12.1
XL C/C++ for Linux Fix Pack 7 (May 2014 Update) for 12.1
APAR status
Closed as program error.
Error description
===== DESCRIPTION: xlC compile does not issue optimal code for compare with 32-bit immediates. extern "C" unsigned int eqFEFEEFEF(unsigned int *in) { unsigned int i = *in; if (i == 0xFEFEEFEF) i++; return i; } Output: | 000000 PDEF eqFEFEEFEF 17| PROC in,gr3 19| 000080 lwz 80830000 1 L4Z gr4=(unsigned int)(gr3,0) 20| 000084 ld E8620018 1 L8 gr3=.+CONSTANT_AREA (gr2,0) <---- here 20| 000088 ld E8030000 1 L8 gr0=+CONSTANT_AREA (gr3,0) <---- here 20| 00008C cmplw 7C040040 1 CL4 cr0=gr4,gr0 20| 000090 bc 40820010 1 BF CL.23,cr0,0x4/eq,taken=50%(0,0) 20| 000094 addi 38040001 1 AI gr0=gr4,1 20| 000098 rlwinm 5403003E 1 RN4 gr3=gr0,0,0xFFFFFFFF 0| 00009C bclr 4E800020 1 BA lr 0| CL.23: 20| 0000A0 rlwinm 5483003E 1 RN4 gr3=gr4,0,0xFFFFFFFF 22| 0000A4 bclr 4E800020 1 BA lr Optimal C input: extern "C" unsigned int eqFEFEEFEF_opt(unsigned int *in) { unsigned int i = *in; if ((i ^ 0xFEFE0000) == 0xEFEF) i++; return i; } Optimal output: 26| 0000C0 lwz 80630000 1 L4Z gr3=(unsigned int)(gr3,0) 27| 0000C4 xoris 6C60FEFE 1 XIU gr0=gr3,0xFEFE 27| 0000C8 cmplwi 2800EFEF 1 CL4 cr0=gr0,61423 27| 0000CC bc 40820010 1 BF CL.20,cr0,0x4/eq,taken=50%(0,0) 27| 0000D0 addi 38830001 1 AI gr4=gr3,1 27| 0000D4 rlwinm 5483003E 1 RN4 gr3=gr4,0,0xFFFFFFFF 0| 0000D8 bclr 4E800020 1 BA lr 0| CL.20: 27| 0000DC rlwinm 5463003E 1 RN4 gr3=gr3,0,0xFFFFFFFF 29| 0000E0 bclr 4E800020 1 BA lr ===== TESTCASE: $ cat test.C extern "C" unsigned int eqFEFEEFEF(unsigned int *in) { unsigned int i = *in; if (i == 0xFEFEEFEF) i++; return i; } $ ===== COMPILE COMMAND: xlC -q64 -O2 test.C -qlist -c
Local fix
n/a
Problem summary
USERS AFFECTED: Potentially any user of the compiler is affected by this issue. PROBLEM DESCRIPTION: When doing comparisons with large 32-bit constant values, we are generating 3 instructions; ie 2 to generate the constant, and 1 to do the comparison. When the comparison is a check for equality, we could accomplish it with 2 instructions.
Problem conclusion
Added code in the compiler to generate the 2 instruction sequence when appropriate.
Temporary fix
Comments
APAR Information
APAR number
LI77365
Reported component name
XL C/C++ FOR LI
Reported component ID
5725C7300
Reported release
C10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2013-04-27
Closed date
2013-04-27
Last modified date
2013-04-27
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
XL C/C++ FOR LI
Fixed component ID
5725C7300
Applicable component levels
RC10 PSN IV33245
UP06/09/13
[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSXVZZ","label":"XL C\/C++ for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"12.1","Line of Business":{"code":"LOB57","label":"Power"}}]
Document Information
Modified date:
14 October 2021