Message ID | 4E0E06EC.3050709@codesourcery.com |
---|---|
State | New |
Headers | show |
On 07/01/2011 10:42 AM, Bernd Schmidt wrote: > get_mode_bounds should also use GET_MODE_PRECISION, but this exposes a > problem on ia64 - BImode needs to be handled specially here to work > around another preexisting special case in gen_int_mode. Would it be better to remove the trunc_int_for_mode special case? It appears that I added that for ia64 and it's unchanged since... r~
On 07/06/11 20:37, Richard Henderson wrote: > On 07/01/2011 10:42 AM, Bernd Schmidt wrote: >> get_mode_bounds should also use GET_MODE_PRECISION, but this exposes a >> problem on ia64 - BImode needs to be handled specially here to work >> around another preexisting special case in gen_int_mode. > > Would it be better to remove the trunc_int_for_mode special case? > It appears that I added that for ia64 and it's unchanged since... That might require target specific changes if there are assumptions that a BImode value is either 0 or 1, not 0 or -1. For now I'd prefer to minimize the impact. Bernd
On 07/06/2011 04:04 PM, Bernd Schmidt wrote: > That might require target specific changes if there are assumptions that > a BImode value is either 0 or 1, not 0 or -1. For now I'd prefer to > minimize the impact. Systems that set STORE_FLAG_VALUE to -1: m68k spu Systems that use BImode: bfin ia64 mep sh rs6000 stormy16 There's no overlap. That said, I'm willing to approve the patch as-is. Certainly testing the signed-ness of the tree type seems preferable to just the mode, which can't tell signedness. r~
On 07/06/11 20:37, Richard Henderson wrote: > On 07/01/2011 10:42 AM, Bernd Schmidt wrote: >> get_mode_bounds should also use GET_MODE_PRECISION, but this exposes a >> problem on ia64 - BImode needs to be handled specially here to work >> around another preexisting special case in gen_int_mode. > > Would it be better to remove the trunc_int_for_mode special case? > It appears that I added that for ia64 and it's unchanged since... I tried that on ia64. It didn't bootstrap with the special case removed (configure-stage1-target-libgomp failure), and progressed further without the change. (It still failed with /usr/bin/ld: /opt/cfarm/gmp-4.2.4/lib/libgmp.a(errno.o): @gprel relocation against dynamic symbol __gmp_errno /usr/bin/ld: /opt/cfarm/gmp-4.2.4/lib/libgmp.a(errno.o): @gprel relocation against dynamic symbol __gmp_errno /usr/bin/ld: /opt/cfarm/gmp-4.2.4/lib/libgmp.a(errno.o): @gprel relocation against dynamic symbol __gmp_errno /usr/bin/ld: final link failed: Nonrepresentable section on output ) > That said, I'm willing to approve the patch as-is. I'll commit it then. Bernd
Index: gcc/stor-layout.c =================================================================== --- gcc/stor-layout.c.orig +++ gcc/stor-layout.c @@ -2439,11 +2439,26 @@ get_mode_bounds (enum machine_mode mode, enum machine_mode target_mode, rtx *mmin, rtx *mmax) { - unsigned size = GET_MODE_BITSIZE (mode); + unsigned size = GET_MODE_PRECISION (mode); unsigned HOST_WIDE_INT min_val, max_val; gcc_assert (size <= HOST_BITS_PER_WIDE_INT); + /* gen_int_mode performs an unwanted canonicalization for BImode. */ + if (mode == BImode) + { + if (sign) + { + *mmin = constm1_rtx; + *mmax = const0_rtx; + } + else + { + *mmin = const0_rtx; + *mmax = const1_rtx; + } + return; + } if (sign) { min_val = -((unsigned HOST_WIDE_INT) 1 << (size - 1));