diff options
author | Kyrylo Tkachov <kyrylo.tkachov@arm.com> | 2017-02-08 09:14:39 +0000 |
---|---|---|
committer | Kyrylo Tkachov <ktkachov@gcc.gnu.org> | 2017-02-08 09:14:39 +0000 |
commit | 01726bc97785f6e66d6d882bf2b81077391603c5 (patch) | |
tree | c508e4c77ec2520564cb1350bc542510ae56ad46 /gcc | |
parent | d798497efc24b3787683cd31ead1863fa7a461f5 (diff) | |
download | gcc-01726bc97785f6e66d6d882bf2b81077391603c5.zip gcc-01726bc97785f6e66d6d882bf2b81077391603c5.tar.gz gcc-01726bc97785f6e66d6d882bf2b81077391603c5.tar.bz2 |
[riscv] Fix build due to INT16_MAX issue
* config/riscv/riscv.c (riscv_build_integer_1): Avoid use of INT16_MAX.
From-SVN: r245272
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/config/riscv/riscv.c | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b518e6..bb1e7e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2016-02-08 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * config/riscv/riscv.c (riscv_build_integer_1): Avoid use of INT16_MAX. + 2017-02-08 Richard Biener <rguenther@suse.de> PR tree-optimization/71824 diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index 834651f..89567f7 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) |