On Linux/ia32, r217646 caused: FAIL: gcc.dg/torture/fp-int-convert-float128.c -O0 execution test FAIL: gcc.dg/torture/fp-int-convert-float128.c -O1 execution test FAIL: gcc.dg/torture/fp-int-convert-float128.c -O2 execution test FAIL: gcc.dg/torture/fp-int-convert-float128.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test FAIL: gcc.dg/torture/fp-int-convert-float128.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test FAIL: gcc.dg/torture/fp-int-convert-float128.c -O3 -fomit-frame-pointer execution test FAIL: gcc.dg/torture/fp-int-convert-float128.c -O3 -g execution test FAIL: gcc.dg/torture/fp-int-convert-float128.c -Os execution test FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c -O0 execution test FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c -O1 execution test FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c -O2 execution test FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c -O3 -fomit-frame-pointer execution test FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c -O3 -g execution test FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c -Os execution test FAIL: gfortran.dg/erf_3.F90 -O0 execution test FAIL: gfortran.dg/erf_3.F90 -O1 execution test FAIL: gfortran.dg/erf_3.F90 -O2 execution test FAIL: gfortran.dg/erf_3.F90 -O3 -fomit-frame-pointer execution test FAIL: gfortran.dg/erf_3.F90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test FAIL: gfortran.dg/erf_3.F90 -O3 -fomit-frame-pointer -funroll-loops execution test FAIL: gfortran.dg/erf_3.F90 -O3 -g execution test FAIL: gfortran.dg/erf_3.F90 -Os execution test
Same thing on x86_64-apple-darwin14.
Thanks for the report. I can reproduce the FAIL on IA32. Since the patch does not impact on -O0, it seams some library functions are wrong. I will investigate it.
Root cause: r217646 enhances ifcvt to handle cbranchcc4 instruction. But ifcvt does not check whether an insn will clobber CC or not, when moving it before the cbranchcc4 instruction. I will work out a patch to fix it.
On aarch64, I have noticed that the following tests FAIL after r217646: gcc.target/aarch64/test_frame_1.c scan-assembler-times ldr\tx30, \\[sp\\], [0-9]+ 3 gcc.target/aarch64/test_frame_2.c scan-assembler-times ldp\tx19, x30, \\[sp\\], [0-9]+ 2 gcc.target/aarch64/test_frame_4.c scan-assembler-times ldp\tx19, x30, \\[sp\\], [0-9]+ 2 gcc.target/aarch64/test_frame_6.c scan-assembler-times ldr\tx30, \\[sp\\], [0-9]+ 3 gcc.target/aarch64/test_frame_7.c scan-assembler-times ldp\tx19, x30, \\[sp\\], [0-9]+ 2 (tested on aarch64 and aarch64_be)
(In reply to clyon from comment #4) > On aarch64, I have noticed that the following tests FAIL after r217646: That is recorded as bug 63971 and just a testsuite issue. In that the return is no longer duplicated so the loads are not either. Anyways I have a fix which I will be posting this weekend. > gcc.target/aarch64/test_frame_1.c scan-assembler-times ldr\tx30, \\[sp\\], > [0-9]+ 3 > gcc.target/aarch64/test_frame_2.c scan-assembler-times ldp\tx19, x30, > \\[sp\\], [0-9]+ 2 > gcc.target/aarch64/test_frame_4.c scan-assembler-times ldp\tx19, x30, > \\[sp\\], [0-9]+ 2 > gcc.target/aarch64/test_frame_6.c scan-assembler-times ldr\tx30, \\[sp\\], > [0-9]+ 3 > gcc.target/aarch64/test_frame_7.c scan-assembler-times ldp\tx19, x30, > \\[sp\\], [0-9]+ 2 > > (tested on aarch64 and aarch64_be)
*** Bug 64007 has been marked as a duplicate of this bug. ***
also gmp-4.3.2/mpz/n_pow_ui.c is miscompiled because of this.
(In reply to Zhenqiang Chen from comment #3) > Root cause: r217646 enhances ifcvt to handle cbranchcc4 instruction. But > ifcvt does not check whether an insn will clobber CC or not, when moving it > before the cbranchcc4 instruction. This is a clear and important regression, miscompiling real-life code. Can we get this fixed, or should we ask to revert 217646 until this is fixed?
A patch has been submitted at https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00478.html waiting for approval!-(
Author: zqchen Date: Fri Dec 12 05:51:19 2014 New Revision: 218658 URL: https://gcc.gnu.org/viewcvs?rev=218658&root=gcc&view=rev Log: 2014-12-12 Zhenqiang Chen <zhenqiang.chen@arm.com> PR rtl-optimization/63917 * ifcvt.c (cc_in_cond): New function. (end_ifcvt_sequence): Make sure new generated insns do not clobber CC. (noce_process_if_block, check_cond_move_block): Check CC references. testsuite/ChangeLog: 2014-12-12 Zhenqiang Chen <zhenqiang.chen@arm.com> * gcc.dg/pr64007.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr64007.c Modified: trunk/gcc/ChangeLog trunk/gcc/ifcvt.c trunk/gcc/testsuite/ChangeLog
Fixed.
Author: yroux Date: Tue Apr 7 13:24:05 2015 New Revision: 221894 URL: https://gcc.gnu.org/viewcvs?rev=221894&root=gcc&view=rev Log: gcc/ 2015-04-07 Yvan Roux <yvan.roux@linaro.org> Backport from trunk r217062, r217646, r218658. 2014-12-12 Zhenqiang Chen <zhenqiang.chen@arm.com> PR rtl-optimization/63917 * ifcvt.c (cc_in_cond): New function. (end_ifcvt_sequence): Make sure new generated insns do not clobber CC. (noce_process_if_block, check_cond_move_block): Check CC references. 2014-11-17 Zhenqiang Chen <zhenqiang.chen@arm.com> * ifcvt.c (HAVE_cbranchcc4): Define. (noce_emit_cmove, noce_get_alt_condition, noce_get_condition): Use HAVE_cbranchcc4. 2014-11-04 Zhenqiang Chen <zhenqiang.chen@arm.com> Revert: 2014-11-03 Zhenqiang Chen <zhenqiang.chen@arm.com> * ifcvt.c (noce_emit_cmove, noce_get_alt_condition, noce_get_condition): Allow CC mode if HAVE_cbranchcc4. gcc/testsuite/ 2015-04-07 Yvan Roux <yvan.roux@linaro.org> Backport from trunk r218658. 2014-12-12 Zhenqiang Chen <zhenqiang.chen@arm.com> * gcc.dg/pr64007.c: New test. Added: branches/linaro/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr64007.c Modified: branches/linaro/gcc-4_9-branch/gcc/ChangeLog.linaro branches/linaro/gcc-4_9-branch/gcc/ifcvt.c branches/linaro/gcc-4_9-branch/gcc/testsuite/ChangeLog.linaro