<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1049841944;
        mso-list-type:hybrid;
        mso-list-template-ids:1883672006 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:.25in;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:.75in;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:1.25in;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:1.75in;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:2.25in;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:2.75in;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:3.25in;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:3.75in;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:4.25in;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hello folks,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I prepared a patch with initial implementation of Neon scalar instructions.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The patch was built on top of Kevin’s SIMD copy patch still under review (UMOV, SMOV, INS instructions). Once his patch is merged, I will update mine and re-submit it.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>In the meanwhile I would like to discuss a couple of implementation decisions made in the patches before we proceed with implementation of the other Neon scalar instructions.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I implemented some of the Scalar Arithmetic and Scalar Reduce Pairwise instructions to illustrate the change. Complete implementation of these instructions will come in subsequent patches, once we agree on the items below.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoListParagraph style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>1)<span style='font:7.0pt "Times New Roman"'>      </span></span><![endif]>Extended support in the backend for one-element vectors of size <= 64 bits, e.g. v1i8, v1i16, v1i32, v1f32, v1f64, v1i64.<o:p></o:p></p><p class=MsoListParagraph style='margin-left:.25in'>This is a change in the the SelectionDAG (or TableGen) level, by adding new types to include/llvm/CodeGen/ValueTypes.td.<o:p></o:p></p><p class=MsoListParagraph style='margin-left:.25in'>This is so that we can distinguish code generation for example that uses float32_t  and float32x1_t.<o:p></o:p></p><p class=MsoListParagraph style='margin-left:.25in'><o:p> </o:p></p><p class=MsoListParagraph style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>2)<span style='font:7.0pt "Times New Roman"'>      </span></span><![endif]>Associated types v1i8, v1i16, v1i32 with FPR8, FPR16, FPR32 register classes.<o:p></o:p></p><p class=MsoNormal style='margin-left:.25in'><o:p> </o:p></p><p class=MsoNormal style='margin-left:.25in'>I associated these types with the FPR register classes because they are printed as scalar registers “b”, “h”, “s”, “d” in the Neon scalar instructions.<o:p></o:p></p><p class=MsoNormal style='margin-left:.25in'><o:p> </o:p></p><p class=MsoNormal style='margin-left:.25in'>In situations where these types have to be mapped to instructions that use the vector form “v”, I make use of EXTRACT_SUBREG and SUBREG_TO_REG operations to construct the patterns.<o:p></o:p></p><p class=MsoNormal style='margin-left:.25in'><o:p> </o:p></p><p class=MsoNormal style='margin-left:.25in'>Note: <o:p></o:p></p><p class=MsoNormal style='margin-left:.25in'>I can also remove v1i64 from VPR64 register class and associate it with FPR64.<o:p></o:p></p><p class=MsoNormal style='margin-left:.25in'>I have not done so in this patch because it would be a lot of changes at once. <o:p></o:p></p><p class=MsoNormal style='margin-left:.25in'>I have to update the patterns already defined to add EXTRACT_SUBREG and SUBREG_TO_REG operations.<o:p></o:p></p><p class=MsoNormal style='margin-left:.25in'>If we agree this is preferred, I can provide this change as an additional patch.<o:p></o:p></p><p class=MsoNormal style='margin-left:.25in'><o:p> </o:p></p><p class=MsoListParagraph style='margin-left:.25in;text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>3)<span style='font:7.0pt "Times New Roman"'>      </span></span><![endif]>The ACLE Scalar intrinsics (i.e., C level intrinsics for end-user defined in arm_neon.h) use Clang builtins with scalar types.<o:p></o:p></p><p class=MsoListParagraph style='margin-left:.25in'>In CGBuiltin the Clang builtins are translated to LLVM IR intrinsics with v1ix and v1if vector types as input/return types.<o:p></o:p></p><p class=MsoListParagraph style='margin-left:.25in'>It does not look like I can translate these builtins into simple IR operations in CGBuiltin. <o:p></o:p></p><p class=MsoListParagraph style='margin-left:.25in'>Example:<o:p></o:p></p><p class=MsoNormal>      Because the Clang builtins use scalar types, if in CGBuiltin I transform the code below into an IR operation using CreateAdd, the code is optimized and results in the machine instruction ‘add X0, X1, X0’, which is not what we want.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>     int64_t vaddd_s64(int64_t a, int64_t b) {<o:p></o:p></p><p class=MsoNormal>       return (int64_t) vadd_s64((int64x1_t(a), int64x1_t(b));  -<span style='font-family:Wingdings'>ą</span> becomes add x0, x1, x0<o:p></o:p></p><p class=MsoNormal>    }<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>   But in the td file we can still add the instructions selection patterns with IR operations that we want.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Let me know what you think about these decisions and if you prefer another  way to handle Neon Scalar instructions and intrinsics.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks,<o:p></o:p></p><p class=MsoNormal>Ana.<o:p></o:p></p></div></body></html>