diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-10-28 21:04:51 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-10-28 21:04:51 +0000 |
commit | 97574c57cf26ace9b8609575bbab66465924fef7 (patch) | |
tree | 6629e80a0c1643c5764bfcff920a90bf7a2fa59c /gcc/internal-fn.c | |
parent | 17fc6eeba9352b97ba16d64fd1de9a5bdc081062 (diff) | |
download | gcc-97574c57cf26ace9b8609575bbab66465924fef7.tar.gz |
* target.def (min_arithmetic_precision): New hook.
* doc/tm.texi.in (Misc): Add TARGET_MIN_ARITHMETIC_PRECISION.
* doc/tm.texi: Regenerate.
* internal-fn.c (expand_arith_overflow): Adjust handling of target
dependent support by means of TARGET_MIN_ARITHMETIC_PRECISION.
* targhooks.c (default_min_arithmetic_precision): New function.
* targhooks.h (default_min_arithmetic_precision): Declare.
* config/sparc/sparc.c (TARGET_MIN_ARITHMETIC_PRECISION): Define.
(sparc_min_arithmetic_precision): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241665 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/internal-fn.c')
-rw-r--r-- | gcc/internal-fn.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c index 1eeb15e4a50..168adc68105 100644 --- a/gcc/internal-fn.c +++ b/gcc/internal-fn.c @@ -1836,12 +1836,11 @@ expand_arith_overflow (enum tree_code code, gimple *stmt) return; } - /* For sub-word operations, if target doesn't have them, start - with precres widening right away, otherwise do it only - if the most simple cases can't be used. */ - if (WORD_REGISTER_OPERATIONS - && orig_precres == precres - && precres < BITS_PER_WORD) + /* For operations with low precision, if target doesn't have them, start + with precres widening right away, otherwise do it only if the most + simple cases can't be used. */ + const int min_precision = targetm.min_arithmetic_precision (); + if (orig_precres == precres && precres < min_precision) ; else if ((uns0_p && uns1_p && unsr_p && prec0 <= precres && prec1 <= precres) @@ -1876,7 +1875,7 @@ expand_arith_overflow (enum tree_code code, gimple *stmt) /* For sub-word operations, retry with a wider type first. */ if (orig_precres == precres && precop <= BITS_PER_WORD) { - int p = WORD_REGISTER_OPERATIONS ? BITS_PER_WORD : precop; + int p = MAX (min_precision, precop); enum machine_mode m = smallest_mode_for_size (p, MODE_INT); tree optype = build_nonstandard_integer_type (GET_MODE_PRECISION (m), uns0_p && uns1_p |