This is the mail archive of the 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: [rfc] multi-word subreg lowering pass

On Sat, 7 May 2005 18:35:51 -0700, Richard Henderson wrote:
> For AND, IOR, XOR, you should be able to delete the multi-word patterns
> entirely, and leave those operations to be generated by the middle-end.

This will not work for the current CVS version, which requires operations for
mode_for_size(sizeof(int),MODE_INT,0) mode is present (at least for xor).

long long foo (double x, double y)
  return !__builtin_isunordered (x, y);

If it compiled (without any optimizations), the gimple form is:

foo (x, y)
  long long int D.1390;
  _Bool D.1391;
  int D.1392;

  D.1391 = x unord y;
  D.1392 = !D.1391;
  D.1390 = (long long int) D.1392;
  return D.1390;

sizeof(_Bool) is 1 for most architectures. expand_binop for D.1392 =
!D.1391 will be called with a QI Register and (CONST_INT 1) as operands and a result
register with mode_for_size(sizeof(int),MODE_INT,0) mode.

On i386, the result will be a SI register. As xor for SI mode is available,
the following case will be used:

  if (methods != OPTAB_MUST_WIDEN
      && binoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
In this case, the QI operands are converted to the right mode.

On AVR, word_mode is 1, while sizeof(int) is 2 (unless an option is
specified). Therefore the result will be a HI register.  If xor would
only be available for QI mode, the following case will be used:

  /* These can be done a word at a time.  */
  if ((binoptab == and_optab || binoptab == ior_optab || binoptab == xor_optab)
      && class == MODE_INT
      && GET_MODE_SIZE (mode) > UNITS_PER_WORD
      && binoptab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing)

Here operand_subword_force will be called for a QI operand (with
mode=HI as parameter), which will cause an internal compiler error.

mfg Martin Kögler

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