Testcase: int foo (float a) { return a * 4.9f; } int main (void) { if (foo (10.0f) != 49) __builtin_abort (); return 0; } Compiled with -Ofast -mfpu=vfpv3 -mfloat-abi=hard -mcpu=cortex-a15 -fno-inline aborts. The problem is foo (10.0f) returns 40. This is because the combine_vcvtf2i triggers where its predicate should have rejected 4.9f The vfp3_const_double_for_bits function in arm.c is too liberal and accepts any FP constant that, when truncated, evaluates to a power of 2 FP constant.
I have a fix
Confirmed.
Author: ktkachov Date: Tue Oct 27 12:23:51 2015 New Revision: 229436 URL: https://gcc.gnu.org/viewcvs?rev=229436&root=gcc&view=rev Log: [ARM] PR target/67929 Tighten vfp3_const_double_for_bits checks PR target/67929 * config/arm/arm.c (vfp3_const_double_for_bits): Rewrite. * config/arm/constraints.md (Dp): Update callsite. * config/arm/predicates.md (const_double_vcvt_power_of_two): Likewise. * gcc.target/arm/pr67929_1.c: New test. Added: trunk/gcc/testsuite/gcc.target/arm/pr67929_1.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/arm/arm.c trunk/gcc/config/arm/constraints.md trunk/gcc/config/arm/predicates.md trunk/gcc/testsuite/ChangeLog
Author: ktkachov Date: Tue Oct 27 13:46:15 2015 New Revision: 229439 URL: https://gcc.gnu.org/viewcvs?rev=229439&root=gcc&view=rev Log: [ARM] PR target/67929 Tighten vfp3_const_double_for_bits checks PR target/67929 * config/arm/arm.c (vfp3_const_double_for_bits): Rewrite. * config/arm/constraints.md (Dp): Update callsite. * config/arm/predicates.md (const_double_vcvt_power_of_two): Likewise. * gcc.target/arm/pr67929_1.c: New test. Added: branches/gcc-5-branch/gcc/testsuite/gcc.target/arm/pr67929_1.c Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/config/arm/arm.c branches/gcc-5-branch/gcc/config/arm/constraints.md branches/gcc-5-branch/gcc/config/arm/predicates.md branches/gcc-5-branch/gcc/testsuite/ChangeLog
Author: ktkachov Date: Tue Oct 27 13:52:27 2015 New Revision: 229441 URL: https://gcc.gnu.org/viewcvs?rev=229441&root=gcc&view=rev Log: [ARM] PR target/67929 Tighten vfp3_const_double_for_bits checks PR target/67929 * config/arm/arm.c (vfp3_const_double_for_bits): Rewrite. * config/arm/constraints.md (Dp): Update callsite. * config/arm/predicates.md (const_double_vcvt_power_of_two): Likewise. * gcc.target/arm/pr67929_1.c: New test. Added: branches/gcc-4_9-branch/gcc/testsuite/gcc.target/arm/pr67929_1.c Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/config/arm/arm.c branches/gcc-4_9-branch/gcc/config/arm/constraints.md branches/gcc-4_9-branch/gcc/config/arm/predicates.md branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Fixed on trunk, GCC 5 and 4.9 branches
I think the testcase or check_effective_target_arm_vfp3_ok needs an adjustment: when GCC is configured for arm-none-linux-gnueabihf, since the test is compiled with -mfloat-abi=softfp, there is an error at link time because the crt*.o files are compiled with float-abi=hard, and thus conflict with pr67929_1.o. This is because check_effective_target_arm_vfp3_ok only checks whether a *compilation* with -mfloat-abi=soffp works, and does not check that a link actually works.
Author: ktkachov Date: Mon Nov 2 12:23:36 2015 New Revision: 229657 URL: https://gcc.gnu.org/viewcvs?rev=229657&root=gcc&view=rev Log: Move gcc.target/arm/pr67929_1.c test to execute.exp PR target/67929 * gcc.target/arm/pr67929_1.c: Move to... * gcc.c-torture/execute/pr67929_1.c: ... Here. Remove arm-specific directives. Add noclone, noinline attributes. Added: trunk/gcc/testsuite/gcc.c-torture/execute/pr67929_1.c Removed: trunk/gcc/testsuite/gcc.target/arm/pr67929_1.c Modified: trunk/gcc/testsuite/ChangeLog
Author: ktkachov Date: Mon Nov 2 12:26:39 2015 New Revision: 229658 URL: https://gcc.gnu.org/viewcvs?rev=229658&root=gcc&view=rev Log: Move gcc.target/arm/pr67929_1.c test to execute.exp PR target/67929 * gcc.target/arm/pr67929_1.c: Move to... * gcc.c-torture/execute/pr67929_1.c: ... Here. Remove arm-specific directives. Add noclone, noinline attributes. Added: branches/gcc-5-branch/gcc/testsuite/gcc.c-torture/execute/pr67929_1.c Removed: branches/gcc-5-branch/gcc/testsuite/gcc.target/arm/pr67929_1.c Modified: branches/gcc-5-branch/gcc/testsuite/ChangeLog
Author: ktkachov Date: Mon Nov 2 12:29:31 2015 New Revision: 229659 URL: https://gcc.gnu.org/viewcvs?rev=229659&root=gcc&view=rev Log: Move gcc.target/arm/pr67929_1.c test to execute.exp PR target/67929 * gcc.target/arm/pr67929_1.c: Move to... * gcc.c-torture/execute/pr67929_1.c: ... Here. Remove arm-specific directives. Add noclone, noinline attributes. Added: branches/gcc-4_9-branch/gcc/testsuite/gcc.c-torture/execute/pr67929_1.c Removed: branches/gcc-4_9-branch/gcc/testsuite/gcc.target/arm/pr67929_1.c Modified: branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
(In reply to Christophe Lyon from comment #7) > This is because check_effective_target_arm_vfp3_ok only checks whether a > *compilation* with -mfloat-abi=soffp works, and does not check that a link > actually works. Following some discussion on gcc-patches I've moved the test to gcc.c-torture/execute