On Thu, 2015-02-26 at 10:36 -0500, David Edelsohn wrote:

> My one concern is the interaction between TARGET_ALLOW_MOVMISALIGN and
> TARGET_EFFICIENT_UNALIGNED_VSX in the movmisalign<mode> pattern in
> vector.md.  Your patch changes
> rs6000_builtin_support_vector_misalignment to return TRUE if
> TARGET_EFFICIENT_UNALIGNED_VSX is enabled, which seems to enable the
> use of the movmisalign<mode> pattern, but the pattern final condition
> depends on TARGET_ALLOW_MOVMISALIGN.
> 
> -mcpu=power8 will enable both flags, but if a user manually overrides
> one or both flags, the hook could return TRUE while the pattern is
> disabled, which would lead to an ICE.  The relationship between the
> hook and the pattern need to be consistent.  I'm not sure about the
> best way to rationalize it.
> 
> Thanks, David
> 

This is a good point.  I think the following is probably the right way
to fix this:

  /* Determine when unaligned vector accesses are permitted, and when           
     they are preferred over masked Altivec loads.  Note that if                
     TARGET_ALLOW_MOVMISALIGN has been disabled by the user, then               
     TARGET_EFFICIENT_UNALIGNED_VSX must be as well.  The converse              
     is not true.  */

  if (TARGET_EFFICIENT_UNALIGNED_VSX == -1) {
    if (TARGET_VSX && rs6000_cpu == PROCESSOR_POWER8
        && TARGET_ALLOW_MOVMISALIGN != 0)
      TARGET_EFFICIENT_UNALIGNED_VSX = 1;
    else
      TARGET_EFFICIENT_UNALIGNED_VSX = 0;
  }

  if (TARGET_ALLOW_MOVMISALIGN == -1 && rs6000_cpu == PROCESSOR_POWER8)
    TARGET_ALLOW_MOVMISALIGN = 1;


That is, determine TARGET_EFFICIENT_UNALIGNED_VSX first, and only allow
it if TARGET_ALLOW_MOVMISALIGN hasn't been specifically disabled.  Sound
reasonable?

Bill

Reply via email to