llvm-project/clang/docs/ReleaseNotes.rst
James Y Knight 0431d6dab4
Clang: convert __m64 intrinsics to unconditionally use SSE2 instead of MMX. (#96540)
The MMX instruction set is legacy, and the SSE2 variants are in every
way superior, when they are available -- and they have been available
since the Pentium 4 was released, 20 years ago.

Therefore, we are switching the "MMX" intrinsics to depend on SSE2,
unconditionally. This change entirely drops the ability to generate
vectorized code using compiler intrinsics for chips with MMX but without
SSE2: the Intel Pentium MMX, Pentium, II, and Pentium III (released
1997-1999), as well as AMD K6 and K7 series chips of around the same
timeframe. Targeting these older CPUs remains supported -- simply
without the ability to use MMX compiler intrinsics.

Migrating away from the use of MMX registers also fixes a rather
non-obvious requirement. The long-standing programming model for these
MMX intrinsics requires that the programmer be aware of the x87/MMX
mode-switching semantics, and manually call `_mm_empty()` between using
any MMX instruction and any x87 FPU instruction. If you neglect to, then
every future x87 operation will return a NaN result. This requirement is
not at all obvious to users of these these intrinsic functions, and
causes very difficult to detect bugs.

Worse, even if the user did write code that correctly calls
`_mm_empty()` in the right places, LLVM may sometimes reorder x87 and
mmx operations around each-other, unaware of this mode switching issue.

Eliminating the use of MMX registers eliminates this problem.

This change also deletes the now-unnecessary MMX `__builtin_ia32_*`
functions from Clang. Only 3 MMX-related builtins remain in use --
`__builtin_ia32_emms`, used by `_mm_empty`, and
`__builtin_ia32_vec_{ext,set}_v4si`, used by `_mm_insert_pi16` and
`_mm_extract_pi16`. Note particularly that the latter two lower to
generic, non-MMX, IR. Support for the LLVM intrinsics underlying these
removed builtins still remains, for the moment.

The file `clang/www/builtins.py` has been updated with mappings from the
newly-removed `__builtin_ia32` functions to the still-supported
equivalents in `mmintrin.h`.

(Originally uploaded at https://reviews.llvm.org/D86855 and
https://reviews.llvm.org/D94252)

Fixes issue #41665
Works towards #98272
2024-07-24 17:00:12 -04:00

284 lines
7.2 KiB
ReStructuredText

===========================================
Clang |release| |ReleaseNotesTitle|
===========================================
.. contents::
:local:
:depth: 2
Written by the `LLVM Team <https://llvm.org/>`_
.. only:: PreRelease
.. warning::
These are in-progress notes for the upcoming Clang |version| release.
Release notes for previous releases can be found on
`the Releases Page <https://llvm.org/releases/>`_.
Introduction
============
This document contains the release notes for the Clang C/C++/Objective-C
frontend, part of the LLVM Compiler Infrastructure, release |release|. Here we
describe the status of Clang in some detail, including major
improvements from the previous release and new feature work. For the
general LLVM release notes, see `the LLVM
documentation <https://llvm.org/docs/ReleaseNotes.html>`_. For the libc++ release notes,
see `this page <https://libcxx.llvm.org/ReleaseNotes.html>`_. All LLVM releases
may be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
For more information about Clang or LLVM, including information about the
latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the
`LLVM Web Site <https://llvm.org>`_.
Potentially Breaking Changes
============================
These changes are ones which we think may surprise users when upgrading to
Clang |release| because of the opportunity they pose for disruption to existing
code bases.
C/C++ Language Potentially Breaking Changes
-------------------------------------------
C++ Specific Potentially Breaking Changes
-----------------------------------------
ABI Changes in This Version
---------------------------
AST Dumping Potentially Breaking Changes
----------------------------------------
Clang Frontend Potentially Breaking Changes
-------------------------------------------
Clang Python Bindings Potentially Breaking Changes
--------------------------------------------------
What's New in Clang |release|?
==============================
Some of the major new features and improvements to Clang are listed
here. Generic improvements to Clang as a whole or to its underlying
infrastructure are described first, followed by language-specific
sections with improvements to Clang's support for those languages.
C++ Language Changes
--------------------
C++17 Feature Support
^^^^^^^^^^^^^^^^^^^^^
C++14 Feature Support
^^^^^^^^^^^^^^^^^^^^^
C++20 Feature Support
^^^^^^^^^^^^^^^^^^^^^
C++23 Feature Support
^^^^^^^^^^^^^^^^^^^^^
- Removed the restriction to literal types in constexpr functions in C++23 mode.
C++2c Feature Support
^^^^^^^^^^^^^^^^^^^^^
Resolutions to C++ Defect Reports
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
C Language Changes
------------------
C2y Feature Support
^^^^^^^^^^^^^^^^^^^
C23 Feature Support
^^^^^^^^^^^^^^^^^^^
New Compiler Flags
------------------
Deprecated Compiler Flags
-------------------------
Modified Compiler Flags
-----------------------
Removed Compiler Flags
-------------------------
Attribute Changes in Clang
--------------------------
- Clang now disallows more than one ``__attribute__((ownership_returns(class, idx)))`` with
different class names attached to one function.
Improvements to Clang's diagnostics
-----------------------------------
- Some template related diagnostics have been improved.
.. code-block:: c++
void foo() { template <typename> int i; } // error: templates can only be declared in namespace or class scope
struct S {
template <typename> int i; // error: non-static data member 'i' cannot be declared as a template
};
- Clang now diagnoses dangling references to fields of temporary objects. Fixes #GH81589.
- Clang now diagnoses undefined behavior in constant expressions more consistently. This includes invalid shifts, and signed overflow in arithmetic.
Improvements to Clang's time-trace
----------------------------------
Improvements to Coverage Mapping
--------------------------------
Bug Fixes in This Version
-------------------------
- Fixed the definition of ``ATOMIC_FLAG_INIT`` in ``<stdatomic.h>`` so it can
be used in C++.
Bug Fixes to Compiler Builtins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug Fixes to Attribute Support
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug Fixes to C++ Support
^^^^^^^^^^^^^^^^^^^^^^^^
- Fixed a crash when an expression with a dependent ``__typeof__`` type is used as the operand of a unary operator. (#GH97646)
Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
Miscellaneous Bug Fixes
^^^^^^^^^^^^^^^^^^^^^^^
Miscellaneous Clang Crashes Fixed
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OpenACC Specific Changes
------------------------
Target Specific Changes
-----------------------
AMDGPU Support
^^^^^^^^^^^^^^
X86 Support
^^^^^^^^^^^
- The MMX vector intrinsic functions from ``*mmintrin.h`` which
operate on `__m64` vectors, such as ``_mm_add_pi8``, have been
reimplemented to use the SSE2 instruction-set and XMM registers
unconditionally. These intrinsics are therefore *no longer
supported* if MMX is enabled without SSE2 -- either from targeting
CPUs from the Pentium-MMX through the Pentium 3, or explicitly via
passing arguments such as ``-mmmx -mno-sse2``.
- The compiler builtins such as ``__builtin_ia32_paddb`` which
formerly implemented the above MMX intrinsic functions have been
removed. Any uses of these removed functions should migrate to the
functions defined by the ``*mmintrin.h`` headers. A mapping can be
found in the file ``clang/www/builtins.py``.
Arm and AArch64 Support
^^^^^^^^^^^^^^^^^^^^^^^
Android Support
^^^^^^^^^^^^^^^
Windows Support
^^^^^^^^^^^^^^^
LoongArch Support
^^^^^^^^^^^^^^^^^
RISC-V Support
^^^^^^^^^^^^^^
CUDA/HIP Language Changes
^^^^^^^^^^^^^^^^^^^^^^^^^
CUDA Support
^^^^^^^^^^^^
AIX Support
^^^^^^^^^^^
NetBSD Support
^^^^^^^^^^^^^^
WebAssembly Support
^^^^^^^^^^^^^^^^^^^
AVR Support
^^^^^^^^^^^
DWARF Support in Clang
----------------------
Floating Point Support in Clang
-------------------------------
Fixed Point Support in Clang
----------------------------
AST Matchers
------------
clang-format
------------
libclang
--------
Static Analyzer
---------------
New features
^^^^^^^^^^^^
- MallocChecker now checks for ``ownership_returns(class, idx)`` and ``ownership_takes(class, idx)``
attributes with class names different from "malloc". Clang static analyzer now reports an error
if class of allocation and deallocation function mismatches.
`Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#unix-mismatcheddeallocator-c-c>`__.
Crash and bug fixes
^^^^^^^^^^^^^^^^^^^
Improvements
^^^^^^^^^^^^
Moved checkers
^^^^^^^^^^^^^^
.. _release-notes-sanitizers:
Sanitizers
----------
Python Binding Changes
----------------------
OpenMP Support
--------------
Additional Information
======================
A wide variety of additional information is available on the `Clang web
page <https://clang.llvm.org/>`_. The web page contains versions of the
API documentation which are up-to-date with the Git version of
the source code. You can access versions of these documents specific to
this release by going into the "``clang/docs/``" directory in the Clang
tree.
If you have any questions or comments about Clang, please feel free to
contact us on the `Discourse forums (Clang Frontend category)
<https://discourse.llvm.org/c/clang/6>`_.