summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-09-30 22:19:38 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-09-30 22:19:38 +0000
commitc08cd4e20bcc7534ae4a7e13b97a92f0f16142ff (patch)
tree50a4e856828028d8e023aa3797dd10b147f57748 /clang/test
parent9cb915b7bed5f758d7bb9475fd617a7dba47f9f9 (diff)
downloadbcm5719-llvm-c08cd4e20bcc7534ae4a7e13b97a92f0f16142ff.tar.gz
bcm5719-llvm-c08cd4e20bcc7534ae4a7e13b97a92f0f16142ff.zip
[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
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/vector-cast.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/test/Sema/vector-cast.c b/clang/test/Sema/vector-cast.c
index c0382892b69..ea4acfac6a0 100644
--- a/clang/test/Sema/vector-cast.c
+++ b/clang/test/Sema/vector-cast.c
@@ -53,14 +53,13 @@ void f4() {
float2 f2;
double d, a, b, c;
float64x2_t v = {0.0, 1.0};
- f2 += d;
+ // FIXME: These diagnostics are inaccurate: should complain that 'double' to vector 'float2' involves truncation
+ f2 += d; // expected-error {{cannot convert between vector values of different size ('float2' (vector of 2 'float' values) and 'double')}}
+ d += f2; // expected-error {{cannot convert between vector values of different size}}
a = 3.0 + vget_low_f64(v);
b = vget_low_f64(v) + 3.0;
c = vget_low_f64(v);
- // LAX conversions within compound assignments are not supported.
- // FIXME: This diagnostic is inaccurate.
- d += f2; // expected-error {{cannot convert between vector values of different size}}
- c -= vget_low_f64(v); // expected-error {{cannot convert between vector values of different size}}
+ c -= vget_low_f64(v);
// LAX conversions between scalar and vector types require same size and one element sized vectors.
d = f2; // expected-error {{assigning to 'double' from incompatible type 'float2'}}
d = d + f2; // expected-error {{assigning to 'double' from incompatible type 'float2'}}
OpenPOWER on IntegriCloud