aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-edge.cc
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2022-07-02 16:16:44 +0800
committerXi Ruoyao <xry111@xry111.site>2022-07-03 11:03:26 +0800
commitf150dc1bd11802b70277f0fa209f2d23695a1095 (patch)
tree9133d8fb81d95414f60ea7a3065c96e4d97bd7fd /gcc/gimple-range-edge.cc
parentb5c3dd3df381896b09fa76b52cd7a49b9b24afb3 (diff)
downloadgcc-f150dc1bd11802b70277f0fa209f2d23695a1095.zip
gcc-f150dc1bd11802b70277f0fa209f2d23695a1095.tar.gz
gcc-f150dc1bd11802b70277f0fa209f2d23695a1095.tar.bz2
loongarch: use -mno-check-zero-division as the default for optimized code
Integer division by zero is undefined behavior anyway, and there are already many platforms where neither the GCC port and the hardware do anything to trap on division by zero. So any portable program shall not rely on SIGFPE on division by zero, in both theory and practice. As the result, there is no real reason to cost two additional instructions just for the trap on division by zero with a new ISA. One remaining reason to trap on division by zero may be debugging, especially while -fsanitize=integer-divide-by-zero is not implemented for LoongArch yet. To make debugging easier, keep -mcheck-zero-division as the default for -O0 and -Og, but use -mno-check-zero-division as the default for all other optimization levels. Co-authored-by: Lulu Cheng <chenglulu@loongson.cn> gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_check_zero_div_p): New static function. (loongarch_idiv_insns): Use loongarch_check_zero_div_p instead of TARGET_CHECK_ZERO_DIV. (loongarch_output_division): Likewise. * common/config/loongarch/loongarch-common.cc (TARGET_DEFAULT_TARGET_FLAGS): Remove unneeded hook. * doc/invoke.texi: Update to match the new behavior. gcc/testsuite/ChangeLog: * gcc.c-torture/execute/20101011-1.c (dg-additional-options): add -mcheck-zero-division for LoongArch targets.
Diffstat (limited to 'gcc/gimple-range-edge.cc')
0 files changed, 0 insertions, 0 deletions