Andreas Schwab <sch...@linux-m68k.org> wrote: > FAIL: gcc.target/aarch64/ccmp_1.c scan-assembler-times \tcmp\tw[0-9]+, 0 4 > FAIL: gcc.target/aarch64/ccmp_1.c scan-assembler adds\t > FAIL: gcc.target/aarch64/ccmp_1.c scan-assembler-times fccmpe\t.*0\\.0 1
Yes I noticed those too, and here is the fix. Richard's recent change added UNSPEC to the CCMP patterns to stop combine optimizing the CCMP CCmode immediate in a rare case. This requires a change to the CCMP cost calculation as the CCMP instruction with unspec is no longer recognized. Fix the ccmp_1.c test to allow both '0' and 'wzr' on cmp - BTW is there a regular expression that correctly implements (0|xzr)? If I use that the test still fails somehow but \[0wzr\]+ works fine... Is the correct syntax documented somewhere? Finally to ensure FCCMPE is emitted on relational compares, add -ffinite-math-only. ChangeLog: 2016-01-25 Wilco Dijkstra <wdijk...@arm.com> gcc/ * config/aarch64/aarch64.c (aarch64_if_then_else_costs): Remove CONST_INT_P check in CCMP cost calculation. gcc/testsuite/ * gcc.target/aarch64/ccmp_1.c: Fix test issues. --- diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 6c570c7db1cfbd0415e73fb110ce5d70aa09b540..7f304b78a3e48862bf5aaf855e307fe90969dd8c 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -6014,7 +6014,7 @@ aarch64_if_then_else_costs (rtx op0, rtx op1, rtx op2, int *cost, bool speed) else if (GET_MODE_CLASS (GET_MODE (inner)) == MODE_CC) { /* CCMP. */ - if ((GET_CODE (op1) == COMPARE) && CONST_INT_P (op2)) + if (GET_CODE (op1) == COMPARE) { /* Increase cost of CCMP reg, 0, imm, CC to prefer CMP reg, 0. */ if (XEXP (op1, 1) == const0_rtx) diff --git a/gcc/testsuite/gcc.target/aarch64/ccmp_1.c b/gcc/testsuite/gcc.target/aarch64/ccmp_1.c index 7c39b61a585a1d4d662b0736e1c80e06bdc6b4ce..8e3f8629f802eec64c95080a23f320712333471b 100644 --- a/gcc/testsuite/gcc.target/aarch64/ccmp_1.c +++ b/gcc/testsuite/gcc.target/aarch64/ccmp_1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2" } */ +/* { dg-options "-O2 -ffinite-math-only" } */ int f1 (int a) @@ -85,7 +85,7 @@ f13 (int a, int b) /* { dg-final { scan-assembler "cmp\t(.)+34" } } */ /* { dg-final { scan-assembler "cmp\t(.)+35" } } */ -/* { dg-final { scan-assembler-times "\tcmp\tw\[0-9\]+, 0" 4 } } */ +/* { dg-final { scan-assembler-times "\tcmp\tw\[0-9\]+, \[0wzr\]+" 4 } } */ /* { dg-final { scan-assembler-times "fcmpe\t(.)+0\\.0" 2 } } */ /* { dg-final { scan-assembler-times "fcmp\t(.)+0\\.0" 2 } } */