arm: Fix REVERSIBLE_CC_MODE [PR110796...]
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap |
success
|
Build passed
|
Commit Message
Since we have vcmp and vcmpe instructions (vcmpe raises an "Invalid
Operation" exception in presence of a NaN operand), we need to tell
the compiler it is not safe to reverse comparisons of floating-point
arguments.
On armv8-m.main+dsp+fp (cortex-m33):
PASS: gcc.dg/torture/builtin-iseqsig-1.c
at -O1, -O2, -O3, -Os
On armv8.1-m.main+mve.fp+fp.dp (cortex-m55):
PASS: gcc.dg/torture/builtin-iseqsig-1.c
PASS: gcc.dg/torture/builtin-iseqsig-2.c
PASS: gcc.dg/torture/builtin-iseqsig-3.c
at -O1, -O2, -O3, -Os
On armv7e-m+fp.dp (cortex-m7):
PASS: gcc.dg/torture/builtin-iseqsig-1.c
PASS: gcc.dg/torture/builtin-iseqsig-2.c
PASS: gcc.dg/torture/builtin-iseqsig-3.c
PASS: gcc.dg/torture/pr82692.c
at -O1, -O2, -O3, -Os
On armv8-a+simd:
PASS: gcc.dg/torture/builtin-iseqsig-1.c
PASS: gcc.dg/torture/builtin-iseqsig-2.c
PASS: gcc.dg/torture/builtin-iseqsig-3.c
PASS: gfortran.dg/ieee/comparisons_3.F90
at -Os (they already passed at other optimization levels)
gcc/
PR target/110796
PR target/118446
* config/arm/arm.h (REVERSIBLE_CC_MODE): Take floating-point modes
into account.
---
gcc/config/arm/arm.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On 13/03/2025 08:22, Christophe Lyon wrote:
> Since we have vcmp and vcmpe instructions (vcmpe raises an "Invalid
> Operation" exception in presence of a NaN operand), we need to tell
> the compiler it is not safe to reverse comparisons of floating-point
> arguments.
>
> On armv8-m.main+dsp+fp (cortex-m33):
> PASS: gcc.dg/torture/builtin-iseqsig-1.c
> at -O1, -O2, -O3, -Os
>
> On armv8.1-m.main+mve.fp+fp.dp (cortex-m55):
> PASS: gcc.dg/torture/builtin-iseqsig-1.c
> PASS: gcc.dg/torture/builtin-iseqsig-2.c
> PASS: gcc.dg/torture/builtin-iseqsig-3.c
> at -O1, -O2, -O3, -Os
>
> On armv7e-m+fp.dp (cortex-m7):
> PASS: gcc.dg/torture/builtin-iseqsig-1.c
> PASS: gcc.dg/torture/builtin-iseqsig-2.c
> PASS: gcc.dg/torture/builtin-iseqsig-3.c
> PASS: gcc.dg/torture/pr82692.c
> at -O1, -O2, -O3, -Os
>
> On armv8-a+simd:
> PASS: gcc.dg/torture/builtin-iseqsig-1.c
> PASS: gcc.dg/torture/builtin-iseqsig-2.c
> PASS: gcc.dg/torture/builtin-iseqsig-3.c
> PASS: gfortran.dg/ieee/comparisons_3.F90
> at -Os (they already passed at other optimization levels)
>
> gcc/
> PR target/110796
> PR target/118446
> * config/arm/arm.h (REVERSIBLE_CC_MODE): Take floating-point modes
> into account.
> ---
> gcc/config/arm/arm.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
> index 8472b756127..3c9c7c795cb 100644
> --- a/gcc/config/arm/arm.h
> +++ b/gcc/config/arm/arm.h
> @@ -2257,7 +2257,10 @@ extern int making_const_table;
>
> #define SELECT_CC_MODE(OP, X, Y) arm_select_cc_mode (OP, X, Y)
>
> -#define REVERSIBLE_CC_MODE(MODE) 1
> +/* Having an integer comparison mode guarantees that we can use
> + reverse_condition, but the usual restrictions apply to floating-point
> + comparisons. */
> +#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPmode && (MODE) != CCFPEmode)
>
> #define REVERSE_CONDITION(CODE,MODE) \
> (((MODE) == CCFPmode || (MODE) == CCFPEmode) \
I'd like to understand the impact of this for conditional execution when the result comes from a floating-point comparison. Adding support for non-reversable conditions would involve adding a substantial number of patterns to the machine description.
R.
@@ -2257,7 +2257,10 @@ extern int making_const_table;
#define SELECT_CC_MODE(OP, X, Y) arm_select_cc_mode (OP, X, Y)
-#define REVERSIBLE_CC_MODE(MODE) 1
+/* Having an integer comparison mode guarantees that we can use
+ reverse_condition, but the usual restrictions apply to floating-point
+ comparisons. */
+#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPmode && (MODE) != CCFPEmode)
#define REVERSE_CONDITION(CODE,MODE) \
(((MODE) == CCFPmode || (MODE) == CCFPEmode) \