Hi, r16-2175-g5aa21765236730 introduced an assert for floating-point modes when expanding an RDIV_EXPR but forgot fixed-point modes. This patch adds ALL_FIXED_POINT_MODE_P to the assert.
Bootstrap and regtest running on x86, aarch64, and power10. Regtested on rv64gcv. Regtest on arm running, needed to set it up still. Regards Robin PR middle-end/121065 gcc/ChangeLog: * cfgexpand.cc (expand_debug_expr): Allow fixed-point modes for RDIV_EXPR. * optabs-tree.cc (optab_for_tree_code): Ditto. gcc/testsuite/ChangeLog: * gcc.target/arm/pr121065.c: New test. --- gcc/cfgexpand.cc | 3 ++- gcc/optabs-tree.cc | 3 ++- gcc/testsuite/gcc.target/arm/pr121065.c | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/pr121065.c diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc index a656ccebf17..8a55f4f472a 100644 --- a/gcc/cfgexpand.cc +++ b/gcc/cfgexpand.cc @@ -5358,7 +5358,8 @@ expand_debug_expr (tree exp) return simplify_gen_binary (MULT, mode, op0, op1); case RDIV_EXPR: - gcc_assert (FLOAT_MODE_P (mode)); + gcc_assert (FLOAT_MODE_P (mode) + || ALL_FIXED_POINT_MODE_P (mode)); /* Fall through. */ case TRUNC_DIV_EXPR: case EXACT_DIV_EXPR: diff --git a/gcc/optabs-tree.cc b/gcc/optabs-tree.cc index 9308a6dfd65..0de74c7966a 100644 --- a/gcc/optabs-tree.cc +++ b/gcc/optabs-tree.cc @@ -82,7 +82,8 @@ optab_for_tree_code (enum tree_code code, const_tree type, return unknown_optab; /* FALLTHRU */ case RDIV_EXPR: - gcc_assert (FLOAT_TYPE_P (type)); + gcc_assert (FLOAT_TYPE_P (type) + || ALL_FIXED_POINT_MODE_P (TYPE_MODE (type))); /* FALLTHRU */ case TRUNC_DIV_EXPR: case EXACT_DIV_EXPR: diff --git a/gcc/testsuite/gcc.target/arm/pr121065.c b/gcc/testsuite/gcc.target/arm/pr121065.c new file mode 100644 index 00000000000..dfc6059a46d --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr121065.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-mcpu=cortex-m55" } */ + +_Accum sa; +char c; + +void +div_csa () +{ + c /= sa; +} -- 2.50.0