This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/6] Generate virtual locations for tokens


Dodji Seketeli wrote:

> libcpp/ChangeLog
> 2011-10-15  Tom Tromey  <tromey@redhat.com>
> 	    Dodji Seketeli  <dodji@redhat.com>
> 
> 	(cpp_get_token_1): New static function. Split and extended from
> 	cpp_get_token.  Use reached_end_of_context and
> 	consume_next_token_from_context.  Unify its return point.  Move
> 	the location tweaking from cpp_get_token_with_location in here.
> 	(cpp_get_token): Use cpp_get_token_1

Since this set of patches went in, I'm seeing weird errors when building
newlib for SPU:

/home/kwerner/dailybuild/spu-tc-2011-10-18/newlib-head/src/newlib/libm/machine/spu/headers/recipd2.h: In function '_recipd2':
/home/kwerner/dailybuild/spu-tc-2011-10-18/newlib-head/src/newlib/libm/machine/spu/headers/recipd2.h:129:3: note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts
/home/kwerner/dailybuild/spu-tc-2011-10-18/newlib-head/src/newlib/libm/machine/spu/headers/recipd2.h:129:13: error: incompatible types when assigning to type '__vector(4) int' from type '__vector(4) unsigned int'
/home/kwerner/dailybuild/spu-tc-2011-10-18/newlib-head/src/newlib/libm/machine/spu/headers/recipd2.h:131:10: error: incompatible types when assigning to type '__vector(4) int' from type '__vector(4) unsigned int'
/home/kwerner/dailybuild/spu-tc-2011-10-18/newlib-head/src/newlib/libm/machine/spu/headers/recipd2.h:132:10: error: incompatible types when assigning to type '__vector(4) int' from type '__vector(4) unsigned int'

The code in question looks like:

  vec_uint4 isinf, iszero, isdenorm0;
[snip]
  isdenorm0 = spu_cmpeq(spu_shuffle((vec_uint4)exp, (vec_uint4)exp, splat_hi), 0);

  isinf  = spu_cmpeq((vec_uint4)value_abs, (vec_uint4)expmask);
  iszero = spu_cmpeq((vec_uint4)value_abs, 0);

Note that isinf etc. *are* defined as *unsigned* vector types.

The problem seems to be that the preprocessor somehow stripped
off the "unsigned" keyword.  A reduced test case is:

#define isinf(__x)

#define vec_uint4 __vector unsigned int

vec_uint4 isinf;

(Using the name of a function-like macro as identifer is maybe a bit odd,
but should be perfectly legal C as far as I know ...)

Running this through "cc1 -E" on a SPU target before the patch set yields:

__attribute__((__spu_vector__)) unsigned int isinf;

as expected, but after the patch set we get:

__attribute__((__spu_vector__)) int isinf;

instead.

The problem is clearly related to the platform-specific "macro_to_expand"
routine that is used on SPU to implement the context-sensitive __vector
keyword.

With your changes to cpp_get_token (which is the sole caller of the
macro_to_expand callback), are there any changes in the interface
to the callback?  Any suggestions what could be going on here?

Note that the implementation of the callback is in
  config/spu/spu-c.c:spu_macro_to_expand


Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]