<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Yvan,<br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Sorry for this, it should now be fixed  in
<span class="rpHighlightAllClass rpHighlightSubjectClass" role="heading" aria-level="2" title="">
r367823.</span></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Thanks,</p>
<p style="margin-top:0;margin-bottom:0">Anastasia<br>
</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Yvan Roux <yvan.roux@linaro.org><br>
<b>Sent:</b> 02 August 2019 14:09<br>
<b>To:</b> Anastasia Stulova <Anastasia.Stulova@arm.com><br>
<b>Cc:</b> cfe-commits <cfe-commits@lists.llvm.org><br>
<b>Subject:</b> Re: r367675 - [OpenCL] Allow OpenCL C style vector initialization in C++</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi Anastasia,<br>
<br>
This commit broke ARMv8 bots, logs are available here:<br>
<br>
<a href="http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/14655/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Avector_literals_valid.cl">http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/14655/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Avector_literals_valid.cl</a><br>
<br>
Thanks,<br>
Yvan<br>
<br>
On Fri, 2 Aug 2019 at 13:18, Anastasia Stulova via cfe-commits<br>
<cfe-commits@lists.llvm.org> wrote:<br>
><br>
> Author: stulova<br>
> Date: Fri Aug  2 04:19:35 2019<br>
> New Revision: 367675<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=367675&view=rev">http://llvm.org/viewvc/llvm-project?rev=367675&view=rev</a><br>
> Log:<br>
> [OpenCL] Allow OpenCL C style vector initialization in C++<br>
><br>
> Allow creating vector literals from other vectors.<br>
><br>
>  float4 a = (float4)(1.0f, 2.0f, 3.0f, 4.0f);<br>
>  float4 v = (float4)(a.s23, a.s01);<br>
><br>
> Differential revision: <a href="https://reviews.llvm.org/D65286">https://reviews.llvm.org/D65286</a><br>
><br>
><br>
> Removed:<br>
>     cfe/trunk/test/CodeGenOpenCL/vector_literals_nested.cl<br>
>     cfe/trunk/test/SemaOpenCL/vector_literals_const.cl<br>
> Modified:<br>
>     cfe/trunk/lib/Sema/SemaInit.cpp<br>
>     cfe/trunk/test/CodeGenOpenCL/vector_literals_valid.cl<br>
>     cfe/trunk/test/SemaCXX/vector.cpp<br>
><br>
> Modified: cfe/trunk/lib/Sema/SemaInit.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=367675&r1=367674&r2=367675&view=diff">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=367675&r1=367674&r2=367675&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Sema/SemaInit.cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Aug  2 04:19:35 2019<br>
> @@ -1289,7 +1289,16 @@ void InitListChecker::CheckSubElementTyp<br>
>      // FIXME: Better EqualLoc?<br>
>      InitializationKind Kind =<br>
>          InitializationKind::CreateCopy(expr->getBeginLoc(), SourceLocation());<br>
> -    InitializationSequence Seq(SemaRef, Entity, Kind, expr,<br>
> +<br>
> +    // Vector elements can be initialized from other vectors in which case<br>
> +    // we need initialization entity with a type of a vector (and not a vector<br>
> +    // element!) initializing multiple vector elements.<br>
> +    auto TmpEntity =<br>
> +        (ElemType->isExtVectorType() && !Entity.getType()->isExtVectorType())<br>
> +            ? InitializedEntity::InitializeTemporary(ElemType)<br>
> +            : Entity;<br>
> +<br>
> +    InitializationSequence Seq(SemaRef, TmpEntity, Kind, expr,<br>
>                                 /*TopLevelOfInitList*/ true);<br>
><br>
>      // C++14 [dcl.init.aggr]p13:<br>
> @@ -1300,8 +1309,7 @@ void InitListChecker::CheckSubElementTyp<br>
>      // assignment-expression.<br>
>      if (Seq || isa<InitListExpr>(expr)) {<br>
>        if (!VerifyOnly) {<br>
> -        ExprResult Result =<br>
> -          Seq.Perform(SemaRef, Entity, Kind, expr);<br>
> +        ExprResult Result = Seq.Perform(SemaRef, TmpEntity, Kind, expr);<br>
>          if (Result.isInvalid())<br>
>            hadError = true;<br>
><br>
><br>
> Removed: cfe/trunk/test/CodeGenOpenCL/vector_literals_nested.cl<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/vector_literals_nested.cl?rev=367674&view=auto">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/vector_literals_nested.cl?rev=367674&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/test/CodeGenOpenCL/vector_literals_nested.cl (original)<br>
> +++ cfe/trunk/test/CodeGenOpenCL/vector_literals_nested.cl (removed)<br>
> @@ -1,23 +0,0 @@<br>
> -// RUN: %clang_cc1 %s -emit-llvm -O3 -o - | FileCheck %s<br>
> -<br>
> -typedef int int2 __attribute((ext_vector_type(2)));<br>
> -typedef int int4 __attribute((ext_vector_type(4)));<br>
> -<br>
> -__constant const int4 itest1 = (int4)(1, 2, ((int2)(3, 4)));<br>
> -// CHECK: constant <4 x i32> <i32 1, i32 2, i32 3, i32 4><br>
> -__constant const int4 itest2 = (int4)(1, 2, ((int2)(3)));<br>
> -// CHECK: constant <4 x i32> <i32 1, i32 2, i32 3, i32 3><br>
> -<br>
> -typedef float float2 __attribute((ext_vector_type(2)));<br>
> -typedef float float4 __attribute((ext_vector_type(4)));<br>
> -<br>
> -void ftest1(float4 *p) {<br>
> -  *p = (float4)(1.1f, 1.2f, ((float2)(1.3f, 1.4f)));<br>
> -// CHECK: store <4 x float> <float 0x3FF19999A0000000, float 0x3FF3333340000000, float 0x3FF4CCCCC0000000, float 0x3FF6666660000000><br>
> -}<br>
> -<br>
> -float4 ftest2(float4 *p) {<br>
> -   *p =  (float4)(1.1f, 1.2f, ((float2)(1.3f)));<br>
> -// CHECK: store <4 x float> <float 0x3FF19999A0000000, float 0x3FF3333340000000, float 0x3FF4CCCCC0000000, float 0x3FF4CCCCC0000000><br>
> -}<br>
> -<br>
><br>
> Modified: cfe/trunk/test/CodeGenOpenCL/vector_literals_valid.cl<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/vector_literals_valid.cl?rev=367675&r1=367674&r2=367675&view=diff">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/vector_literals_valid.cl?rev=367675&r1=367674&r2=367675&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/test/CodeGenOpenCL/vector_literals_valid.cl (original)<br>
> +++ cfe/trunk/test/CodeGenOpenCL/vector_literals_valid.cl Fri Aug  2 04:19:35 2019<br>
> @@ -1,22 +1,65 @@<br>
> -// RUN: %clang_cc1 -emit-llvm %s -o %t<br>
> +// RUN: %clang_cc1 -emit-llvm %s -o - -O0 | FileCheck %s<br>
> +// RUN: %clang_cc1 -emit-llvm %s -o - -cl-std=clc++ -O0 | FileCheck %s<br>
><br>
> -typedef __attribute__(( ext_vector_type(2) ))  int int2;<br>
> -typedef __attribute__(( ext_vector_type(3) ))  int int3;<br>
> -typedef __attribute__(( ext_vector_type(4) ))  int int4;<br>
> -typedef __attribute__(( ext_vector_type(8) ))  int int8;<br>
> -typedef __attribute__(( ext_vector_type(4) ))  float float4;<br>
> +typedef __attribute__((ext_vector_type(2))) int int2;<br>
> +typedef __attribute__((ext_vector_type(3))) int int3;<br>
> +typedef __attribute__((ext_vector_type(4)))  int int4;<br>
> +typedef __attribute__((ext_vector_type(8)))  int int8;<br>
> +typedef __attribute__((ext_vector_type(4))) float float4;<br>
> +<br>
> +__constant const int4 c1 = (int4)(1, 2, ((int2)(3)));<br>
> +// CHECK: constant <4 x i32> <i32 1, i32 2, i32 3, i32 3><br>
> +<br>
> +__constant const int4 c2 = (int4)(1, 2, ((int2)(3, 4)));<br>
> +// CHECK: constant <4 x i32> <i32 1, i32 2, i32 3, i32 4><br>
><br>
>  void vector_literals_valid() {<br>
> -  int4 a_1_1_1_1 = (int4)(1,2,3,4);<br>
> -  int4 a_2_1_1 = (int4)((int2)(1,2),3,4);<br>
> -  int4 a_1_2_1 = (int4)(1,(int2)(2,3),4);<br>
> -  int4 a_1_1_2 = (int4)(1,2,(int2)(3,4));<br>
> -  int4 a_2_2 = (int4)((int2)(1,2),(int2)(3,4));<br>
> -  int4 a_3_1 = (int4)((int3)(1,2,3),4);<br>
> -  int4 a_1_3 = (int4)(1,(int3)(2,3,4));<br>
> +  //CHECK: insertelement <4 x i32> <i32 1, i32 2, i32 undef, i32 undef>, i32 %{{.+}}, i32 2<br>
> +  //CHECK: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 3<br>
> +  int4 a_1_1_1_1 = (int4)(1, 2, c1.s2, c2.s3);<br>
> +<br>
> +  //CHECK: store <2 x i32> <i32 1, i32 2>, <2 x i32>*<br>
> +  //CHECK: shufflevector <2 x i32> %{{[0-9]+}}, <2 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef><br>
> +  //CHECK: shufflevector <4 x i32> %{{.+}}, <4 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef><br>
> +  //CHECK: insertelement <4 x i32> %{{.+}}, i32 3, i32 2<br>
> +  //CHECK: insertelement <4 x i32> %{{.+}}, i32 4, i32 3<br>
> +  int4 a_2_1_1 = (int4)((int2)(1, 2), 3, 4);<br>
> +<br>
> +  //CHECK: store <2 x i32> <i32 2, i32 3>, <2 x i32>*<br>
> +  //CHECK: shufflevector <2 x i32> %{{[0-9]+}}, <2 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef><br>
> +  //CHECK: shufflevector <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>, <4 x i32> %{{.+}}, <4 x i32> <i32 0, i32 4, i32 5, i32 undef><br>
> +  //CHECK: insertelement <4 x i32> %{{.+}}, i32 4, i32 3<br>
> +  int4 a_1_2_1 = (int4)(1, (int2)(2, 3), 4);<br>
> +<br>
> +  //CHECK: store <2 x i32> <i32 3, i32 4>, <2 x i32>*<br>
> +  //CHECK: shufflevector <2 x i32> %{{[0-9]+}}, <2 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef><br>
> +  //CHECK: shufflevector <4 x i32> <i32 1, i32 2, i32 undef, i32 undef>, <4 x i32> %{{.+}}, <4 x i32> <i32 0, i32 1, i32 4, i32 5><br>
> +  int4 a_1_1_2 = (int4)(1, 2, (int2)(3, 4));<br>
> +<br>
> +  //CHECK: store <2 x i32> <i32 1, i32 2>, <2 x i32>*<br>
> +  //CHECK: shufflevector <2 x i32> %{{[0-9]+}}, <2 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef><br>
> +  //CHECK: shufflevector <4 x i32> %{{.+}}, <4 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef><br>
> +  //CHECK: shufflevector <4 x i32> %{{.+}}, <4 x i32> <i32 3, i32 3, i32 undef, i32 undef>, <4 x i32> <i32 0, i32 1, i32 4, i32 5><br>
> +  int4 a_2_2 = (int4)((int2)(1, 2), (int2)(3));<br>
> +<br>
> +  //CHECK: store <4 x i32> <i32 2, i32 3, i32 4, i32 undef>, <4 x i32>*<br>
> +  //CHECK: shufflevector <4 x i32> %{{.+}}, <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2><br>
> +  //CHECK: shufflevector <3 x i32> %{{.+}}, <3 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 undef><br>
> +  //CHECK: shufflevector <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>, <4 x i32> %{{.+}}, <4 x i32> <i32 0, i32 4, i32 5, i32 6><br>
> +  int4 a_1_3 = (int4)(1, (int3)(2, 3, 4));<br>
> +<br>
> +  //CHECK: store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %a<br>
>    int4 a = (int4)(1);<br>
> -  int8 b = (int8)(1,2,a.xy,a);<br>
> -  float4 V2 = (float4) (1);<br>
> -}<br>
><br>
> +  //CHECK: load <4 x i32>, <4 x i32>* %a, align 16<br>
> +  //CHECK: shufflevector <4 x i32> %{{[0-9]+}}, <4 x i32> undef, <2 x i32> <i32 0, i32 1><br>
> +  //CHECK: shufflevector <2 x i32> %{{[0-9]+}}, <2 x i32> undef, <8 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef><br>
> +  //CHECK: shufflevector <8 x i32> <i32 1, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>, <8 x i32> %{{.+}}, <8 x i32> <i32 0, i32 1, i32 8, i32 9, i32 undef, i32 undef, i32 undef, i32 undef><br>
> +  //CHECK: load <4 x i32>, <4 x i32>* %a, align 16<br>
> +  //CHECK: shufflevector <4 x i32> %{{[0-9]+}}, <4 x i32> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef><br>
> +  //CHECK: shufflevector <8 x i32> %{{.+}}, <8 x i32> %{{.+}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11><br>
> +  int8 b = (int8)(1, 2, a.xy, a);<br>
><br>
> +  //CHECK: store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %V2<br>
> +  float4 V2 = (float4)(1);<br>
> +}<br>
><br>
> Modified: cfe/trunk/test/SemaCXX/vector.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/vector.cpp?rev=367675&r1=367674&r2=367675&view=diff">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/vector.cpp?rev=367675&r1=367674&r2=367675&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/test/SemaCXX/vector.cpp (original)<br>
> +++ cfe/trunk/test/SemaCXX/vector.cpp Fri Aug  2 04:19:35 2019<br>
> @@ -334,3 +334,11 @@ void Init() {<br>
>  }<br>
><br>
>  } // namespace Templates<br>
> +<br>
> +typedef int inte2 __attribute__((__ext_vector_type__(2)));<br>
> +<br>
> +void test_vector_literal(inte4 res) {<br>
> +  inte2 a = (inte2)(1, 2); //expected-warning{{expression result unused}}<br>
> +  inte4 b = (inte4)(a, a); //expected-error{{C-style cast from vector 'inte2' (vector of 2 'int' values) to vector 'inte4' (vector of 4 'int' values) of different size}} //expected-warning{{expression result unused}}<br>
> +}<br>
> +<br>
><br>
> Removed: cfe/trunk/test/SemaOpenCL/vector_literals_const.cl<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/vector_literals_const.cl?rev=367674&view=auto">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/vector_literals_const.cl?rev=367674&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/test/SemaOpenCL/vector_literals_const.cl (original)<br>
> +++ cfe/trunk/test/SemaOpenCL/vector_literals_const.cl (removed)<br>
> @@ -1,27 +0,0 @@<br>
> -// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only<br>
> -// expected-no-diagnostics<br>
> -<br>
> -typedef int int2 __attribute((ext_vector_type(2)));<br>
> -typedef int int3 __attribute((ext_vector_type(3)));<br>
> -typedef int int4 __attribute((ext_vector_type(4)));<br>
> -<br>
> -__constant int4 i_1_1_1_1 = (int4)(1,2,3,4);<br>
> -__constant int4 i_2_1_1 = (int4)((int2)(1,2),3,4);<br>
> -__constant int4 i_1_2_1 = (int4)(1,(int2)(2,3),4);<br>
> -__constant int4 i_1_1_2 = (int4)(1,2,(int2)(3,4));<br>
> -__constant int4 i_2_2 = (int4)((int2)(1,2),(int2)(3,4));<br>
> -__constant int4 i_3_1 = (int4)((int3)(1,2,3),4);<br>
> -__constant int4 i_1_3 = (int4)(1,(int3)(2,3,4));<br>
> -<br>
> -typedef float float2 __attribute((ext_vector_type(2)));<br>
> -typedef float float3 __attribute((ext_vector_type(3)));<br>
> -typedef float float4 __attribute((ext_vector_type(4)));<br>
> -<br>
> -__constant float4 f_1_1_1_1 = (float4)(1,2,3,4);<br>
> -__constant float4 f_2_1_1 = (float4)((float2)(1,2),3,4);<br>
> -__constant float4 f_1_2_1 = (float4)(1,(float2)(2,3),4);<br>
> -__constant float4 f_1_1_2 = (float4)(1,2,(float2)(3,4));<br>
> -__constant float4 f_2_2 = (float4)((float2)(1,2),(float2)(3,4));<br>
> -__constant float4 f_3_1 = (float4)((float3)(1,2,3),4);<br>
> -__constant float4 f_1_3 = (float4)(1,(float3)(2,3,4));<br>
> -<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> cfe-commits@lists.llvm.org<br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>