[PATCH] Fix part of PR45678

H.J. Lu hjl.tools@gmail.com
Fri Sep 17 13:20:00 GMT 2010


On Fri, Sep 17, 2010 at 5:39 AM, Richard Guenther <rguenther@suse.de> wrote:
> On Fri, 17 Sep 2010, H.J. Lu wrote:
>
>> On Fri, Sep 17, 2010 at 1:48 AM, Richard Guenther <rguenther@suse.de> wrote:
>> >
>> > This fixes part of PR45678 where memcpy folding lies about alignment
>> > of memory accesses.  Usually this shouldn't matter for !STRICT_ALIGNMENT
>> > targets but some targets are half strict-alignment but lie about that
>> > (x86_64 for example, where all vector modes require strict alignment).
>> > For those targets we require that they implement a movmisalign
>> > optab for the affected modes.
>> >
>> > Bootstrapped and tested on x86_64-unknown-linux-gnu, committed.
>> >
>> > Richard.
>> >
>> > 2010-09-17  Richard Guenther  <rguenther@suse.de>
>> >
>> >        PR middle-end/45678
>> >        * builtins.c (fold_builtin_memory_op): Always properly adjust
>> >        alignment of memory accesses.
>> >
>>
>> Could you please add the testcase in PR 45678?
>
> It isn't fixed - cfgexpand still messes up DECL_ALIGN as I said in
> the PR.
>

Even with this

---
typedef float V __attribute__ ((vector_size (16)));
V g;
float d[4] = { 4, 3, 2, 1 };

int
main ()
{
  V e;
  __builtin_memcpy (&e, &d, sizeof (d));
  V f = { 5, 15, 25, 35 };
  e = e * f;
  g = e;
  return 0;
}
---

There are 2 independent bugs, wrong alignment and the
cfgexpand issue.  We should fix and test them separately.



-- 
H.J.



More information about the Gcc-patches mailing list