Skip to content

Commit

Permalink
Merge pull request #2913 from ibuclaw/issue8543
Browse files Browse the repository at this point in the history
Issue 8543 - [CTFE] simd literals need better support
  • Loading branch information
WalterBright committed Dec 9, 2013
2 parents 2a7ecc3 + d9c404e commit bc8454a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/interpret.c
Expand Up @@ -3940,7 +3940,7 @@ bool interpretAssignToIndex(InterState *istate, Loc loc,
*/
if (aggregate->op == TOKindex || aggregate->op == TOKdotvar ||
aggregate->op == TOKslice || aggregate->op == TOKcall ||
aggregate->op == TOKstar)
aggregate->op == TOKstar || aggregate->op == TOKcast)
{
aggregate = aggregate->interpret(istate, ctfeNeedLvalue);
if (exceptionOrCantInterpret(aggregate))
Expand Down Expand Up @@ -4143,9 +4143,8 @@ Expression *interpretAssignToSlice(InterState *istate, CtfeGoal goal, Loc loc,
/* The only possible slicable LValue aggregates are array literals,
* and slices of array literals.
*/

if (aggregate->op == TOKindex || aggregate->op == TOKdotvar ||
aggregate->op == TOKslice ||
aggregate->op == TOKslice || aggregate->op == TOKcast ||
aggregate->op == TOKstar || aggregate->op == TOKcall)
{
aggregate = aggregate->interpret(istate, ctfeNeedLvalue);
Expand Down
32 changes: 32 additions & 0 deletions test/compilable/test8543.d
@@ -0,0 +1,32 @@

version (D_SIMD)
{
struct vfloat
{
public:
__vector(float[4]) f32;

this(float X) nothrow
{
f32.ptr[0] = X;
f32.ptr[1] = X;
f32.ptr[2] = X;
f32.ptr[3] = X;
}
this(float X, float Y, float Z, float W) nothrow
{
f32.array[0] = X;
f32.array[1] = Y;
f32.array[2] = Z;
f32.array[3] = W;
}
this(float[4] values) nothrow
{
f32.array = values;
}
}

immutable GvfGlobal_ThreeA = vfloat(3.0f);
immutable GvfGlobal_ThreeB = vfloat(3.0f, 3.0f, 3.0f, 3.0f);
immutable GvfGlobal_ThreeC = vfloat([3.0f, 3.0f, 3.0f, 3.0f]);
}

0 comments on commit bc8454a

Please sign in to comment.