Message ID | 5899A52E.1000809@foss.arm.com |
---|---|
State | New |
Headers | show |
Approved. And thanks for the reminder about the MAINTAINERS file. On Tue, Feb 7, 2017 at 2:45 AM, Kyrill Tkachov <kyrylo.tkachov@foss.arm.com> wrote: > Hi all, > > I tried building a cc1 for riscv-x-elf and I got a build error about > INT16_MAX not being defined on my system. > I think it's not a standard macro. This patch fixes that with what I think > is the equivalent definition using > GCC modes logic. > > With this my build proceeds to build a cc1 successfully. No testing beyond > that. > > Is this ok for trunk? > > Thanks, > Kyrill > > P.S. Palmer, Andrew, I didn't see your names and emails in the MAINTAINERS > file, you should update that when > you get the chance. > > > 2016-02-07 Kyrylo Tkachov <kyrylo.tkachov@arm.com> > > * config/riscv/riscv.c (riscv_build_integer_1): Avoid use of INT16_MAX.
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)