Fixes are available
XL C/C++ for AIX Fix Pack 11 (February 2015 PTF) for 12.1
XL C for AIX Fix Pack 12 (May 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 12 (May 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 13 (August 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 14 (December 2015 Update) for 12.1
XL C for AIX Fix Pack 15 (April 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 15 (April 2016 Update) for 12.1
XL C for AIX Fix Pack 16 (July 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 16 (July 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 17 (November 2016 Update) for 12.1
XL C for AIX Fix Pack 17 (November 2016 Update) for 12.1
XL C for AIX Fix Pack 18 (February 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 18 (February 2017 Update) for 12.1
XL C for AIX Fix Pack 19 (August 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 19 (August 2017 Update) for 12.1
XL C for AIX Fix Pack 20 (March 2018 Update) for 12.1
XL C/C++ for AIX Fix Pack 20 (March 2018 Update) for 12.1
XL C for AIX Fix Pack 9 (July 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 9 (July 2014 PTF) for 12.1
XL C for AIX Fix Pack 10 (October 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 10 (October 2014 PTF) for 12.1
XL C for AIX Fix Pack 11 (February 2015 PTF) for 12.1
XL C for AIX Fix Pack 13 (August 2015 Update) for 12.1
XL C for AIX Fix Pack 14 (December 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 21 (January 2019 Update) for 12.1
XL C for AIX Fix Pack 21 (January 2019 Update) for 12.1
APAR status
Closed as program error.
Error description
The compiler generates inefficient code for the following: ===== COMPILE COMMAND: xlC -q64 -O2 -qlist test.cpp ===== TESTCASE: $ cat test.cpp #define Uint64 unsigned long long Uint64 notZeroMask(Uint64 in) { return -(in != 0); } $ ===== ACTUAL OUTPUT: Looking at the listing file: Output: | 000000 PDEF notZeroMask(unsigned long long) | 000000 AKA notZeroMask__FUL 51| PROC in,gr3 53| 000160 addic 3003FFFF 1 ADDC gr0,ca=gr3,-1 53| 000164 addi 38600000 1 LI gr3=0 53| 000168 addze 7C030194 1 ADDE gr0,ca=gr3,0,ca 53| 00016C neg 7C8000D0 1 COMP gr4=gr0 53| 000170 extsw 7C8307B4 1 EXTS4 gr3=gr4 54| 000174 bclr 4E800020 1 BA lr ===== EXPECTED OUTPUT: Optimal output consists of subfic + subfe such as the one created using the following code: Uint64 notZeroMask_opt(Uint64 in) { Uint64 mask; asm("subfic %0, %1, 0; subfe %0,%0,%0" : "=r"(mask) : "r"(in) : "xer"); return mask; }
Local fix
N/A
Problem summary
USERS AFFECTED: Users who use the -(a!=0) syntax may be affected by this issue. PROBLEM DESCRIPTION: The compiler produces inefficient code for the -(a!=0) comparison.
Problem conclusion
The compiler now generates better code for Uint64 notZeroMask(Uint64 in) { return in != 0 ? 0xFFFFFFFFFFFFFFFFULL : 0ULL; } which is semantically equivalent to Uint64 notZeroMask(Uint64 in) { return -(in != 0); }
Temporary fix
Comments
APAR Information
APAR number
IV55854
Reported component name
XL C/C++ FOR AI
Reported component ID
5725C7200
Reported release
C10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2014-02-25
Closed date
2014-09-16
Last modified date
2014-09-16
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 FOR AIX
Fixed component ID
5725C7100
Applicable component levels
RC10 PSY
UP
Document Information
Modified date:
03 October 2021