[cfe-dev] How do I get the Lvalue for va.hi of a ext_vector_type

jahanian fjahanian at apple.com
Fri Aug 15 15:56:26 PDT 2014


Hi,

This simple test case currently asserts because IRGen does not know how to generate Lvalue for
base expression “va.hi”  of v2’s array reference (as in va.hi[1]).

Specifically clang asserts here (in CodeGenFunction::EmitArraySubscriptExpr):

  // If the base is a vector type, then we are forming a vector element lvalue
  // with this subscript.
  if (E->getBase()->getType()->isVectorType()) {
    // Emit the vector as an lvalue to get its address.
    LValue LHS = EmitLValue(E->getBase());
    assert(LHS.isSimple() && "Can only subscript lvalue vectors here!");
    return LValue::MakeVectorElt(LHS.getAddress(), Idx,
                                 E->getBase()->getType(), LHS.getAlignment());
  }


// Test.
#include <stdio.h>

void foo()
{
  typedef __attribute__ ((ext_vector_type( 4))) double double4;

  double4 va;
  va.hi[1] = 4.0;
}

Any suggestion is appreciated.

- Fariborz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140815/a1b2a834/attachment.html>


More information about the cfe-dev mailing list