[Sema] Support lax conversions for compound assignments
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 30 Sep 2016 22:19:38 +0000 (22:19 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 30 Sep 2016 22:19:38 +0000 (22:19 +0000)
commitc08cd4e20bcc7534ae4a7e13b97a92f0f16142ff
tree50a4e856828028d8e023aa3797dd10b147f57748
parent9cb915b7bed5f758d7bb9475fd617a7dba47f9f9
[Sema] Support lax conversions for compound assignments

Support lax convertions on compound assignment expressions like:

  typedef __attribute__((vector_size(8))) double float64x1_t;
  typedef __attribute__((vector_size(16))) double float64x2_t;
  float64x1_t vget_low_f64(float64x2_t __p0);

  double c = 3.0;
  float64x2_t v = {0.0, 1.0};
  c += vget_low_f64(v);

This restores one more valid behavior pre r266366, and is a incremental
follow up from work committed in r274646.

While here, make the check more strict, add FIXMEs, clean up variable
names to match what they can actually be and update testcases to reflect
that. We now reject:

  typedef float float2 __attribute__ ((vector_size (8)));
  double d;
  f2 += d;

which doesn't fit as a direct bitcast anyway.

Differential Revision: https://reviews.llvm.org/D24472

rdar://problem/28033929

llvm-svn: 282968
clang/lib/Sema/SemaExpr.cpp
clang/test/Sema/vector-cast.c