From: Kyrylo Tkachov Date: Wed, 8 Feb 2017 09:14:39 +0000 (+0000) Subject: [riscv] Fix build due to INT16_MAX issue X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=01726bc97785f6e66d6d882bf2b81077391603c5;p=gcc.git [riscv] Fix build due to INT16_MAX issue * config/riscv/riscv.c (riscv_build_integer_1): Avoid use of INT16_MAX. From-SVN: r245272 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b518e68aed..bb1e7e99556 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-02-08 Kyrylo Tkachov + + * config/riscv/riscv.c (riscv_build_integer_1): Avoid use of INT16_MAX. + 2017-02-08 Richard Biener PR tree-optimization/71824 diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index 834651f4214..89567f72b71 100644 --- a/gcc/config/riscv/riscv.c +++ b/gcc/config/riscv/riscv.c @@ -356,7 +356,9 @@ riscv_build_integer_1 (struct riscv_integer_op codes[RISCV_MAX_INTEGER_OPS], /* End with ADDI. When constructing HImode constants, do not generate any intermediate value that is not itself a valid HImode constant. The XORI case below will handle those remaining HImode constants. */ - if (low_part != 0 && (mode != HImode || value - low_part <= INT16_MAX)) + if (low_part != 0 + && (mode != HImode + || value - low_part <= ((1 << (GET_MODE_BITSIZE (HImode) - 1)) - 1))) { alt_cost = 1 + riscv_build_integer_1 (alt_codes, value - low_part, mode); if (alt_cost < cost)