<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Sep 29, 2014 at 11:36 AM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Richard,<br>
<br>
What does all of this suggest to you about the right design?<br></blockquote><div><br></div>One more question. Given:<div><br></div><div>  typedef int * __attribute__((align_value(32))) *Y;</div><div><br></div><div>... does the attribute apply to the outer pointer or the inner pointer? (My guess: it surprisingly applies to the outer pointer.) If that's the case, then I think align_value should live entirely outside the type system, in the same way that __attribute__((aligned)) does. Note that, given:</div><div><br></div><div>  typedef int __attribute__((aligned(64))) *p __attribute__((aligned(8)))<br></div><div><br></div><div>p is a 64-byte-aligned pointer to int, not an 8-byte-aligned pointer to a 64-byte-aligned int.</div><div><br></div><div>If that's the case, I suggest you model it exactly like AlignedAttr -- as an attribute on the TypedefDecl -- and look for it explicitly in the cases where you want to use it by walking the type sugar and looking for a TypedefDecl.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
FWIW, maybe creating some kind of synthetic typedef type for the return value from DeduceTemplateArgumentsByTypeMatch would work?<br>
<br>
Thanks again,<br>
Hal<br>
<span class="im"><br>
----- Original Message -----<br>
> From: "Alexey Bataev" <<a href="mailto:a.bataev@hotmail.com">a.bataev@hotmail.com</a>><br>
</span><div class=""><div class="h5">> To: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>>, <a href="mailto:reviews%2BD4635%2Bpublic%2Bb7e82bdc1d8c324a@reviews.llvm.org">reviews+D4635+public+b7e82bdc1d8c324a@reviews.llvm.org</a><br>
> Cc: <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a>, "aaron ballman" <<a href="mailto:aaron.ballman@gmail.com">aaron.ballman@gmail.com</a>>, <a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a>, <a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a><br>
> Sent: Friday, September 26, 2014 12:26:29 AM<br>
> Subject: Re: [PATCH] align_value attribute in Clang<br>
><br>
> 1. ICC does not create a new type for type with this attribute. All<br>
> types are still the same.<br>
> 2.<br>
><br>
> int n __attribute__((aligned(32)));<br>
> decltype(&n) - int*.<br>
><br>
><br>
> Best regards,<br>
> Alexey Bataev<br>
> =============<br>
> Software Engineer<br>
> Intel Compiler Team<br>
><br>
> 26.09.2014 4:28, Hal Finkel пишет:<br>
> > ----- Original Message -----<br>
> >> From: "Richard Smith" <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>><br>
> >> To: <a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>, "aaron ballman" <<a href="mailto:aaron.ballman@gmail.com">aaron.ballman@gmail.com</a>>,<br>
> >> <a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a>, <a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>, "a<br>
> >> bataev" <<a href="mailto:a.bataev@hotmail.com">a.bataev@hotmail.com</a>><br>
> >> Cc: <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> >> Sent: Thursday, September 25, 2014 7:06:33 PM<br>
> >> Subject: Re: [PATCH] align_value attribute in Clang<br>
> >><br>
> >> I'd like some more information about how ICC treats this<br>
> >> attribute.<br>
> >> Does it produce a new type? For instance:<br>
> > I did a quick experiment with icc (ICC) 14.0.1 20131008 (with -Wall<br>
> > -O3 -pedantic):<br>
> ><br>
> >>    typedef int *I32 __attribute__((align_value(32)));<br>
> >>    typedef int *I64 __attribute__((align_value(64)));<br>
> >><br>
> >>    typedef I32 X; typedef I64 X; // ill-formed?<br>
> > No diagnostic.<br>
> ><br>
> >>    template<typename> struct Y;<br>
> >>    typedef Y<I32> Z; typedef Y<I64> Z; // ill-formed?<br>
> > No diagnostic.<br>
> ><br>
> >>    extern I32 i32;<br>
> >>    I64 i64 = i32; // ill-formed? Is an explicit cast required?<br>
> > No diagnostic.<br>
> ><br>
> >>    I32 i32 = i64; // ill-formed? Is there an implicit conversion<br>
> >>    that<br>
> >>    discards alignment?<br>
> > No diagnostic.<br>
> ><br>
> > Alexey, can you please comment on the specifics?<br>
> ><br>
> >   -Hal<br>
> ><br>
> >> ... and if there's an implicit conversion that discards alignment,<br>
> >> what is its conversion rank?<br>
> >><br>
> >> If I have:<br>
> >><br>
> >>    int n __attribute__((aligned(32)));<br>
> >><br>
> >> ... then what is `decltype(&n)`? Is it `int*`, or `int*<br>
> >> __attribute__((align_value(32)))`?<br>
> >><br>
> >> <a href="http://reviews.llvm.org/D4635" target="_blank">http://reviews.llvm.org/D4635</a><br>
> >><br>
> >><br>
> >><br>
><br>
><br>
<br>
</div></div><div class=""><div class="h5">--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
</div></div></blockquote></div><br></div></div>