[PATCH] D36954: [Sema] Update release notes with details of implicit scalar to vector conversions

Simon Dardis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 21 06:12:04 PDT 2017


sdardis created this revision.

Add notes on this to the C language section, along with the C++ section.


https://reviews.llvm.org/D36954

Files:
  docs/ReleaseNotes.rst


Index: docs/ReleaseNotes.rst
===================================================================
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -95,7 +95,41 @@
 C Language Changes in Clang
 ---------------------------
 
-- ...
+- Added near complete support for implicit scalar to vector conversion, a GNU
+  C/C++ language extension. With this extension, the following code is
+  considered valid:
+
+.. code-block:: c
+
+    typedef unsigned v4i32 __attribute__((vector_size(16)));
+
+    v4i32 foo(v4i32 a) {
+      // Here 5 is implicitly casted to an unsigned value and replicated into a
+      // vector with as many elements as 'a'.
+      return a + 5;
+    }
+
+The implicit conversion of a scalar value to a vector value--in the context of
+a vector expression--occurs when:
+
+- The type of the vector is that of a ``__attribute__((vector_size(size)))``
+  vector, not an OpenCL ``__attribute__((ext_vector_type(size)))`` vector type.
+
+- The scalar value can be casted to that of the vector element's type without
+  the loss of precision based on the type of the scalar and the type of the
+  vector's elements.
+
+- For compile time constant values, the above rule is weakened to consider the
+  value of the scalar constant rather than the constant's type.
+
+- Floating point constants with precise integral representations are not
+  implicitly converted to integer values, this is for compatability with GCC.
+
+
+Currently the basic integer and floating point types with the following
+operators are supported: ``+``, ``/``, ``-``, ``*``, ``%``, ``>``, ``<``,
+``>=``, ``<=``, ``==``, ``!=``, ``&``, ``|``, ``^`` and the corresponding
+assignment operators where applicable.
 
 ...
 
@@ -107,6 +141,10 @@
 C++ Language Changes in Clang
 -----------------------------
 
+- As mentioned in `C Language Changes in Clang`_, Clang's support for
+  implicit scalar to vector conversions also applies to C++. Additionally
+  the following operators are also supported: ``&&`` and ``||``.
+
 ...
 
 C++1z Feature Support


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36954.111961.patch
Type: text/x-patch
Size: 2041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170821/5c86a5f1/attachment.bin>


More information about the cfe-commits mailing list