[PATCH] D88863: [docs] Fix vector literal examples that don't compile

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 5 16:56:58 PDT 2020


ahatanak created this revision.
ahatanak added reviewers: nemanjai, ayartsev.
ahatanak added a project: clang.
Herald added subscribers: ributzka, dexonsmith, jkorous.
ahatanak requested review of this revision.

Guard the AltiVec vector variables with `#ifdef __VEC__` and remove the last line, which doesn't compile.

rdar://problem/34411929


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88863

Files:
  clang/docs/LanguageExtensions.rst


Index: clang/docs/LanguageExtensions.rst
===================================================================
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -452,12 +452,13 @@
 
   v4si vsi = (v4si){1, 2, 3, 4};
   float4 vf = (float4)(1.0f, 2.0f, 3.0f, 4.0f);
+  #ifdef __VEC__
   vector int vi1 = (vector int)(1);    // vi1 will be (1, 1, 1, 1).
   vector int vi2 = (vector int){1};    // vi2 will be (1, 0, 0, 0).
   vector int vi3 = (vector int)(1, 2); // error
   vector int vi4 = (vector int){1, 2}; // vi4 will be (1, 2, 0, 0).
   vector int vi5 = (vector int)(1, 2, 3, 4);
-  float4 vf = (float4)((float2)(1.0f, 2.0f), (float2)(3.0f, 4.0f));
+  #endif
 
 Vector Operations
 -----------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88863.296330.patch
Type: text/x-patch
Size: 731 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201005/c17f012f/attachment.bin>


More information about the cfe-commits mailing list