<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi,<div><br><div>This simple test case currently asserts because IRGen does not know how to generate Lvalue for</div><div>base expression “va.hi” of v2’s array reference (as in <span style="font-family: Menlo; font-size: 11px;">va.hi[1]).</span></div><div><span style="font-family: Menlo; font-size: 11px;"><br></span></div><div><span style="font-family: Menlo; font-size: 11px;">Specifically clang asserts here (in </span><span style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);">CodeGenFunction</span><span style="font-family: Menlo; font-size: 11px;">::EmitArraySubscriptExpr):</span></div><div><span style="font-family: Menlo; font-size: 11px;"><br></span></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0);"><span style="color: #000000"> </span>// If the base is a vector type, then we are forming a vector element lvalue</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0);"><span style="color: #000000"> </span>// with this subscript.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(49, 89, 93);"><span style="color: #000000"> </span><span style="color: #bb2ca2">if</span><span style="color: #000000"> (E-></span>getBase<span style="color: #000000">()-></span>getType<span style="color: #000000">()-></span>isVectorType<span style="color: #000000">()) {</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0);"><span style="color: #000000"> </span>// Emit the vector as an lvalue to get its address.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> <span style="color: #4f8187">LValue</span> LHS = <span style="color: #31595d">EmitLValue</span>(E-><span style="color: #31595d">getBase</span>());</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27);"><span style="color: #000000"> </span><span style="color: #78492a">assert</span><span style="color: #000000">(LHS.</span><span style="color: #31595d">isSimple</span><span style="color: #000000">() && </span>"Can only subscript lvalue vectors here!"<span style="color: #000000">);</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(49, 89, 93);"><span style="color: #000000"> </span><span style="color: #bb2ca2">return</span><span style="color: #000000"> </span><span style="color: #4f8187">LValue</span><span style="color: #000000">::</span>MakeVectorElt<span style="color: #000000">(LHS.</span>getAddress<span style="color: #000000">(), Idx,</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> E-><span style="color: #31595d">getBase</span>()-><span style="color: #31595d">getType</span>(), LHS.<span style="color: #31595d">getAlignment</span>());</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> }</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div><span style="font-family: Menlo; font-size: 11px;"><br></span></div><div><span style="font-family: Menlo; font-size: 11px;">// Test.</span></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">#include <stdio.h></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">void foo()</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">{</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> typedef __attribute__ ((ext_vector_type( 4))) double double4;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> double4 va;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> va.hi[1] = 4.0;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">}</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Any suggestion is appreciated.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">- Fariborz</div></div></body></html>