From 519e1985aef0136fe593e52b5404e2934b077115 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 15 Feb 2019 20:48:51 +0000 Subject: [PATCH 1/4] Vendor import of llvm release_80 branch r354130: https://llvm.org/svn/llvm-project/llvm/branches/release_80@354130 --- CMakeLists.txt | 5 +- bindings/go/llvm/ir_test.go | 4 +- cmake/modules/CheckCompilerVersion.cmake | 130 ++- cmake/modules/CrossCompile.cmake | 1 + docs/CMake.rst | 9 + docs/DeveloperPolicy.rst | 43 +- docs/GettingStarted.rst | 61 +- docs/LibFuzzer.rst | 14 +- docs/ReleaseNotes.rst | 33 +- include/llvm/BinaryFormat/Wasm.h | 4 +- include/llvm/MC/MCSymbolWasm.h | 22 +- lib/Analysis/TargetLibraryInfo.cpp | 190 +++-- lib/MC/MCExpr.cpp | 5 + lib/MC/MCParser/AsmParser.cpp | 9 +- lib/MC/WasmObjectWriter.cpp | 25 +- lib/Object/WasmObjectFile.cpp | 22 +- lib/Support/Unix/Threading.inc | 6 + lib/Target/AArch64/AArch64InstrInfo.cpp | 41 + lib/Target/AArch64/AArch64InstrInfo.h | 4 + lib/Target/AArch64/AArch64RegisterInfo.td | 10 +- .../Disassembler/AArch64Disassembler.cpp | 4 +- lib/Target/SystemZ/SystemZISelLowering.cpp | 121 ++- lib/Target/SystemZ/SystemZInstrInfo.cpp | 74 -- lib/Target/SystemZ/SystemZInstrInfo.h | 3 - .../SystemZ/SystemZSelectionDAGInfo.cpp | 18 +- .../WebAssemblyTargetStreamer.cpp | 11 +- .../MCTargetDesc/WebAssemblyTargetStreamer.h | 13 +- .../WebAssembly/WebAssemblyAsmPrinter.cpp | 9 +- .../WebAssemblyFixFunctionBitcasts.cpp | 36 +- lib/Target/X86/AsmParser/X86AsmParser.cpp | 3 +- .../X86/InstPrinter/X86ATTInstPrinter.cpp | 11 + .../X86/InstPrinter/X86ATTInstPrinter.h | 1 + .../X86/InstPrinter/X86IntelInstPrinter.cpp | 11 + .../X86/InstPrinter/X86IntelInstPrinter.h | 1 + lib/Target/X86/X86ISelLowering.cpp | 8 + lib/Target/X86/X86InstrFPStack.td | 156 ++-- lib/Target/X86/X86InstrInfo.td | 46 +- lib/Target/X86/X86RegisterInfo.cpp | 3 + lib/Target/X86/X86RegisterInfo.td | 10 +- .../Instrumentation/MemorySanitizer.cpp | 24 +- test/CodeGen/AArch64/cmpxchg-lse-even-regs.ll | 17 + test/CodeGen/AArch64/seqpaircopy.mir | 23 + test/CodeGen/MIR/X86/memory-operands.mir | 4 +- test/CodeGen/Mips/micromips-b-range.ll | 8 +- test/CodeGen/SystemZ/memcmp-01.ll | 58 +- test/CodeGen/SystemZ/strcmp-01.ll | 18 +- test/CodeGen/WebAssembly/call.ll | 4 +- .../WebAssembly/function-bitcasts-varargs.ll | 2 +- test/CodeGen/WebAssembly/function-bitcasts.ll | 2 +- test/CodeGen/WebAssembly/import-module.ll | 3 +- test/CodeGen/WebAssembly/main-declaration.ll | 16 +- test/CodeGen/WebAssembly/main-no-args.ll | 13 +- test/CodeGen/WebAssembly/main-three-args.ll | 16 + test/CodeGen/WebAssembly/main-with-args.ll | 2 +- test/CodeGen/X86/and-su.ll | 2 +- test/CodeGen/X86/avx512-regcall-NoMask.ll | 18 +- test/CodeGen/X86/fcmove.ll | 2 +- test/CodeGen/X86/fmf-flags.ll | 4 +- test/CodeGen/X86/fp-cvt.ll | 8 +- .../X86/inline-asm-default-clobbers.ll | 8 + test/CodeGen/X86/inline-asm-fpstack.ll | 38 +- test/CodeGen/X86/ipra-reg-usage.ll | 2 +- test/CodeGen/X86/pr13577.ll | 2 +- test/CodeGen/X86/pr33349.ll | 16 +- test/CodeGen/X86/pr34080.ll | 18 +- test/CodeGen/X86/pr34177.ll | 16 +- test/CodeGen/X86/pr40529.ll | 43 + test/CodeGen/X86/scalar-fp-to-i64.ll | 24 +- test/CodeGen/X86/select.ll | 24 +- test/CodeGen/X86/sincos-opt.ll | 4 +- test/CodeGen/X86/x87-schedule.ll | 792 +++++++++--------- test/DebugInfo/Mips/eh_frame.ll | 22 +- .../MemorySanitizer/global_ctors_2to3.ll | 18 + .../MemorySanitizer/msan_basic.ll | 5 +- .../MemorySanitizer/msan_llvm_is_constant.ll | 3 + test/MC/Disassembler/X86/fp-stack.txt | 416 ++++----- test/MC/Disassembler/X86/x86-16.txt | 4 +- test/MC/MachO/file-single.s | 8 - test/MC/MachO/file.s | 3 + test/MC/WebAssembly/external-func-address.ll | 4 +- test/MC/WebAssembly/import-module.ll | 31 + test/MC/X86/PPRO-32.s | 32 +- test/MC/X86/PPRO-64.s | 32 +- test/MC/X86/X87-32.s | 48 +- test/MC/X86/X87-64.s | 46 +- test/MC/X86/intel-syntax-2.s | 12 +- test/MC/X86/intel-syntax.s | 96 +-- test/MC/X86/x86-16.s | 4 +- test/MC/X86/x86-32-coverage.s | 38 +- test/MC/X86/x86-32.s | 2 +- test/MC/X86/x86-64.s | 166 ++-- .../InstCombine/double-float-shrink-1.ll | 128 +-- .../InstCombine/double-float-shrink-2.ll | 446 +++++----- test/Transforms/InstCombine/pow-1.ll | 306 ++++--- test/Transforms/InstCombine/win-math.ll | 261 +++--- test/tools/llvm-mca/X86/Atom/resources-x87.s | 172 ++-- .../tools/llvm-mca/X86/BdVer2/resources-x87.s | 172 ++-- .../llvm-mca/X86/Broadwell/resources-x87.s | 172 ++-- .../tools/llvm-mca/X86/BtVer2/resources-x87.s | 172 ++-- .../llvm-mca/X86/Generic/resources-x87.s | 172 ++-- .../llvm-mca/X86/Haswell/resources-x87.s | 172 ++-- test/tools/llvm-mca/X86/SLM/resources-x87.s | 172 ++-- .../llvm-mca/X86/SandyBridge/resources-x87.s | 172 ++-- .../X86/SkylakeClient/resources-x87.s | 172 ++-- .../X86/SkylakeServer/resources-x87.s | 172 ++-- .../tools/llvm-mca/X86/Znver1/resources-x87.s | 172 ++-- tools/yaml2obj/yaml2wasm.cpp | 3 +- utils/TableGen/X86RecognizableInstr.cpp | 2 + 108 files changed, 3524 insertions(+), 2912 deletions(-) create mode 100644 test/CodeGen/AArch64/cmpxchg-lse-even-regs.ll create mode 100644 test/CodeGen/AArch64/seqpaircopy.mir create mode 100644 test/CodeGen/WebAssembly/main-three-args.ll create mode 100644 test/CodeGen/X86/inline-asm-default-clobbers.ll create mode 100644 test/CodeGen/X86/pr40529.ll create mode 100644 test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll delete mode 100644 test/MC/MachO/file-single.s create mode 100644 test/MC/WebAssembly/import-module.ll diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e5221ebfd33..27754f339493 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -383,9 +383,12 @@ option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF) set(LLVM_ABI_BREAKING_CHECKS "WITH_ASSERTS" CACHE STRING "Enable abi-breaking checks. Can be WITH_ASSERTS, FORCE_ON or FORCE_OFF.") -option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN +option(LLVM_FORCE_USE_OLD_TOOLCHAIN "Set to ON to force using an old, unsupported host toolchain." OFF) +option(LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN + "Set to ON to only warn when using a toolchain which is about to be deprecated, instead of emitting an error." OFF) + option(LLVM_USE_INTEL_JITEVENTS "Use Intel JIT API to inform Intel(R) VTune(TM) Amplifier XE 2011 about JIT code" OFF) diff --git a/bindings/go/llvm/ir_test.go b/bindings/go/llvm/ir_test.go index 10f4968ba89f..4d559c336715 100644 --- a/bindings/go/llvm/ir_test.go +++ b/bindings/go/llvm/ir_test.go @@ -31,7 +31,7 @@ func testAttribute(t *testing.T, name string) { fn.AddFunctionAttr(attr) newattr := fn.GetEnumFunctionAttribute(kind) if attr != newattr { - t.Errorf("got attribute mask %d, want %d", newattr, attr) + t.Errorf("got attribute %p, want %p", newattr.C, attr.C) } text := mod.String() @@ -42,7 +42,7 @@ func testAttribute(t *testing.T, name string) { fn.RemoveEnumFunctionAttribute(kind) newattr = fn.GetEnumFunctionAttribute(kind) if !newattr.IsNil() { - t.Errorf("got attribute mask %d, want 0", newattr) + t.Errorf("got attribute %p, want 0", newattr.C) } } diff --git a/cmake/modules/CheckCompilerVersion.cmake b/cmake/modules/CheckCompilerVersion.cmake index adf500ad53a7..b1cb55274228 100644 --- a/cmake/modules/CheckCompilerVersion.cmake +++ b/cmake/modules/CheckCompilerVersion.cmake @@ -1,52 +1,94 @@ -# Check if the host compiler is new enough. LLVM requires at least GCC 4.8, -# MSVC 2015 (Update 3), or Clang 3.1. +# Check if the host compiler is new enough. +# These versions are updated based on the following policy: +# llvm.org/docs/DeveloperPolicy.html#toolchain include(CheckCXXSourceCompiles) -if(NOT DEFINED LLVM_COMPILER_CHECKED) - set(LLVM_COMPILER_CHECKED ON) +set(GCC_MIN 4.8) +set(GCC_SOFT_ERROR 5.1) +set(CLANG_MIN 3.1) +set(CLANG_SOFT_ERROR 3.5) +set(APPLECLANG_MIN 3.1) +set(APPLECLANG_SOFT_ERROR 6.0) +set(MSVC_MIN 19.00.24213.1) +set(MSVC_SOFT_ERROR 19.1) - if(NOT LLVM_FORCE_USE_OLD_TOOLCHAIN) - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - message(FATAL_ERROR "Host GCC version must be at least 4.8!") - endif() - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1) - message(FATAL_ERROR "Host Clang version must be at least 3.1!") - endif() +# Map the above GCC versions to dates: https://gcc.gnu.org/develop.html#timeline +set(GCC_MIN_DATE 20130322) +set(GCC_SOFT_ERROR_DATE 20150422) - if (CMAKE_CXX_SIMULATE_ID MATCHES "MSVC") - if (CMAKE_CXX_SIMULATE_VERSION VERSION_LESS 19.0) - message(FATAL_ERROR "Host Clang must have at least -fms-compatibility-version=19.0") - endif() - set(CLANG_CL 1) - elseif(NOT LLVM_ENABLE_LIBCXX) - # Otherwise, test that we aren't using too old of a version of libstdc++ - # with the Clang compiler. This is tricky as there is no real way to - # check the version of libstdc++ directly. Instead we test for a known - # bug in libstdc++4.6 that is fixed in libstdc++4.7. - set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x") - check_cxx_source_compiles(" -#include -std::atomic x(0.0f); -int main() { return (float)x; }" - LLVM_NO_OLD_LIBSTDCXX) - if(NOT LLVM_NO_OLD_LIBSTDCXX) - message(FATAL_ERROR "Host Clang must be able to find libstdc++4.8 or newer!") - endif() - set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES}) - endif() - elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0) - message(FATAL_ERROR "Host Visual Studio must be at least 2015") - elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.00.24213.1) - message(WARNING "Host Visual Studio should at least be 2015 Update 3 (MSVC 19.00.24213.1)" - " due to miscompiles from earlier versions") - endif() + +if(DEFINED LLVM_COMPILER_CHECKED) + return() +endif() +set(LLVM_COMPILER_CHECKED ON) + +if(LLVM_FORCE_USE_OLD_TOOLCHAIN) + return() +endif() + +function(check_compiler_version NAME NICE_NAME MINIMUM_VERSION SOFT_ERROR_VERSION) + if(NOT CMAKE_CXX_COMPILER_ID STREQUAL NAME) + return() + endif() + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS MINIMUM_VERSION) + message(FATAL_ERROR "Host ${NICE_NAME} version must be at least ${MINIMUM_VERSION}, your version is ${CMAKE_CXX_COMPILER_VERSION}.") + elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS SOFT_ERROR_VERSION) + if(LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN) + message(WARNING "Host ${NICE_NAME} version should be at least ${SOFT_ERROR_VERSION} because LLVM will soon use new C++ features which your toolchain version doesn't support. Your version is ${CMAKE_CXX_COMPILER_VERSION}. Ignoring because you've set LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN, but very soon your toolchain won't be supported.") + else() + message(FATAL_ERROR "Host ${NICE_NAME} version should be at least ${SOFT_ERROR_VERSION} because LLVM will soon use new C++ features which your toolchain version doesn't support. Your version is ${CMAKE_CXX_COMPILER_VERSION}. You can temporarily opt out using LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN, but very soon your toolchain won't be supported.") endif() endif() +endfunction(check_compiler_version) + +check_compiler_version("GNU" "GCC" ${GCC_MIN} ${GCC_SOFT_ERROR}) +check_compiler_version("Clang" "Clang" ${CLANG_MIN} ${CLANG_SOFT_ERROR}) +check_compiler_version("AppleClang" "Apple Clang" ${APPLECLANG_MIN} ${APPLECLANG_SOFT_ERROR}) +check_compiler_version("MSVC" "Visual Studio" ${MSVC_MIN} ${MSVC_SOFT_ERROR}) + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if (CMAKE_CXX_SIMULATE_ID MATCHES "MSVC") + if (CMAKE_CXX_SIMULATE_VERSION VERSION_LESS MSVC_MIN) + message(FATAL_ERROR "Host Clang must have at least -fms-compatibility-version=${MSVC_MIN}, your version is ${CMAKE_CXX_COMPILER_VERSION}.") + endif() + set(CLANG_CL 1) + elseif(NOT LLVM_ENABLE_LIBCXX) + # Test that we aren't using too old of a version of libstdc++. + set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x") + check_cxx_source_compiles(" +#include +#if defined(__GLIBCXX__) +#if __GLIBCXX__ < ${GCC_MIN_DATE} +#error Unsupported libstdc++ version +#endif +#endif +int main() { return 0; } +" + LLVM_LIBSTDCXX_MIN) + if(NOT LLVM_LIBSTDCXX_MIN) + message(FATAL_ERROR "libstdc++ version must be at least ${GCC_MIN}.") + endif() + check_cxx_source_compiles(" +#include +#if defined(__GLIBCXX__) +#if __GLIBCXX__ < ${GCC_SOFT_ERROR_DATE} +#error Unsupported libstdc++ version +#endif +#endif +int main() { return 0; } +" + LLVM_LIBSTDCXX_SOFT_ERROR) + if(NOT LLVM_LIBSTDCXX_SOFT_ERROR) + if(LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN) + message(WARNING "libstdc++ version should be at least ${GCC_SOFT_ERROR} because LLVM will soon use new C++ features which your toolchain version doesn't support. Ignoring because you've set LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN, but very soon your toolchain won't be supported.") + else() + message(FATAL_ERROR "libstdc++ version should be at least ${GCC_SOFT_ERROR} because LLVM will soon use new C++ features which your toolchain version doesn't support. You can temporarily opt out using LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN, but very soon your toolchain won't be supported.") + endif() + endif() + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) + set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES}) + endif() endif() diff --git a/cmake/modules/CrossCompile.cmake b/cmake/modules/CrossCompile.cmake index b239816c8253..bc3b210f0185 100644 --- a/cmake/modules/CrossCompile.cmake +++ b/cmake/modules/CrossCompile.cmake @@ -52,6 +52,7 @@ function(llvm_create_cross_target_internal target_name toolchain buildtype) -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${experimental_targets_to_build_arg}" -DLLVM_DEFAULT_TARGET_TRIPLE="${TARGET_TRIPLE}" -DLLVM_TARGET_ARCH="${LLVM_TARGET_ARCH}" + -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="${LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN}" ${build_type_flags} ${linker_flag} ${external_clang_dir} WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} DEPENDS CREATE_LLVM_${target_name} diff --git a/docs/CMake.rst b/docs/CMake.rst index a5a574e57077..eb219c58560b 100644 --- a/docs/CMake.rst +++ b/docs/CMake.rst @@ -573,6 +573,15 @@ LLVM-specific variables options, which are passed to the CCACHE_MAXSIZE and CCACHE_DIR environment variables, respectively. +**LLVM_FORCE_USE_OLD_TOOLCHAIN**:BOOL + If enabled, the compiler and standard library versions won't be checked. LLVM + may not compile at all, or might fail at runtime due to known bugs in these + toolchains. + +**LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN**:BOOL + If enabled, the compiler version check will only warn when using a toolchain + which is about to be deprecated, instead of emitting an error. + CMake Caches ============ diff --git a/docs/DeveloperPolicy.rst b/docs/DeveloperPolicy.rst index 09912940cde2..4ed67cbf1ef1 100644 --- a/docs/DeveloperPolicy.rst +++ b/docs/DeveloperPolicy.rst @@ -22,7 +22,7 @@ This policy is also designed to accomplish the following objectives: #. Make life as simple and easy for contributors as possible. -#. Keep the tip of tree as stable as possible. +#. Keep the top of tree as stable as possible. #. Establish awareness of the project's :ref:`copyright, license, and patent policies ` with contributors to the project. @@ -638,6 +638,47 @@ In essences, these rules are necessary for targets to gain and retain their status, but also markers to define bit-rot, and will be used to clean up the tree from unmaintained targets. +.. _toolchain: + +Updating Toolchain Requirements +------------------------------- + +We intend to require newer toolchains as time goes by. This means LLVM's +codebase can use newer versions of C++ as they get standardized. Requiring newer +toolchains to build LLVM can be painful for those building LLVM; therefore, it +will only be done through the following process: + + * Generally, try to support LLVM and GCC versions from the last 3 years at a + minimum. This time-based guideline is not strict: we may support much older + compilers, or decide to support fewer versions. + + * An RFC is sent to the `llvm-dev mailing list `_ + + - Detail upsides of the version increase (e.g. which newer C++ language or + library features LLVM should use; avoid miscompiles in particular compiler + versions, etc). + - Detail downsides on important platforms (e.g. Ubuntu LTS status). + + * Once the RFC reaches consensus, update the CMake toolchain version checks as + well as the :doc:`getting started` guide. We want to + soft-error when developers compile LLVM. We say "soft-error" because the + error can be turned into a warning using a CMake flag. This is an important + step: LLVM still doesn't have code which requires the new toolchains, but it + soon will. If you compile LLVM but don't read the mailing list, we should + tell you! + + * Ensure that at least one LLVM release has had this soft-error. Not all + developers compile LLVM top-of-tree. These release-bound developers should + also be told about upcoming changes. + + * Turn the soft-error into a hard-error after said LLVM release has branched. + + * Update the :doc:`coding standards` to allow the new + features we've explicitly approved in the RFC. + + * Start using the new features in LLVM's codebase. + + .. _copyright-license-patents: Copyright, License, and Patents diff --git a/docs/GettingStarted.rst b/docs/GettingStarted.rst index b714cc6601a0..c22e821e3b7a 100644 --- a/docs/GettingStarted.rst +++ b/docs/GettingStarted.rst @@ -170,7 +170,7 @@ uses the package and provides other details. Package Version Notes =========================================================== ============ ========================================== `GNU Make `_ 3.79, 3.79.1 Makefile/build processor -`GCC `_ >=4.8.0 C/C++ compiler\ :sup:`1` +`GCC `_ >=5.1.0 C/C++ compiler\ :sup:`1` `python `_ >=2.7 Automated test suite\ :sup:`2` `zlib `_ >=1.2.3.4 Compression library\ :sup:`3` =========================================================== ============ ========================================== @@ -220,15 +220,25 @@ Host C++ Toolchain, both Compiler and Standard Library ------------------------------------------------------ LLVM is very demanding of the host C++ compiler, and as such tends to expose -bugs in the compiler. We are also planning to follow improvements and -developments in the C++ language and library reasonably closely. As such, we -require a modern host C++ toolchain, both compiler and standard library, in -order to build LLVM. +bugs in the compiler. We also attempt to follow improvements and developments in +the C++ language and library reasonably closely. As such, we require a modern +host C++ toolchain, both compiler and standard library, in order to build LLVM. -For the most popular host toolchains we check for specific minimum versions in -our build systems: +LLVM is written using the subset of C++ documented in :doc:`coding +standards`. To enforce this language version, we check the most +popular host toolchains for specific minimum versions in our build systems: + +* Clang 3.5 +* Apple Clang 6.0 +* GCC 5.1 +* Visual Studio 2017 + +The below versions currently soft-error as we transition to the new compiler +versions listed above. The LLVM codebase is currently known to compile correctly +with the following compilers, though this will change in the near future: * Clang 3.1 +* Apple Clang 3.1 * GCC 4.8 * Visual Studio 2015 (Update 3) @@ -282,33 +292,36 @@ The first step is to get a recent GCC toolchain installed. The most common distribution on which users have struggled with the version requirements is Ubuntu Precise, 12.04 LTS. For this distribution, one easy option is to install the `toolchain testing PPA`_ and use it to install a modern GCC. There is -a really nice discussions of this on the `ask ubuntu stack exchange`_. However, -not all users can use PPAs and there are many other distributions, so it may be -necessary (or just useful, if you're here you *are* doing compiler development -after all) to build and install GCC from source. It is also quite easy to do -these days. +a really nice discussions of this on the `ask ubuntu stack exchange`_ and a +`github gist`_ with updated commands. However, not all users can use PPAs and +there are many other distributions, so it may be necessary (or just useful, if +you're here you *are* doing compiler development after all) to build and install +GCC from source. It is also quite easy to do these days. .. _toolchain testing PPA: https://launchpad.net/~ubuntu-toolchain-r/+archive/test .. _ask ubuntu stack exchange: - http://askubuntu.com/questions/271388/how-to-install-gcc-4-8-in-ubuntu-12-04-from-the-terminal + https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu/581497#58149 +.. _github gist: + https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91 -Easy steps for installing GCC 4.8.2: +Easy steps for installing GCC 5.1.0: .. code-block:: console - % wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2 - % wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2.sig + % gcc_version=5.1.0 + % wget https://ftp.gnu.org/gnu/gcc/gcc-${gcc_version}/gcc-${gcc_version}.tar.bz2 + % wget https://ftp.gnu.org/gnu/gcc/gcc-${gcc_version}/gcc-${gcc_version}.tar.bz2.sig % wget https://ftp.gnu.org/gnu/gnu-keyring.gpg - % signature_invalid=`gpg --verify --no-default-keyring --keyring ./gnu-keyring.gpg gcc-4.8.2.tar.bz2.sig` + % signature_invalid=`gpg --verify --no-default-keyring --keyring ./gnu-keyring.gpg gcc-${gcc_version}.tar.bz2.sig` % if [ $signature_invalid ]; then echo "Invalid signature" ; exit 1 ; fi - % tar -xvjf gcc-4.8.2.tar.bz2 - % cd gcc-4.8.2 + % tar -xvjf gcc-${gcc_version}.tar.bz2 + % cd gcc-${gcc_version} % ./contrib/download_prerequisites % cd .. - % mkdir gcc-4.8.2-build - % cd gcc-4.8.2-build - % $PWD/../gcc-4.8.2/configure --prefix=$HOME/toolchains --enable-languages=c,c++ + % mkdir gcc-${gcc_version}-build + % cd gcc-${gcc_version}-build + % $PWD/../gcc-${gcc_version}/configure --prefix=$HOME/toolchains --enable-languages=c,c++ % make -j$(nproc) % make install @@ -316,7 +329,7 @@ For more details, check out the excellent `GCC wiki entry`_, where I got most of this information from. .. _GCC wiki entry: - http://gcc.gnu.org/wiki/InstallingGCC + https://gcc.gnu.org/wiki/InstallingGCC Once you have a GCC toolchain, configure your build of LLVM to use the new toolchain for your host compiler and C++ standard library. Because the new @@ -336,7 +349,7 @@ If you fail to set rpath, most LLVM binaries will fail on startup with a message from the loader similar to ``libstdc++.so.6: version `GLIBCXX_3.4.20' not found``. This means you need to tweak the -rpath linker flag. -When you build Clang, you will need to give *it* access to modern C++11 +When you build Clang, you will need to give *it* access to modern C++ standard library in order to use it as your new host in part of a bootstrap. There are two easy ways to do this, either build (and install) libc++ along with Clang and then use it with the ``-stdlib=libc++`` compile and link flag, diff --git a/docs/LibFuzzer.rst b/docs/LibFuzzer.rst index 0737fbbcd930..37b0833599a9 100644 --- a/docs/LibFuzzer.rst +++ b/docs/LibFuzzer.rst @@ -645,10 +645,20 @@ coverage set of the process (since the fuzzer is in-process). In other words, by using more external dependencies we will slow down the fuzzer while the main reason for it to exist is extreme speed. -Q. What about Windows then? The fuzzer contains code that does not build on Windows. +Q. Does libFuzzer Support Windows? ------------------------------------------------------------------------------------ -Volunteers are welcome. +Yes, libFuzzer now supports Windows. Initial support was added in r341082. +You can download a build of Clang for Windows +that has libFuzzer from +`LLVM Snapshot Builds `_. + +Using libFuzzer on Windows without ASAN is unsupported. Building fuzzers with the +``/MD`` (dynamic runtime library) compile option is unsupported. Support for these +may be added in the future. Linking fuzzers with the ``/INCREMENTAL`` link option +(or the ``/DEBUG`` option which implies it) is also unsupported. + +Send any questions or comments to the mailing list: libfuzzer(#)googlegroups.com Q. When libFuzzer is not a good solution for a problem? --------------------------------------------------------- diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index 2bd435ca9d29..9e2ee95c6519 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -40,6 +40,22 @@ Non-comprehensive list of changes in this release functionality, or simply have a lot to talk about), see the `NOTE` below for adding a new subsection. +* As `discussed on the mailing list + `_, + building LLVM will soon require more recent toolchains as follows: + + ============= ==== + Clang 3.5 + Apple Clang 6.0 + GCC 5.1 + Visual Studio 2017 + ============= ==== + + A new CMake check when configuring LLVM provides a soft-error if your + toolchain will become unsupported soon. You can opt out of the soft-error by + setting the ``LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN`` CMake variable to + ``ON``. + * The **llvm-cov** tool can now export lcov trace files using the `-format=lcov` option of the `export` command. @@ -82,7 +98,7 @@ Changes to the ARM Backend Changes to the Hexagon Target --------------------------- +----------------------------- * Added support for Hexagon/HVX V66 ISA. @@ -156,6 +172,21 @@ Changes to the DAG infrastructure External Open Source Projects Using LLVM 8 ========================================== +LDC - the LLVM-based D compiler +------------------------------- + +`D `_ is a language with C-like syntax and static typing. It +pragmatically combines efficiency, control, and modeling power, with safety and +programmer productivity. D supports powerful concepts like Compile-Time Function +Execution (CTFE) and Template Meta-Programming, provides an innovative approach +to concurrency and offers many classical paradigms. + +`LDC `_ uses the frontend from the reference compiler +combined with LLVM as backend to produce efficient native code. LDC targets +x86/x86_64 systems like Linux, OS X, FreeBSD and Windows and also Linux on ARM +and PowerPC (32/64 bit). Ports to other architectures like AArch64 and MIPS64 +are underway. + Zig Programming Language ------------------------ diff --git a/include/llvm/BinaryFormat/Wasm.h b/include/llvm/BinaryFormat/Wasm.h index d9f0f94b298d..b02ddb6b7e29 100644 --- a/include/llvm/BinaryFormat/Wasm.h +++ b/include/llvm/BinaryFormat/Wasm.h @@ -165,7 +165,8 @@ struct WasmSymbolInfo { StringRef Name; uint8_t Kind; uint32_t Flags; - StringRef Module; // For undefined symbols the module name of the import + StringRef ImportModule; // For undefined symbols the module of the import + StringRef ImportName; // For undefined symbols the name of the import union { // For function or global symbols, the index in function or global index // space. @@ -284,6 +285,7 @@ const unsigned WASM_SYMBOL_BINDING_LOCAL = 0x2; const unsigned WASM_SYMBOL_VISIBILITY_DEFAULT = 0x0; const unsigned WASM_SYMBOL_VISIBILITY_HIDDEN = 0x4; const unsigned WASM_SYMBOL_UNDEFINED = 0x10; +const unsigned WASM_SYMBOL_EXPLICIT_NAME = 0x40; #define WASM_RELOC(name, value) name = value, diff --git a/include/llvm/MC/MCSymbolWasm.h b/include/llvm/MC/MCSymbolWasm.h index 8e66dc881d0f..34639b6ebb64 100644 --- a/include/llvm/MC/MCSymbolWasm.h +++ b/include/llvm/MC/MCSymbolWasm.h @@ -19,7 +19,8 @@ class MCSymbolWasm : public MCSymbol { bool IsWeak = false; bool IsHidden = false; bool IsComdat = false; - std::string ModuleName; + Optional ImportModule; + Optional ImportName; wasm::WasmSignature *Signature = nullptr; Optional GlobalType; Optional EventType; @@ -32,7 +33,7 @@ class MCSymbolWasm : public MCSymbol { // Use a module name of "env" for now, for compatibility with existing tools. // This is temporary, and may change, as the ABI is not yet stable. MCSymbolWasm(const StringMapEntry *Name, bool isTemporary) - : MCSymbol(SymbolKindWasm, Name, isTemporary), ModuleName("env") {} + : MCSymbol(SymbolKindWasm, Name, isTemporary) {} static bool classof(const MCSymbol *S) { return S->isWasm(); } const MCExpr *getSize() const { return SymbolSize; } @@ -55,8 +56,21 @@ class MCSymbolWasm : public MCSymbol { bool isComdat() const { return IsComdat; } void setComdat(bool isComdat) { IsComdat = isComdat; } - const StringRef getModuleName() const { return ModuleName; } - void setModuleName(StringRef Name) { ModuleName = Name; } + const StringRef getImportModule() const { + if (ImportModule.hasValue()) { + return ImportModule.getValue(); + } + return "env"; + } + void setImportModule(StringRef Name) { ImportModule = Name; } + + const StringRef getImportName() const { + if (ImportName.hasValue()) { + return ImportName.getValue(); + } + return getName(); + } + void setImportName(StringRef Name) { ImportName = Name; } const wasm::WasmSignature *getSignature() const { return Signature; } void setSignature(wasm::WasmSignature *Sig) { Signature = Sig; } diff --git a/lib/Analysis/TargetLibraryInfo.cpp b/lib/Analysis/TargetLibraryInfo.cpp index 4643f75da42d..ae86ee3d3650 100644 --- a/lib/Analysis/TargetLibraryInfo.cpp +++ b/lib/Analysis/TargetLibraryInfo.cpp @@ -161,25 +161,66 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, } if (T.isOSWindows() && !T.isOSCygMing()) { - // Win32 does not support long double + // XXX: The earliest documentation available at the moment is for VS2015/VC19: + // https://docs.microsoft.com/en-us/cpp/c-runtime-library/floating-point-support?view=vs-2015 + // XXX: In order to use an MSVCRT older than VC19, + // the specific library version must be explicit in the target triple, + // e.g., x86_64-pc-windows-msvc18. + bool hasPartialC99 = true; + if (T.isKnownWindowsMSVCEnvironment()) { + unsigned Major, Minor, Micro; + T.getEnvironmentVersion(Major, Minor, Micro); + hasPartialC99 = (Major == 0 || Major >= 19); + } + + // Latest targets support C89 math functions, in part. + bool isARM = (T.getArch() == Triple::aarch64 || + T.getArch() == Triple::arm); + bool hasPartialFloat = (isARM || + T.getArch() == Triple::x86_64); + + // Win32 does not support float C89 math functions, in general. + if (!hasPartialFloat) { + TLI.setUnavailable(LibFunc_acosf); + TLI.setUnavailable(LibFunc_asinf); + TLI.setUnavailable(LibFunc_atan2f); + TLI.setUnavailable(LibFunc_atanf); + TLI.setUnavailable(LibFunc_ceilf); + TLI.setUnavailable(LibFunc_cosf); + TLI.setUnavailable(LibFunc_coshf); + TLI.setUnavailable(LibFunc_expf); + TLI.setUnavailable(LibFunc_floorf); + TLI.setUnavailable(LibFunc_fmodf); + TLI.setUnavailable(LibFunc_log10f); + TLI.setUnavailable(LibFunc_logf); + TLI.setUnavailable(LibFunc_modff); + TLI.setUnavailable(LibFunc_powf); + TLI.setUnavailable(LibFunc_sinf); + TLI.setUnavailable(LibFunc_sinhf); + TLI.setUnavailable(LibFunc_sqrtf); + TLI.setUnavailable(LibFunc_tanf); + TLI.setUnavailable(LibFunc_tanhf); + } + if (!isARM) + TLI.setUnavailable(LibFunc_fabsf); + TLI.setUnavailable(LibFunc_frexpf); + TLI.setUnavailable(LibFunc_ldexpf); + + // Win32 does not support long double C89 math functions. TLI.setUnavailable(LibFunc_acosl); TLI.setUnavailable(LibFunc_asinl); - TLI.setUnavailable(LibFunc_atanl); TLI.setUnavailable(LibFunc_atan2l); + TLI.setUnavailable(LibFunc_atanl); TLI.setUnavailable(LibFunc_ceill); - TLI.setUnavailable(LibFunc_copysignl); TLI.setUnavailable(LibFunc_cosl); TLI.setUnavailable(LibFunc_coshl); TLI.setUnavailable(LibFunc_expl); - TLI.setUnavailable(LibFunc_fabsf); // Win32 and Win64 both lack fabsf TLI.setUnavailable(LibFunc_fabsl); TLI.setUnavailable(LibFunc_floorl); - TLI.setUnavailable(LibFunc_fmaxl); - TLI.setUnavailable(LibFunc_fminl); TLI.setUnavailable(LibFunc_fmodl); TLI.setUnavailable(LibFunc_frexpl); - TLI.setUnavailable(LibFunc_ldexpf); TLI.setUnavailable(LibFunc_ldexpl); + TLI.setUnavailable(LibFunc_log10l); TLI.setUnavailable(LibFunc_logl); TLI.setUnavailable(LibFunc_modfl); TLI.setUnavailable(LibFunc_powl); @@ -189,81 +230,66 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, TLI.setUnavailable(LibFunc_tanl); TLI.setUnavailable(LibFunc_tanhl); - // Win32 only has C89 math - TLI.setUnavailable(LibFunc_acosh); - TLI.setUnavailable(LibFunc_acoshf); - TLI.setUnavailable(LibFunc_acoshl); - TLI.setUnavailable(LibFunc_asinh); - TLI.setUnavailable(LibFunc_asinhf); - TLI.setUnavailable(LibFunc_asinhl); - TLI.setUnavailable(LibFunc_atanh); - TLI.setUnavailable(LibFunc_atanhf); - TLI.setUnavailable(LibFunc_atanhl); - TLI.setUnavailable(LibFunc_cabs); - TLI.setUnavailable(LibFunc_cabsf); - TLI.setUnavailable(LibFunc_cabsl); - TLI.setUnavailable(LibFunc_cbrt); - TLI.setUnavailable(LibFunc_cbrtf); - TLI.setUnavailable(LibFunc_cbrtl); - TLI.setUnavailable(LibFunc_exp2); - TLI.setUnavailable(LibFunc_exp2f); - TLI.setUnavailable(LibFunc_exp2l); - TLI.setUnavailable(LibFunc_expm1); - TLI.setUnavailable(LibFunc_expm1f); - TLI.setUnavailable(LibFunc_expm1l); - TLI.setUnavailable(LibFunc_log2); - TLI.setUnavailable(LibFunc_log2f); - TLI.setUnavailable(LibFunc_log2l); - TLI.setUnavailable(LibFunc_log1p); - TLI.setUnavailable(LibFunc_log1pf); - TLI.setUnavailable(LibFunc_log1pl); - TLI.setUnavailable(LibFunc_logb); - TLI.setUnavailable(LibFunc_logbf); - TLI.setUnavailable(LibFunc_logbl); - TLI.setUnavailable(LibFunc_nearbyint); - TLI.setUnavailable(LibFunc_nearbyintf); - TLI.setUnavailable(LibFunc_nearbyintl); - TLI.setUnavailable(LibFunc_rint); - TLI.setUnavailable(LibFunc_rintf); - TLI.setUnavailable(LibFunc_rintl); - TLI.setUnavailable(LibFunc_round); - TLI.setUnavailable(LibFunc_roundf); - TLI.setUnavailable(LibFunc_roundl); - TLI.setUnavailable(LibFunc_trunc); - TLI.setUnavailable(LibFunc_truncf); - TLI.setUnavailable(LibFunc_truncl); - - // Win32 provides some C99 math with mangled names - TLI.setAvailableWithName(LibFunc_copysign, "_copysign"); - - if (T.getArch() == Triple::x86) { - // Win32 on x86 implements single-precision math functions as macros - TLI.setUnavailable(LibFunc_acosf); - TLI.setUnavailable(LibFunc_asinf); - TLI.setUnavailable(LibFunc_atanf); - TLI.setUnavailable(LibFunc_atan2f); - TLI.setUnavailable(LibFunc_ceilf); - TLI.setUnavailable(LibFunc_copysignf); - TLI.setUnavailable(LibFunc_cosf); - TLI.setUnavailable(LibFunc_coshf); - TLI.setUnavailable(LibFunc_expf); - TLI.setUnavailable(LibFunc_floorf); - TLI.setUnavailable(LibFunc_fminf); + // Win32 does not fully support C99 math functions. + if (!hasPartialC99) { + TLI.setUnavailable(LibFunc_acosh); + TLI.setUnavailable(LibFunc_acoshf); + TLI.setUnavailable(LibFunc_asinh); + TLI.setUnavailable(LibFunc_asinhf); + TLI.setUnavailable(LibFunc_atanh); + TLI.setUnavailable(LibFunc_atanhf); + TLI.setAvailableWithName(LibFunc_cabs, "_cabs"); + TLI.setUnavailable(LibFunc_cabsf); + TLI.setUnavailable(LibFunc_cbrt); + TLI.setUnavailable(LibFunc_cbrtf); + TLI.setAvailableWithName(LibFunc_copysign, "_copysign"); + TLI.setAvailableWithName(LibFunc_copysignf, "_copysignf"); + TLI.setUnavailable(LibFunc_exp2); + TLI.setUnavailable(LibFunc_exp2f); + TLI.setUnavailable(LibFunc_expm1); + TLI.setUnavailable(LibFunc_expm1f); + TLI.setUnavailable(LibFunc_fmax); TLI.setUnavailable(LibFunc_fmaxf); - TLI.setUnavailable(LibFunc_fmodf); - TLI.setUnavailable(LibFunc_logf); - TLI.setUnavailable(LibFunc_log10f); - TLI.setUnavailable(LibFunc_modff); - TLI.setUnavailable(LibFunc_powf); - TLI.setUnavailable(LibFunc_sinf); - TLI.setUnavailable(LibFunc_sinhf); - TLI.setUnavailable(LibFunc_sqrtf); - TLI.setUnavailable(LibFunc_tanf); - TLI.setUnavailable(LibFunc_tanhf); + TLI.setUnavailable(LibFunc_fmin); + TLI.setUnavailable(LibFunc_fminf); + TLI.setUnavailable(LibFunc_log1p); + TLI.setUnavailable(LibFunc_log1pf); + TLI.setUnavailable(LibFunc_log2); + TLI.setUnavailable(LibFunc_log2f); + TLI.setAvailableWithName(LibFunc_logb, "_logb"); + if (hasPartialFloat) + TLI.setAvailableWithName(LibFunc_logbf, "_logbf"); + else + TLI.setUnavailable(LibFunc_logbf); + TLI.setUnavailable(LibFunc_rint); + TLI.setUnavailable(LibFunc_rintf); + TLI.setUnavailable(LibFunc_round); + TLI.setUnavailable(LibFunc_roundf); + TLI.setUnavailable(LibFunc_trunc); + TLI.setUnavailable(LibFunc_truncf); } - // Win32 does *not* provide these functions, but they are - // generally available on POSIX-compliant systems: + // Win32 does not support long double C99 math functions. + TLI.setUnavailable(LibFunc_acoshl); + TLI.setUnavailable(LibFunc_asinhl); + TLI.setUnavailable(LibFunc_atanhl); + TLI.setUnavailable(LibFunc_cabsl); + TLI.setUnavailable(LibFunc_cbrtl); + TLI.setUnavailable(LibFunc_copysignl); + TLI.setUnavailable(LibFunc_exp2l); + TLI.setUnavailable(LibFunc_expm1l); + TLI.setUnavailable(LibFunc_fmaxl); + TLI.setUnavailable(LibFunc_fminl); + TLI.setUnavailable(LibFunc_log1pl); + TLI.setUnavailable(LibFunc_log2l); + TLI.setUnavailable(LibFunc_logbl); + TLI.setUnavailable(LibFunc_nearbyintl); + TLI.setUnavailable(LibFunc_rintl); + TLI.setUnavailable(LibFunc_roundl); + TLI.setUnavailable(LibFunc_truncl); + + // Win32 does not support these functions, but + // they are generally available on POSIX-compliant systems. TLI.setUnavailable(LibFunc_access); TLI.setUnavailable(LibFunc_bcmp); TLI.setUnavailable(LibFunc_bcopy); @@ -318,12 +344,6 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, TLI.setUnavailable(LibFunc_utime); TLI.setUnavailable(LibFunc_utimes); TLI.setUnavailable(LibFunc_write); - - // Win32 does *not* provide provide these functions, but they are - // specified by C99: - TLI.setUnavailable(LibFunc_atoll); - TLI.setUnavailable(LibFunc_frexpf); - TLI.setUnavailable(LibFunc_llabs); } switch (T.getOS()) { diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp index 3c022199145f..0e4174a7a4c9 100644 --- a/lib/MC/MCExpr.cpp +++ b/lib/MC/MCExpr.cpp @@ -559,6 +559,11 @@ static void AttemptToFoldSymbolOffsetDifference( if (Asm->isThumbFunc(&SA)) Addend |= 1; + // If symbol is labeled as micromips, we set low-bit to ensure + // correct offset in .gcc_except_table + if (Asm->getBackend().isMicroMips(&SA)) + Addend |= 1; + // Clear the symbol expr pointers to indicate we have folded these // operands. A = B = nullptr; diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index cf42a6f7075b..a0506715be37 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -3364,10 +3364,11 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) { } if (FileNumber == -1) { - if (!getContext().getAsmInfo()->hasSingleParameterDotFile()) - return Error(DirectiveLoc, - "target does not support '.file' without a number"); - getStreamer().EmitFileDirective(Filename); + // Ignore the directive if there is no number and the target doesn't support + // numberless .file directives. This allows some portability of assembler + // between different object file formats. + if (getContext().getAsmInfo()->hasSingleParameterDotFile()) + getStreamer().EmitFileDirective(Filename); } else { // In case there is a -g option as well as debug info from directive .file, // we turn off the -g option, directly use the existing debug info instead. diff --git a/lib/MC/WasmObjectWriter.cpp b/lib/MC/WasmObjectWriter.cpp index 0cca3757be90..333748db9190 100644 --- a/lib/MC/WasmObjectWriter.cpp +++ b/lib/MC/WasmObjectWriter.cpp @@ -982,7 +982,8 @@ void WasmObjectWriter::writeLinkingMetaDataSection( case wasm::WASM_SYMBOL_TYPE_GLOBAL: case wasm::WASM_SYMBOL_TYPE_EVENT: encodeULEB128(Sym.ElementIndex, W.OS); - if ((Sym.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0) + if ((Sym.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0 || + (Sym.Flags & wasm::WASM_SYMBOL_EXPLICIT_NAME) != 0) writeString(Sym.Name); break; case wasm::WASM_SYMBOL_TYPE_DATA: @@ -1162,8 +1163,8 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm, MCSymbolWasm *MemorySym = cast(Ctx.getOrCreateSymbol("__linear_memory")); wasm::WasmImport MemImport; - MemImport.Module = MemorySym->getModuleName(); - MemImport.Field = MemorySym->getName(); + MemImport.Module = MemorySym->getImportModule(); + MemImport.Field = MemorySym->getImportName(); MemImport.Kind = wasm::WASM_EXTERNAL_MEMORY; Imports.push_back(MemImport); @@ -1173,8 +1174,8 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm, MCSymbolWasm *TableSym = cast(Ctx.getOrCreateSymbol("__indirect_function_table")); wasm::WasmImport TableImport; - TableImport.Module = TableSym->getModuleName(); - TableImport.Field = TableSym->getName(); + TableImport.Module = TableSym->getImportModule(); + TableImport.Field = TableSym->getImportName(); TableImport.Kind = wasm::WASM_EXTERNAL_TABLE; TableImport.Table.ElemType = wasm::WASM_TYPE_FUNCREF; Imports.push_back(TableImport); @@ -1200,8 +1201,8 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm, if (!WS.isDefined() && !WS.isComdat()) { if (WS.isFunction()) { wasm::WasmImport Import; - Import.Module = WS.getModuleName(); - Import.Field = WS.getName(); + Import.Module = WS.getImportModule(); + Import.Field = WS.getImportName(); Import.Kind = wasm::WASM_EXTERNAL_FUNCTION; Import.SigIndex = getFunctionType(WS); Imports.push_back(Import); @@ -1211,8 +1212,8 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm, report_fatal_error("undefined global symbol cannot be weak"); wasm::WasmImport Import; - Import.Module = WS.getModuleName(); - Import.Field = WS.getName(); + Import.Module = WS.getImportModule(); + Import.Field = WS.getImportName(); Import.Kind = wasm::WASM_EXTERNAL_GLOBAL; Import.Global = WS.getGlobalType(); Imports.push_back(Import); @@ -1222,8 +1223,8 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm, report_fatal_error("undefined event symbol cannot be weak"); wasm::WasmImport Import; - Import.Module = WS.getModuleName(); - Import.Field = WS.getName(); + Import.Module = WS.getImportModule(); + Import.Field = WS.getImportName(); Import.Kind = wasm::WASM_EXTERNAL_EVENT; Import.Event.Attribute = wasm::WASM_EVENT_ATTRIBUTE_EXCEPTION; Import.Event.SigIndex = getEventType(WS); @@ -1448,6 +1449,8 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm, Flags |= wasm::WASM_SYMBOL_BINDING_LOCAL; if (WS.isUndefined()) Flags |= wasm::WASM_SYMBOL_UNDEFINED; + if (WS.getName() != WS.getImportName()) + Flags |= wasm::WASM_SYMBOL_EXPLICIT_NAME; wasm::WasmSymbolInfo Info; Info.Name = WS.getName(); diff --git a/lib/Object/WasmObjectFile.cpp b/lib/Object/WasmObjectFile.cpp index d84cb48c9fbd..66a53becbb05 100644 --- a/lib/Object/WasmObjectFile.cpp +++ b/lib/Object/WasmObjectFile.cpp @@ -505,9 +505,13 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { Function.SymbolName = Info.Name; } else { wasm::WasmImport &Import = *ImportedFunctions[Info.ElementIndex]; + if ((Info.Flags & wasm::WASM_SYMBOL_EXPLICIT_NAME) != 0) + Info.Name = readString(Ctx); + else + Info.Name = Import.Field; Signature = &Signatures[Import.SigIndex]; - Info.Name = Import.Field; - Info.Module = Import.Module; + Info.ImportName = Import.Field; + Info.ImportModule = Import.Module; } break; @@ -530,8 +534,13 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { Global.SymbolName = Info.Name; } else { wasm::WasmImport &Import = *ImportedGlobals[Info.ElementIndex]; - Info.Name = Import.Field; + if ((Info.Flags & wasm::WASM_SYMBOL_EXPLICIT_NAME) != 0) + Info.Name = readString(Ctx); + else + Info.Name = Import.Field; GlobalType = &Import.Global; + Info.ImportName = Import.Field; + Info.ImportModule = Import.Module; } break; @@ -585,9 +594,14 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { } else { wasm::WasmImport &Import = *ImportedEvents[Info.ElementIndex]; + if ((Info.Flags & wasm::WASM_SYMBOL_EXPLICIT_NAME) != 0) + Info.Name = readString(Ctx); + else + Info.Name = Import.Field; EventType = &Import.Event; Signature = &Signatures[EventType->SigIndex]; - Info.Name = Import.Field; + Info.ImportName = Import.Field; + Info.ImportModule = Import.Module; } break; } diff --git a/lib/Support/Unix/Threading.inc b/lib/Support/Unix/Threading.inc index 2d49ce1ad747..92bec36d6a2d 100644 --- a/lib/Support/Unix/Threading.inc +++ b/lib/Support/Unix/Threading.inc @@ -202,6 +202,12 @@ void llvm::get_thread_name(SmallVectorImpl &Name) { char buf[len]; ::pthread_getname_np(::pthread_self(), buf, len); + Name.append(buf, buf + strlen(buf)); +#elif defined(__OpenBSD__) + constexpr uint32_t len = get_max_thread_name_length_impl(); + char buf[len]; + ::pthread_get_name_np(::pthread_self(), buf, len); + Name.append(buf, buf + strlen(buf)); #elif defined(__linux__) #if HAVE_PTHREAD_GETNAME_NP diff --git a/lib/Target/AArch64/AArch64InstrInfo.cpp b/lib/Target/AArch64/AArch64InstrInfo.cpp index ada067888572..50316ebe218b 100644 --- a/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -2292,6 +2292,31 @@ void AArch64InstrInfo::copyPhysRegTuple(MachineBasicBlock &MBB, } } +void AArch64InstrInfo::copyGPRRegTuple(MachineBasicBlock &MBB, + MachineBasicBlock::iterator I, + DebugLoc DL, unsigned DestReg, + unsigned SrcReg, bool KillSrc, + unsigned Opcode, unsigned ZeroReg, + llvm::ArrayRef Indices) const { + const TargetRegisterInfo *TRI = &getRegisterInfo(); + unsigned NumRegs = Indices.size(); + +#ifndef NDEBUG + uint16_t DestEncoding = TRI->getEncodingValue(DestReg); + uint16_t SrcEncoding = TRI->getEncodingValue(SrcReg); + assert(DestEncoding % NumRegs == 0 && SrcEncoding % NumRegs == 0 && + "GPR reg sequences should not be able to overlap"); +#endif + + for (unsigned SubReg = 0; SubReg != NumRegs; ++SubReg) { + const MachineInstrBuilder MIB = BuildMI(MBB, I, DL, get(Opcode)); + AddSubReg(MIB, DestReg, Indices[SubReg], RegState::Define, TRI); + MIB.addReg(ZeroReg); + AddSubReg(MIB, SrcReg, Indices[SubReg], getKillRegState(KillSrc), TRI); + MIB.addImm(0); + } +} + void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, unsigned DestReg, @@ -2431,6 +2456,22 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB, return; } + if (AArch64::XSeqPairsClassRegClass.contains(DestReg) && + AArch64::XSeqPairsClassRegClass.contains(SrcReg)) { + static const unsigned Indices[] = {AArch64::sube64, AArch64::subo64}; + copyGPRRegTuple(MBB, I, DL, DestReg, SrcReg, KillSrc, AArch64::ORRXrs, + AArch64::XZR, Indices); + return; + } + + if (AArch64::WSeqPairsClassRegClass.contains(DestReg) && + AArch64::WSeqPairsClassRegClass.contains(SrcReg)) { + static const unsigned Indices[] = {AArch64::sube32, AArch64::subo32}; + copyGPRRegTuple(MBB, I, DL, DestReg, SrcReg, KillSrc, AArch64::ORRWrs, + AArch64::WZR, Indices); + return; + } + if (AArch64::FPR128RegClass.contains(DestReg) && AArch64::FPR128RegClass.contains(SrcReg)) { if (Subtarget.hasNEON()) { diff --git a/lib/Target/AArch64/AArch64InstrInfo.h b/lib/Target/AArch64/AArch64InstrInfo.h index 9954669d5675..e48c26d4a84a 100644 --- a/lib/Target/AArch64/AArch64InstrInfo.h +++ b/lib/Target/AArch64/AArch64InstrInfo.h @@ -122,6 +122,10 @@ class AArch64InstrInfo final : public AArch64GenInstrInfo { const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc, unsigned Opcode, llvm::ArrayRef Indices) const; + void copyGPRRegTuple(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, + DebugLoc DL, unsigned DestReg, unsigned SrcReg, + bool KillSrc, unsigned Opcode, unsigned ZeroReg, + llvm::ArrayRef Indices) const; void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override; diff --git a/lib/Target/AArch64/AArch64RegisterInfo.td b/lib/Target/AArch64/AArch64RegisterInfo.td index d3710cea0687..8e6aa69eae85 100644 --- a/lib/Target/AArch64/AArch64RegisterInfo.td +++ b/lib/Target/AArch64/AArch64RegisterInfo.td @@ -649,10 +649,12 @@ def FPR128Op : RegisterOperand { // ARMv8.1a atomic CASP register operands -def WSeqPairs : RegisterTuples<[sube32, subo32], - [(rotl GPR32, 0), (rotl GPR32, 1)]>; -def XSeqPairs : RegisterTuples<[sube64, subo64], - [(rotl GPR64, 0), (rotl GPR64, 1)]>; +def WSeqPairs : RegisterTuples<[sube32, subo32], + [(decimate (rotl GPR32, 0), 2), + (decimate (rotl GPR32, 1), 2)]>; +def XSeqPairs : RegisterTuples<[sube64, subo64], + [(decimate (rotl GPR64, 0), 2), + (decimate (rotl GPR64, 1), 2)]>; def WSeqPairsClass : RegisterClass<"AArch64", [untyped], 32, (add WSeqPairs)>{ diff --git a/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp b/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp index 4102f1eb5cc1..64afabd450c1 100644 --- a/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp +++ b/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp @@ -1779,8 +1779,8 @@ static DecodeStatus DecodeGPRSeqPairsClassRegisterClass(MCInst &Inst, if (RegNo & 0x1) return Fail; - unsigned Register = AArch64MCRegisterClasses[RegClassID].getRegister(RegNo); - Inst.addOperand(MCOperand::createReg(Register)); + unsigned Reg = AArch64MCRegisterClasses[RegClassID].getRegister(RegNo / 2); + Inst.addOperand(MCOperand::createReg(Reg)); return Success; } diff --git a/lib/Target/SystemZ/SystemZISelLowering.cpp b/lib/Target/SystemZ/SystemZISelLowering.cpp index 2a825c1316f3..607e55bf71c8 100644 --- a/lib/Target/SystemZ/SystemZISelLowering.cpp +++ b/lib/Target/SystemZ/SystemZISelLowering.cpp @@ -5618,55 +5618,96 @@ SDValue SystemZTargetLowering::combineBSWAP( static bool combineCCMask(SDValue &CCReg, int &CCValid, int &CCMask) { // We have a SELECT_CCMASK or BR_CCMASK comparing the condition code // set by the CCReg instruction using the CCValid / CCMask masks, - // If the CCReg instruction is itself a (ICMP (SELECT_CCMASK)) testing - // the condition code set by some other instruction, see whether we - // can directly use that condition code. - bool Invert = false; + // If the CCReg instruction is itself a ICMP testing the condition + // code set by some other instruction, see whether we can directly + // use that condition code. - // Verify that we have an appropriate mask for a EQ or NE comparison. + // Verify that we have an ICMP against some constant. if (CCValid != SystemZ::CCMASK_ICMP) return false; - if (CCMask == SystemZ::CCMASK_CMP_NE) - Invert = !Invert; - else if (CCMask != SystemZ::CCMASK_CMP_EQ) - return false; - - // Verify that we have an ICMP that is the user of a SELECT_CCMASK. - SDNode *ICmp = CCReg.getNode(); + auto *ICmp = CCReg.getNode(); if (ICmp->getOpcode() != SystemZISD::ICMP) return false; - SDNode *Select = ICmp->getOperand(0).getNode(); - if (Select->getOpcode() != SystemZISD::SELECT_CCMASK) + auto *CompareLHS = ICmp->getOperand(0).getNode(); + auto *CompareRHS = dyn_cast(ICmp->getOperand(1)); + if (!CompareRHS) return false; - // Verify that the ICMP compares against one of select values. - auto *CompareVal = dyn_cast(ICmp->getOperand(1)); - if (!CompareVal) - return false; - auto *TrueVal = dyn_cast(Select->getOperand(0)); - if (!TrueVal) - return false; - auto *FalseVal = dyn_cast(Select->getOperand(1)); - if (!FalseVal) - return false; - if (CompareVal->getZExtValue() == FalseVal->getZExtValue()) - Invert = !Invert; - else if (CompareVal->getZExtValue() != TrueVal->getZExtValue()) - return false; + // Optimize the case where CompareLHS is a SELECT_CCMASK. + if (CompareLHS->getOpcode() == SystemZISD::SELECT_CCMASK) { + // Verify that we have an appropriate mask for a EQ or NE comparison. + bool Invert = false; + if (CCMask == SystemZ::CCMASK_CMP_NE) + Invert = !Invert; + else if (CCMask != SystemZ::CCMASK_CMP_EQ) + return false; - // Compute the effective CC mask for the new branch or select. - auto *NewCCValid = dyn_cast(Select->getOperand(2)); - auto *NewCCMask = dyn_cast(Select->getOperand(3)); - if (!NewCCValid || !NewCCMask) - return false; - CCValid = NewCCValid->getZExtValue(); - CCMask = NewCCMask->getZExtValue(); - if (Invert) - CCMask ^= CCValid; + // Verify that the ICMP compares against one of select values. + auto *TrueVal = dyn_cast(CompareLHS->getOperand(0)); + if (!TrueVal) + return false; + auto *FalseVal = dyn_cast(CompareLHS->getOperand(1)); + if (!FalseVal) + return false; + if (CompareRHS->getZExtValue() == FalseVal->getZExtValue()) + Invert = !Invert; + else if (CompareRHS->getZExtValue() != TrueVal->getZExtValue()) + return false; - // Return the updated CCReg link. - CCReg = Select->getOperand(4); - return true; + // Compute the effective CC mask for the new branch or select. + auto *NewCCValid = dyn_cast(CompareLHS->getOperand(2)); + auto *NewCCMask = dyn_cast(CompareLHS->getOperand(3)); + if (!NewCCValid || !NewCCMask) + return false; + CCValid = NewCCValid->getZExtValue(); + CCMask = NewCCMask->getZExtValue(); + if (Invert) + CCMask ^= CCValid; + + // Return the updated CCReg link. + CCReg = CompareLHS->getOperand(4); + return true; + } + + // Optimize the case where CompareRHS is (SRA (SHL (IPM))). + if (CompareLHS->getOpcode() == ISD::SRA) { + auto *SRACount = dyn_cast(CompareLHS->getOperand(1)); + if (!SRACount || SRACount->getZExtValue() != 30) + return false; + auto *SHL = CompareLHS->getOperand(0).getNode(); + if (SHL->getOpcode() != ISD::SHL) + return false; + auto *SHLCount = dyn_cast(SHL->getOperand(1)); + if (!SHLCount || SHLCount->getZExtValue() != 30 - SystemZ::IPM_CC) + return false; + auto *IPM = SHL->getOperand(0).getNode(); + if (IPM->getOpcode() != SystemZISD::IPM) + return false; + + // Avoid introducing CC spills (because SRA would clobber CC). + if (!CompareLHS->hasOneUse()) + return false; + // Verify that the ICMP compares against zero. + if (CompareRHS->getZExtValue() != 0) + return false; + + // Compute the effective CC mask for the new branch or select. + switch (CCMask) { + case SystemZ::CCMASK_CMP_EQ: break; + case SystemZ::CCMASK_CMP_NE: break; + case SystemZ::CCMASK_CMP_LT: CCMask = SystemZ::CCMASK_CMP_GT; break; + case SystemZ::CCMASK_CMP_GT: CCMask = SystemZ::CCMASK_CMP_LT; break; + case SystemZ::CCMASK_CMP_LE: CCMask = SystemZ::CCMASK_CMP_GE; break; + case SystemZ::CCMASK_CMP_GE: CCMask = SystemZ::CCMASK_CMP_LE; break; + default: return false; + } + + // Return the updated CCReg link. + CCReg = IPM->getOperand(0); + return true; + } + + return false; } SDValue SystemZTargetLowering::combineBR_CCMASK( diff --git a/lib/Target/SystemZ/SystemZInstrInfo.cpp b/lib/Target/SystemZ/SystemZInstrInfo.cpp index b03b4edaa4ab..8aab5c2c4999 100644 --- a/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -557,80 +557,6 @@ bool SystemZInstrInfo::analyzeCompare(const MachineInstr &MI, unsigned &SrcReg, return false; } -// If Reg is a virtual register, return its definition, otherwise return null. -static MachineInstr *getDef(unsigned Reg, - const MachineRegisterInfo *MRI) { - if (TargetRegisterInfo::isPhysicalRegister(Reg)) - return nullptr; - return MRI->getUniqueVRegDef(Reg); -} - -// Return true if MI is a shift of type Opcode by Imm bits. -static bool isShift(MachineInstr *MI, unsigned Opcode, int64_t Imm) { - return (MI->getOpcode() == Opcode && - !MI->getOperand(2).getReg() && - MI->getOperand(3).getImm() == Imm); -} - -// If the destination of MI has no uses, delete it as dead. -static void eraseIfDead(MachineInstr *MI, const MachineRegisterInfo *MRI) { - if (MRI->use_nodbg_empty(MI->getOperand(0).getReg())) - MI->eraseFromParent(); -} - -// Compare compares SrcReg against zero. Check whether SrcReg contains -// the result of an IPM sequence whose input CC survives until Compare, -// and whether Compare is therefore redundant. Delete it and return -// true if so. -static bool removeIPMBasedCompare(MachineInstr &Compare, unsigned SrcReg, - const MachineRegisterInfo *MRI, - const TargetRegisterInfo *TRI) { - MachineInstr *LGFR = nullptr; - MachineInstr *RLL = getDef(SrcReg, MRI); - if (RLL && RLL->getOpcode() == SystemZ::LGFR) { - LGFR = RLL; - RLL = getDef(LGFR->getOperand(1).getReg(), MRI); - } - if (!RLL || !isShift(RLL, SystemZ::RLL, 31)) - return false; - - MachineInstr *SRL = getDef(RLL->getOperand(1).getReg(), MRI); - if (!SRL || !isShift(SRL, SystemZ::SRL, SystemZ::IPM_CC)) - return false; - - MachineInstr *IPM = getDef(SRL->getOperand(1).getReg(), MRI); - if (!IPM || IPM->getOpcode() != SystemZ::IPM) - return false; - - // Check that there are no assignments to CC between the IPM and Compare, - if (IPM->getParent() != Compare.getParent()) - return false; - MachineBasicBlock::iterator MBBI = IPM, MBBE = Compare.getIterator(); - for (++MBBI; MBBI != MBBE; ++MBBI) { - MachineInstr &MI = *MBBI; - if (MI.modifiesRegister(SystemZ::CC, TRI)) - return false; - } - - Compare.eraseFromParent(); - if (LGFR) - eraseIfDead(LGFR, MRI); - eraseIfDead(RLL, MRI); - eraseIfDead(SRL, MRI); - eraseIfDead(IPM, MRI); - - return true; -} - -bool SystemZInstrInfo::optimizeCompareInstr( - MachineInstr &Compare, unsigned SrcReg, unsigned SrcReg2, int Mask, - int Value, const MachineRegisterInfo *MRI) const { - assert(!SrcReg2 && "Only optimizing constant comparisons so far"); - bool IsLogical = (Compare.getDesc().TSFlags & SystemZII::IsLogical) != 0; - return Value == 0 && !IsLogical && - removeIPMBasedCompare(Compare, SrcReg, MRI, &RI); -} - bool SystemZInstrInfo::canInsertSelect(const MachineBasicBlock &MBB, ArrayRef Pred, unsigned TrueReg, unsigned FalseReg, diff --git a/lib/Target/SystemZ/SystemZInstrInfo.h b/lib/Target/SystemZ/SystemZInstrInfo.h index 216139eb7c79..0392430ed872 100644 --- a/lib/Target/SystemZ/SystemZInstrInfo.h +++ b/lib/Target/SystemZ/SystemZInstrInfo.h @@ -208,9 +208,6 @@ class SystemZInstrInfo : public SystemZGenInstrInfo { int *BytesAdded = nullptr) const override; bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg, unsigned &SrcReg2, int &Mask, int &Value) const override; - bool optimizeCompareInstr(MachineInstr &CmpInstr, unsigned SrcReg, - unsigned SrcReg2, int Mask, int Value, - const MachineRegisterInfo *MRI) const override; bool canInsertSelect(const MachineBasicBlock&, ArrayRef Cond, unsigned, unsigned, int&, int&, int&) const override; void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, diff --git a/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp b/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp index e0d7bca9a94b..4592e82eea71 100644 --- a/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp +++ b/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp @@ -164,17 +164,17 @@ static SDValue emitCLC(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, } // Convert the current CC value into an integer that is 0 if CC == 0, -// less than zero if CC == 1 and greater than zero if CC >= 2. +// greater than zero if CC == 1 and less than zero if CC >= 2. // The sequence starts with IPM, which puts CC into bits 29 and 28 // of an integer and clears bits 30 and 31. static SDValue addIPMSequence(const SDLoc &DL, SDValue CCReg, SelectionDAG &DAG) { SDValue IPM = DAG.getNode(SystemZISD::IPM, DL, MVT::i32, CCReg); - SDValue SRL = DAG.getNode(ISD::SRL, DL, MVT::i32, IPM, - DAG.getConstant(SystemZ::IPM_CC, DL, MVT::i32)); - SDValue ROTL = DAG.getNode(ISD::ROTL, DL, MVT::i32, SRL, - DAG.getConstant(31, DL, MVT::i32)); - return ROTL; + SDValue SHL = DAG.getNode(ISD::SHL, DL, MVT::i32, IPM, + DAG.getConstant(30 - SystemZ::IPM_CC, DL, MVT::i32)); + SDValue SRA = DAG.getNode(ISD::SRA, DL, MVT::i32, SHL, + DAG.getConstant(30, DL, MVT::i32)); + return SRA; } std::pair SystemZSelectionDAGInfo::EmitTargetCodeForMemcmp( @@ -184,7 +184,8 @@ std::pair SystemZSelectionDAGInfo::EmitTargetCodeForMemcmp( if (auto *CSize = dyn_cast(Size)) { uint64_t Bytes = CSize->getZExtValue(); assert(Bytes > 0 && "Caller should have handled 0-size case"); - SDValue CCReg = emitCLC(DAG, DL, Chain, Src1, Src2, Bytes); + // Swap operands to invert CC == 1 vs. CC == 2 cases. + SDValue CCReg = emitCLC(DAG, DL, Chain, Src2, Src1, Bytes); Chain = CCReg.getValue(1); return std::make_pair(addIPMSequence(DL, CCReg, DAG), Chain); } @@ -232,7 +233,8 @@ std::pair SystemZSelectionDAGInfo::EmitTargetCodeForStrcmp( SDValue Src2, MachinePointerInfo Op1PtrInfo, MachinePointerInfo Op2PtrInfo) const { SDVTList VTs = DAG.getVTList(Src1.getValueType(), MVT::i32, MVT::Other); - SDValue Unused = DAG.getNode(SystemZISD::STRCMP, DL, VTs, Chain, Src1, Src2, + // Swap operands to invert CC == 1 vs. CC == 2 cases. + SDValue Unused = DAG.getNode(SystemZISD::STRCMP, DL, VTs, Chain, Src2, Src1, DAG.getConstant(0, DL, MVT::i32)); SDValue CCReg = Unused.getValue(1); Chain = Unused.getValue(2); diff --git a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp index 50143fb0ece3..7caeebb1a9aa 100644 --- a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp +++ b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp @@ -113,8 +113,15 @@ void WebAssemblyTargetAsmStreamer::emitEventType(const MCSymbolWasm *Sym) { } void WebAssemblyTargetAsmStreamer::emitImportModule(const MCSymbolWasm *Sym, - StringRef ModuleName) { - OS << "\t.import_module\t" << Sym->getName() << ", " << ModuleName << '\n'; + StringRef ImportModule) { + OS << "\t.import_module\t" << Sym->getName() << ", " + << ImportModule << '\n'; +} + +void WebAssemblyTargetAsmStreamer::emitImportName(const MCSymbolWasm *Sym, + StringRef ImportName) { + OS << "\t.import_name\t" << Sym->getName() << ", " + << ImportName << '\n'; } void WebAssemblyTargetAsmStreamer::emitIndIdx(const MCExpr *Value) { diff --git a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h index 3073938118b4..2ee9956c8e38 100644 --- a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h +++ b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h @@ -45,7 +45,10 @@ class WebAssemblyTargetStreamer : public MCTargetStreamer { virtual void emitEventType(const MCSymbolWasm *Sym) = 0; /// .import_module virtual void emitImportModule(const MCSymbolWasm *Sym, - StringRef ModuleName) = 0; + StringRef ImportModule) = 0; + /// .import_name + virtual void emitImportName(const MCSymbolWasm *Sym, + StringRef ImportName) = 0; protected: void emitValueType(wasm::ValType Type); @@ -67,7 +70,8 @@ class WebAssemblyTargetAsmStreamer final : public WebAssemblyTargetStreamer { void emitIndIdx(const MCExpr *Value) override; void emitGlobalType(const MCSymbolWasm *Sym) override; void emitEventType(const MCSymbolWasm *Sym) override; - void emitImportModule(const MCSymbolWasm *Sym, StringRef ModuleName) override; + void emitImportModule(const MCSymbolWasm *Sym, StringRef ImportModule) override; + void emitImportName(const MCSymbolWasm *Sym, StringRef ImportName) override; }; /// This part is for Wasm object output @@ -82,7 +86,9 @@ class WebAssemblyTargetWasmStreamer final : public WebAssemblyTargetStreamer { void emitGlobalType(const MCSymbolWasm *Sym) override {} void emitEventType(const MCSymbolWasm *Sym) override {} void emitImportModule(const MCSymbolWasm *Sym, - StringRef ModuleName) override {} + StringRef ImportModule) override {} + void emitImportName(const MCSymbolWasm *Sym, + StringRef ImportName) override {} }; /// This part is for null output @@ -98,6 +104,7 @@ class WebAssemblyTargetNullStreamer final : public WebAssemblyTargetStreamer { void emitGlobalType(const MCSymbolWasm *) override {} void emitEventType(const MCSymbolWasm *) override {} void emitImportModule(const MCSymbolWasm *, StringRef) override {} + void emitImportName(const MCSymbolWasm *, StringRef) override {} }; } // end namespace llvm diff --git a/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index c4f03dfa7f9e..b492d1146950 100644 --- a/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -111,9 +111,16 @@ void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) { F.hasFnAttribute("wasm-import-module")) { StringRef Name = F.getFnAttribute("wasm-import-module").getValueAsString(); - Sym->setModuleName(Name); + Sym->setImportModule(Name); getTargetStreamer()->emitImportModule(Sym, Name); } + if (TM.getTargetTriple().isOSBinFormatWasm() && + F.hasFnAttribute("wasm-import-name")) { + StringRef Name = + F.getFnAttribute("wasm-import-name").getValueAsString(); + Sym->setImportName(Name); + getTargetStreamer()->emitImportName(Sym, Name); + } } } diff --git a/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp b/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp index 1a416520f97d..13f37f611ed0 100644 --- a/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp +++ b/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp @@ -36,11 +36,6 @@ using namespace llvm; #define DEBUG_TYPE "wasm-fix-function-bitcasts" -static cl::opt - TemporaryWorkarounds("wasm-temporary-workarounds", - cl::desc("Apply certain temporary workarounds"), - cl::init(true), cl::Hidden); - namespace { class FixFunctionBitcasts final : public ModulePass { StringRef getPassName() const override { @@ -227,6 +222,17 @@ static Function *CreateWrapper(Function *F, FunctionType *Ty) { return Wrapper; } +// Test whether a main function with type FuncTy should be rewritten to have +// type MainTy. +bool shouldFixMainFunction(FunctionType *FuncTy, FunctionType *MainTy) { + // Only fix the main function if it's the standard zero-arg form. That way, + // the standard cases will work as expected, and users will see signature + // mismatches from the linker for non-standard cases. + return FuncTy->getReturnType() == MainTy->getReturnType() && + FuncTy->getNumParams() == 0 && + !FuncTy->isVarArg(); +} + bool FixFunctionBitcasts::runOnModule(Module &M) { LLVM_DEBUG(dbgs() << "********** Fix Function Bitcasts **********\n"); @@ -243,14 +249,14 @@ bool FixFunctionBitcasts::runOnModule(Module &M) { // "int main(int argc, char *argv[])", create an artificial call with it // bitcasted to that type so that we generate a wrapper for it, so that // the C runtime can call it. - if (!TemporaryWorkarounds && !F.isDeclaration() && F.getName() == "main") { + if (F.getName() == "main") { Main = &F; LLVMContext &C = M.getContext(); Type *MainArgTys[] = {Type::getInt32Ty(C), PointerType::get(Type::getInt8PtrTy(C), 0)}; FunctionType *MainTy = FunctionType::get(Type::getInt32Ty(C), MainArgTys, /*isVarArg=*/false); - if (F.getFunctionType() != MainTy) { + if (shouldFixMainFunction(F.getFunctionType(), MainTy)) { LLVM_DEBUG(dbgs() << "Found `main` function with incorrect type: " << *F.getFunctionType() << "\n"); Value *Args[] = {UndefValue::get(MainArgTys[0]), @@ -298,12 +304,18 @@ bool FixFunctionBitcasts::runOnModule(Module &M) { Main->setName("__original_main"); Function *MainWrapper = cast(CallMain->getCalledValue()->stripPointerCasts()); - MainWrapper->setName("main"); - MainWrapper->setLinkage(Main->getLinkage()); - MainWrapper->setVisibility(Main->getVisibility()); - Main->setLinkage(Function::PrivateLinkage); - Main->setVisibility(Function::DefaultVisibility); delete CallMain; + if (Main->isDeclaration()) { + // The wrapper is not needed in this case as we don't need to export + // it to anyone else. + MainWrapper->eraseFromParent(); + } else { + // Otherwise give the wrapper the same linkage as the original main + // function, so that it can be called from the same places. + MainWrapper->setName("main"); + MainWrapper->setLinkage(Main->getLinkage()); + MainWrapper->setVisibility(Main->getVisibility()); + } } return true; diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 899b50d0f78f..81391b96d126 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1115,8 +1115,7 @@ bool X86AsmParser::ParseRegister(unsigned &RegNo, } // Parse "%st" as "%st(0)" and "%st(1)", which is multiple tokens. - if (RegNo == 0 && (Tok.getString() == "st" || Tok.getString() == "ST")) { - RegNo = X86::ST0; + if (RegNo == X86::ST0) { Parser.Lex(); // Eat 'st' // Check to see if we have '(4)' after %st. diff --git a/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp b/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp index 0e861d5ddbc9..3a074818c762 100644 --- a/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp +++ b/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp @@ -200,3 +200,14 @@ void X86ATTInstPrinter::printU8Imm(const MCInst *MI, unsigned Op, O << markup("getOperand(Op).getImm() & 0xff) << markup(">"); } + +void X86ATTInstPrinter::printSTiRegOperand(const MCInst *MI, unsigned OpNo, + raw_ostream &OS) { + const MCOperand &Op = MI->getOperand(OpNo); + unsigned Reg = Op.getReg(); + // Override the default printing to print st(0) instead st. + if (Reg == X86::ST0) + OS << markup(""); + else + printRegName(OS, Reg); +} diff --git a/lib/Target/X86/InstPrinter/X86ATTInstPrinter.h b/lib/Target/X86/InstPrinter/X86ATTInstPrinter.h index 57422bc9a0b2..584dc9c286e6 100644 --- a/lib/Target/X86/InstPrinter/X86ATTInstPrinter.h +++ b/lib/Target/X86/InstPrinter/X86ATTInstPrinter.h @@ -44,6 +44,7 @@ class X86ATTInstPrinter final : public X86InstPrinterCommon { void printSrcIdx(const MCInst *MI, unsigned Op, raw_ostream &O); void printDstIdx(const MCInst *MI, unsigned Op, raw_ostream &O); void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &OS); + void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS); void printanymem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { printMemReference(MI, OpNo, O); diff --git a/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp b/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp index 044b71564152..b31f8ab80838 100644 --- a/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp +++ b/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp @@ -160,3 +160,14 @@ void X86IntelInstPrinter::printU8Imm(const MCInst *MI, unsigned Op, O << formatImm(MI->getOperand(Op).getImm() & 0xff); } + +void X86IntelInstPrinter::printSTiRegOperand(const MCInst *MI, unsigned OpNo, + raw_ostream &OS) { + const MCOperand &Op = MI->getOperand(OpNo); + unsigned Reg = Op.getReg(); + // Override the default printing to print st(0) instead st. + if (Reg == X86::ST0) + OS << "st(0)"; + else + printRegName(OS, Reg); +} diff --git a/lib/Target/X86/InstPrinter/X86IntelInstPrinter.h b/lib/Target/X86/InstPrinter/X86IntelInstPrinter.h index 3b34a8052bec..fe52bd482a26 100644 --- a/lib/Target/X86/InstPrinter/X86IntelInstPrinter.h +++ b/lib/Target/X86/InstPrinter/X86IntelInstPrinter.h @@ -39,6 +39,7 @@ class X86IntelInstPrinter final : public X86InstPrinterCommon { void printSrcIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printDstIdx(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printU8Imm(const MCInst *MI, unsigned Op, raw_ostream &O); + void printSTiRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &OS); void printanymem(const MCInst *MI, unsigned OpNo, raw_ostream &O) { printMemReference(MI, OpNo, O); diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 3637562c8ec3..f4f37a894620 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -42507,6 +42507,14 @@ X86TargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, if (StringRef("{flags}").equals_lower(Constraint)) return std::make_pair(X86::EFLAGS, &X86::CCRRegClass); + // dirflag -> DF + if (StringRef("{dirflag}").equals_lower(Constraint)) + return std::make_pair(X86::DF, &X86::DFCCRRegClass); + + // fpsr -> FPSW + if (StringRef("{fpsr}").equals_lower(Constraint)) + return std::make_pair(X86::FPSW, &X86::FPCCRRegClass); + // 'A' means [ER]AX + [ER]DX. if (Constraint == "A") { if (Subtarget.is64Bit()) diff --git a/lib/Target/X86/X86InstrFPStack.td b/lib/Target/X86/X86InstrFPStack.td index 5912a3199613..8e12efff77ea 100644 --- a/lib/Target/X86/X86InstrFPStack.td +++ b/lib/Target/X86/X86InstrFPStack.td @@ -230,7 +230,7 @@ def _FI32m : FPI<0xDA, fp, (outs), (ins i32mem:$src), } // mayLoad = 1, hasSideEffects = 1 } -let Defs = [FPSW] in { +let Defs = [FPSW], Uses = [FPCW] in { // FPBinary_rr just defines pseudo-instructions, no need to set a scheduling // resources. let hasNoSchedulingInfo = 1 in { @@ -258,42 +258,42 @@ defm DIVR: FPBinary; } // Defs = [FPSW] class FPST0rInst - : FPI<0xD8, fp, (outs), (ins RST:$op), asm>; + : FPI<0xD8, fp, (outs), (ins RSTi:$op), asm>; class FPrST0Inst - : FPI<0xDC, fp, (outs), (ins RST:$op), asm>; + : FPI<0xDC, fp, (outs), (ins RSTi:$op), asm>; class FPrST0PInst - : FPI<0xDE, fp, (outs), (ins RST:$op), asm>; + : FPI<0xDE, fp, (outs), (ins RSTi:$op), asm>; // NOTE: GAS and apparently all other AT&T style assemblers have a broken notion // of some of the 'reverse' forms of the fsub and fdiv instructions. As such, // we have to put some 'r's in and take them out of weird places. -let SchedRW = [WriteFAdd] in { -def ADD_FST0r : FPST0rInst ; -def ADD_FrST0 : FPrST0Inst ; -def ADD_FPrST0 : FPrST0PInst; -def SUBR_FST0r : FPST0rInst ; -def SUB_FrST0 : FPrST0Inst ; -def SUB_FPrST0 : FPrST0PInst; -def SUB_FST0r : FPST0rInst ; -def SUBR_FrST0 : FPrST0Inst ; -def SUBR_FPrST0 : FPrST0PInst; +let SchedRW = [WriteFAdd], Defs = [FPSW], Uses = [FPCW] in { +def ADD_FST0r : FPST0rInst ; +def ADD_FrST0 : FPrST0Inst ; +def ADD_FPrST0 : FPrST0PInst; +def SUBR_FST0r : FPST0rInst ; +def SUB_FrST0 : FPrST0Inst ; +def SUB_FPrST0 : FPrST0PInst; +def SUB_FST0r : FPST0rInst ; +def SUBR_FrST0 : FPrST0Inst ; +def SUBR_FPrST0 : FPrST0PInst; } // SchedRW -let SchedRW = [WriteFCom] in { +let SchedRW = [WriteFCom], Defs = [FPSW], Uses = [FPCW] in { def COM_FST0r : FPST0rInst ; def COMP_FST0r : FPST0rInst ; } // SchedRW -let SchedRW = [WriteFMul] in { -def MUL_FST0r : FPST0rInst ; -def MUL_FrST0 : FPrST0Inst ; -def MUL_FPrST0 : FPrST0PInst; +let SchedRW = [WriteFMul], Defs = [FPSW], Uses = [FPCW] in { +def MUL_FST0r : FPST0rInst ; +def MUL_FrST0 : FPrST0Inst ; +def MUL_FPrST0 : FPrST0PInst; } // SchedRW -let SchedRW = [WriteFDiv] in { -def DIVR_FST0r : FPST0rInst ; -def DIV_FrST0 : FPrST0Inst ; -def DIV_FPrST0 : FPrST0PInst; -def DIV_FST0r : FPST0rInst ; -def DIVR_FrST0 : FPrST0Inst ; -def DIVR_FPrST0 : FPrST0PInst; +let SchedRW = [WriteFDiv], Defs = [FPSW], Uses = [FPCW] in { +def DIVR_FST0r : FPST0rInst ; +def DIV_FrST0 : FPrST0Inst ; +def DIV_FPrST0 : FPrST0PInst; +def DIV_FST0r : FPST0rInst ; +def DIVR_FrST0 : FPrST0Inst ; +def DIVR_FPrST0 : FPrST0PInst; } // SchedRW // Unary operations. @@ -307,7 +307,7 @@ def _Fp80 : FpI_<(outs RFP80:$dst), (ins RFP80:$src), OneArgFPRW, def _F : FPI<0xD9, fp, (outs), (ins), asmstring>; } -let Defs = [FPSW] in { +let Defs = [FPSW], Uses = [FPCW] in { let SchedRW = [WriteFSign] in { defm CHS : FPUnary; @@ -335,7 +335,7 @@ def TST_F : FPI<0xD9, MRM_E4, (outs), (ins), "ftst">; // Versions of FP instructions that take a single memory operand. Added for the // disassembler; remove as they are included with patterns elsewhere. -let SchedRW = [WriteFComLd] in { +let SchedRW = [WriteFComLd], Defs = [FPSW], Uses = [FPCW] in { def FCOM32m : FPI<0xD8, MRM2m, (outs), (ins f32mem:$src), "fcom{s}\t$src">; def FCOMP32m : FPI<0xD8, MRM3m, (outs), (ins f32mem:$src), "fcomp{s}\t$src">; @@ -398,22 +398,22 @@ defm CMOVNP : FPCMov; let Predicates = [HasCMov] in { // These are not factored because there's no clean way to pass DA/DB. -def CMOVB_F : FPI<0xDA, MRM0r, (outs), (ins RST:$op), - "fcmovb\t{$op, %st(0)|st(0), $op}">; -def CMOVBE_F : FPI<0xDA, MRM2r, (outs), (ins RST:$op), - "fcmovbe\t{$op, %st(0)|st(0), $op}">; -def CMOVE_F : FPI<0xDA, MRM1r, (outs), (ins RST:$op), - "fcmove\t{$op, %st(0)|st(0), $op}">; -def CMOVP_F : FPI<0xDA, MRM3r, (outs), (ins RST:$op), - "fcmovu\t{$op, %st(0)|st(0), $op}">; -def CMOVNB_F : FPI<0xDB, MRM0r, (outs), (ins RST:$op), - "fcmovnb\t{$op, %st(0)|st(0), $op}">; -def CMOVNBE_F: FPI<0xDB, MRM2r, (outs), (ins RST:$op), - "fcmovnbe\t{$op, %st(0)|st(0), $op}">; -def CMOVNE_F : FPI<0xDB, MRM1r, (outs), (ins RST:$op), - "fcmovne\t{$op, %st(0)|st(0), $op}">; -def CMOVNP_F : FPI<0xDB, MRM3r, (outs), (ins RST:$op), - "fcmovnu\t{$op, %st(0)|st(0), $op}">; +def CMOVB_F : FPI<0xDA, MRM0r, (outs), (ins RSTi:$op), + "fcmovb\t{$op, %st|st, $op}">; +def CMOVBE_F : FPI<0xDA, MRM2r, (outs), (ins RSTi:$op), + "fcmovbe\t{$op, %st|st, $op}">; +def CMOVE_F : FPI<0xDA, MRM1r, (outs), (ins RSTi:$op), + "fcmove\t{$op, %st|st, $op}">; +def CMOVP_F : FPI<0xDA, MRM3r, (outs), (ins RSTi:$op), + "fcmovu\t{$op, %st|st, $op}">; +def CMOVNB_F : FPI<0xDB, MRM0r, (outs), (ins RSTi:$op), + "fcmovnb\t{$op, %st|st, $op}">; +def CMOVNBE_F: FPI<0xDB, MRM2r, (outs), (ins RSTi:$op), + "fcmovnbe\t{$op, %st|st, $op}">; +def CMOVNE_F : FPI<0xDB, MRM1r, (outs), (ins RSTi:$op), + "fcmovne\t{$op, %st|st, $op}">; +def CMOVNP_F : FPI<0xDB, MRM3r, (outs), (ins RSTi:$op), + "fcmovnu\t{$op, %st|st, $op}">; } // Predicates = [HasCMov] } // SchedRW @@ -454,7 +454,7 @@ def ILD_Fp64m80: FpI_<(outs RFP80:$dst), (ins i64mem:$src), ZeroArgFP, [(set RFP80:$dst, (X86fild addr:$src, i64))]>; } // SchedRW -let SchedRW = [WriteStore] in { +let SchedRW = [WriteStore], Uses = [FPCW] in { def ST_Fp32m : FpIf32<(outs), (ins f32mem:$op, RFP32:$src), OneArgFP, [(store RFP32:$src, addr:$op)]>; def ST_Fp64m32 : FpIf64<(outs), (ins f32mem:$op, RFP64:$src), OneArgFP, @@ -489,7 +489,7 @@ def IST_Fp16m80 : FpI_<(outs), (ins i16mem:$op, RFP80:$src), OneArgFP, []>; def IST_Fp32m80 : FpI_<(outs), (ins i32mem:$op, RFP80:$src), OneArgFP, []>; def IST_Fp64m80 : FpI_<(outs), (ins i64mem:$op, RFP80:$src), OneArgFP, []>; } // mayStore -} // SchedRW +} // SchedRW, Uses = [FPCW] let mayLoad = 1, SchedRW = [WriteLoad] in { def LD_F32m : FPI<0xD9, MRM0m, (outs), (ins f32mem:$src), "fld{s}\t$src">; @@ -499,7 +499,7 @@ def ILD_F16m : FPI<0xDF, MRM0m, (outs), (ins i16mem:$src), "fild{s}\t$src">; def ILD_F32m : FPI<0xDB, MRM0m, (outs), (ins i32mem:$src), "fild{l}\t$src">; def ILD_F64m : FPI<0xDF, MRM5m, (outs), (ins i64mem:$src), "fild{ll}\t$src">; } -let mayStore = 1, SchedRW = [WriteStore] in { +let mayStore = 1, SchedRW = [WriteStore], Uses = [FPCW] in { def ST_F32m : FPI<0xD9, MRM2m, (outs), (ins f32mem:$dst), "fst{s}\t$dst">; def ST_F64m : FPI<0xDD, MRM2m, (outs), (ins f64mem:$dst), "fst{l}\t$dst">; def ST_FP32m : FPI<0xD9, MRM3m, (outs), (ins f32mem:$dst), "fstp{s}\t$dst">; @@ -513,7 +513,7 @@ def IST_FP64m : FPI<0xDF, MRM7m, (outs), (ins i64mem:$dst), "fistp{ll}\t$dst">; } // FISTTP requires SSE3 even though it's a FPStack op. -let Predicates = [HasSSE3], SchedRW = [WriteStore] in { +let Predicates = [HasSSE3], SchedRW = [WriteStore], Uses = [FPCW] in { def ISTT_Fp16m32 : FpI_<(outs), (ins i16mem:$op, RFP32:$src), OneArgFP, [(X86fp_to_i16mem RFP32:$src, addr:$op)]>; def ISTT_Fp32m32 : FpI_<(outs), (ins i32mem:$op, RFP32:$src), OneArgFP, @@ -534,7 +534,7 @@ def ISTT_Fp64m80 : FpI_<(outs), (ins i64mem:$op, RFP80:$src), OneArgFP, [(X86fp_to_i64mem RFP80:$src, addr:$op)]>; } // Predicates = [HasSSE3] -let mayStore = 1, SchedRW = [WriteStore] in { +let mayStore = 1, SchedRW = [WriteStore], Uses = [FPCW] in { def ISTT_FP16m : FPI<0xDF, MRM1m, (outs), (ins i16mem:$dst), "fisttp{s}\t$dst">; def ISTT_FP32m : FPI<0xDB, MRM1m, (outs), (ins i32mem:$dst), "fisttp{l}\t$dst">; def ISTT_FP64m : FPI<0xDD, MRM1m, (outs), (ins i64mem:$dst), "fisttp{ll}\t$dst">; @@ -542,10 +542,10 @@ def ISTT_FP64m : FPI<0xDD, MRM1m, (outs), (ins i64mem:$dst), "fisttp{ll}\t$dst"> // FP Stack manipulation instructions. let SchedRW = [WriteMove] in { -def LD_Frr : FPI<0xD9, MRM0r, (outs), (ins RST:$op), "fld\t$op">; -def ST_Frr : FPI<0xDD, MRM2r, (outs), (ins RST:$op), "fst\t$op">; -def ST_FPrr : FPI<0xDD, MRM3r, (outs), (ins RST:$op), "fstp\t$op">; -def XCH_F : FPI<0xD9, MRM1r, (outs), (ins RST:$op), "fxch\t$op">; +def LD_Frr : FPI<0xD9, MRM0r, (outs), (ins RSTi:$op), "fld\t$op">; +def ST_Frr : FPI<0xDD, MRM2r, (outs), (ins RSTi:$op), "fst\t$op">; +def ST_FPrr : FPI<0xDD, MRM3r, (outs), (ins RSTi:$op), "fstp\t$op">; +def XCH_F : FPI<0xD9, MRM1r, (outs), (ins RSTi:$op), "fxch\t$op">; } // Floating point constant loads. @@ -570,7 +570,7 @@ def LD_F0 : FPI<0xD9, MRM_EE, (outs), (ins), "fldz">; let SchedRW = [WriteFLD1] in def LD_F1 : FPI<0xD9, MRM_E8, (outs), (ins), "fld1">; -let SchedRW = [WriteFLDC], Defs = [FPSW] in { +let SchedRW = [WriteFLDC] in { def FLDL2T : I<0xD9, MRM_E9, (outs), (ins), "fldl2t", []>; def FLDL2E : I<0xD9, MRM_EA, (outs), (ins), "fldl2e", []>; def FLDPI : I<0xD9, MRM_EB, (outs), (ins), "fldpi", []>; @@ -579,7 +579,7 @@ def FLDLN2 : I<0xD9, MRM_ED, (outs), (ins), "fldln2", []>; } // SchedRW // Floating point compares. -let SchedRW = [WriteFCom] in { +let SchedRW = [WriteFCom], Uses = [FPCW] in { def UCOM_Fpr32 : FpIf32<(outs), (ins RFP32:$lhs, RFP32:$rhs), CompareFP, [(set FPSW, (trunc (X86cmp RFP32:$lhs, RFP32:$rhs)))]>; def UCOM_Fpr64 : FpIf64<(outs), (ins RFP64:$lhs, RFP64:$rhs), CompareFP, @@ -591,37 +591,37 @@ def UCOM_Fpr80 : FpI_ <(outs), (ins RFP80:$lhs, RFP80:$rhs), CompareFP, let SchedRW = [WriteFCom] in { // CC = ST(0) cmp ST(i) -let Defs = [EFLAGS, FPSW] in { -let Predicates = [FPStackf32, HasCMov] in -def UCOM_FpIr32: FpIf32<(outs), (ins RFP32:$lhs, RFP32:$rhs), CompareFP, - [(set EFLAGS, (X86cmp RFP32:$lhs, RFP32:$rhs))]>; -let Predicates = [FPStackf64, HasCMov] in -def UCOM_FpIr64: FpIf64<(outs), (ins RFP64:$lhs, RFP64:$rhs), CompareFP, - [(set EFLAGS, (X86cmp RFP64:$lhs, RFP64:$rhs))]>; -let Predicates = [HasCMov] in +let Defs = [EFLAGS, FPSW], Uses = [FPCW] in { +def UCOM_FpIr32: FpI_<(outs), (ins RFP32:$lhs, RFP32:$rhs), CompareFP, + [(set EFLAGS, (X86cmp RFP32:$lhs, RFP32:$rhs))]>, + Requires<[FPStackf32, HasCMov]>; +def UCOM_FpIr64: FpI_<(outs), (ins RFP64:$lhs, RFP64:$rhs), CompareFP, + [(set EFLAGS, (X86cmp RFP64:$lhs, RFP64:$rhs))]>, + Requires<[FPStackf64, HasCMov]>; def UCOM_FpIr80: FpI_<(outs), (ins RFP80:$lhs, RFP80:$rhs), CompareFP, - [(set EFLAGS, (X86cmp RFP80:$lhs, RFP80:$rhs))]>; + [(set EFLAGS, (X86cmp RFP80:$lhs, RFP80:$rhs))]>, + Requires<[HasCMov]>; } -let Defs = [FPSW], Uses = [ST0] in { +let Defs = [FPSW], Uses = [ST0, FPCW] in { def UCOM_Fr : FPI<0xDD, MRM4r, // FPSW = cmp ST(0) with ST(i) - (outs), (ins RST:$reg), "fucom\t$reg">; + (outs), (ins RSTi:$reg), "fucom\t$reg">; def UCOM_FPr : FPI<0xDD, MRM5r, // FPSW = cmp ST(0) with ST(i), pop - (outs), (ins RST:$reg), "fucomp\t$reg">; + (outs), (ins RSTi:$reg), "fucomp\t$reg">; def UCOM_FPPr : FPI<0xDA, MRM_E9, // cmp ST(0) with ST(1), pop, pop (outs), (ins), "fucompp">; } -let Defs = [EFLAGS, FPSW], Uses = [ST0] in { +let Defs = [EFLAGS, FPSW], Uses = [ST0, FPCW] in { def UCOM_FIr : FPI<0xDB, MRM5r, // CC = cmp ST(0) with ST(i) - (outs), (ins RST:$reg), "fucomi\t$reg">; + (outs), (ins RSTi:$reg), "fucomi\t{$reg, %st|st, $reg}">; def UCOM_FIPr : FPI<0xDF, MRM5r, // CC = cmp ST(0) with ST(i), pop - (outs), (ins RST:$reg), "fucompi\t$reg">; -} + (outs), (ins RSTi:$reg), "fucompi\t{$reg, %st|st, $reg}">; -let Defs = [EFLAGS, FPSW] in { -def COM_FIr : FPI<0xDB, MRM6r, (outs), (ins RST:$reg), "fcomi\t$reg">; -def COM_FIPr : FPI<0xDF, MRM6r, (outs), (ins RST:$reg), "fcompi\t$reg">; +def COM_FIr : FPI<0xDB, MRM6r, (outs), (ins RSTi:$reg), + "fcomi\t{$reg, %st|st, $reg}">; +def COM_FIPr : FPI<0xDF, MRM6r, (outs), (ins RSTi:$reg), + "fcompi\t{$reg, %st|st, $reg}">; } } // SchedRW @@ -631,12 +631,12 @@ let Defs = [AX], Uses = [FPSW] in def FNSTSW16r : I<0xDF, MRM_E0, // AX = fp flags (outs), (ins), "fnstsw\t{%ax|ax}", [(set AX, (X86fp_stsw FPSW))]>; -let Defs = [FPSW] in +let Defs = [FPSW], Uses = [FPCW] in def FNSTCW16m : I<0xD9, MRM7m, // [mem16] = X87 control world (outs), (ins i16mem:$dst), "fnstcw\t$dst", [(X86fp_cwd_get16 addr:$dst)]>; } // SchedRW -let Defs = [FPSW], mayLoad = 1 in +let Defs = [FPSW,FPCW], mayLoad = 1 in def FLDCW16m : I<0xD9, MRM5m, // X87 control world = [mem16] (outs), (ins i16mem:$dst), "fldcw\t$dst", []>, Sched<[WriteLoad]>; @@ -645,8 +645,8 @@ def FLDCW16m : I<0xD9, MRM5m, // X87 control world = [mem16] let SchedRW = [WriteMicrocoded] in { let Defs = [FPSW] in { def FNINIT : I<0xDB, MRM_E3, (outs), (ins), "fninit", []>; -def FFREE : FPI<0xDD, MRM0r, (outs), (ins RST:$reg), "ffree\t$reg">; -def FFREEP : FPI<0xDF, MRM0r, (outs), (ins RST:$reg), "ffreep\t$reg">; +def FFREE : FPI<0xDD, MRM0r, (outs), (ins RSTi:$reg), "ffree\t$reg">; +def FFREEP : FPI<0xDF, MRM0r, (outs), (ins RSTi:$reg), "ffreep\t$reg">; // Clear exceptions def FNCLEX : I<0xDB, MRM_E2, (outs), (ins), "fnclex", []>; diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td index e53f83baa3c6..4ec4d566ca99 100644 --- a/lib/Target/X86/X86InstrInfo.td +++ b/lib/Target/X86/X86InstrInfo.td @@ -3231,39 +3231,39 @@ def : InstAlias<"fucompi", (UCOM_FIPr ST1), 0>; // instructions like "fadd %st(0), %st(0)" as "fadd %st(0)" for consistency with // gas. multiclass FpUnaryAlias { - def : InstAlias; - def : InstAlias; + def : InstAlias; } -defm : FpUnaryAlias<"fadd", ADD_FST0r>; +defm : FpUnaryAlias<"fadd", ADD_FST0r, 0>; defm : FpUnaryAlias<"faddp", ADD_FPrST0, 0>; -defm : FpUnaryAlias<"fsub", SUB_FST0r>; -defm : FpUnaryAlias<"fsub{|r}p", SUBR_FPrST0>; -defm : FpUnaryAlias<"fsubr", SUBR_FST0r>; -defm : FpUnaryAlias<"fsub{r|}p", SUB_FPrST0>; -defm : FpUnaryAlias<"fmul", MUL_FST0r>; -defm : FpUnaryAlias<"fmulp", MUL_FPrST0>; -defm : FpUnaryAlias<"fdiv", DIV_FST0r>; -defm : FpUnaryAlias<"fdiv{|r}p", DIVR_FPrST0>; -defm : FpUnaryAlias<"fdivr", DIVR_FST0r>; -defm : FpUnaryAlias<"fdiv{r|}p", DIV_FPrST0>; +defm : FpUnaryAlias<"fsub", SUB_FST0r, 0>; +defm : FpUnaryAlias<"fsub{|r}p", SUBR_FPrST0, 0>; +defm : FpUnaryAlias<"fsubr", SUBR_FST0r, 0>; +defm : FpUnaryAlias<"fsub{r|}p", SUB_FPrST0, 0>; +defm : FpUnaryAlias<"fmul", MUL_FST0r, 0>; +defm : FpUnaryAlias<"fmulp", MUL_FPrST0, 0>; +defm : FpUnaryAlias<"fdiv", DIV_FST0r, 0>; +defm : FpUnaryAlias<"fdiv{|r}p", DIVR_FPrST0, 0>; +defm : FpUnaryAlias<"fdivr", DIVR_FST0r, 0>; +defm : FpUnaryAlias<"fdiv{r|}p", DIV_FPrST0, 0>; defm : FpUnaryAlias<"fcomi", COM_FIr, 0>; defm : FpUnaryAlias<"fucomi", UCOM_FIr, 0>; -defm : FpUnaryAlias<"fcompi", COM_FIPr>; -defm : FpUnaryAlias<"fucompi", UCOM_FIPr>; +defm : FpUnaryAlias<"fcompi", COM_FIPr, 0>; +defm : FpUnaryAlias<"fucompi", UCOM_FIPr, 0>; -// Handle "f{mulp,addp} st(0), $op" the same as "f{mulp,addp} $op", since they +// Handle "f{mulp,addp} $op, %st(0)" the same as "f{mulp,addp} $op", since they // commute. We also allow fdiv[r]p/fsubrp even though they don't commute, // solely because gas supports it. -def : InstAlias<"faddp\t{%st(0), $op|$op, st(0)}", (ADD_FPrST0 RST:$op), 0>; -def : InstAlias<"fmulp\t{%st(0), $op|$op, st(0)}", (MUL_FPrST0 RST:$op)>; -def : InstAlias<"fsub{|r}p\t{%st(0), $op|$op, st(0)}", (SUBR_FPrST0 RST:$op)>; -def : InstAlias<"fsub{r|}p\t{%st(0), $op|$op, st(0)}", (SUB_FPrST0 RST:$op)>; -def : InstAlias<"fdiv{|r}p\t{%st(0), $op|$op, st(0)}", (DIVR_FPrST0 RST:$op)>; -def : InstAlias<"fdiv{r|}p\t{%st(0), $op|$op, st(0)}", (DIV_FPrST0 RST:$op)>; +def : InstAlias<"faddp\t{$op, %st|st, $op}", (ADD_FPrST0 RSTi:$op), 0>; +def : InstAlias<"fmulp\t{$op, %st|st, $op}", (MUL_FPrST0 RSTi:$op), 0>; +def : InstAlias<"fsub{|r}p\t{$op, %st|st, $op}", (SUBR_FPrST0 RSTi:$op), 0>; +def : InstAlias<"fsub{r|}p\t{$op, %st|st, $op}", (SUB_FPrST0 RSTi:$op), 0>; +def : InstAlias<"fdiv{|r}p\t{$op, %st|st, $op}", (DIVR_FPrST0 RSTi:$op), 0>; +def : InstAlias<"fdiv{r|}p\t{$op, %st|st, $op}", (DIV_FPrST0 RSTi:$op), 0>; def : InstAlias<"fnstsw" , (FNSTSW16r), 0>; diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index 55842a4a2091..bc39cee34c4a 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -497,6 +497,9 @@ BitVector X86RegisterInfo::getReservedRegs(const MachineFunction &MF) const { BitVector Reserved(getNumRegs()); const X86FrameLowering *TFI = getFrameLowering(MF); + // Set the floating point control register as reserved. + Reserved.set(X86::FPCW); + // Set the stack-pointer register and its aliases as reserved. for (MCSubRegIterator I(X86::RSP, this, /*IncludeSelf=*/true); I.isValid(); ++I) diff --git a/lib/Target/X86/X86RegisterInfo.td b/lib/Target/X86/X86RegisterInfo.td index aa20273f89ab..6a0538138528 100644 --- a/lib/Target/X86/X86RegisterInfo.td +++ b/lib/Target/X86/X86RegisterInfo.td @@ -278,7 +278,7 @@ def K7 : X86Reg<"k7", 7>, DwarfRegNum<[125, 100, 100]>; // pseudo registers, but we still mark them as aliasing FP registers. That // way both kinds can be live without exceeding the stack depth. ST registers // are only live around inline assembly. -def ST0 : X86Reg<"st(0)", 0>, DwarfRegNum<[33, 12, 11]>; +def ST0 : X86Reg<"st", 0>, DwarfRegNum<[33, 12, 11]>; def ST1 : X86Reg<"st(1)", 1>, DwarfRegNum<[34, 13, 12]>; def ST2 : X86Reg<"st(2)", 2>, DwarfRegNum<[35, 14, 13]>; def ST3 : X86Reg<"st(3)", 3>, DwarfRegNum<[36, 15, 14]>; @@ -288,7 +288,10 @@ def ST6 : X86Reg<"st(6)", 6>, DwarfRegNum<[39, 18, 17]>; def ST7 : X86Reg<"st(7)", 7>, DwarfRegNum<[40, 19, 18]>; // Floating-point status word -def FPSW : X86Reg<"fpsw", 0>; +def FPSW : X86Reg<"fpsr", 0>; + +// Floating-point control word +def FPCW : X86Reg<"fpcr", 0>; // Status flags register. // @@ -539,6 +542,9 @@ def RST : RegisterClass<"X86", [f80, f64, f32], 32, (sequence "ST%u", 0, 7)> { let isAllocatable = 0; } +// Helper to allow %st to print as %st(0) when its encoded in the instruction. +def RSTi : RegisterOperand; + // Generic vector registers: VR64 and VR128. // Ensure that float types are declared first - only float is legal on SSE1. def VR64: RegisterClass<"X86", [x86mmx], 64, (sequence "MM%u", 0, 7)>; diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index e6573af2077d..b2230afa13d8 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -321,6 +321,7 @@ static cl::opt ClOriginBase("msan-origin-base", cl::desc("Define custom MSan OriginBase"), cl::Hidden, cl::init(0)); +static const char *const kMsanModuleCtorName = "msan.module_ctor"; static const char *const kMsanInitName = "__msan_init"; namespace { @@ -586,6 +587,8 @@ class MemorySanitizer { /// An empty volatile inline asm that prevents callback merge. InlineAsm *EmptyAsm; + + Function *MsanCtorFunction; }; /// A legacy function pass for msan instrumentation. @@ -839,6 +842,8 @@ Value *MemorySanitizer::getKmsanShadowOriginAccessFn(bool isStore, int size) { } /// Module-level initialization. +/// +/// inserts a call to __msan_init to the module's constructor list. void MemorySanitizer::initializeModule(Module &M) { auto &DL = M.getDataLayout(); @@ -913,7 +918,22 @@ void MemorySanitizer::initializeModule(Module &M) { OriginStoreWeights = MDBuilder(*C).createBranchWeights(1, 1000); if (!CompileKernel) { - getOrCreateInitFunction(M, kMsanInitName); + std::tie(MsanCtorFunction, std::ignore) = + getOrCreateSanitizerCtorAndInitFunctions( + M, kMsanModuleCtorName, kMsanInitName, + /*InitArgTypes=*/{}, + /*InitArgs=*/{}, + // This callback is invoked when the functions are created the first + // time. Hook them into the global ctors list in that case: + [&](Function *Ctor, Function *) { + if (!ClWithComdat) { + appendToGlobalCtors(M, Ctor, 0); + return; + } + Comdat *MsanCtorComdat = M.getOrInsertComdat(kMsanModuleCtorName); + Ctor->setComdat(MsanCtorComdat); + appendToGlobalCtors(M, Ctor, 0, Ctor); + }); if (TrackOrigins) M.getOrInsertGlobal("__msan_track_origins", IRB.getInt32Ty(), [&] { @@ -4458,6 +4478,8 @@ static VarArgHelper *CreateVarArgHelper(Function &Func, MemorySanitizer &Msan, } bool MemorySanitizer::sanitizeFunction(Function &F, TargetLibraryInfo &TLI) { + if (!CompileKernel && (&F == MsanCtorFunction)) + return false; MemorySanitizerVisitor Visitor(F, *this, TLI); // Clear out readonly/readnone attributes. diff --git a/test/CodeGen/AArch64/cmpxchg-lse-even-regs.ll b/test/CodeGen/AArch64/cmpxchg-lse-even-regs.ll new file mode 100644 index 000000000000..9c6d8cc20533 --- /dev/null +++ b/test/CodeGen/AArch64/cmpxchg-lse-even-regs.ll @@ -0,0 +1,17 @@ +; RUN: llc -mtriple arm64-apple-ios -mattr=+lse %s -o - | FileCheck %s + +; Only "even,even+1" pairs are valid for CASP instructions. Make sure LLVM +; doesn't allocate odd ones and that it can copy them around properly. N.b. we +; don't actually check that they're sequential because FileCheck can't; odd/even +; will have to be good enough. +define void @test_atomic_cmpxchg_i128_register_shuffling(i128* %addr, i128 %desired, i128 %new) nounwind { +; CHECK-LABEL: test_atomic_cmpxchg_i128_register_shuffling: +; CHECK-DAG: mov [[DESIRED_LO:x[0-9]*[02468]]], x1 +; CHECK-DAG: mov [[DESIRED_HI:x[0-9]*[13579]]], x2 +; CHECK-DAG: mov [[NEW_LO:x[0-9]*[02468]]], x3 +; CHECK-DAG: mov [[NEW_HI:x[0-9]*[13579]]], x4 +; CHECK: caspal [[DESIRED_LO]], [[DESIRED_HI]], [[NEW_LO]], [[NEW_HI]], [x0] + + %res = cmpxchg i128* %addr, i128 %desired, i128 %new seq_cst seq_cst + ret void +} diff --git a/test/CodeGen/AArch64/seqpaircopy.mir b/test/CodeGen/AArch64/seqpaircopy.mir new file mode 100644 index 000000000000..89511cbf726b --- /dev/null +++ b/test/CodeGen/AArch64/seqpaircopy.mir @@ -0,0 +1,23 @@ +# RUN: llc -o - %s -mtriple=aarch64-- -mattr=+v8.1a -run-pass=postrapseudos | FileCheck %s +--- +# CHECK-LABEL: name: copy_xseqpairs +name: copy_xseqpairs +body: | + bb.0: + ; CHECK: $x4_x5 = CASPALX $x4_x5, $x2_x3, $x0 + ; CHECK: $x0 = ORRXrs $xzr, $x4, 0 + ; CHECK: $x1 = ORRXrs $xzr, $x5, 0 + $x4_x5 = CASPALX $x4_x5, $x2_x3, $x0 + $x0_x1 = COPY $x4_x5 +... +--- +# CHECK-LABEL: name: copy_wseqpairs +name: copy_wseqpairs +body: | + bb.0: + ; CHECK: $w4_w5 = CASPALW $w4_w5, $w2_w3, $x0 + ; CHECK: $w0 = ORRWrs $wzr, $w4, 0 + ; CHECK: $w1 = ORRWrs $wzr, $w5, 0 + $w4_w5 = CASPALW $w4_w5, $w2_w3, $x0 + $w0_w1 = COPY $w4_w5 +... diff --git a/test/CodeGen/MIR/X86/memory-operands.mir b/test/CodeGen/MIR/X86/memory-operands.mir index 2ac7bea2fc9b..89b28126b916 100644 --- a/test/CodeGen/MIR/X86/memory-operands.mir +++ b/test/CodeGen/MIR/X86/memory-operands.mir @@ -359,8 +359,8 @@ body: | CFI_INSTRUCTION def_cfa_offset 32 LD_F80m $rsp, 1, $noreg, 32, $noreg, implicit-def dead $fpsw ; CHECK: name: stack_psv - ; CHECK: ST_FP80m $rsp, 1, $noreg, 0, $noreg, implicit-def dead $fpsw :: (store 10 into stack, align 16) - ST_FP80m $rsp, 1, _, 0, _, implicit-def dead $fpsw :: (store 10 into stack, align 16) + ; CHECK: ST_FP80m $rsp, 1, $noreg, 0, $noreg, implicit-def dead $fpsw, implicit $fpcw :: (store 10 into stack, align 16) + ST_FP80m $rsp, 1, _, 0, _, implicit-def dead $fpsw, implicit $fpcw :: (store 10 into stack, align 16) CALL64pcrel32 &cosl, csr_64, implicit $rsp, implicit-def $rsp, implicit-def $fp0 $rsp = ADD64ri8 $rsp, 24, implicit-def dead $eflags RETQ diff --git a/test/CodeGen/Mips/micromips-b-range.ll b/test/CodeGen/Mips/micromips-b-range.ll index 5831ae81baed..27a0db545f74 100644 --- a/test/CodeGen/Mips/micromips-b-range.ll +++ b/test/CodeGen/Mips/micromips-b-range.ll @@ -13,7 +13,7 @@ ; CHECK-NEXT: 1e: fb fd 00 00 sw $ra, 0($sp) ; CHECK-NEXT: 22: 41 a1 00 01 lui $1, 1 ; CHECK-NEXT: 26: 40 60 00 02 bal 8 -; CHECK-NEXT: 2a: 30 21 04 68 addiu $1, $1, 1128 +; CHECK-NEXT: 2a: 30 21 04 69 addiu $1, $1, 1129 ; CHECK-NEXT: 2e: 00 3f 09 50 addu $1, $ra, $1 ; CHECK-NEXT: 32: ff fd 00 00 lw $ra, 0($sp) ; CHECK-NEXT: 36: 00 01 0f 3c jr $1 @@ -27,7 +27,7 @@ ; CHECK-NEXT: 56: fb fd 00 00 sw $ra, 0($sp) ; CHECK-NEXT: 5a: 41 a1 00 01 lui $1, 1 ; CHECK-NEXT: 5e: 40 60 00 02 bal 8 -; CHECK-NEXT: 62: 30 21 04 5c addiu $1, $1, 1116 +; CHECK-NEXT: 62: 30 21 04 5d addiu $1, $1, 1117 ; CHECK-NEXT: 66: 00 3f 09 50 addu $1, $ra, $1 ; CHECK-NEXT: 6a: ff fd 00 00 lw $ra, 0($sp) ; CHECK-NEXT: 6e: 00 01 0f 3c jr $1 @@ -39,7 +39,7 @@ ; CHECK-NEXT: 86: fb fd 00 00 sw $ra, 0($sp) ; CHECK-NEXT: 8a: 41 a1 00 01 lui $1, 1 ; CHECK-NEXT: 8e: 40 60 00 02 bal 8 -; CHECK-NEXT: 92: 30 21 04 2c addiu $1, $1, 1068 +; CHECK-NEXT: 92: 30 21 04 2d addiu $1, $1, 1069 ; CHECK-NEXT: 96: 00 3f 09 50 addu $1, $ra, $1 ; CHECK-NEXT: 9a: ff fd 00 00 lw $ra, 0($sp) ; CHECK-NEXT: 9e: 00 01 0f 3c jr $1 @@ -51,7 +51,7 @@ ; CHECK-NEXT: 10476: fb fd 00 00 sw $ra, 0($sp) ; CHECK-NEXT: 1047a: 41 a1 00 01 lui $1, 1 ; CHECK-NEXT: 1047e: 40 60 00 02 bal 8 -; CHECK-NEXT: 10482: 30 21 04 00 addiu $1, $1, 1024 +; CHECK-NEXT: 10482: 30 21 04 01 addiu $1, $1, 1025 ; CHECK-NEXT: 10486: 00 3f 09 50 addu $1, $ra, $1 ; CHECK-NEXT: 1048a: ff fd 00 00 lw $ra, 0($sp) ; CHECK-NEXT: 1048e: 00 01 0f 3c jr $1 diff --git a/test/CodeGen/SystemZ/memcmp-01.ll b/test/CodeGen/SystemZ/memcmp-01.ll index ac980e49d60b..740a86750dd8 100644 --- a/test/CodeGen/SystemZ/memcmp-01.ll +++ b/test/CodeGen/SystemZ/memcmp-01.ll @@ -16,10 +16,10 @@ define i32 @f1(i8 *%src1, i8 *%src2) { ; Check a case where the result is used as an integer. define i32 @f2(i8 *%src1, i8 *%src2) { ; CHECK-LABEL: f2: -; CHECK: clc 0(2,%r2), 0(%r3) -; CHECK: ipm [[REG:%r[0-5]]] -; CHECK: srl [[REG]], 28 -; CHECK: rll %r2, [[REG]], 31 +; CHECK: clc 0(2,%r3), 0(%r2) +; CHECK: ipm %r2 +; CHECK: sll %r2, 2 +; CHECK: sra %r2, 30 ; CHECK: br %r14 %res = call i32 @memcmp(i8 *%src1, i8 *%src2, i64 2) ret i32 %res @@ -28,7 +28,7 @@ define i32 @f2(i8 *%src1, i8 *%src2) { ; Check a case where the result is tested for equality. define void @f3(i8 *%src1, i8 *%src2, i32 *%dest) { ; CHECK-LABEL: f3: -; CHECK: clc 0(3,%r2), 0(%r3) +; CHECK: clc 0(3,%r3), 0(%r2) ; CHECK-NEXT: ber %r14 ; CHECK: br %r14 %res = call i32 @memcmp(i8 *%src1, i8 *%src2, i64 3) @@ -46,7 +46,7 @@ exit: ; Check a case where the result is tested for inequality. define void @f4(i8 *%src1, i8 *%src2, i32 *%dest) { ; CHECK-LABEL: f4: -; CHECK: clc 0(4,%r2), 0(%r3) +; CHECK: clc 0(4,%r3), 0(%r2) ; CHECK-NEXT: blhr %r14 ; CHECK: br %r14 entry: @@ -65,8 +65,8 @@ exit: ; Check a case where the result is tested via slt. define void @f5(i8 *%src1, i8 *%src2, i32 *%dest) { ; CHECK-LABEL: f5: -; CHECK: clc 0(5,%r2), 0(%r3) -; CHECK-NEXT: blr %r14 +; CHECK: clc 0(5,%r3), 0(%r2) +; CHECK-NEXT: bhr %r14 ; CHECK: br %r14 entry: %res = call i32 @memcmp(i8 *%src1, i8 *%src2, i64 5) @@ -84,8 +84,8 @@ exit: ; Check a case where the result is tested for sgt. define void @f6(i8 *%src1, i8 *%src2, i32 *%dest) { ; CHECK-LABEL: f6: -; CHECK: clc 0(6,%r2), 0(%r3) -; CHECK-NEXT: bhr %r14 +; CHECK: clc 0(6,%r3), 0(%r2) +; CHECK-NEXT: blr %r14 ; CHECK: br %r14 entry: %res = call i32 @memcmp(i8 *%src1, i8 *%src2, i64 6) @@ -104,10 +104,10 @@ exit: ; an integer and for branching. define i32 @f7(i8 *%src1, i8 *%src2, i32 *%dest) { ; CHECK-LABEL: f7: -; CHECK: clc 0(256,%r2), 0(%r3) -; CHECK: ipm [[REG:%r[0-5]]] -; CHECK: srl [[REG]], 28 -; CHECK: rll %r2, [[REG]], 31 +; CHECK: clc 0(256,%r3), 0(%r2) +; CHECK: ipm %r2 +; CHECK: sll %r2, 2 +; CHECK: sra %r2, 30 ; CHECK: blr %r14 ; CHECK: br %r14 entry: @@ -126,9 +126,9 @@ exit: ; 257 bytes needs two CLCs. define i32 @f8(i8 *%src1, i8 *%src2) { ; CHECK-LABEL: f8: -; CHECK: clc 0(256,%r2), 0(%r3) +; CHECK: clc 0(256,%r3), 0(%r2) ; CHECK: jlh [[LABEL:\..*]] -; CHECK: clc 256(1,%r2), 256(%r3) +; CHECK: clc 256(1,%r3), 256(%r2) ; CHECK: [[LABEL]]: ; CHECK: ipm [[REG:%r[0-5]]] ; CHECK: br %r14 @@ -139,11 +139,11 @@ define i32 @f8(i8 *%src1, i8 *%src2) { ; Test a comparison of 258 bytes in which the CC result can be used directly. define void @f9(i8 *%src1, i8 *%src2, i32 *%dest) { ; CHECK-LABEL: f9: -; CHECK: clc 0(256,%r2), 0(%r3) +; CHECK: clc 0(256,%r3), 0(%r2) ; CHECK: jlh [[LABEL:\..*]] -; CHECK: clc 256(1,%r2), 256(%r3) +; CHECK: clc 256(1,%r3), 256(%r2) ; CHECK: [[LABEL]]: -; CHECK-NEXT: blr %r14 +; CHECK-NEXT: bhr %r14 ; CHECK: br %r14 entry: %res = call i32 @memcmp(i8 *%src1, i8 *%src2, i64 257) @@ -161,9 +161,9 @@ exit: ; Test the largest size that can use two CLCs. define i32 @f10(i8 *%src1, i8 *%src2) { ; CHECK-LABEL: f10: -; CHECK: clc 0(256,%r2), 0(%r3) +; CHECK: clc 0(256,%r3), 0(%r2) ; CHECK: jlh [[LABEL:\..*]] -; CHECK: clc 256(256,%r2), 256(%r3) +; CHECK: clc 256(256,%r3), 256(%r2) ; CHECK: [[LABEL]]: ; CHECK: ipm [[REG:%r[0-5]]] ; CHECK: br %r14 @@ -174,11 +174,11 @@ define i32 @f10(i8 *%src1, i8 *%src2) { ; Test the smallest size that needs 3 CLCs. define i32 @f11(i8 *%src1, i8 *%src2) { ; CHECK-LABEL: f11: -; CHECK: clc 0(256,%r2), 0(%r3) +; CHECK: clc 0(256,%r3), 0(%r2) ; CHECK: jlh [[LABEL:\..*]] -; CHECK: clc 256(256,%r2), 256(%r3) +; CHECK: clc 256(256,%r3), 256(%r2) ; CHECK: jlh [[LABEL]] -; CHECK: clc 512(1,%r2), 512(%r3) +; CHECK: clc 512(1,%r3), 512(%r2) ; CHECK: [[LABEL]]: ; CHECK: ipm [[REG:%r[0-5]]] ; CHECK: br %r14 @@ -189,11 +189,11 @@ define i32 @f11(i8 *%src1, i8 *%src2) { ; Test the largest size than can use 3 CLCs. define i32 @f12(i8 *%src1, i8 *%src2) { ; CHECK-LABEL: f12: -; CHECK: clc 0(256,%r2), 0(%r3) +; CHECK: clc 0(256,%r3), 0(%r2) ; CHECK: jlh [[LABEL:\..*]] -; CHECK: clc 256(256,%r2), 256(%r3) +; CHECK: clc 256(256,%r3), 256(%r2) ; CHECK: jlh [[LABEL]] -; CHECK: clc 512(256,%r2), 512(%r3) +; CHECK: clc 512(256,%r3), 512(%r2) ; CHECK: [[LABEL]]: ; CHECK: ipm [[REG:%r[0-5]]] ; CHECK: br %r14 @@ -207,12 +207,12 @@ define i32 @f13(i8 *%src1, i8 *%src2) { ; CHECK-LABEL: f13: ; CHECK: lghi [[COUNT:%r[0-5]]], 3 ; CHECK: [[LOOP:.L[^:]*]]: -; CHECK: clc 0(256,%r2), 0(%r3) +; CHECK: clc 0(256,%r3), 0(%r2) ; CHECK: jlh [[LABEL:\..*]] ; CHECK-DAG: la %r2, 256(%r2) ; CHECK-DAG: la %r3, 256(%r3) ; CHECK: brctg [[COUNT]], [[LOOP]] -; CHECK: clc 0(1,%r2), 0(%r3) +; CHECK: clc 0(1,%r3), 0(%r2) ; CHECK: [[LABEL]]: ; CHECK: ipm [[REG:%r[0-5]]] ; CHECK: br %r14 diff --git a/test/CodeGen/SystemZ/strcmp-01.ll b/test/CodeGen/SystemZ/strcmp-01.ll index ef05d832e73e..a3e3bbbb23be 100644 --- a/test/CodeGen/SystemZ/strcmp-01.ll +++ b/test/CodeGen/SystemZ/strcmp-01.ll @@ -9,12 +9,12 @@ define i32 @f1(i8 *%src1, i8 *%src2) { ; CHECK-LABEL: f1: ; CHECK: lhi %r0, 0 ; CHECK: [[LABEL:\.[^:]*]]: -; CHECK: clst %r2, %r3 +; CHECK: clst %r3, %r2 ; CHECK-NEXT: jo [[LABEL]] ; CHECK-NEXT: %bb.{{[0-9]+}} -; CHECK-NEXT: ipm [[REG:%r[0-5]]] -; CHECK: srl [[REG]], 28 -; CHECK: rll %r2, [[REG]], 31 +; CHECK-NEXT: ipm %r2 +; CHECK: sll %r2, 2 +; CHECK: sra %r2, 30 ; CHECK: br %r14 %res = call i32 @strcmp(i8 *%src1, i8 *%src2) ret i32 %res @@ -25,7 +25,7 @@ define void @f2(i8 *%src1, i8 *%src2, i32 *%dest) { ; CHECK-LABEL: f2: ; CHECK: lhi %r0, 0 ; CHECK: [[LABEL:\.[^:]*]]: -; CHECK: clst %r2, %r3 +; CHECK: clst %r3, %r2 ; CHECK-NEXT: jo [[LABEL]] ; CHECK-NEXT: %bb.{{[0-9]+}} ; CHECK-NEXT: ber %r14 @@ -48,12 +48,12 @@ define i32 @f3(i8 *%src1, i8 *%src2, i32 *%dest) { ; CHECK-LABEL: f3: ; CHECK: lhi %r0, 0 ; CHECK: [[LABEL:\.[^:]*]]: -; CHECK: clst %r2, %r3 +; CHECK: clst %r3, %r2 ; CHECK-NEXT: jo [[LABEL]] ; CHECK-NEXT: %bb.{{[0-9]+}} -; CHECK-NEXT: ipm [[REG:%r[0-5]]] -; CHECK: srl [[REG]], 28 -; CHECK: rll %r2, [[REG]], 31 +; CHECK-NEXT: ipm %r2 +; CHECK: sll %r2, 2 +; CHECK: sra %r2, 30 ; CHECK: blr %r14 ; CHECK: br %r14 entry: diff --git a/test/CodeGen/WebAssembly/call.ll b/test/CodeGen/WebAssembly/call.ll index db666a6c3668..77f17c850eda 100644 --- a/test/CodeGen/WebAssembly/call.ll +++ b/test/CodeGen/WebAssembly/call.ll @@ -1,5 +1,5 @@ -; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -wasm-temporary-workarounds=false -mattr=+sign-ext,+simd128 | FileCheck %s -; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -fast-isel -fast-isel-abort=1 -wasm-temporary-workarounds=false -mattr=+sign-ext,+simd128 | FileCheck %s +; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -mattr=+sign-ext,+simd128 | FileCheck %s +; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -fast-isel -fast-isel-abort=1 -mattr=+sign-ext,+simd128 | FileCheck %s ; Test that basic call operations assemble as expected. diff --git a/test/CodeGen/WebAssembly/function-bitcasts-varargs.ll b/test/CodeGen/WebAssembly/function-bitcasts-varargs.ll index 515c5703d86c..b542276e068f 100644 --- a/test/CodeGen/WebAssembly/function-bitcasts-varargs.ll +++ b/test/CodeGen/WebAssembly/function-bitcasts-varargs.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -asm-verbose=false -wasm-temporary-workarounds=false -wasm-keep-registers | FileCheck %s +; RUN: llc < %s -asm-verbose=false -wasm-keep-registers | FileCheck %s ; Test that function pointer casts casting away varargs are replaced with ; wrappers. diff --git a/test/CodeGen/WebAssembly/function-bitcasts.ll b/test/CodeGen/WebAssembly/function-bitcasts.ll index a779cbe41422..813e8420ae54 100644 --- a/test/CodeGen/WebAssembly/function-bitcasts.ll +++ b/test/CodeGen/WebAssembly/function-bitcasts.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -asm-verbose=false -wasm-disable-explicit-locals -wasm-keep-registers -enable-emscripten-cxx-exceptions -wasm-temporary-workarounds=false | FileCheck %s +; RUN: llc < %s -asm-verbose=false -wasm-disable-explicit-locals -wasm-keep-registers -enable-emscripten-cxx-exceptions | FileCheck %s ; Test that function pointer casts are replaced with wrappers. diff --git a/test/CodeGen/WebAssembly/import-module.ll b/test/CodeGen/WebAssembly/import-module.ll index a8202a77acb5..0cf0f2f25e0b 100644 --- a/test/CodeGen/WebAssembly/import-module.ll +++ b/test/CodeGen/WebAssembly/import-module.ll @@ -12,8 +12,9 @@ define void @test() { declare void @foo() #0 declare void @plain() -attributes #0 = { "wasm-import-module"="bar" } +attributes #0 = { "wasm-import-module"="bar" "wasm-import-name"="qux" } ; CHECK-NOT: .import_module plain ; CHECK: .import_module foo, bar +; CHECK: .import_name foo, qux ; CHECK-NOT: .import_module plain diff --git a/test/CodeGen/WebAssembly/main-declaration.ll b/test/CodeGen/WebAssembly/main-declaration.ll index f9d68db2bae8..544f5588c504 100644 --- a/test/CodeGen/WebAssembly/main-declaration.ll +++ b/test/CodeGen/WebAssembly/main-declaration.ll @@ -1,20 +1,18 @@ -; RUN: llc < %s -asm-verbose=false -wasm-temporary-workarounds=false | FileCheck %s +; RUN: llc < %s -asm-verbose=false | FileCheck %s ; Test main functions with alternate signatures. target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" -declare void @main() +declare i32 @main() -define void @foo() { - call void @main() - ret void +define i32 @foo() { + %t = call i32 @main() + ret i32 %t } -; CHECK-NOT: __original_main ; CHECK-LABEL: foo: -; CHECK-NEXT: .functype foo () -> () -; CHECK-NEXT: call main@FUNCTION +; CHECK-NEXT: .functype foo () -> (i32) +; CHECK-NEXT: call __original_main@FUNCTION ; CHECK-NEXT: end_function -; CHECK-NOT: __original_main diff --git a/test/CodeGen/WebAssembly/main-no-args.ll b/test/CodeGen/WebAssembly/main-no-args.ll index 0bc46717d97b..97023e269454 100644 --- a/test/CodeGen/WebAssembly/main-no-args.ll +++ b/test/CodeGen/WebAssembly/main-no-args.ll @@ -1,18 +1,19 @@ -; RUN: llc < %s -asm-verbose=false -wasm-temporary-workarounds=false | FileCheck %s +; RUN: llc < %s -asm-verbose=false | FileCheck %s ; Test main functions with alternate signatures. target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" -define void @main() { - ret void +define i32 @main() { + ret i32 0 } -; CHECK-LABEL: .L__original_main: -; CHECK-NEXT: .functype .L__original_main () -> () +; CHECK-LABEL: __original_main: +; CHECK-NEXT: .functype __original_main () -> (i32) +; CHECK-NEXT: i32.const 0 ; CHECK-NEXT: end_function ; CHECK-LABEL: main: ; CHECK-NEXT: .functype main (i32, i32) -> (i32) -; CHECK: call .L__original_main@FUNCTION +; CHECK: call __original_main@FUNCTION diff --git a/test/CodeGen/WebAssembly/main-three-args.ll b/test/CodeGen/WebAssembly/main-three-args.ll new file mode 100644 index 000000000000..77b3e5b8c306 --- /dev/null +++ b/test/CodeGen/WebAssembly/main-three-args.ll @@ -0,0 +1,16 @@ +; RUN: llc < %s -asm-verbose=false | FileCheck %s + +; Test that main function with a non-standard third argument is +; not wrapped. + +target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown" + +define i32 @main(i32 %a, i8** %b, i8** %c) { + ret i32 0 +} + +; CHECK-LABEL: main: +; CHECK-NEXT: .functype main (i32, i32, i32) -> (i32) + +; CHECK-NOT: __original_main: diff --git a/test/CodeGen/WebAssembly/main-with-args.ll b/test/CodeGen/WebAssembly/main-with-args.ll index d4a11ef14d46..205cb133f8ca 100644 --- a/test/CodeGen/WebAssembly/main-with-args.ll +++ b/test/CodeGen/WebAssembly/main-with-args.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -asm-verbose=false -wasm-temporary-workarounds=false | FileCheck %s +; RUN: llc < %s -asm-verbose=false | FileCheck %s ; Test that main function with expected signature is not wrapped diff --git a/test/CodeGen/X86/and-su.ll b/test/CodeGen/X86/and-su.ll index 55bfa8def44f..de384368bfca 100644 --- a/test/CodeGen/X86/and-su.ll +++ b/test/CodeGen/X86/and-su.ll @@ -49,7 +49,7 @@ define fastcc double @bar(i32 %hash, double %x, double %y) nounwind { ; CHECK-NEXT: fchs ; CHECK-NEXT: fxch %st(1) ; CHECK-NEXT: .LBB1_5: # %bb16 -; CHECK-NEXT: faddp %st(1) +; CHECK-NEXT: faddp %st, %st(1) ; CHECK-NEXT: movl %ebp, %esp ; CHECK-NEXT: popl %ebp ; CHECK-NEXT: retl diff --git a/test/CodeGen/X86/avx512-regcall-NoMask.ll b/test/CodeGen/X86/avx512-regcall-NoMask.ll index 1136a3a50693..985860166a3f 100644 --- a/test/CodeGen/X86/avx512-regcall-NoMask.ll +++ b/test/CodeGen/X86/avx512-regcall-NoMask.ll @@ -508,17 +508,17 @@ define x86_regcallcc double @test_CallargRetDouble(double %a) { define x86_regcallcc x86_fp80 @test_argRetf80(x86_fp80 %a0) nounwind { ; X32-LABEL: test_argRetf80: ; X32: # %bb.0: -; X32-NEXT: fadd %st(0), %st(0) +; X32-NEXT: fadd %st, %st(0) ; X32-NEXT: retl ; ; WIN64-LABEL: test_argRetf80: ; WIN64: # %bb.0: -; WIN64-NEXT: fadd %st(0), %st(0) +; WIN64-NEXT: fadd %st, %st(0) ; WIN64-NEXT: retq ; ; LINUXOSX64-LABEL: test_argRetf80: ; LINUXOSX64: # %bb.0: -; LINUXOSX64-NEXT: fadd %st(0), %st(0) +; LINUXOSX64-NEXT: fadd %st, %st(0) ; LINUXOSX64-NEXT: retq %r0 = fadd x86_fp80 %a0, %a0 ret x86_fp80 %r0 @@ -529,9 +529,9 @@ define x86_regcallcc x86_fp80 @test_CallargRetf80(x86_fp80 %a) { ; X32-LABEL: test_CallargRetf80: ; X32: # %bb.0: ; X32-NEXT: pushl %esp -; X32-NEXT: fadd %st(0), %st(0) +; X32-NEXT: fadd %st, %st(0) ; X32-NEXT: calll _test_argRetf80 -; X32-NEXT: fadd %st(0), %st(0) +; X32-NEXT: fadd %st, %st(0) ; X32-NEXT: popl %esp ; X32-NEXT: retl ; @@ -540,9 +540,9 @@ define x86_regcallcc x86_fp80 @test_CallargRetf80(x86_fp80 %a) { ; WIN64-NEXT: pushq %rsp ; WIN64-NEXT: .seh_pushreg 4 ; WIN64-NEXT: .seh_endprologue -; WIN64-NEXT: fadd %st(0), %st(0) +; WIN64-NEXT: fadd %st, %st(0) ; WIN64-NEXT: callq test_argRetf80 -; WIN64-NEXT: fadd %st(0), %st(0) +; WIN64-NEXT: fadd %st, %st(0) ; WIN64-NEXT: popq %rsp ; WIN64-NEXT: retq ; WIN64-NEXT: .seh_handlerdata @@ -554,9 +554,9 @@ define x86_regcallcc x86_fp80 @test_CallargRetf80(x86_fp80 %a) { ; LINUXOSX64-NEXT: pushq %rsp ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 16 ; LINUXOSX64-NEXT: .cfi_offset %rsp, -16 -; LINUXOSX64-NEXT: fadd %st(0), %st(0) +; LINUXOSX64-NEXT: fadd %st, %st(0) ; LINUXOSX64-NEXT: callq test_argRetf80 -; LINUXOSX64-NEXT: fadd %st(0), %st(0) +; LINUXOSX64-NEXT: fadd %st, %st(0) ; LINUXOSX64-NEXT: popq %rsp ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8 ; LINUXOSX64-NEXT: retq diff --git a/test/CodeGen/X86/fcmove.ll b/test/CodeGen/X86/fcmove.ll index 35dbb68117ba..6bb014858d04 100644 --- a/test/CodeGen/X86/fcmove.ll +++ b/test/CodeGen/X86/fcmove.ll @@ -6,7 +6,7 @@ target triple = "x86_64-unknown-unknown" ; Test that we can generate an fcmove, and also that it passes verification. ; CHECK-LABEL: cmove_f -; CHECK: fcmove %st({{[0-7]}}), %st(0) +; CHECK: fcmove %st({{[0-7]}}), %st define x86_fp80 @cmove_f(x86_fp80 %a, x86_fp80 %b, i32 %c) { %test = icmp eq i32 %c, 0 %add = fadd x86_fp80 %a, %b diff --git a/test/CodeGen/X86/fmf-flags.ll b/test/CodeGen/X86/fmf-flags.ll index 4fb2040b338d..bb883e92dc11 100644 --- a/test/CodeGen/X86/fmf-flags.ll +++ b/test/CodeGen/X86/fmf-flags.ll @@ -20,7 +20,7 @@ define float @fast_recip_sqrt(float %x) { ; X86-NEXT: flds {{[0-9]+}}(%esp) ; X86-NEXT: fsqrt ; X86-NEXT: fld1 -; X86-NEXT: fdivp %st(1) +; X86-NEXT: fdivp %st, %st(1) ; X86-NEXT: retl %y = call fast float @llvm.sqrt.f32(float %x) %z = fdiv fast float 1.0, %y @@ -95,7 +95,7 @@ define float @not_so_fast_recip_sqrt(float %x) { ; X86-NEXT: flds {{[0-9]+}}(%esp) ; X86-NEXT: fsqrt ; X86-NEXT: fld1 -; X86-NEXT: fdiv %st(1) +; X86-NEXT: fdiv %st(1), %st ; X86-NEXT: fxch %st(1) ; X86-NEXT: fstps sqrt1 ; X86-NEXT: retl diff --git a/test/CodeGen/X86/fp-cvt.ll b/test/CodeGen/X86/fp-cvt.ll index ab3d40ddcaa5..71738cb85d2e 100644 --- a/test/CodeGen/X86/fp-cvt.ll +++ b/test/CodeGen/X86/fp-cvt.ll @@ -486,7 +486,7 @@ define i64 @fptoui_i64_fp80(x86_fp80 %a0) nounwind { ; X64-X87-NEXT: xorl %eax, %eax ; X64-X87-NEXT: fxch %st(1) ; X64-X87-NEXT: fucompi %st(2) -; X64-X87-NEXT: fcmovnbe %st(1), %st(0) +; X64-X87-NEXT: fcmovnbe %st(1), %st ; X64-X87-NEXT: fstp %st(1) ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %ecx @@ -509,7 +509,7 @@ define i64 @fptoui_i64_fp80(x86_fp80 %a0) nounwind { ; X64-SSSE3-NEXT: xorl %eax, %eax ; X64-SSSE3-NEXT: fxch %st(1) ; X64-SSSE3-NEXT: fucompi %st(2) -; X64-SSSE3-NEXT: fcmovnbe %st(1), %st(0) +; X64-SSSE3-NEXT: fcmovnbe %st(1), %st ; X64-SSSE3-NEXT: fstp %st(1) ; X64-SSSE3-NEXT: fisttpll -{{[0-9]+}}(%rsp) ; X64-SSSE3-NEXT: setbe %al @@ -568,7 +568,7 @@ define i64 @fptoui_i64_fp80_ld(x86_fp80 *%a0) nounwind { ; X64-X87-NEXT: xorl %eax, %eax ; X64-X87-NEXT: fxch %st(1) ; X64-X87-NEXT: fucompi %st(2) -; X64-X87-NEXT: fcmovnbe %st(1), %st(0) +; X64-X87-NEXT: fcmovnbe %st(1), %st ; X64-X87-NEXT: fstp %st(1) ; X64-X87-NEXT: fnstcw -{{[0-9]+}}(%rsp) ; X64-X87-NEXT: movzwl -{{[0-9]+}}(%rsp), %ecx @@ -591,7 +591,7 @@ define i64 @fptoui_i64_fp80_ld(x86_fp80 *%a0) nounwind { ; X64-SSSE3-NEXT: xorl %eax, %eax ; X64-SSSE3-NEXT: fxch %st(1) ; X64-SSSE3-NEXT: fucompi %st(2) -; X64-SSSE3-NEXT: fcmovnbe %st(1), %st(0) +; X64-SSSE3-NEXT: fcmovnbe %st(1), %st ; X64-SSSE3-NEXT: fstp %st(1) ; X64-SSSE3-NEXT: fisttpll -{{[0-9]+}}(%rsp) ; X64-SSSE3-NEXT: setbe %al diff --git a/test/CodeGen/X86/inline-asm-default-clobbers.ll b/test/CodeGen/X86/inline-asm-default-clobbers.ll new file mode 100644 index 000000000000..34a77ea5fecd --- /dev/null +++ b/test/CodeGen/X86/inline-asm-default-clobbers.ll @@ -0,0 +1,8 @@ +; RUN: llc < %s -mtriple=i686 -stop-after=expand-isel-pseudos | FileCheck %s + +; CHECK: INLINEASM &"", 1, 12, implicit-def early-clobber $df, 12, implicit-def early-clobber $fpsw, 12, implicit-def early-clobber $eflags +define void @foo() { +entry: + call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() + ret void +} diff --git a/test/CodeGen/X86/inline-asm-fpstack.ll b/test/CodeGen/X86/inline-asm-fpstack.ll index 1c36d31c480b..db6127acb0ae 100644 --- a/test/CodeGen/X86/inline-asm-fpstack.ll +++ b/test/CodeGen/X86/inline-asm-fpstack.ll @@ -75,20 +75,20 @@ define void @test6(double %A, double %B, double %C, double %D, double %E) nounwi ; CHECK-NEXT: fldl {{[0-9]+}}(%esp) ; CHECK-NEXT: fldl {{[0-9]+}}(%esp) ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: foo %st(0) %st(0) +; CHECK-NEXT: foo %st %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: fstp %st(0) ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: bar %st(1) %st(0) +; CHECK-NEXT: bar %st(1) %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: fstp %st(1) ; CHECK-NEXT: fstp %st(0) ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: baz %st(1) %st(0) +; CHECK-NEXT: baz %st(1) %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: fstp %st(0) ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: baz %st(0) +; CHECK-NEXT: baz %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: fstp %st(0) ; CHECK-NEXT: retl @@ -117,10 +117,10 @@ define void @testPR4185() { ; CHECK-NEXT: flds LCPI6_0 ; CHECK-NEXT: fld %st(0) ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: fistpl %st(0) +; CHECK-NEXT: fistpl %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: fistpl %st(0) +; CHECK-NEXT: fistpl %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: retl return: @@ -138,10 +138,10 @@ define void @testPR4185b() { ; CHECK: ## %bb.0: ## %return ; CHECK-NEXT: flds LCPI7_0 ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: fistl %st(0) +; CHECK-NEXT: fistl %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: fistpl %st(0) +; CHECK-NEXT: fistpl %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: retl return: @@ -163,7 +163,7 @@ define void @testPR4459(x86_fp80 %a) { ; CHECK-NEXT: fld %st(0) ; CHECK-NEXT: fxch %st(1) ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: fistpl %st(0) +; CHECK-NEXT: fistpl %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: fstpt (%esp) ; CHECK-NEXT: calll _test3 @@ -191,7 +191,7 @@ define void @testPR4484(x86_fp80 %a) { ; CHECK-NEXT: calll _test1 ; CHECK-NEXT: fldt {{[0-9]+}}(%esp) ## 10-byte Folded Reload ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: fistpl %st(0) +; CHECK-NEXT: fistpl %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: fstpt (%esp) ; CHECK-NEXT: calll _test3 @@ -211,18 +211,18 @@ define void @testPR4485(x86_fp80* %a) { ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax ; CHECK-NEXT: fldt (%eax) ; CHECK-NEXT: flds LCPI10_0 -; CHECK-NEXT: fmul %st(0), %st(1) +; CHECK-NEXT: fmul %st, %st(1) ; CHECK-NEXT: flds LCPI10_1 -; CHECK-NEXT: fmul %st(0), %st(2) +; CHECK-NEXT: fmul %st, %st(2) ; CHECK-NEXT: fxch %st(2) ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: fistpl %st(0) +; CHECK-NEXT: fistpl %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: fldt (%eax) -; CHECK-NEXT: fmulp %st(1) -; CHECK-NEXT: fmulp %st(1) +; CHECK-NEXT: fmulp %st, %st(1) +; CHECK-NEXT: fmulp %st, %st(1) ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: fistpl %st(0) +; CHECK-NEXT: fistpl %st ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: retl entry: @@ -422,7 +422,7 @@ define i32 @PR10602() nounwind ssp { ; CHECK-NEXT: fld %st(0) ; CHECK-NEXT: fxch %st(1) ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: fcomi %st(1), %st(0); pushf; pop %eax +; CHECK-NEXT: fcomi %st(1), %st; pushf; pop %eax ; CHECK-NEXT: ## InlineAsm End ; CHECK-NEXT: fstp %st(0) ; CHECK-NEXT: fstp %st(0) @@ -505,9 +505,9 @@ define double @test_operand_rewrite() { ; CHECK-LABEL: test_operand_rewrite: ; CHECK: ## %bb.0: ## %entry ; CHECK-NEXT: ## InlineAsm Start -; CHECK-NEXT: foo %st(0), %st(1) +; CHECK-NEXT: foo %st, %st(1) ; CHECK-NEXT: ## InlineAsm End -; CHECK-NEXT: fsubp %st(1) +; CHECK-NEXT: fsubp %st, %st(1) ; CHECK-NEXT: retl entry: %0 = tail call { double, double } asm sideeffect "foo $0, $1", "={st},={st(1)},~{dirflag},~{fpsr},~{flags}"() diff --git a/test/CodeGen/X86/ipra-reg-usage.ll b/test/CodeGen/X86/ipra-reg-usage.ll index 3e57ef218442..2a557f2902a2 100644 --- a/test/CodeGen/X86/ipra-reg-usage.ll +++ b/test/CodeGen/X86/ipra-reg-usage.ll @@ -3,7 +3,7 @@ target triple = "x86_64-unknown-unknown" declare void @bar1() define preserve_allcc void @foo()#0 { -; CHECK: foo Clobbered Registers: $cs $df $ds $eflags $eip $eiz $es $fpsw $fs $gs $hip $ip $rip $riz $ss $ssp $bnd0 $bnd1 $bnd2 $bnd3 $cr0 $cr1 $cr2 $cr3 $cr4 $cr5 $cr6 $cr7 $cr8 $cr9 $cr10 $cr11 $cr12 $cr13 $cr14 $cr15 $dr0 $dr1 $dr2 $dr3 $dr4 $dr5 $dr6 $dr7 $dr8 $dr9 $dr10 $dr11 $dr12 $dr13 $dr14 $dr15 $fp0 $fp1 $fp2 $fp3 $fp4 $fp5 $fp6 $fp7 $k0 $k1 $k2 $k3 $k4 $k5 $k6 $k7 $mm0 $mm1 $mm2 $mm3 $mm4 $mm5 $mm6 $mm7 $r11 $st0 $st1 $st2 $st3 $st4 $st5 $st6 $st7 $xmm16 $xmm17 $xmm18 $xmm19 $xmm20 $xmm21 $xmm22 $xmm23 $xmm24 $xmm25 $xmm26 $xmm27 $xmm28 $xmm29 $xmm30 $xmm31 $ymm0 $ymm1 $ymm2 $ymm3 $ymm4 $ymm5 $ymm6 $ymm7 $ymm8 $ymm9 $ymm10 $ymm11 $ymm12 $ymm13 $ymm14 $ymm15 $ymm16 $ymm17 $ymm18 $ymm19 $ymm20 $ymm21 $ymm22 $ymm23 $ymm24 $ymm25 $ymm26 $ymm27 $ymm28 $ymm29 $ymm30 $ymm31 $zmm0 $zmm1 $zmm2 $zmm3 $zmm4 $zmm5 $zmm6 $zmm7 $zmm8 $zmm9 $zmm10 $zmm11 $zmm12 $zmm13 $zmm14 $zmm15 $zmm16 $zmm17 $zmm18 $zmm19 $zmm20 $zmm21 $zmm22 $zmm23 $zmm24 $zmm25 $zmm26 $zmm27 $zmm28 $zmm29 $zmm30 $zmm31 $r11b $r11bh $r11d $r11w $r11wh +; CHECK: foo Clobbered Registers: $cs $df $ds $eflags $eip $eiz $es $fpcw $fpsw $fs $gs $hip $ip $rip $riz $ss $ssp $bnd0 $bnd1 $bnd2 $bnd3 $cr0 $cr1 $cr2 $cr3 $cr4 $cr5 $cr6 $cr7 $cr8 $cr9 $cr10 $cr11 $cr12 $cr13 $cr14 $cr15 $dr0 $dr1 $dr2 $dr3 $dr4 $dr5 $dr6 $dr7 $dr8 $dr9 $dr10 $dr11 $dr12 $dr13 $dr14 $dr15 $fp0 $fp1 $fp2 $fp3 $fp4 $fp5 $fp6 $fp7 $k0 $k1 $k2 $k3 $k4 $k5 $k6 $k7 $mm0 $mm1 $mm2 $mm3 $mm4 $mm5 $mm6 $mm7 $r11 $st0 $st1 $st2 $st3 $st4 $st5 $st6 $st7 $xmm16 $xmm17 $xmm18 $xmm19 $xmm20 $xmm21 $xmm22 $xmm23 $xmm24 $xmm25 $xmm26 $xmm27 $xmm28 $xmm29 $xmm30 $xmm31 $ymm0 $ymm1 $ymm2 $ymm3 $ymm4 $ymm5 $ymm6 $ymm7 $ymm8 $ymm9 $ymm10 $ymm11 $ymm12 $ymm13 $ymm14 $ymm15 $ymm16 $ymm17 $ymm18 $ymm19 $ymm20 $ymm21 $ymm22 $ymm23 $ymm24 $ymm25 $ymm26 $ymm27 $ymm28 $ymm29 $ymm30 $ymm31 $zmm0 $zmm1 $zmm2 $zmm3 $zmm4 $zmm5 $zmm6 $zmm7 $zmm8 $zmm9 $zmm10 $zmm11 $zmm12 $zmm13 $zmm14 $zmm15 $zmm16 $zmm17 $zmm18 $zmm19 $zmm20 $zmm21 $zmm22 $zmm23 $zmm24 $zmm25 $zmm26 $zmm27 $zmm28 $zmm29 $zmm30 $zmm31 $r11b $r11bh $r11d $r11w $r11wh call void @bar1() call void @bar2() ret void diff --git a/test/CodeGen/X86/pr13577.ll b/test/CodeGen/X86/pr13577.ll index e0e90f81bc42..3f9e2f953bae 100644 --- a/test/CodeGen/X86/pr13577.ll +++ b/test/CodeGen/X86/pr13577.ll @@ -14,7 +14,7 @@ define x86_fp80 @foo(x86_fp80 %a) { ; CHECK-NEXT: testb $-128, -{{[0-9]+}}(%rsp) ; CHECK-NEXT: flds {{.*}}(%rip) ; CHECK-NEXT: flds {{.*}}(%rip) -; CHECK-NEXT: fcmovne %st(1), %st(0) +; CHECK-NEXT: fcmovne %st(1), %st ; CHECK-NEXT: fstp %st(1) ; CHECK-NEXT: retq %1 = tail call x86_fp80 @copysignl(x86_fp80 0xK7FFF8000000000000000, x86_fp80 %a) nounwind readnone diff --git a/test/CodeGen/X86/pr33349.ll b/test/CodeGen/X86/pr33349.ll index 63edae044f87..9aa28384f4e8 100644 --- a/test/CodeGen/X86/pr33349.ll +++ b/test/CodeGen/X86/pr33349.ll @@ -19,18 +19,18 @@ target triple = "x86_64-unknown-linux-gnu" ; KNL-NEXT: fld1 ; KNL-NEXT: fldz ; KNL-NEXT: fld %st(0) -; KNL-NEXT: fcmovne %st(2), %st(0) +; KNL-NEXT: fcmovne %st(2), %st ; KNL-NEXT: testb $1, %cl ; KNL-NEXT: fld %st(1) -; KNL-NEXT: fcmovne %st(3), %st(0) +; KNL-NEXT: fcmovne %st(3), %st ; KNL-NEXT: kmovw %k2, %eax ; KNL-NEXT: testb $1, %al ; KNL-NEXT: fld %st(2) -; KNL-NEXT: fcmovne %st(4), %st(0) +; KNL-NEXT: fcmovne %st(4), %st ; KNL-NEXT: kmovw %k0, %eax ; KNL-NEXT: testb $1, %al ; KNL-NEXT: fxch %st(3) -; KNL-NEXT: fcmovne %st(4), %st(0) +; KNL-NEXT: fcmovne %st(4), %st ; KNL-NEXT: fstp %st(4) ; KNL-NEXT: fxch %st(3) ; KNL-NEXT: fstpt (%rdi) @@ -55,18 +55,18 @@ target triple = "x86_64-unknown-linux-gnu" ; SKX-NEXT: fld1 ; SKX-NEXT: fldz ; SKX-NEXT: fld %st(0) -; SKX-NEXT: fcmovne %st(2), %st(0) +; SKX-NEXT: fcmovne %st(2), %st ; SKX-NEXT: testb $1, %cl ; SKX-NEXT: fld %st(1) -; SKX-NEXT: fcmovne %st(3), %st(0) +; SKX-NEXT: fcmovne %st(3), %st ; SKX-NEXT: kmovd %k2, %eax ; SKX-NEXT: testb $1, %al ; SKX-NEXT: fld %st(2) -; SKX-NEXT: fcmovne %st(4), %st(0) +; SKX-NEXT: fcmovne %st(4), %st ; SKX-NEXT: kmovd %k0, %eax ; SKX-NEXT: testb $1, %al ; SKX-NEXT: fxch %st(3) -; SKX-NEXT: fcmovne %st(4), %st(0) +; SKX-NEXT: fcmovne %st(4), %st ; SKX-NEXT: fstp %st(4) ; SKX-NEXT: fxch %st(3) ; SKX-NEXT: fstpt (%rdi) diff --git a/test/CodeGen/X86/pr34080.ll b/test/CodeGen/X86/pr34080.ll index a709a4840e53..0b23ab7d4b5d 100644 --- a/test/CodeGen/X86/pr34080.ll +++ b/test/CodeGen/X86/pr34080.ll @@ -27,7 +27,7 @@ define void @_Z1fe(x86_fp80 %z) local_unnamed_addr #0 { ; SSE2-NEXT: movsd %xmm0, -32(%rbp) ; SSE2-NEXT: fsubl -32(%rbp) ; SSE2-NEXT: flds {{.*}}(%rip) -; SSE2-NEXT: fmul %st(0), %st(1) +; SSE2-NEXT: fmul %st, %st(1) ; SSE2-NEXT: fnstcw -2(%rbp) ; SSE2-NEXT: movzwl -2(%rbp), %eax ; SSE2-NEXT: movw $3199, -2(%rbp) ## imm = 0xC7F @@ -41,7 +41,7 @@ define void @_Z1fe(x86_fp80 %z) local_unnamed_addr #0 { ; SSE2-NEXT: movsd %xmm0, -56(%rbp) ; SSE2-NEXT: movsd %xmm0, -24(%rbp) ; SSE2-NEXT: fsubl -24(%rbp) -; SSE2-NEXT: fmulp %st(1) +; SSE2-NEXT: fmulp %st, %st(1) ; SSE2-NEXT: fstpl -48(%rbp) ; SSE2-NEXT: popq %rbp ; SSE2-NEXT: retq @@ -65,12 +65,12 @@ define void @_Z1fe(x86_fp80 %z) local_unnamed_addr #0 { ; SSE2-SCHEDULE-NEXT: movsd %xmm0, -64(%rbp) ; SSE2-SCHEDULE-NEXT: movsd %xmm0, -32(%rbp) ; SSE2-SCHEDULE-NEXT: fsubl -32(%rbp) -; SSE2-SCHEDULE-NEXT: fnstcw -2(%rbp) ; SSE2-SCHEDULE-NEXT: flds {{.*}}(%rip) +; SSE2-SCHEDULE-NEXT: fnstcw -2(%rbp) +; SSE2-SCHEDULE-NEXT: fmul %st, %st(1) ; SSE2-SCHEDULE-NEXT: movzwl -2(%rbp), %eax ; SSE2-SCHEDULE-NEXT: movw $3199, -2(%rbp) ## imm = 0xC7F ; SSE2-SCHEDULE-NEXT: fldcw -2(%rbp) -; SSE2-SCHEDULE-NEXT: fmul %st(0), %st(1) ; SSE2-SCHEDULE-NEXT: movw %ax, -2(%rbp) ; SSE2-SCHEDULE-NEXT: fxch %st(1) ; SSE2-SCHEDULE-NEXT: fistl -12(%rbp) @@ -80,7 +80,7 @@ define void @_Z1fe(x86_fp80 %z) local_unnamed_addr #0 { ; SSE2-SCHEDULE-NEXT: movsd %xmm0, -56(%rbp) ; SSE2-SCHEDULE-NEXT: movsd %xmm0, -24(%rbp) ; SSE2-SCHEDULE-NEXT: fsubl -24(%rbp) -; SSE2-SCHEDULE-NEXT: fmulp %st(1) +; SSE2-SCHEDULE-NEXT: fmulp %st, %st(1) ; SSE2-SCHEDULE-NEXT: fstpl -48(%rbp) ; SSE2-SCHEDULE-NEXT: popq %rbp ; SSE2-SCHEDULE-NEXT: retq @@ -100,7 +100,7 @@ define void @_Z1fe(x86_fp80 %z) local_unnamed_addr #0 { ; SSE3-NEXT: movsd %xmm0, -24(%rbp) ; SSE3-NEXT: fsubl -24(%rbp) ; SSE3-NEXT: flds {{.*}}(%rip) -; SSE3-NEXT: fmul %st(0), %st(1) +; SSE3-NEXT: fmul %st, %st(1) ; SSE3-NEXT: fld %st(1) ; SSE3-NEXT: fisttpl -8(%rbp) ; SSE3-NEXT: xorps %xmm0, %xmm0 @@ -109,7 +109,7 @@ define void @_Z1fe(x86_fp80 %z) local_unnamed_addr #0 { ; SSE3-NEXT: movsd %xmm0, -16(%rbp) ; SSE3-NEXT: fxch %st(1) ; SSE3-NEXT: fsubl -16(%rbp) -; SSE3-NEXT: fmulp %st(1) +; SSE3-NEXT: fmulp %st, %st(1) ; SSE3-NEXT: fstpl -32(%rbp) ; SSE3-NEXT: popq %rbp ; SSE3-NEXT: retq @@ -129,7 +129,7 @@ define void @_Z1fe(x86_fp80 %z) local_unnamed_addr #0 { ; AVX-NEXT: vmovsd %xmm0, -24(%rbp) ; AVX-NEXT: fsubl -24(%rbp) ; AVX-NEXT: flds {{.*}}(%rip) -; AVX-NEXT: fmul %st(0), %st(1) +; AVX-NEXT: fmul %st, %st(1) ; AVX-NEXT: fld %st(1) ; AVX-NEXT: fisttpl -8(%rbp) ; AVX-NEXT: vcvtsi2sdl -8(%rbp), %xmm1, %xmm0 @@ -137,7 +137,7 @@ define void @_Z1fe(x86_fp80 %z) local_unnamed_addr #0 { ; AVX-NEXT: vmovsd %xmm0, -16(%rbp) ; AVX-NEXT: fxch %st(1) ; AVX-NEXT: fsubl -16(%rbp) -; AVX-NEXT: fmulp %st(1) +; AVX-NEXT: fmulp %st, %st(1) ; AVX-NEXT: fstpl -32(%rbp) ; AVX-NEXT: popq %rbp ; AVX-NEXT: retq diff --git a/test/CodeGen/X86/pr34177.ll b/test/CodeGen/X86/pr34177.ll index 3fe56277fb4b..f6b8dec3c3b3 100644 --- a/test/CodeGen/X86/pr34177.ll +++ b/test/CodeGen/X86/pr34177.ll @@ -20,17 +20,17 @@ define void @test(<4x i64> %a, <4 x x86_fp80> %b, <8 x x86_fp80>* %c) local_unna ; CHECK-NEXT: fld1 ; CHECK-NEXT: fldz ; CHECK-NEXT: fld %st(0) -; CHECK-NEXT: fcmove %st(2), %st(0) +; CHECK-NEXT: fcmove %st(2), %st ; CHECK-NEXT: cmpq %rax, %rsi ; CHECK-NEXT: fld %st(1) -; CHECK-NEXT: fcmove %st(3), %st(0) +; CHECK-NEXT: fcmove %st(3), %st ; CHECK-NEXT: cmpq %rdx, %r9 ; CHECK-NEXT: fld %st(2) -; CHECK-NEXT: fcmove %st(4), %st(0) +; CHECK-NEXT: fcmove %st(4), %st ; CHECK-NEXT: movl $1, %eax ; CHECK-NEXT: cmpq %r8, %rax ; CHECK-NEXT: fxch %st(3) -; CHECK-NEXT: fcmove %st(4), %st(0) +; CHECK-NEXT: fcmove %st(4), %st ; CHECK-NEXT: fstp %st(4) ; CHECK-NEXT: fldt {{[0-9]+}}(%rsp) ; CHECK-NEXT: fstpt 70(%rdi) @@ -40,15 +40,15 @@ define void @test(<4x i64> %a, <4 x x86_fp80> %b, <8 x x86_fp80>* %c) local_unna ; CHECK-NEXT: fstpt 30(%rdi) ; CHECK-NEXT: fldt {{[0-9]+}}(%rsp) ; CHECK-NEXT: fstpt 10(%rdi) -; CHECK-NEXT: fadd %st(0), %st(0) +; CHECK-NEXT: fadd %st, %st(0) ; CHECK-NEXT: fstpt 60(%rdi) ; CHECK-NEXT: fxch %st(1) -; CHECK-NEXT: fadd %st(0), %st(0) +; CHECK-NEXT: fadd %st, %st(0) ; CHECK-NEXT: fstpt 40(%rdi) ; CHECK-NEXT: fxch %st(1) -; CHECK-NEXT: fadd %st(0), %st(0) +; CHECK-NEXT: fadd %st, %st(0) ; CHECK-NEXT: fstpt 20(%rdi) -; CHECK-NEXT: fadd %st(0), %st(0) +; CHECK-NEXT: fadd %st, %st(0) ; CHECK-NEXT: fstpt (%rdi) %1 = icmp eq <4 x i64> , %a %2 = select <4 x i1> %1, <4 x x86_fp80> , <4 x x86_fp80> zeroinitializer diff --git a/test/CodeGen/X86/pr40529.ll b/test/CodeGen/X86/pr40529.ll new file mode 100644 index 000000000000..9520ac22d749 --- /dev/null +++ b/test/CodeGen/X86/pr40529.ll @@ -0,0 +1,43 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=x86_64-unknown-linux -mcpu=x86-64 | FileCheck %s + +define x86_fp80 @rem_pio2l_min(x86_fp80 %z) { +; CHECK-LABEL: rem_pio2l_min: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: fnstcw -{{[0-9]+}}(%rsp) +; CHECK-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax +; CHECK-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F +; CHECK-NEXT: fldcw -{{[0-9]+}}(%rsp) +; CHECK-NEXT: fldt {{[0-9]+}}(%rsp) +; CHECK-NEXT: movw %ax, -{{[0-9]+}}(%rsp) +; CHECK-NEXT: fistl -{{[0-9]+}}(%rsp) +; CHECK-NEXT: fldcw -{{[0-9]+}}(%rsp) +; CHECK-NEXT: movl -{{[0-9]+}}(%rsp), %eax +; CHECK-NEXT: movl %eax, -{{[0-9]+}}(%rsp) +; CHECK-NEXT: fisubl -{{[0-9]+}}(%rsp) +; CHECK-NEXT: flds {{.*}}(%rip) +; CHECK-NEXT: fnstcw -{{[0-9]+}}(%rsp) +; CHECK-NEXT: fmul %st, %st(1) +; CHECK-NEXT: movzwl -{{[0-9]+}}(%rsp), %eax +; CHECK-NEXT: movw $3199, -{{[0-9]+}}(%rsp) # imm = 0xC7F +; CHECK-NEXT: fldcw -{{[0-9]+}}(%rsp) +; CHECK-NEXT: movw %ax, -{{[0-9]+}}(%rsp) +; CHECK-NEXT: fxch %st(1) +; CHECK-NEXT: fistl -{{[0-9]+}}(%rsp) +; CHECK-NEXT: fldcw -{{[0-9]+}}(%rsp) +; CHECK-NEXT: movl -{{[0-9]+}}(%rsp), %eax +; CHECK-NEXT: movl %eax, -{{[0-9]+}}(%rsp) +; CHECK-NEXT: fisubl -{{[0-9]+}}(%rsp) +; CHECK-NEXT: fmulp %st, %st(1) +; CHECK-NEXT: retq +entry: + %conv = fptosi x86_fp80 %z to i32 + %conv1 = sitofp i32 %conv to x86_fp80 + %sub = fsub x86_fp80 %z, %conv1 + %mul = fmul x86_fp80 %sub, 0xK40178000000000000000 + %conv2 = fptosi x86_fp80 %mul to i32 + %conv3 = sitofp i32 %conv2 to x86_fp80 + %sub4 = fsub x86_fp80 %mul, %conv3 + %mul5 = fmul x86_fp80 %sub4, 0xK40178000000000000000 + ret x86_fp80 %mul5 +} diff --git a/test/CodeGen/X86/scalar-fp-to-i64.ll b/test/CodeGen/X86/scalar-fp-to-i64.ll index 7ed61f8fdc7d..92361efa49fa 100644 --- a/test/CodeGen/X86/scalar-fp-to-i64.ll +++ b/test/CodeGen/X86/scalar-fp-to-i64.ll @@ -1028,7 +1028,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; AVX512_32_WIN-NEXT: xorl %edx, %edx ; AVX512_32_WIN-NEXT: fxch %st(1) ; AVX512_32_WIN-NEXT: fucompi %st(2) -; AVX512_32_WIN-NEXT: fcmovnbe %st(1), %st(0) +; AVX512_32_WIN-NEXT: fcmovnbe %st(1), %st ; AVX512_32_WIN-NEXT: fstp %st(1) ; AVX512_32_WIN-NEXT: fisttpll (%esp) ; AVX512_32_WIN-NEXT: setbe %dl @@ -1049,7 +1049,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; AVX512_32_LIN-NEXT: xorl %edx, %edx ; AVX512_32_LIN-NEXT: fxch %st(1) ; AVX512_32_LIN-NEXT: fucompi %st(2) -; AVX512_32_LIN-NEXT: fcmovnbe %st(1), %st(0) +; AVX512_32_LIN-NEXT: fcmovnbe %st(1), %st ; AVX512_32_LIN-NEXT: fstp %st(1) ; AVX512_32_LIN-NEXT: fisttpll (%esp) ; AVX512_32_LIN-NEXT: setbe %dl @@ -1069,7 +1069,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; AVX512_64_WIN-NEXT: xorl %ecx, %ecx ; AVX512_64_WIN-NEXT: fxch %st(1) ; AVX512_64_WIN-NEXT: fucompi %st(2) -; AVX512_64_WIN-NEXT: fcmovnbe %st(1), %st(0) +; AVX512_64_WIN-NEXT: fcmovnbe %st(1), %st ; AVX512_64_WIN-NEXT: fstp %st(1) ; AVX512_64_WIN-NEXT: fisttpll (%rsp) ; AVX512_64_WIN-NEXT: setbe %cl @@ -1090,7 +1090,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; AVX512_64_LIN-NEXT: xorl %ecx, %ecx ; AVX512_64_LIN-NEXT: fxch %st(1) ; AVX512_64_LIN-NEXT: fucompi %st(2) -; AVX512_64_LIN-NEXT: fcmovnbe %st(1), %st(0) +; AVX512_64_LIN-NEXT: fcmovnbe %st(1), %st ; AVX512_64_LIN-NEXT: fstp %st(1) ; AVX512_64_LIN-NEXT: fisttpll -{{[0-9]+}}(%rsp) ; AVX512_64_LIN-NEXT: setbe %cl @@ -1114,7 +1114,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; SSE3_32_WIN-NEXT: xorl %edx, %edx ; SSE3_32_WIN-NEXT: fxch %st(1) ; SSE3_32_WIN-NEXT: fucompi %st(2) -; SSE3_32_WIN-NEXT: fcmovnbe %st(1), %st(0) +; SSE3_32_WIN-NEXT: fcmovnbe %st(1), %st ; SSE3_32_WIN-NEXT: fstp %st(1) ; SSE3_32_WIN-NEXT: fisttpll (%esp) ; SSE3_32_WIN-NEXT: setbe %dl @@ -1135,7 +1135,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; SSE3_32_LIN-NEXT: xorl %edx, %edx ; SSE3_32_LIN-NEXT: fxch %st(1) ; SSE3_32_LIN-NEXT: fucompi %st(2) -; SSE3_32_LIN-NEXT: fcmovnbe %st(1), %st(0) +; SSE3_32_LIN-NEXT: fcmovnbe %st(1), %st ; SSE3_32_LIN-NEXT: fstp %st(1) ; SSE3_32_LIN-NEXT: fisttpll (%esp) ; SSE3_32_LIN-NEXT: setbe %dl @@ -1155,7 +1155,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; SSE3_64_WIN-NEXT: xorl %eax, %eax ; SSE3_64_WIN-NEXT: fxch %st(1) ; SSE3_64_WIN-NEXT: fucompi %st(2) -; SSE3_64_WIN-NEXT: fcmovnbe %st(1), %st(0) +; SSE3_64_WIN-NEXT: fcmovnbe %st(1), %st ; SSE3_64_WIN-NEXT: fstp %st(1) ; SSE3_64_WIN-NEXT: fisttpll (%rsp) ; SSE3_64_WIN-NEXT: setbe %al @@ -1173,7 +1173,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; SSE3_64_LIN-NEXT: xorl %eax, %eax ; SSE3_64_LIN-NEXT: fxch %st(1) ; SSE3_64_LIN-NEXT: fucompi %st(2) -; SSE3_64_LIN-NEXT: fcmovnbe %st(1), %st(0) +; SSE3_64_LIN-NEXT: fcmovnbe %st(1), %st ; SSE3_64_LIN-NEXT: fstp %st(1) ; SSE3_64_LIN-NEXT: fisttpll -{{[0-9]+}}(%rsp) ; SSE3_64_LIN-NEXT: setbe %al @@ -1194,7 +1194,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; SSE2_32_WIN-NEXT: xorl %edx, %edx ; SSE2_32_WIN-NEXT: fxch %st(1) ; SSE2_32_WIN-NEXT: fucompi %st(2) -; SSE2_32_WIN-NEXT: fcmovnbe %st(1), %st(0) +; SSE2_32_WIN-NEXT: fcmovnbe %st(1), %st ; SSE2_32_WIN-NEXT: fstp %st(1) ; SSE2_32_WIN-NEXT: fnstcw {{[0-9]+}}(%esp) ; SSE2_32_WIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax @@ -1221,7 +1221,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; SSE2_32_LIN-NEXT: xorl %edx, %edx ; SSE2_32_LIN-NEXT: fxch %st(1) ; SSE2_32_LIN-NEXT: fucompi %st(2) -; SSE2_32_LIN-NEXT: fcmovnbe %st(1), %st(0) +; SSE2_32_LIN-NEXT: fcmovnbe %st(1), %st ; SSE2_32_LIN-NEXT: fstp %st(1) ; SSE2_32_LIN-NEXT: fnstcw {{[0-9]+}}(%esp) ; SSE2_32_LIN-NEXT: movzwl {{[0-9]+}}(%esp), %eax @@ -1247,7 +1247,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; SSE2_64_WIN-NEXT: xorl %eax, %eax ; SSE2_64_WIN-NEXT: fxch %st(1) ; SSE2_64_WIN-NEXT: fucompi %st(2) -; SSE2_64_WIN-NEXT: fcmovnbe %st(1), %st(0) +; SSE2_64_WIN-NEXT: fcmovnbe %st(1), %st ; SSE2_64_WIN-NEXT: fstp %st(1) ; SSE2_64_WIN-NEXT: fnstcw {{[0-9]+}}(%rsp) ; SSE2_64_WIN-NEXT: movzwl {{[0-9]+}}(%rsp), %ecx @@ -1271,7 +1271,7 @@ define i64 @x_to_u64(x86_fp80 %a) nounwind { ; SSE2_64_LIN-NEXT: xorl %eax, %eax ; SSE2_64_LIN-NEXT: fxch %st(1) ; SSE2_64_LIN-NEXT: fucompi %st(2) -; SSE2_64_LIN-NEXT: fcmovnbe %st(1), %st(0) +; SSE2_64_LIN-NEXT: fcmovnbe %st(1), %st ; SSE2_64_LIN-NEXT: fstp %st(1) ; SSE2_64_LIN-NEXT: fnstcw -{{[0-9]+}}(%rsp) ; SSE2_64_LIN-NEXT: movzwl -{{[0-9]+}}(%rsp), %ecx diff --git a/test/CodeGen/X86/select.ll b/test/CodeGen/X86/select.ll index 947c95137206..9429e1854d44 100644 --- a/test/CodeGen/X86/select.ll +++ b/test/CodeGen/X86/select.ll @@ -293,25 +293,25 @@ define void @test6(i32 %C, <4 x float>* %A, <4 x float>* %B) nounwind { ; ATHLON-NEXT: flds 4(%ecx) ; ATHLON-NEXT: flds (%ecx) ; ATHLON-NEXT: flds (%eax) -; ATHLON-NEXT: fmul %st(0), %st(0) +; ATHLON-NEXT: fmul %st, %st(0) ; ATHLON-NEXT: cmpl $0, {{[0-9]+}}(%esp) ; ATHLON-NEXT: fxch %st(1) -; ATHLON-NEXT: fcmove %st(1), %st(0) +; ATHLON-NEXT: fcmove %st(1), %st ; ATHLON-NEXT: fstp %st(1) ; ATHLON-NEXT: flds 4(%eax) -; ATHLON-NEXT: fmul %st(0), %st(0) +; ATHLON-NEXT: fmul %st, %st(0) ; ATHLON-NEXT: fxch %st(2) -; ATHLON-NEXT: fcmove %st(2), %st(0) +; ATHLON-NEXT: fcmove %st(2), %st ; ATHLON-NEXT: fstp %st(2) ; ATHLON-NEXT: flds 8(%eax) -; ATHLON-NEXT: fmul %st(0), %st(0) +; ATHLON-NEXT: fmul %st, %st(0) ; ATHLON-NEXT: fxch %st(3) -; ATHLON-NEXT: fcmove %st(3), %st(0) +; ATHLON-NEXT: fcmove %st(3), %st ; ATHLON-NEXT: fstp %st(3) ; ATHLON-NEXT: flds 12(%eax) -; ATHLON-NEXT: fmul %st(0), %st(0) +; ATHLON-NEXT: fmul %st, %st(0) ; ATHLON-NEXT: fxch %st(4) -; ATHLON-NEXT: fcmove %st(4), %st(0) +; ATHLON-NEXT: fcmove %st(4), %st ; ATHLON-NEXT: fstp %st(4) ; ATHLON-NEXT: fxch %st(3) ; ATHLON-NEXT: fstps 12(%ecx) @@ -332,13 +332,13 @@ define void @test6(i32 %C, <4 x float>* %A, <4 x float>* %B) nounwind { ; MCU-NEXT: flds 4(%ecx) ; MCU-NEXT: flds 8(%ecx) ; MCU-NEXT: flds 12(%ecx) -; MCU-NEXT: fmul %st(0), %st(0) +; MCU-NEXT: fmul %st, %st(0) ; MCU-NEXT: fxch %st(1) -; MCU-NEXT: fmul %st(0), %st(0) +; MCU-NEXT: fmul %st, %st(0) ; MCU-NEXT: fxch %st(2) -; MCU-NEXT: fmul %st(0), %st(0) +; MCU-NEXT: fmul %st, %st(0) ; MCU-NEXT: fxch %st(3) -; MCU-NEXT: fmul %st(0), %st(0) +; MCU-NEXT: fmul %st, %st(0) ; MCU-NEXT: testl %eax, %eax ; MCU-NEXT: flds (%edx) ; MCU-NEXT: je .LBB5_2 diff --git a/test/CodeGen/X86/sincos-opt.ll b/test/CodeGen/X86/sincos-opt.ll index b4330ea58ea5..b64450863427 100644 --- a/test/CodeGen/X86/sincos-opt.ll +++ b/test/CodeGen/X86/sincos-opt.ll @@ -115,13 +115,13 @@ entry: ; GNU_SINCOS: callq sincosl ; GNU_SINCOS: fldt 16(%rsp) ; GNU_SINCOS: fldt 32(%rsp) -; GNU_SINCOS: faddp %st(1) +; GNU_SINCOS: faddp %st, %st(1) ; GNU_SINCOS_FASTMATH-LABEL: test3: ; GNU_SINCOS_FASTMATH: callq sincosl ; GNU_SINCOS_FASTMATH: fldt 16(%{{[re]}}sp) ; GNU_SINCOS_FASTMATH: fldt 32(%{{[re]}}sp) -; GNU_SINCOS_FASTMATH: faddp %st(1) +; GNU_SINCOS_FASTMATH: faddp %st, %st(1) %call = tail call x86_fp80 @sinl(x86_fp80 %x) readnone %call1 = tail call x86_fp80 @cosl(x86_fp80 %x) readnone %add = fadd x86_fp80 %call, %call1 diff --git a/test/CodeGen/X86/x87-schedule.ll b/test/CodeGen/X86/x87-schedule.ll index 1921f8c75a3d..599f313b1302 100644 --- a/test/CodeGen/X86/x87-schedule.ll +++ b/test/CodeGen/X86/x87-schedule.ll @@ -180,8 +180,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fadd %st(0), %st(1) -; GENERIC-NEXT: fadd %st(2) +; GENERIC-NEXT: fadd %st, %st(1) +; GENERIC-NEXT: fadd %st(2), %st ; GENERIC-NEXT: fadds (%ecx) ; GENERIC-NEXT: faddl (%eax) ; GENERIC-NEXT: #NO_APP @@ -192,8 +192,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fadd %st(0), %st(1) # sched: [5:5.00] -; ATOM-NEXT: fadd %st(2) # sched: [5:5.00] +; ATOM-NEXT: fadd %st, %st(1) # sched: [5:5.00] +; ATOM-NEXT: fadd %st(2), %st # sched: [5:5.00] ; ATOM-NEXT: fadds (%ecx) # sched: [5:5.00] ; ATOM-NEXT: faddl (%eax) # sched: [5:5.00] ; ATOM-NEXT: #NO_APP @@ -204,8 +204,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fadd %st(0), %st(1) # sched: [3:1.00] -; SLM-NEXT: fadd %st(2) # sched: [3:1.00] +; SLM-NEXT: fadd %st, %st(1) # sched: [3:1.00] +; SLM-NEXT: fadd %st(2), %st # sched: [3:1.00] ; SLM-NEXT: fadds (%ecx) # sched: [6:1.00] ; SLM-NEXT: faddl (%eax) # sched: [6:1.00] ; SLM-NEXT: #NO_APP @@ -216,8 +216,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fadd %st(0), %st(1) # sched: [3:1.00] -; SANDY-NEXT: fadd %st(2) # sched: [3:1.00] +; SANDY-NEXT: fadd %st, %st(1) # sched: [3:1.00] +; SANDY-NEXT: fadd %st(2), %st # sched: [3:1.00] ; SANDY-NEXT: fadds (%ecx) # sched: [10:1.00] ; SANDY-NEXT: faddl (%eax) # sched: [10:1.00] ; SANDY-NEXT: #NO_APP @@ -228,8 +228,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fadd %st(0), %st(1) # sched: [3:1.00] -; HASWELL-NEXT: fadd %st(2) # sched: [3:1.00] +; HASWELL-NEXT: fadd %st, %st(1) # sched: [3:1.00] +; HASWELL-NEXT: fadd %st(2), %st # sched: [3:1.00] ; HASWELL-NEXT: fadds (%ecx) # sched: [10:1.00] ; HASWELL-NEXT: faddl (%eax) # sched: [10:1.00] ; HASWELL-NEXT: #NO_APP @@ -240,8 +240,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fadd %st(0), %st(1) # sched: [3:1.00] -; BROADWELL-NEXT: fadd %st(2) # sched: [3:1.00] +; BROADWELL-NEXT: fadd %st, %st(1) # sched: [3:1.00] +; BROADWELL-NEXT: fadd %st(2), %st # sched: [3:1.00] ; BROADWELL-NEXT: fadds (%ecx) # sched: [9:1.00] ; BROADWELL-NEXT: faddl (%eax) # sched: [9:1.00] ; BROADWELL-NEXT: #NO_APP @@ -252,8 +252,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fadd %st(0), %st(1) # sched: [3:1.00] -; SKYLAKE-NEXT: fadd %st(2) # sched: [3:1.00] +; SKYLAKE-NEXT: fadd %st, %st(1) # sched: [3:1.00] +; SKYLAKE-NEXT: fadd %st(2), %st # sched: [3:1.00] ; SKYLAKE-NEXT: fadds (%ecx) # sched: [10:1.00] ; SKYLAKE-NEXT: faddl (%eax) # sched: [10:1.00] ; SKYLAKE-NEXT: #NO_APP @@ -264,8 +264,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fadd %st(0), %st(1) # sched: [3:1.00] -; SKX-NEXT: fadd %st(2) # sched: [3:1.00] +; SKX-NEXT: fadd %st, %st(1) # sched: [3:1.00] +; SKX-NEXT: fadd %st(2), %st # sched: [3:1.00] ; SKX-NEXT: fadds (%ecx) # sched: [10:1.00] ; SKX-NEXT: faddl (%eax) # sched: [10:1.00] ; SKX-NEXT: #NO_APP @@ -276,8 +276,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fadd %st(0), %st(1) # sched: [5:1.00] -; BDVER2-NEXT: fadd %st(2) # sched: [5:1.00] +; BDVER2-NEXT: fadd %st, %st(1) # sched: [5:1.00] +; BDVER2-NEXT: fadd %st(2), %st # sched: [5:1.00] ; BDVER2-NEXT: fadds (%ecx) # sched: [10:1.00] ; BDVER2-NEXT: faddl (%eax) # sched: [10:1.00] ; BDVER2-NEXT: #NO_APP @@ -288,8 +288,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fadd %st(0), %st(1) # sched: [3:1.00] -; BTVER2-NEXT: fadd %st(2) # sched: [3:1.00] +; BTVER2-NEXT: fadd %st, %st(1) # sched: [3:1.00] +; BTVER2-NEXT: fadd %st(2), %st # sched: [3:1.00] ; BTVER2-NEXT: fadds (%ecx) # sched: [8:1.00] ; BTVER2-NEXT: faddl (%eax) # sched: [8:1.00] ; BTVER2-NEXT: #NO_APP @@ -300,8 +300,8 @@ define void @test_fadd(float *%a0, double *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fadd %st(0), %st(1) # sched: [3:1.00] -; ZNVER1-NEXT: fadd %st(2) # sched: [3:1.00] +; ZNVER1-NEXT: fadd %st, %st(1) # sched: [3:1.00] +; ZNVER1-NEXT: fadd %st(2), %st # sched: [3:1.00] ; ZNVER1-NEXT: fadds (%ecx) # sched: [10:1.00] ; ZNVER1-NEXT: faddl (%eax) # sched: [10:1.00] ; ZNVER1-NEXT: #NO_APP @@ -316,8 +316,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: faddp %st(1) -; GENERIC-NEXT: faddp %st(2) +; GENERIC-NEXT: faddp %st, %st(1) +; GENERIC-NEXT: faddp %st, %st(2) ; GENERIC-NEXT: fiadds (%ecx) ; GENERIC-NEXT: fiaddl (%eax) ; GENERIC-NEXT: #NO_APP @@ -328,8 +328,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: faddp %st(1) # sched: [5:5.00] -; ATOM-NEXT: faddp %st(2) # sched: [5:5.00] +; ATOM-NEXT: faddp %st, %st(1) # sched: [5:5.00] +; ATOM-NEXT: faddp %st, %st(2) # sched: [5:5.00] ; ATOM-NEXT: fiadds (%ecx) # sched: [5:5.00] ; ATOM-NEXT: fiaddl (%eax) # sched: [5:5.00] ; ATOM-NEXT: #NO_APP @@ -340,8 +340,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: faddp %st(1) # sched: [3:1.00] -; SLM-NEXT: faddp %st(2) # sched: [3:1.00] +; SLM-NEXT: faddp %st, %st(1) # sched: [3:1.00] +; SLM-NEXT: faddp %st, %st(2) # sched: [3:1.00] ; SLM-NEXT: fiadds (%ecx) # sched: [6:1.00] ; SLM-NEXT: fiaddl (%eax) # sched: [6:1.00] ; SLM-NEXT: #NO_APP @@ -352,8 +352,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: faddp %st(1) # sched: [3:1.00] -; SANDY-NEXT: faddp %st(2) # sched: [3:1.00] +; SANDY-NEXT: faddp %st, %st(1) # sched: [3:1.00] +; SANDY-NEXT: faddp %st, %st(2) # sched: [3:1.00] ; SANDY-NEXT: fiadds (%ecx) # sched: [13:2.00] ; SANDY-NEXT: fiaddl (%eax) # sched: [13:2.00] ; SANDY-NEXT: #NO_APP @@ -364,8 +364,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: faddp %st(1) # sched: [3:1.00] -; HASWELL-NEXT: faddp %st(2) # sched: [3:1.00] +; HASWELL-NEXT: faddp %st, %st(1) # sched: [3:1.00] +; HASWELL-NEXT: faddp %st, %st(2) # sched: [3:1.00] ; HASWELL-NEXT: fiadds (%ecx) # sched: [13:2.00] ; HASWELL-NEXT: fiaddl (%eax) # sched: [13:2.00] ; HASWELL-NEXT: #NO_APP @@ -376,8 +376,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: faddp %st(1) # sched: [3:1.00] -; BROADWELL-NEXT: faddp %st(2) # sched: [3:1.00] +; BROADWELL-NEXT: faddp %st, %st(1) # sched: [3:1.00] +; BROADWELL-NEXT: faddp %st, %st(2) # sched: [3:1.00] ; BROADWELL-NEXT: fiadds (%ecx) # sched: [12:2.00] ; BROADWELL-NEXT: fiaddl (%eax) # sched: [12:2.00] ; BROADWELL-NEXT: #NO_APP @@ -388,8 +388,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: faddp %st(1) # sched: [3:1.00] -; SKYLAKE-NEXT: faddp %st(2) # sched: [3:1.00] +; SKYLAKE-NEXT: faddp %st, %st(1) # sched: [3:1.00] +; SKYLAKE-NEXT: faddp %st, %st(2) # sched: [3:1.00] ; SKYLAKE-NEXT: fiadds (%ecx) # sched: [13:2.00] ; SKYLAKE-NEXT: fiaddl (%eax) # sched: [13:2.00] ; SKYLAKE-NEXT: #NO_APP @@ -400,8 +400,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: faddp %st(1) # sched: [3:1.00] -; SKX-NEXT: faddp %st(2) # sched: [3:1.00] +; SKX-NEXT: faddp %st, %st(1) # sched: [3:1.00] +; SKX-NEXT: faddp %st, %st(2) # sched: [3:1.00] ; SKX-NEXT: fiadds (%ecx) # sched: [13:2.00] ; SKX-NEXT: fiaddl (%eax) # sched: [13:2.00] ; SKX-NEXT: #NO_APP @@ -412,8 +412,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: faddp %st(1) # sched: [5:1.00] -; BDVER2-NEXT: faddp %st(2) # sched: [5:1.00] +; BDVER2-NEXT: faddp %st, %st(1) # sched: [5:1.00] +; BDVER2-NEXT: faddp %st, %st(2) # sched: [5:1.00] ; BDVER2-NEXT: fiadds (%ecx) # sched: [10:1.00] ; BDVER2-NEXT: fiaddl (%eax) # sched: [10:1.00] ; BDVER2-NEXT: #NO_APP @@ -424,8 +424,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: faddp %st(1) # sched: [3:1.00] -; BTVER2-NEXT: faddp %st(2) # sched: [3:1.00] +; BTVER2-NEXT: faddp %st, %st(1) # sched: [3:1.00] +; BTVER2-NEXT: faddp %st, %st(2) # sched: [3:1.00] ; BTVER2-NEXT: fiadds (%ecx) # sched: [8:1.00] ; BTVER2-NEXT: fiaddl (%eax) # sched: [8:1.00] ; BTVER2-NEXT: #NO_APP @@ -436,8 +436,8 @@ define void @test_faddp_fiadd(i16 *%a0, i32 *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: faddp %st(1) # sched: [3:1.00] -; ZNVER1-NEXT: faddp %st(2) # sched: [3:1.00] +; ZNVER1-NEXT: faddp %st, %st(1) # sched: [3:1.00] +; ZNVER1-NEXT: faddp %st, %st(2) # sched: [3:1.00] ; ZNVER1-NEXT: fiadds (%ecx) # sched: [10:1.00] ; ZNVER1-NEXT: fiaddl (%eax) # sched: [10:1.00] ; ZNVER1-NEXT: #NO_APP @@ -807,154 +807,154 @@ define void @test_fcmov() optsize { ; GENERIC-LABEL: test_fcmov: ; GENERIC: # %bb.0: ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fcmovb %st(1), %st(0) -; GENERIC-NEXT: fcmovbe %st(1), %st(0) -; GENERIC-NEXT: fcmove %st(1), %st(0) -; GENERIC-NEXT: fcmovnb %st(1), %st(0) -; GENERIC-NEXT: fcmovnbe %st(1), %st(0) -; GENERIC-NEXT: fcmovne %st(1), %st(0) -; GENERIC-NEXT: fcmovnu %st(1), %st(0) -; GENERIC-NEXT: fcmovu %st(1), %st(0) +; GENERIC-NEXT: fcmovb %st(1), %st +; GENERIC-NEXT: fcmovbe %st(1), %st +; GENERIC-NEXT: fcmove %st(1), %st +; GENERIC-NEXT: fcmovnb %st(1), %st +; GENERIC-NEXT: fcmovnbe %st(1), %st +; GENERIC-NEXT: fcmovne %st(1), %st +; GENERIC-NEXT: fcmovnu %st(1), %st +; GENERIC-NEXT: fcmovu %st(1), %st ; GENERIC-NEXT: #NO_APP ; GENERIC-NEXT: retl ; ; ATOM-LABEL: test_fcmov: ; ATOM: # %bb.0: ; ATOM-NEXT: #APP -; ATOM-NEXT: fcmovb %st(1), %st(0) # sched: [9:4.50] -; ATOM-NEXT: fcmovbe %st(1), %st(0) # sched: [9:4.50] -; ATOM-NEXT: fcmove %st(1), %st(0) # sched: [9:4.50] -; ATOM-NEXT: fcmovnb %st(1), %st(0) # sched: [9:4.50] -; ATOM-NEXT: fcmovnbe %st(1), %st(0) # sched: [9:4.50] -; ATOM-NEXT: fcmovne %st(1), %st(0) # sched: [9:4.50] -; ATOM-NEXT: fcmovnu %st(1), %st(0) # sched: [9:4.50] -; ATOM-NEXT: fcmovu %st(1), %st(0) # sched: [9:4.50] +; ATOM-NEXT: fcmovb %st(1), %st # sched: [9:4.50] +; ATOM-NEXT: fcmovbe %st(1), %st # sched: [9:4.50] +; ATOM-NEXT: fcmove %st(1), %st # sched: [9:4.50] +; ATOM-NEXT: fcmovnb %st(1), %st # sched: [9:4.50] +; ATOM-NEXT: fcmovnbe %st(1), %st # sched: [9:4.50] +; ATOM-NEXT: fcmovne %st(1), %st # sched: [9:4.50] +; ATOM-NEXT: fcmovnu %st(1), %st # sched: [9:4.50] +; ATOM-NEXT: fcmovu %st(1), %st # sched: [9:4.50] ; ATOM-NEXT: #NO_APP ; ATOM-NEXT: retl # sched: [79:39.50] ; ; SLM-LABEL: test_fcmov: ; SLM: # %bb.0: ; SLM-NEXT: #APP -; SLM-NEXT: fcmovb %st(1), %st(0) # sched: [3:1.00] -; SLM-NEXT: fcmovbe %st(1), %st(0) # sched: [3:1.00] -; SLM-NEXT: fcmove %st(1), %st(0) # sched: [3:1.00] -; SLM-NEXT: fcmovnb %st(1), %st(0) # sched: [3:1.00] -; SLM-NEXT: fcmovnbe %st(1), %st(0) # sched: [3:1.00] -; SLM-NEXT: fcmovne %st(1), %st(0) # sched: [3:1.00] -; SLM-NEXT: fcmovnu %st(1), %st(0) # sched: [3:1.00] -; SLM-NEXT: fcmovu %st(1), %st(0) # sched: [3:1.00] +; SLM-NEXT: fcmovb %st(1), %st # sched: [3:1.00] +; SLM-NEXT: fcmovbe %st(1), %st # sched: [3:1.00] +; SLM-NEXT: fcmove %st(1), %st # sched: [3:1.00] +; SLM-NEXT: fcmovnb %st(1), %st # sched: [3:1.00] +; SLM-NEXT: fcmovnbe %st(1), %st # sched: [3:1.00] +; SLM-NEXT: fcmovne %st(1), %st # sched: [3:1.00] +; SLM-NEXT: fcmovnu %st(1), %st # sched: [3:1.00] +; SLM-NEXT: fcmovu %st(1), %st # sched: [3:1.00] ; SLM-NEXT: #NO_APP ; SLM-NEXT: retl # sched: [4:1.00] ; ; SANDY-LABEL: test_fcmov: ; SANDY: # %bb.0: ; SANDY-NEXT: #APP -; SANDY-NEXT: fcmovb %st(1), %st(0) # sched: [3:2.00] -; SANDY-NEXT: fcmovbe %st(1), %st(0) # sched: [3:2.00] -; SANDY-NEXT: fcmove %st(1), %st(0) # sched: [3:2.00] -; SANDY-NEXT: fcmovnb %st(1), %st(0) # sched: [3:2.00] -; SANDY-NEXT: fcmovnbe %st(1), %st(0) # sched: [3:2.00] -; SANDY-NEXT: fcmovne %st(1), %st(0) # sched: [3:2.00] -; SANDY-NEXT: fcmovnu %st(1), %st(0) # sched: [3:2.00] -; SANDY-NEXT: fcmovu %st(1), %st(0) # sched: [3:2.00] +; SANDY-NEXT: fcmovb %st(1), %st # sched: [3:2.00] +; SANDY-NEXT: fcmovbe %st(1), %st # sched: [3:2.00] +; SANDY-NEXT: fcmove %st(1), %st # sched: [3:2.00] +; SANDY-NEXT: fcmovnb %st(1), %st # sched: [3:2.00] +; SANDY-NEXT: fcmovnbe %st(1), %st # sched: [3:2.00] +; SANDY-NEXT: fcmovne %st(1), %st # sched: [3:2.00] +; SANDY-NEXT: fcmovnu %st(1), %st # sched: [3:2.00] +; SANDY-NEXT: fcmovu %st(1), %st # sched: [3:2.00] ; SANDY-NEXT: #NO_APP ; SANDY-NEXT: retl # sched: [6:1.00] ; ; HASWELL-LABEL: test_fcmov: ; HASWELL: # %bb.0: ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fcmovb %st(1), %st(0) # sched: [3:1.00] -; HASWELL-NEXT: fcmovbe %st(1), %st(0) # sched: [3:1.00] -; HASWELL-NEXT: fcmove %st(1), %st(0) # sched: [3:1.00] -; HASWELL-NEXT: fcmovnb %st(1), %st(0) # sched: [3:1.00] -; HASWELL-NEXT: fcmovnbe %st(1), %st(0) # sched: [3:1.00] -; HASWELL-NEXT: fcmovne %st(1), %st(0) # sched: [3:1.00] -; HASWELL-NEXT: fcmovnu %st(1), %st(0) # sched: [3:1.00] -; HASWELL-NEXT: fcmovu %st(1), %st(0) # sched: [3:1.00] +; HASWELL-NEXT: fcmovb %st(1), %st # sched: [3:1.00] +; HASWELL-NEXT: fcmovbe %st(1), %st # sched: [3:1.00] +; HASWELL-NEXT: fcmove %st(1), %st # sched: [3:1.00] +; HASWELL-NEXT: fcmovnb %st(1), %st # sched: [3:1.00] +; HASWELL-NEXT: fcmovnbe %st(1), %st # sched: [3:1.00] +; HASWELL-NEXT: fcmovne %st(1), %st # sched: [3:1.00] +; HASWELL-NEXT: fcmovnu %st(1), %st # sched: [3:1.00] +; HASWELL-NEXT: fcmovu %st(1), %st # sched: [3:1.00] ; HASWELL-NEXT: #NO_APP ; HASWELL-NEXT: retl # sched: [7:1.00] ; ; BROADWELL-LABEL: test_fcmov: ; BROADWELL: # %bb.0: ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fcmovb %st(1), %st(0) # sched: [3:1.00] -; BROADWELL-NEXT: fcmovbe %st(1), %st(0) # sched: [3:1.00] -; BROADWELL-NEXT: fcmove %st(1), %st(0) # sched: [3:1.00] -; BROADWELL-NEXT: fcmovnb %st(1), %st(0) # sched: [3:1.00] -; BROADWELL-NEXT: fcmovnbe %st(1), %st(0) # sched: [3:1.00] -; BROADWELL-NEXT: fcmovne %st(1), %st(0) # sched: [3:1.00] -; BROADWELL-NEXT: fcmovnu %st(1), %st(0) # sched: [3:1.00] -; BROADWELL-NEXT: fcmovu %st(1), %st(0) # sched: [3:1.00] +; BROADWELL-NEXT: fcmovb %st(1), %st # sched: [3:1.00] +; BROADWELL-NEXT: fcmovbe %st(1), %st # sched: [3:1.00] +; BROADWELL-NEXT: fcmove %st(1), %st # sched: [3:1.00] +; BROADWELL-NEXT: fcmovnb %st(1), %st # sched: [3:1.00] +; BROADWELL-NEXT: fcmovnbe %st(1), %st # sched: [3:1.00] +; BROADWELL-NEXT: fcmovne %st(1), %st # sched: [3:1.00] +; BROADWELL-NEXT: fcmovnu %st(1), %st # sched: [3:1.00] +; BROADWELL-NEXT: fcmovu %st(1), %st # sched: [3:1.00] ; BROADWELL-NEXT: #NO_APP ; BROADWELL-NEXT: retl # sched: [6:0.50] ; ; SKYLAKE-LABEL: test_fcmov: ; SKYLAKE: # %bb.0: ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fcmovb %st(1), %st(0) # sched: [3:1.00] -; SKYLAKE-NEXT: fcmovbe %st(1), %st(0) # sched: [3:1.00] -; SKYLAKE-NEXT: fcmove %st(1), %st(0) # sched: [3:1.00] -; SKYLAKE-NEXT: fcmovnb %st(1), %st(0) # sched: [3:1.00] -; SKYLAKE-NEXT: fcmovnbe %st(1), %st(0) # sched: [3:1.00] -; SKYLAKE-NEXT: fcmovne %st(1), %st(0) # sched: [3:1.00] -; SKYLAKE-NEXT: fcmovnu %st(1), %st(0) # sched: [3:1.00] -; SKYLAKE-NEXT: fcmovu %st(1), %st(0) # sched: [3:1.00] +; SKYLAKE-NEXT: fcmovb %st(1), %st # sched: [3:1.00] +; SKYLAKE-NEXT: fcmovbe %st(1), %st # sched: [3:1.00] +; SKYLAKE-NEXT: fcmove %st(1), %st # sched: [3:1.00] +; SKYLAKE-NEXT: fcmovnb %st(1), %st # sched: [3:1.00] +; SKYLAKE-NEXT: fcmovnbe %st(1), %st # sched: [3:1.00] +; SKYLAKE-NEXT: fcmovne %st(1), %st # sched: [3:1.00] +; SKYLAKE-NEXT: fcmovnu %st(1), %st # sched: [3:1.00] +; SKYLAKE-NEXT: fcmovu %st(1), %st # sched: [3:1.00] ; SKYLAKE-NEXT: #NO_APP ; SKYLAKE-NEXT: retl # sched: [6:0.50] ; ; SKX-LABEL: test_fcmov: ; SKX: # %bb.0: ; SKX-NEXT: #APP -; SKX-NEXT: fcmovb %st(1), %st(0) # sched: [3:1.00] -; SKX-NEXT: fcmovbe %st(1), %st(0) # sched: [3:1.00] -; SKX-NEXT: fcmove %st(1), %st(0) # sched: [3:1.00] -; SKX-NEXT: fcmovnb %st(1), %st(0) # sched: [3:1.00] -; SKX-NEXT: fcmovnbe %st(1), %st(0) # sched: [3:1.00] -; SKX-NEXT: fcmovne %st(1), %st(0) # sched: [3:1.00] -; SKX-NEXT: fcmovnu %st(1), %st(0) # sched: [3:1.00] -; SKX-NEXT: fcmovu %st(1), %st(0) # sched: [3:1.00] +; SKX-NEXT: fcmovb %st(1), %st # sched: [3:1.00] +; SKX-NEXT: fcmovbe %st(1), %st # sched: [3:1.00] +; SKX-NEXT: fcmove %st(1), %st # sched: [3:1.00] +; SKX-NEXT: fcmovnb %st(1), %st # sched: [3:1.00] +; SKX-NEXT: fcmovnbe %st(1), %st # sched: [3:1.00] +; SKX-NEXT: fcmovne %st(1), %st # sched: [3:1.00] +; SKX-NEXT: fcmovnu %st(1), %st # sched: [3:1.00] +; SKX-NEXT: fcmovu %st(1), %st # sched: [3:1.00] ; SKX-NEXT: #NO_APP ; SKX-NEXT: retl # sched: [6:0.50] ; ; BDVER2-LABEL: test_fcmov: ; BDVER2: # %bb.0: ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fcmovb %st(1), %st(0) # sched: [1:1.00] -; BDVER2-NEXT: fcmovbe %st(1), %st(0) # sched: [1:1.00] -; BDVER2-NEXT: fcmove %st(1), %st(0) # sched: [1:1.00] -; BDVER2-NEXT: fcmovnb %st(1), %st(0) # sched: [1:1.00] -; BDVER2-NEXT: fcmovnbe %st(1), %st(0) # sched: [1:1.00] -; BDVER2-NEXT: fcmovne %st(1), %st(0) # sched: [1:1.00] -; BDVER2-NEXT: fcmovnu %st(1), %st(0) # sched: [1:1.00] -; BDVER2-NEXT: fcmovu %st(1), %st(0) # sched: [1:1.00] +; BDVER2-NEXT: fcmovb %st(1), %st # sched: [1:1.00] +; BDVER2-NEXT: fcmovbe %st(1), %st # sched: [1:1.00] +; BDVER2-NEXT: fcmove %st(1), %st # sched: [1:1.00] +; BDVER2-NEXT: fcmovnb %st(1), %st # sched: [1:1.00] +; BDVER2-NEXT: fcmovnbe %st(1), %st # sched: [1:1.00] +; BDVER2-NEXT: fcmovne %st(1), %st # sched: [1:1.00] +; BDVER2-NEXT: fcmovnu %st(1), %st # sched: [1:1.00] +; BDVER2-NEXT: fcmovu %st(1), %st # sched: [1:1.00] ; BDVER2-NEXT: #NO_APP ; BDVER2-NEXT: retl # sched: [5:1.00] ; ; BTVER2-LABEL: test_fcmov: ; BTVER2: # %bb.0: ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fcmovb %st(1), %st(0) # sched: [3:1.00] -; BTVER2-NEXT: fcmovbe %st(1), %st(0) # sched: [3:1.00] -; BTVER2-NEXT: fcmove %st(1), %st(0) # sched: [3:1.00] -; BTVER2-NEXT: fcmovnb %st(1), %st(0) # sched: [3:1.00] -; BTVER2-NEXT: fcmovnbe %st(1), %st(0) # sched: [3:1.00] -; BTVER2-NEXT: fcmovne %st(1), %st(0) # sched: [3:1.00] -; BTVER2-NEXT: fcmovnu %st(1), %st(0) # sched: [3:1.00] -; BTVER2-NEXT: fcmovu %st(1), %st(0) # sched: [3:1.00] +; BTVER2-NEXT: fcmovb %st(1), %st # sched: [3:1.00] +; BTVER2-NEXT: fcmovbe %st(1), %st # sched: [3:1.00] +; BTVER2-NEXT: fcmove %st(1), %st # sched: [3:1.00] +; BTVER2-NEXT: fcmovnb %st(1), %st # sched: [3:1.00] +; BTVER2-NEXT: fcmovnbe %st(1), %st # sched: [3:1.00] +; BTVER2-NEXT: fcmovne %st(1), %st # sched: [3:1.00] +; BTVER2-NEXT: fcmovnu %st(1), %st # sched: [3:1.00] +; BTVER2-NEXT: fcmovu %st(1), %st # sched: [3:1.00] ; BTVER2-NEXT: #NO_APP ; BTVER2-NEXT: retl # sched: [4:1.00] ; ; ZNVER1-LABEL: test_fcmov: ; ZNVER1: # %bb.0: ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fcmovb %st(1), %st(0) # sched: [100:0.25] -; ZNVER1-NEXT: fcmovbe %st(1), %st(0) # sched: [100:0.25] -; ZNVER1-NEXT: fcmove %st(1), %st(0) # sched: [100:0.25] -; ZNVER1-NEXT: fcmovnb %st(1), %st(0) # sched: [100:0.25] -; ZNVER1-NEXT: fcmovnbe %st(1), %st(0) # sched: [100:0.25] -; ZNVER1-NEXT: fcmovne %st(1), %st(0) # sched: [100:0.25] -; ZNVER1-NEXT: fcmovnu %st(1), %st(0) # sched: [100:0.25] -; ZNVER1-NEXT: fcmovu %st(1), %st(0) # sched: [100:0.25] +; ZNVER1-NEXT: fcmovb %st(1), %st # sched: [100:0.25] +; ZNVER1-NEXT: fcmovbe %st(1), %st # sched: [100:0.25] +; ZNVER1-NEXT: fcmove %st(1), %st # sched: [100:0.25] +; ZNVER1-NEXT: fcmovnb %st(1), %st # sched: [100:0.25] +; ZNVER1-NEXT: fcmovnbe %st(1), %st # sched: [100:0.25] +; ZNVER1-NEXT: fcmovne %st(1), %st # sched: [100:0.25] +; ZNVER1-NEXT: fcmovnu %st(1), %st # sched: [100:0.25] +; ZNVER1-NEXT: fcmovu %st(1), %st # sched: [100:0.25] ; ZNVER1-NEXT: #NO_APP ; ZNVER1-NEXT: retl # sched: [1:0.50] tail call void asm sideeffect "fcmovb %st(1), %st(0) \0A\09 fcmovbe %st(1), %st(0) \0A\09 fcmove %st(1), %st(0) \0A\09 fcmovnb %st(1), %st(0) \0A\09 fcmovnbe %st(1), %st(0) \0A\09 fcmovne %st(1), %st(0) \0A\09 fcmovnu %st(1), %st(0) \0A\09 fcmovu %st(1), %st(0)", ""() nounwind @@ -1248,88 +1248,88 @@ define void @test_fcomi_fcomip() optsize { ; GENERIC-LABEL: test_fcomi_fcomip: ; GENERIC: # %bb.0: ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fcomi %st(3) -; GENERIC-NEXT: fcompi %st(3) +; GENERIC-NEXT: fcomi %st(3), %st +; GENERIC-NEXT: fcompi %st(3), %st ; GENERIC-NEXT: #NO_APP ; GENERIC-NEXT: retl ; ; ATOM-LABEL: test_fcomi_fcomip: ; ATOM: # %bb.0: ; ATOM-NEXT: #APP -; ATOM-NEXT: fcomi %st(3) # sched: [9:4.50] -; ATOM-NEXT: fcompi %st(3) # sched: [9:4.50] +; ATOM-NEXT: fcomi %st(3), %st # sched: [9:4.50] +; ATOM-NEXT: fcompi %st(3), %st # sched: [9:4.50] ; ATOM-NEXT: #NO_APP ; ATOM-NEXT: retl # sched: [79:39.50] ; ; SLM-LABEL: test_fcomi_fcomip: ; SLM: # %bb.0: ; SLM-NEXT: #APP -; SLM-NEXT: fcomi %st(3) # sched: [3:1.00] -; SLM-NEXT: fcompi %st(3) # sched: [3:1.00] +; SLM-NEXT: fcomi %st(3), %st # sched: [3:1.00] +; SLM-NEXT: fcompi %st(3), %st # sched: [3:1.00] ; SLM-NEXT: #NO_APP ; SLM-NEXT: retl # sched: [4:1.00] ; ; SANDY-LABEL: test_fcomi_fcomip: ; SANDY: # %bb.0: ; SANDY-NEXT: #APP -; SANDY-NEXT: fcomi %st(3) # sched: [3:1.00] -; SANDY-NEXT: fcompi %st(3) # sched: [3:1.00] +; SANDY-NEXT: fcomi %st(3), %st # sched: [3:1.00] +; SANDY-NEXT: fcompi %st(3), %st # sched: [3:1.00] ; SANDY-NEXT: #NO_APP ; SANDY-NEXT: retl # sched: [6:1.00] ; ; HASWELL-LABEL: test_fcomi_fcomip: ; HASWELL: # %bb.0: ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fcomi %st(3) # sched: [1:0.50] -; HASWELL-NEXT: fcompi %st(3) # sched: [1:0.50] +; HASWELL-NEXT: fcomi %st(3), %st # sched: [1:0.50] +; HASWELL-NEXT: fcompi %st(3), %st # sched: [1:0.50] ; HASWELL-NEXT: #NO_APP ; HASWELL-NEXT: retl # sched: [7:1.00] ; ; BROADWELL-LABEL: test_fcomi_fcomip: ; BROADWELL: # %bb.0: ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fcomi %st(3) # sched: [3:1.00] -; BROADWELL-NEXT: fcompi %st(3) # sched: [3:1.00] +; BROADWELL-NEXT: fcomi %st(3), %st # sched: [3:1.00] +; BROADWELL-NEXT: fcompi %st(3), %st # sched: [3:1.00] ; BROADWELL-NEXT: #NO_APP ; BROADWELL-NEXT: retl # sched: [6:0.50] ; ; SKYLAKE-LABEL: test_fcomi_fcomip: ; SKYLAKE: # %bb.0: ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fcomi %st(3) # sched: [2:1.00] -; SKYLAKE-NEXT: fcompi %st(3) # sched: [2:1.00] +; SKYLAKE-NEXT: fcomi %st(3), %st # sched: [2:1.00] +; SKYLAKE-NEXT: fcompi %st(3), %st # sched: [2:1.00] ; SKYLAKE-NEXT: #NO_APP ; SKYLAKE-NEXT: retl # sched: [6:0.50] ; ; SKX-LABEL: test_fcomi_fcomip: ; SKX: # %bb.0: ; SKX-NEXT: #APP -; SKX-NEXT: fcomi %st(3) # sched: [2:1.00] -; SKX-NEXT: fcompi %st(3) # sched: [2:1.00] +; SKX-NEXT: fcomi %st(3), %st # sched: [2:1.00] +; SKX-NEXT: fcompi %st(3), %st # sched: [2:1.00] ; SKX-NEXT: #NO_APP ; SKX-NEXT: retl # sched: [6:0.50] ; ; BDVER2-LABEL: test_fcomi_fcomip: ; BDVER2: # %bb.0: ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fcomi %st(3) # sched: [1:1.00] -; BDVER2-NEXT: fcompi %st(3) # sched: [1:1.00] +; BDVER2-NEXT: fcomi %st(3), %st # sched: [1:1.00] +; BDVER2-NEXT: fcompi %st(3), %st # sched: [1:1.00] ; BDVER2-NEXT: #NO_APP ; BDVER2-NEXT: retl # sched: [5:1.00] ; ; BTVER2-LABEL: test_fcomi_fcomip: ; BTVER2: # %bb.0: ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fcomi %st(3) # sched: [3:1.00] -; BTVER2-NEXT: fcompi %st(3) # sched: [3:1.00] +; BTVER2-NEXT: fcomi %st(3), %st # sched: [3:1.00] +; BTVER2-NEXT: fcompi %st(3), %st # sched: [3:1.00] ; BTVER2-NEXT: #NO_APP ; BTVER2-NEXT: retl # sched: [4:1.00] ; ; ZNVER1-LABEL: test_fcomi_fcomip: ; ZNVER1: # %bb.0: ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fcomi %st(3) # sched: [9:0.50] -; ZNVER1-NEXT: fcompi %st(3) # sched: [9:0.50] +; ZNVER1-NEXT: fcomi %st(3), %st # sched: [9:0.50] +; ZNVER1-NEXT: fcompi %st(3), %st # sched: [9:0.50] ; ZNVER1-NEXT: #NO_APP ; ZNVER1-NEXT: retl # sched: [1:0.50] tail call void asm sideeffect "fcomi %st(3) \0A\09 fcomip %st(3)", ""() nounwind @@ -1504,8 +1504,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fdiv %st(0), %st(1) -; GENERIC-NEXT: fdiv %st(2) +; GENERIC-NEXT: fdiv %st, %st(1) +; GENERIC-NEXT: fdiv %st(2), %st ; GENERIC-NEXT: fdivs (%ecx) ; GENERIC-NEXT: fdivl (%eax) ; GENERIC-NEXT: #NO_APP @@ -1516,8 +1516,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fdiv %st(0), %st(1) # sched: [34:17.00] -; ATOM-NEXT: fdiv %st(2) # sched: [34:17.00] +; ATOM-NEXT: fdiv %st, %st(1) # sched: [34:17.00] +; ATOM-NEXT: fdiv %st(2), %st # sched: [34:17.00] ; ATOM-NEXT: fdivs (%ecx) # sched: [34:17.00] ; ATOM-NEXT: fdivl (%eax) # sched: [34:17.00] ; ATOM-NEXT: #NO_APP @@ -1528,8 +1528,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fdiv %st(0), %st(1) # sched: [19:17.00] -; SLM-NEXT: fdiv %st(2) # sched: [19:17.00] +; SLM-NEXT: fdiv %st, %st(1) # sched: [19:17.00] +; SLM-NEXT: fdiv %st(2), %st # sched: [19:17.00] ; SLM-NEXT: fdivs (%ecx) # sched: [22:17.00] ; SLM-NEXT: fdivl (%eax) # sched: [22:17.00] ; SLM-NEXT: #NO_APP @@ -1540,8 +1540,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fdiv %st(0), %st(1) # sched: [14:14.00] -; SANDY-NEXT: fdiv %st(2) # sched: [14:14.00] +; SANDY-NEXT: fdiv %st, %st(1) # sched: [14:14.00] +; SANDY-NEXT: fdiv %st(2), %st # sched: [14:14.00] ; SANDY-NEXT: fdivs (%ecx) # sched: [31:1.00] ; SANDY-NEXT: fdivl (%eax) # sched: [31:1.00] ; SANDY-NEXT: #NO_APP @@ -1552,8 +1552,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fdiv %st(0), %st(1) # sched: [24:1.00] -; HASWELL-NEXT: fdiv %st(2) # sched: [20:1.00] +; HASWELL-NEXT: fdiv %st, %st(1) # sched: [24:1.00] +; HASWELL-NEXT: fdiv %st(2), %st # sched: [20:1.00] ; HASWELL-NEXT: fdivs (%ecx) # sched: [31:1.00] ; HASWELL-NEXT: fdivl (%eax) # sched: [31:1.00] ; HASWELL-NEXT: #NO_APP @@ -1564,8 +1564,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fdiv %st(0), %st(1) # sched: [15:1.00] -; BROADWELL-NEXT: fdiv %st(2) # sched: [20:1.00] +; BROADWELL-NEXT: fdiv %st, %st(1) # sched: [15:1.00] +; BROADWELL-NEXT: fdiv %st(2), %st # sched: [20:1.00] ; BROADWELL-NEXT: fdivs (%ecx) # sched: [21:1.00] ; BROADWELL-NEXT: fdivl (%eax) # sched: [21:1.00] ; BROADWELL-NEXT: #NO_APP @@ -1576,8 +1576,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fdiv %st(0), %st(1) # sched: [15:1.00] -; SKYLAKE-NEXT: fdiv %st(2) # sched: [20:1.00] +; SKYLAKE-NEXT: fdiv %st, %st(1) # sched: [15:1.00] +; SKYLAKE-NEXT: fdiv %st(2), %st # sched: [20:1.00] ; SKYLAKE-NEXT: fdivs (%ecx) # sched: [22:1.00] ; SKYLAKE-NEXT: fdivl (%eax) # sched: [22:1.00] ; SKYLAKE-NEXT: #NO_APP @@ -1588,8 +1588,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fdiv %st(0), %st(1) # sched: [15:1.00] -; SKX-NEXT: fdiv %st(2) # sched: [20:1.00] +; SKX-NEXT: fdiv %st, %st(1) # sched: [15:1.00] +; SKX-NEXT: fdiv %st(2), %st # sched: [20:1.00] ; SKX-NEXT: fdivs (%ecx) # sched: [22:1.00] ; SKX-NEXT: fdivl (%eax) # sched: [22:1.00] ; SKX-NEXT: #NO_APP @@ -1600,8 +1600,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fdiv %st(0), %st(1) # sched: [9:9.50] -; BDVER2-NEXT: fdiv %st(2) # sched: [9:9.50] +; BDVER2-NEXT: fdiv %st, %st(1) # sched: [9:9.50] +; BDVER2-NEXT: fdiv %st(2), %st # sched: [9:9.50] ; BDVER2-NEXT: fdivs (%ecx) # sched: [14:9.50] ; BDVER2-NEXT: fdivl (%eax) # sched: [14:9.50] ; BDVER2-NEXT: #NO_APP @@ -1612,8 +1612,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fdiv %st(0), %st(1) # sched: [19:19.00] -; BTVER2-NEXT: fdiv %st(2) # sched: [19:19.00] +; BTVER2-NEXT: fdiv %st, %st(1) # sched: [19:19.00] +; BTVER2-NEXT: fdiv %st(2), %st # sched: [19:19.00] ; BTVER2-NEXT: fdivs (%ecx) # sched: [24:19.00] ; BTVER2-NEXT: fdivl (%eax) # sched: [24:19.00] ; BTVER2-NEXT: #NO_APP @@ -1624,8 +1624,8 @@ define void @test_fdiv(float *%a0, double *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fdiv %st(0), %st(1) # sched: [15:1.00] -; ZNVER1-NEXT: fdiv %st(2) # sched: [15:1.00] +; ZNVER1-NEXT: fdiv %st, %st(1) # sched: [15:1.00] +; ZNVER1-NEXT: fdiv %st(2), %st # sched: [15:1.00] ; ZNVER1-NEXT: fdivs (%ecx) # sched: [22:1.00] ; ZNVER1-NEXT: fdivl (%eax) # sched: [22:1.00] ; ZNVER1-NEXT: #NO_APP @@ -1640,8 +1640,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fdivp %st(1) -; GENERIC-NEXT: fdivp %st(2) +; GENERIC-NEXT: fdivp %st, %st(1) +; GENERIC-NEXT: fdivp %st, %st(2) ; GENERIC-NEXT: fidivs (%ecx) ; GENERIC-NEXT: fidivl (%eax) ; GENERIC-NEXT: #NO_APP @@ -1652,8 +1652,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fdivp %st(1) # sched: [34:17.00] -; ATOM-NEXT: fdivp %st(2) # sched: [34:17.00] +; ATOM-NEXT: fdivp %st, %st(1) # sched: [34:17.00] +; ATOM-NEXT: fdivp %st, %st(2) # sched: [34:17.00] ; ATOM-NEXT: fidivs (%ecx) # sched: [34:17.00] ; ATOM-NEXT: fidivl (%eax) # sched: [34:17.00] ; ATOM-NEXT: #NO_APP @@ -1664,8 +1664,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fdivp %st(1) # sched: [19:17.00] -; SLM-NEXT: fdivp %st(2) # sched: [19:17.00] +; SLM-NEXT: fdivp %st, %st(1) # sched: [19:17.00] +; SLM-NEXT: fdivp %st, %st(2) # sched: [19:17.00] ; SLM-NEXT: fidivs (%ecx) # sched: [22:17.00] ; SLM-NEXT: fidivl (%eax) # sched: [22:17.00] ; SLM-NEXT: #NO_APP @@ -1676,8 +1676,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fdivp %st(1) # sched: [14:14.00] -; SANDY-NEXT: fdivp %st(2) # sched: [14:14.00] +; SANDY-NEXT: fdivp %st, %st(1) # sched: [14:14.00] +; SANDY-NEXT: fdivp %st, %st(2) # sched: [14:14.00] ; SANDY-NEXT: fidivs (%ecx) # sched: [34:1.00] ; SANDY-NEXT: fidivl (%eax) # sched: [34:1.00] ; SANDY-NEXT: #NO_APP @@ -1688,8 +1688,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fdivp %st(1) # sched: [24:1.00] -; HASWELL-NEXT: fdivp %st(2) # sched: [24:1.00] +; HASWELL-NEXT: fdivp %st, %st(1) # sched: [24:1.00] +; HASWELL-NEXT: fdivp %st, %st(2) # sched: [24:1.00] ; HASWELL-NEXT: fidivs (%ecx) # sched: [34:1.00] ; HASWELL-NEXT: fidivl (%eax) # sched: [34:1.00] ; HASWELL-NEXT: #NO_APP @@ -1700,8 +1700,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fdivp %st(1) # sched: [15:1.00] -; BROADWELL-NEXT: fdivp %st(2) # sched: [15:1.00] +; BROADWELL-NEXT: fdivp %st, %st(1) # sched: [15:1.00] +; BROADWELL-NEXT: fdivp %st, %st(2) # sched: [15:1.00] ; BROADWELL-NEXT: fidivs (%ecx) # sched: [24:1.00] ; BROADWELL-NEXT: fidivl (%eax) # sched: [24:1.00] ; BROADWELL-NEXT: #NO_APP @@ -1712,8 +1712,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fdivp %st(1) # sched: [15:1.00] -; SKYLAKE-NEXT: fdivp %st(2) # sched: [15:1.00] +; SKYLAKE-NEXT: fdivp %st, %st(1) # sched: [15:1.00] +; SKYLAKE-NEXT: fdivp %st, %st(2) # sched: [15:1.00] ; SKYLAKE-NEXT: fidivs (%ecx) # sched: [25:1.00] ; SKYLAKE-NEXT: fidivl (%eax) # sched: [25:1.00] ; SKYLAKE-NEXT: #NO_APP @@ -1724,8 +1724,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fdivp %st(1) # sched: [15:1.00] -; SKX-NEXT: fdivp %st(2) # sched: [15:1.00] +; SKX-NEXT: fdivp %st, %st(1) # sched: [15:1.00] +; SKX-NEXT: fdivp %st, %st(2) # sched: [15:1.00] ; SKX-NEXT: fidivs (%ecx) # sched: [25:1.00] ; SKX-NEXT: fidivl (%eax) # sched: [25:1.00] ; SKX-NEXT: #NO_APP @@ -1736,8 +1736,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fdivp %st(1) # sched: [9:9.50] -; BDVER2-NEXT: fdivp %st(2) # sched: [9:9.50] +; BDVER2-NEXT: fdivp %st, %st(1) # sched: [9:9.50] +; BDVER2-NEXT: fdivp %st, %st(2) # sched: [9:9.50] ; BDVER2-NEXT: fidivs (%ecx) # sched: [14:9.50] ; BDVER2-NEXT: fidivl (%eax) # sched: [14:9.50] ; BDVER2-NEXT: #NO_APP @@ -1748,8 +1748,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fdivp %st(1) # sched: [19:19.00] -; BTVER2-NEXT: fdivp %st(2) # sched: [19:19.00] +; BTVER2-NEXT: fdivp %st, %st(1) # sched: [19:19.00] +; BTVER2-NEXT: fdivp %st, %st(2) # sched: [19:19.00] ; BTVER2-NEXT: fidivs (%ecx) # sched: [24:19.00] ; BTVER2-NEXT: fidivl (%eax) # sched: [24:19.00] ; BTVER2-NEXT: #NO_APP @@ -1760,8 +1760,8 @@ define void @test_fdivp_fidiv(i16 *%a0, i32 *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fdivp %st(1) # sched: [15:1.00] -; ZNVER1-NEXT: fdivp %st(2) # sched: [15:1.00] +; ZNVER1-NEXT: fdivp %st, %st(1) # sched: [15:1.00] +; ZNVER1-NEXT: fdivp %st, %st(2) # sched: [15:1.00] ; ZNVER1-NEXT: fidivs (%ecx) # sched: [22:1.00] ; ZNVER1-NEXT: fidivl (%eax) # sched: [22:1.00] ; ZNVER1-NEXT: #NO_APP @@ -1776,8 +1776,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fdivr %st(0), %st(1) -; GENERIC-NEXT: fdivr %st(2) +; GENERIC-NEXT: fdivr %st, %st(1) +; GENERIC-NEXT: fdivr %st(2), %st ; GENERIC-NEXT: fdivrs (%ecx) ; GENERIC-NEXT: fdivrl (%eax) ; GENERIC-NEXT: #NO_APP @@ -1788,8 +1788,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fdivr %st(0), %st(1) # sched: [34:17.00] -; ATOM-NEXT: fdivr %st(2) # sched: [34:17.00] +; ATOM-NEXT: fdivr %st, %st(1) # sched: [34:17.00] +; ATOM-NEXT: fdivr %st(2), %st # sched: [34:17.00] ; ATOM-NEXT: fdivrs (%ecx) # sched: [34:17.00] ; ATOM-NEXT: fdivrl (%eax) # sched: [34:17.00] ; ATOM-NEXT: #NO_APP @@ -1800,8 +1800,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fdivr %st(0), %st(1) # sched: [19:17.00] -; SLM-NEXT: fdivr %st(2) # sched: [19:17.00] +; SLM-NEXT: fdivr %st, %st(1) # sched: [19:17.00] +; SLM-NEXT: fdivr %st(2), %st # sched: [19:17.00] ; SLM-NEXT: fdivrs (%ecx) # sched: [22:17.00] ; SLM-NEXT: fdivrl (%eax) # sched: [22:17.00] ; SLM-NEXT: #NO_APP @@ -1812,8 +1812,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fdivr %st(0), %st(1) # sched: [14:14.00] -; SANDY-NEXT: fdivr %st(2) # sched: [14:14.00] +; SANDY-NEXT: fdivr %st, %st(1) # sched: [14:14.00] +; SANDY-NEXT: fdivr %st(2), %st # sched: [14:14.00] ; SANDY-NEXT: fdivrs (%ecx) # sched: [31:1.00] ; SANDY-NEXT: fdivrl (%eax) # sched: [31:1.00] ; SANDY-NEXT: #NO_APP @@ -1824,8 +1824,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fdivr %st(0), %st(1) # sched: [20:1.00] -; HASWELL-NEXT: fdivr %st(2) # sched: [24:1.00] +; HASWELL-NEXT: fdivr %st, %st(1) # sched: [20:1.00] +; HASWELL-NEXT: fdivr %st(2), %st # sched: [24:1.00] ; HASWELL-NEXT: fdivrs (%ecx) # sched: [27:1.00] ; HASWELL-NEXT: fdivrl (%eax) # sched: [27:1.00] ; HASWELL-NEXT: #NO_APP @@ -1836,8 +1836,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fdivr %st(0), %st(1) # sched: [20:1.00] -; BROADWELL-NEXT: fdivr %st(2) # sched: [15:1.00] +; BROADWELL-NEXT: fdivr %st, %st(1) # sched: [20:1.00] +; BROADWELL-NEXT: fdivr %st(2), %st # sched: [15:1.00] ; BROADWELL-NEXT: fdivrs (%ecx) # sched: [26:1.00] ; BROADWELL-NEXT: fdivrl (%eax) # sched: [26:1.00] ; BROADWELL-NEXT: #NO_APP @@ -1848,8 +1848,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fdivr %st(0), %st(1) # sched: [20:1.00] -; SKYLAKE-NEXT: fdivr %st(2) # sched: [15:1.00] +; SKYLAKE-NEXT: fdivr %st, %st(1) # sched: [20:1.00] +; SKYLAKE-NEXT: fdivr %st(2), %st # sched: [15:1.00] ; SKYLAKE-NEXT: fdivrs (%ecx) # sched: [27:1.00] ; SKYLAKE-NEXT: fdivrl (%eax) # sched: [27:1.00] ; SKYLAKE-NEXT: #NO_APP @@ -1860,8 +1860,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fdivr %st(0), %st(1) # sched: [20:1.00] -; SKX-NEXT: fdivr %st(2) # sched: [15:1.00] +; SKX-NEXT: fdivr %st, %st(1) # sched: [20:1.00] +; SKX-NEXT: fdivr %st(2), %st # sched: [15:1.00] ; SKX-NEXT: fdivrs (%ecx) # sched: [27:1.00] ; SKX-NEXT: fdivrl (%eax) # sched: [27:1.00] ; SKX-NEXT: #NO_APP @@ -1872,8 +1872,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fdivr %st(0), %st(1) # sched: [9:9.50] -; BDVER2-NEXT: fdivr %st(2) # sched: [9:9.50] +; BDVER2-NEXT: fdivr %st, %st(1) # sched: [9:9.50] +; BDVER2-NEXT: fdivr %st(2), %st # sched: [9:9.50] ; BDVER2-NEXT: fdivrs (%ecx) # sched: [14:9.50] ; BDVER2-NEXT: fdivrl (%eax) # sched: [14:9.50] ; BDVER2-NEXT: #NO_APP @@ -1884,8 +1884,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fdivr %st(0), %st(1) # sched: [19:19.00] -; BTVER2-NEXT: fdivr %st(2) # sched: [19:19.00] +; BTVER2-NEXT: fdivr %st, %st(1) # sched: [19:19.00] +; BTVER2-NEXT: fdivr %st(2), %st # sched: [19:19.00] ; BTVER2-NEXT: fdivrs (%ecx) # sched: [24:19.00] ; BTVER2-NEXT: fdivrl (%eax) # sched: [24:19.00] ; BTVER2-NEXT: #NO_APP @@ -1896,8 +1896,8 @@ define void @test_fdivr(float *%a0, double *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fdivr %st(0), %st(1) # sched: [15:1.00] -; ZNVER1-NEXT: fdivr %st(2) # sched: [15:1.00] +; ZNVER1-NEXT: fdivr %st, %st(1) # sched: [15:1.00] +; ZNVER1-NEXT: fdivr %st(2), %st # sched: [15:1.00] ; ZNVER1-NEXT: fdivrs (%ecx) # sched: [22:1.00] ; ZNVER1-NEXT: fdivrl (%eax) # sched: [22:1.00] ; ZNVER1-NEXT: #NO_APP @@ -1912,8 +1912,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fdivrp %st(1) -; GENERIC-NEXT: fdivrp %st(2) +; GENERIC-NEXT: fdivrp %st, %st(1) +; GENERIC-NEXT: fdivrp %st, %st(2) ; GENERIC-NEXT: fidivrs (%ecx) ; GENERIC-NEXT: fidivrl (%eax) ; GENERIC-NEXT: #NO_APP @@ -1924,8 +1924,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fdivrp %st(1) # sched: [34:17.00] -; ATOM-NEXT: fdivrp %st(2) # sched: [34:17.00] +; ATOM-NEXT: fdivrp %st, %st(1) # sched: [34:17.00] +; ATOM-NEXT: fdivrp %st, %st(2) # sched: [34:17.00] ; ATOM-NEXT: fidivrs (%ecx) # sched: [34:17.00] ; ATOM-NEXT: fidivrl (%eax) # sched: [34:17.00] ; ATOM-NEXT: #NO_APP @@ -1936,8 +1936,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fdivrp %st(1) # sched: [19:17.00] -; SLM-NEXT: fdivrp %st(2) # sched: [19:17.00] +; SLM-NEXT: fdivrp %st, %st(1) # sched: [19:17.00] +; SLM-NEXT: fdivrp %st, %st(2) # sched: [19:17.00] ; SLM-NEXT: fidivrs (%ecx) # sched: [22:17.00] ; SLM-NEXT: fidivrl (%eax) # sched: [22:17.00] ; SLM-NEXT: #NO_APP @@ -1948,8 +1948,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fdivrp %st(1) # sched: [14:14.00] -; SANDY-NEXT: fdivrp %st(2) # sched: [14:14.00] +; SANDY-NEXT: fdivrp %st, %st(1) # sched: [14:14.00] +; SANDY-NEXT: fdivrp %st, %st(2) # sched: [14:14.00] ; SANDY-NEXT: fidivrs (%ecx) # sched: [34:1.00] ; SANDY-NEXT: fidivrl (%eax) # sched: [34:1.00] ; SANDY-NEXT: #NO_APP @@ -1960,8 +1960,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fdivrp %st(1) # sched: [20:1.00] -; HASWELL-NEXT: fdivrp %st(2) # sched: [20:1.00] +; HASWELL-NEXT: fdivrp %st, %st(1) # sched: [20:1.00] +; HASWELL-NEXT: fdivrp %st, %st(2) # sched: [20:1.00] ; HASWELL-NEXT: fidivrs (%ecx) # sched: [30:1.00] ; HASWELL-NEXT: fidivrl (%eax) # sched: [30:1.00] ; HASWELL-NEXT: #NO_APP @@ -1972,8 +1972,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fdivrp %st(1) # sched: [20:1.00] -; BROADWELL-NEXT: fdivrp %st(2) # sched: [20:1.00] +; BROADWELL-NEXT: fdivrp %st, %st(1) # sched: [20:1.00] +; BROADWELL-NEXT: fdivrp %st, %st(2) # sched: [20:1.00] ; BROADWELL-NEXT: fidivrs (%ecx) # sched: [29:1.00] ; BROADWELL-NEXT: fidivrl (%eax) # sched: [29:1.00] ; BROADWELL-NEXT: #NO_APP @@ -1984,8 +1984,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fdivrp %st(1) # sched: [20:1.00] -; SKYLAKE-NEXT: fdivrp %st(2) # sched: [20:1.00] +; SKYLAKE-NEXT: fdivrp %st, %st(1) # sched: [20:1.00] +; SKYLAKE-NEXT: fdivrp %st, %st(2) # sched: [20:1.00] ; SKYLAKE-NEXT: fidivrs (%ecx) # sched: [30:1.00] ; SKYLAKE-NEXT: fidivrl (%eax) # sched: [30:1.00] ; SKYLAKE-NEXT: #NO_APP @@ -1996,8 +1996,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fdivrp %st(1) # sched: [20:1.00] -; SKX-NEXT: fdivrp %st(2) # sched: [20:1.00] +; SKX-NEXT: fdivrp %st, %st(1) # sched: [20:1.00] +; SKX-NEXT: fdivrp %st, %st(2) # sched: [20:1.00] ; SKX-NEXT: fidivrs (%ecx) # sched: [30:1.00] ; SKX-NEXT: fidivrl (%eax) # sched: [30:1.00] ; SKX-NEXT: #NO_APP @@ -2008,8 +2008,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fdivrp %st(1) # sched: [9:9.50] -; BDVER2-NEXT: fdivrp %st(2) # sched: [9:9.50] +; BDVER2-NEXT: fdivrp %st, %st(1) # sched: [9:9.50] +; BDVER2-NEXT: fdivrp %st, %st(2) # sched: [9:9.50] ; BDVER2-NEXT: fidivrs (%ecx) # sched: [14:9.50] ; BDVER2-NEXT: fidivrl (%eax) # sched: [14:9.50] ; BDVER2-NEXT: #NO_APP @@ -2020,8 +2020,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fdivrp %st(1) # sched: [19:19.00] -; BTVER2-NEXT: fdivrp %st(2) # sched: [19:19.00] +; BTVER2-NEXT: fdivrp %st, %st(1) # sched: [19:19.00] +; BTVER2-NEXT: fdivrp %st, %st(2) # sched: [19:19.00] ; BTVER2-NEXT: fidivrs (%ecx) # sched: [24:19.00] ; BTVER2-NEXT: fidivrl (%eax) # sched: [24:19.00] ; BTVER2-NEXT: #NO_APP @@ -2032,8 +2032,8 @@ define void @test_fdivrp_fidivr(i16 *%a0, i32 *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fdivrp %st(1) # sched: [15:1.00] -; ZNVER1-NEXT: fdivrp %st(2) # sched: [15:1.00] +; ZNVER1-NEXT: fdivrp %st, %st(1) # sched: [15:1.00] +; ZNVER1-NEXT: fdivrp %st, %st(2) # sched: [15:1.00] ; ZNVER1-NEXT: fidivrs (%ecx) # sched: [22:1.00] ; ZNVER1-NEXT: fidivrl (%eax) # sched: [22:1.00] ; ZNVER1-NEXT: #NO_APP @@ -3243,8 +3243,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fmul %st(0), %st(1) -; GENERIC-NEXT: fmul %st(2) +; GENERIC-NEXT: fmul %st, %st(1) +; GENERIC-NEXT: fmul %st(2), %st ; GENERIC-NEXT: fmuls (%ecx) ; GENERIC-NEXT: fmull (%eax) ; GENERIC-NEXT: #NO_APP @@ -3255,8 +3255,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fmul %st(0), %st(1) # sched: [4:4.00] -; ATOM-NEXT: fmul %st(2) # sched: [4:4.00] +; ATOM-NEXT: fmul %st, %st(1) # sched: [4:4.00] +; ATOM-NEXT: fmul %st(2), %st # sched: [4:4.00] ; ATOM-NEXT: fmuls (%ecx) # sched: [4:4.00] ; ATOM-NEXT: fmull (%eax) # sched: [4:4.00] ; ATOM-NEXT: #NO_APP @@ -3267,8 +3267,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fmul %st(0), %st(1) # sched: [5:2.00] -; SLM-NEXT: fmul %st(2) # sched: [5:2.00] +; SLM-NEXT: fmul %st, %st(1) # sched: [5:2.00] +; SLM-NEXT: fmul %st(2), %st # sched: [5:2.00] ; SLM-NEXT: fmuls (%ecx) # sched: [8:2.00] ; SLM-NEXT: fmull (%eax) # sched: [8:2.00] ; SLM-NEXT: #NO_APP @@ -3279,8 +3279,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fmul %st(0), %st(1) # sched: [5:1.00] -; SANDY-NEXT: fmul %st(2) # sched: [5:1.00] +; SANDY-NEXT: fmul %st, %st(1) # sched: [5:1.00] +; SANDY-NEXT: fmul %st(2), %st # sched: [5:1.00] ; SANDY-NEXT: fmuls (%ecx) # sched: [12:1.00] ; SANDY-NEXT: fmull (%eax) # sched: [12:1.00] ; SANDY-NEXT: #NO_APP @@ -3291,8 +3291,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fmul %st(0), %st(1) # sched: [5:1.00] -; HASWELL-NEXT: fmul %st(2) # sched: [5:1.00] +; HASWELL-NEXT: fmul %st, %st(1) # sched: [5:1.00] +; HASWELL-NEXT: fmul %st(2), %st # sched: [5:1.00] ; HASWELL-NEXT: fmuls (%ecx) # sched: [12:1.00] ; HASWELL-NEXT: fmull (%eax) # sched: [12:1.00] ; HASWELL-NEXT: #NO_APP @@ -3303,8 +3303,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fmul %st(0), %st(1) # sched: [5:1.00] -; BROADWELL-NEXT: fmul %st(2) # sched: [5:1.00] +; BROADWELL-NEXT: fmul %st, %st(1) # sched: [5:1.00] +; BROADWELL-NEXT: fmul %st(2), %st # sched: [5:1.00] ; BROADWELL-NEXT: fmuls (%ecx) # sched: [11:1.00] ; BROADWELL-NEXT: fmull (%eax) # sched: [11:1.00] ; BROADWELL-NEXT: #NO_APP @@ -3315,8 +3315,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fmul %st(0), %st(1) # sched: [4:1.00] -; SKYLAKE-NEXT: fmul %st(2) # sched: [4:1.00] +; SKYLAKE-NEXT: fmul %st, %st(1) # sched: [4:1.00] +; SKYLAKE-NEXT: fmul %st(2), %st # sched: [4:1.00] ; SKYLAKE-NEXT: fmuls (%ecx) # sched: [11:1.00] ; SKYLAKE-NEXT: fmull (%eax) # sched: [11:1.00] ; SKYLAKE-NEXT: #NO_APP @@ -3327,8 +3327,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fmul %st(0), %st(1) # sched: [4:1.00] -; SKX-NEXT: fmul %st(2) # sched: [4:1.00] +; SKX-NEXT: fmul %st, %st(1) # sched: [4:1.00] +; SKX-NEXT: fmul %st(2), %st # sched: [4:1.00] ; SKX-NEXT: fmuls (%ecx) # sched: [11:1.00] ; SKX-NEXT: fmull (%eax) # sched: [11:1.00] ; SKX-NEXT: #NO_APP @@ -3339,8 +3339,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fmul %st(0), %st(1) # sched: [5:1.00] -; BDVER2-NEXT: fmul %st(2) # sched: [5:1.00] +; BDVER2-NEXT: fmul %st, %st(1) # sched: [5:1.00] +; BDVER2-NEXT: fmul %st(2), %st # sched: [5:1.00] ; BDVER2-NEXT: fmuls (%ecx) # sched: [10:1.00] ; BDVER2-NEXT: fmull (%eax) # sched: [10:1.00] ; BDVER2-NEXT: #NO_APP @@ -3351,8 +3351,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fmul %st(0), %st(1) # sched: [2:1.00] -; BTVER2-NEXT: fmul %st(2) # sched: [2:1.00] +; BTVER2-NEXT: fmul %st, %st(1) # sched: [2:1.00] +; BTVER2-NEXT: fmul %st(2), %st # sched: [2:1.00] ; BTVER2-NEXT: fmuls (%ecx) # sched: [7:1.00] ; BTVER2-NEXT: fmull (%eax) # sched: [7:1.00] ; BTVER2-NEXT: #NO_APP @@ -3363,8 +3363,8 @@ define void @test_fmul(float *%a0, double *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fmul %st(0), %st(1) # sched: [3:0.50] -; ZNVER1-NEXT: fmul %st(2) # sched: [3:0.50] +; ZNVER1-NEXT: fmul %st, %st(1) # sched: [3:0.50] +; ZNVER1-NEXT: fmul %st(2), %st # sched: [3:0.50] ; ZNVER1-NEXT: fmuls (%ecx) # sched: [10:0.50] ; ZNVER1-NEXT: fmull (%eax) # sched: [10:0.50] ; ZNVER1-NEXT: #NO_APP @@ -3379,8 +3379,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fmulp %st(1) -; GENERIC-NEXT: fmulp %st(2) +; GENERIC-NEXT: fmulp %st, %st(1) +; GENERIC-NEXT: fmulp %st, %st(2) ; GENERIC-NEXT: fimuls (%ecx) ; GENERIC-NEXT: fimull (%eax) ; GENERIC-NEXT: #NO_APP @@ -3391,8 +3391,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fmulp %st(1) # sched: [4:4.00] -; ATOM-NEXT: fmulp %st(2) # sched: [4:4.00] +; ATOM-NEXT: fmulp %st, %st(1) # sched: [4:4.00] +; ATOM-NEXT: fmulp %st, %st(2) # sched: [4:4.00] ; ATOM-NEXT: fimuls (%ecx) # sched: [4:4.00] ; ATOM-NEXT: fimull (%eax) # sched: [4:4.00] ; ATOM-NEXT: #NO_APP @@ -3403,8 +3403,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fmulp %st(1) # sched: [5:2.00] -; SLM-NEXT: fmulp %st(2) # sched: [5:2.00] +; SLM-NEXT: fmulp %st, %st(1) # sched: [5:2.00] +; SLM-NEXT: fmulp %st, %st(2) # sched: [5:2.00] ; SLM-NEXT: fimuls (%ecx) # sched: [8:2.00] ; SLM-NEXT: fimull (%eax) # sched: [8:2.00] ; SLM-NEXT: #NO_APP @@ -3415,8 +3415,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fmulp %st(1) # sched: [5:1.00] -; SANDY-NEXT: fmulp %st(2) # sched: [5:1.00] +; SANDY-NEXT: fmulp %st, %st(1) # sched: [5:1.00] +; SANDY-NEXT: fmulp %st, %st(2) # sched: [5:1.00] ; SANDY-NEXT: fimuls (%ecx) # sched: [15:1.00] ; SANDY-NEXT: fimull (%eax) # sched: [15:1.00] ; SANDY-NEXT: #NO_APP @@ -3427,8 +3427,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fmulp %st(1) # sched: [5:1.00] -; HASWELL-NEXT: fmulp %st(2) # sched: [5:1.00] +; HASWELL-NEXT: fmulp %st, %st(1) # sched: [5:1.00] +; HASWELL-NEXT: fmulp %st, %st(2) # sched: [5:1.00] ; HASWELL-NEXT: fimuls (%ecx) # sched: [15:1.00] ; HASWELL-NEXT: fimull (%eax) # sched: [15:1.00] ; HASWELL-NEXT: #NO_APP @@ -3439,8 +3439,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fmulp %st(1) # sched: [5:1.00] -; BROADWELL-NEXT: fmulp %st(2) # sched: [5:1.00] +; BROADWELL-NEXT: fmulp %st, %st(1) # sched: [5:1.00] +; BROADWELL-NEXT: fmulp %st, %st(2) # sched: [5:1.00] ; BROADWELL-NEXT: fimuls (%ecx) # sched: [14:1.00] ; BROADWELL-NEXT: fimull (%eax) # sched: [14:1.00] ; BROADWELL-NEXT: #NO_APP @@ -3451,8 +3451,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fmulp %st(1) # sched: [4:1.00] -; SKYLAKE-NEXT: fmulp %st(2) # sched: [4:1.00] +; SKYLAKE-NEXT: fmulp %st, %st(1) # sched: [4:1.00] +; SKYLAKE-NEXT: fmulp %st, %st(2) # sched: [4:1.00] ; SKYLAKE-NEXT: fimuls (%ecx) # sched: [14:1.00] ; SKYLAKE-NEXT: fimull (%eax) # sched: [14:1.00] ; SKYLAKE-NEXT: #NO_APP @@ -3463,8 +3463,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fmulp %st(1) # sched: [4:1.00] -; SKX-NEXT: fmulp %st(2) # sched: [4:1.00] +; SKX-NEXT: fmulp %st, %st(1) # sched: [4:1.00] +; SKX-NEXT: fmulp %st, %st(2) # sched: [4:1.00] ; SKX-NEXT: fimuls (%ecx) # sched: [14:1.00] ; SKX-NEXT: fimull (%eax) # sched: [14:1.00] ; SKX-NEXT: #NO_APP @@ -3475,8 +3475,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fmulp %st(1) # sched: [5:1.00] -; BDVER2-NEXT: fmulp %st(2) # sched: [5:1.00] +; BDVER2-NEXT: fmulp %st, %st(1) # sched: [5:1.00] +; BDVER2-NEXT: fmulp %st, %st(2) # sched: [5:1.00] ; BDVER2-NEXT: fimuls (%ecx) # sched: [10:1.00] ; BDVER2-NEXT: fimull (%eax) # sched: [10:1.00] ; BDVER2-NEXT: #NO_APP @@ -3487,8 +3487,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fmulp %st(1) # sched: [2:1.00] -; BTVER2-NEXT: fmulp %st(2) # sched: [2:1.00] +; BTVER2-NEXT: fmulp %st, %st(1) # sched: [2:1.00] +; BTVER2-NEXT: fmulp %st, %st(2) # sched: [2:1.00] ; BTVER2-NEXT: fimuls (%ecx) # sched: [7:1.00] ; BTVER2-NEXT: fimull (%eax) # sched: [7:1.00] ; BTVER2-NEXT: #NO_APP @@ -3499,8 +3499,8 @@ define void @test_fmulp_fimul(i16 *%a0, i32 *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fmulp %st(1) # sched: [3:0.50] -; ZNVER1-NEXT: fmulp %st(2) # sched: [3:0.50] +; ZNVER1-NEXT: fmulp %st, %st(1) # sched: [3:0.50] +; ZNVER1-NEXT: fmulp %st, %st(2) # sched: [3:0.50] ; ZNVER1-NEXT: fimuls (%ecx) # sched: [10:0.50] ; ZNVER1-NEXT: fimull (%eax) # sched: [10:0.50] ; ZNVER1-NEXT: #NO_APP @@ -4983,8 +4983,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fsub %st(0), %st(1) -; GENERIC-NEXT: fsub %st(2) +; GENERIC-NEXT: fsub %st, %st(1) +; GENERIC-NEXT: fsub %st(2), %st ; GENERIC-NEXT: fsubs (%ecx) ; GENERIC-NEXT: fsubl (%eax) ; GENERIC-NEXT: #NO_APP @@ -4995,8 +4995,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fsub %st(0), %st(1) # sched: [5:5.00] -; ATOM-NEXT: fsub %st(2) # sched: [5:5.00] +; ATOM-NEXT: fsub %st, %st(1) # sched: [5:5.00] +; ATOM-NEXT: fsub %st(2), %st # sched: [5:5.00] ; ATOM-NEXT: fsubs (%ecx) # sched: [5:5.00] ; ATOM-NEXT: fsubl (%eax) # sched: [5:5.00] ; ATOM-NEXT: #NO_APP @@ -5007,8 +5007,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fsub %st(0), %st(1) # sched: [3:1.00] -; SLM-NEXT: fsub %st(2) # sched: [3:1.00] +; SLM-NEXT: fsub %st, %st(1) # sched: [3:1.00] +; SLM-NEXT: fsub %st(2), %st # sched: [3:1.00] ; SLM-NEXT: fsubs (%ecx) # sched: [6:1.00] ; SLM-NEXT: fsubl (%eax) # sched: [6:1.00] ; SLM-NEXT: #NO_APP @@ -5019,8 +5019,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fsub %st(0), %st(1) # sched: [3:1.00] -; SANDY-NEXT: fsub %st(2) # sched: [3:1.00] +; SANDY-NEXT: fsub %st, %st(1) # sched: [3:1.00] +; SANDY-NEXT: fsub %st(2), %st # sched: [3:1.00] ; SANDY-NEXT: fsubs (%ecx) # sched: [10:1.00] ; SANDY-NEXT: fsubl (%eax) # sched: [10:1.00] ; SANDY-NEXT: #NO_APP @@ -5031,8 +5031,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fsub %st(0), %st(1) # sched: [3:1.00] -; HASWELL-NEXT: fsub %st(2) # sched: [3:1.00] +; HASWELL-NEXT: fsub %st, %st(1) # sched: [3:1.00] +; HASWELL-NEXT: fsub %st(2), %st # sched: [3:1.00] ; HASWELL-NEXT: fsubs (%ecx) # sched: [10:1.00] ; HASWELL-NEXT: fsubl (%eax) # sched: [10:1.00] ; HASWELL-NEXT: #NO_APP @@ -5043,8 +5043,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fsub %st(0), %st(1) # sched: [3:1.00] -; BROADWELL-NEXT: fsub %st(2) # sched: [3:1.00] +; BROADWELL-NEXT: fsub %st, %st(1) # sched: [3:1.00] +; BROADWELL-NEXT: fsub %st(2), %st # sched: [3:1.00] ; BROADWELL-NEXT: fsubs (%ecx) # sched: [9:1.00] ; BROADWELL-NEXT: fsubl (%eax) # sched: [9:1.00] ; BROADWELL-NEXT: #NO_APP @@ -5055,8 +5055,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fsub %st(0), %st(1) # sched: [3:1.00] -; SKYLAKE-NEXT: fsub %st(2) # sched: [3:1.00] +; SKYLAKE-NEXT: fsub %st, %st(1) # sched: [3:1.00] +; SKYLAKE-NEXT: fsub %st(2), %st # sched: [3:1.00] ; SKYLAKE-NEXT: fsubs (%ecx) # sched: [10:1.00] ; SKYLAKE-NEXT: fsubl (%eax) # sched: [10:1.00] ; SKYLAKE-NEXT: #NO_APP @@ -5067,8 +5067,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fsub %st(0), %st(1) # sched: [3:1.00] -; SKX-NEXT: fsub %st(2) # sched: [3:1.00] +; SKX-NEXT: fsub %st, %st(1) # sched: [3:1.00] +; SKX-NEXT: fsub %st(2), %st # sched: [3:1.00] ; SKX-NEXT: fsubs (%ecx) # sched: [10:1.00] ; SKX-NEXT: fsubl (%eax) # sched: [10:1.00] ; SKX-NEXT: #NO_APP @@ -5079,8 +5079,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fsub %st(0), %st(1) # sched: [5:1.00] -; BDVER2-NEXT: fsub %st(2) # sched: [5:1.00] +; BDVER2-NEXT: fsub %st, %st(1) # sched: [5:1.00] +; BDVER2-NEXT: fsub %st(2), %st # sched: [5:1.00] ; BDVER2-NEXT: fsubs (%ecx) # sched: [10:1.00] ; BDVER2-NEXT: fsubl (%eax) # sched: [10:1.00] ; BDVER2-NEXT: #NO_APP @@ -5091,8 +5091,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fsub %st(0), %st(1) # sched: [3:1.00] -; BTVER2-NEXT: fsub %st(2) # sched: [3:1.00] +; BTVER2-NEXT: fsub %st, %st(1) # sched: [3:1.00] +; BTVER2-NEXT: fsub %st(2), %st # sched: [3:1.00] ; BTVER2-NEXT: fsubs (%ecx) # sched: [8:1.00] ; BTVER2-NEXT: fsubl (%eax) # sched: [8:1.00] ; BTVER2-NEXT: #NO_APP @@ -5103,8 +5103,8 @@ define void @test_fsub(float *%a0, double *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fsub %st(0), %st(1) # sched: [3:1.00] -; ZNVER1-NEXT: fsub %st(2) # sched: [3:1.00] +; ZNVER1-NEXT: fsub %st, %st(1) # sched: [3:1.00] +; ZNVER1-NEXT: fsub %st(2), %st # sched: [3:1.00] ; ZNVER1-NEXT: fsubs (%ecx) # sched: [10:1.00] ; ZNVER1-NEXT: fsubl (%eax) # sched: [10:1.00] ; ZNVER1-NEXT: #NO_APP @@ -5119,8 +5119,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fsubp %st(1) -; GENERIC-NEXT: fsubp %st(2) +; GENERIC-NEXT: fsubp %st, %st(1) +; GENERIC-NEXT: fsubp %st, %st(2) ; GENERIC-NEXT: fisubs (%ecx) ; GENERIC-NEXT: fisubl (%eax) ; GENERIC-NEXT: #NO_APP @@ -5131,8 +5131,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fsubp %st(1) # sched: [5:5.00] -; ATOM-NEXT: fsubp %st(2) # sched: [5:5.00] +; ATOM-NEXT: fsubp %st, %st(1) # sched: [5:5.00] +; ATOM-NEXT: fsubp %st, %st(2) # sched: [5:5.00] ; ATOM-NEXT: fisubs (%ecx) # sched: [5:5.00] ; ATOM-NEXT: fisubl (%eax) # sched: [5:5.00] ; ATOM-NEXT: #NO_APP @@ -5143,8 +5143,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fsubp %st(1) # sched: [3:1.00] -; SLM-NEXT: fsubp %st(2) # sched: [3:1.00] +; SLM-NEXT: fsubp %st, %st(1) # sched: [3:1.00] +; SLM-NEXT: fsubp %st, %st(2) # sched: [3:1.00] ; SLM-NEXT: fisubs (%ecx) # sched: [6:1.00] ; SLM-NEXT: fisubl (%eax) # sched: [6:1.00] ; SLM-NEXT: #NO_APP @@ -5155,8 +5155,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fsubp %st(1) # sched: [3:1.00] -; SANDY-NEXT: fsubp %st(2) # sched: [3:1.00] +; SANDY-NEXT: fsubp %st, %st(1) # sched: [3:1.00] +; SANDY-NEXT: fsubp %st, %st(2) # sched: [3:1.00] ; SANDY-NEXT: fisubs (%ecx) # sched: [13:2.00] ; SANDY-NEXT: fisubl (%eax) # sched: [13:2.00] ; SANDY-NEXT: #NO_APP @@ -5167,8 +5167,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fsubp %st(1) # sched: [3:1.00] -; HASWELL-NEXT: fsubp %st(2) # sched: [3:1.00] +; HASWELL-NEXT: fsubp %st, %st(1) # sched: [3:1.00] +; HASWELL-NEXT: fsubp %st, %st(2) # sched: [3:1.00] ; HASWELL-NEXT: fisubs (%ecx) # sched: [13:2.00] ; HASWELL-NEXT: fisubl (%eax) # sched: [13:2.00] ; HASWELL-NEXT: #NO_APP @@ -5179,8 +5179,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fsubp %st(1) # sched: [3:1.00] -; BROADWELL-NEXT: fsubp %st(2) # sched: [3:1.00] +; BROADWELL-NEXT: fsubp %st, %st(1) # sched: [3:1.00] +; BROADWELL-NEXT: fsubp %st, %st(2) # sched: [3:1.00] ; BROADWELL-NEXT: fisubs (%ecx) # sched: [12:2.00] ; BROADWELL-NEXT: fisubl (%eax) # sched: [12:2.00] ; BROADWELL-NEXT: #NO_APP @@ -5191,8 +5191,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fsubp %st(1) # sched: [3:1.00] -; SKYLAKE-NEXT: fsubp %st(2) # sched: [3:1.00] +; SKYLAKE-NEXT: fsubp %st, %st(1) # sched: [3:1.00] +; SKYLAKE-NEXT: fsubp %st, %st(2) # sched: [3:1.00] ; SKYLAKE-NEXT: fisubs (%ecx) # sched: [13:2.00] ; SKYLAKE-NEXT: fisubl (%eax) # sched: [13:2.00] ; SKYLAKE-NEXT: #NO_APP @@ -5203,8 +5203,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fsubp %st(1) # sched: [3:1.00] -; SKX-NEXT: fsubp %st(2) # sched: [3:1.00] +; SKX-NEXT: fsubp %st, %st(1) # sched: [3:1.00] +; SKX-NEXT: fsubp %st, %st(2) # sched: [3:1.00] ; SKX-NEXT: fisubs (%ecx) # sched: [13:2.00] ; SKX-NEXT: fisubl (%eax) # sched: [13:2.00] ; SKX-NEXT: #NO_APP @@ -5215,8 +5215,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fsubp %st(1) # sched: [5:1.00] -; BDVER2-NEXT: fsubp %st(2) # sched: [5:1.00] +; BDVER2-NEXT: fsubp %st, %st(1) # sched: [5:1.00] +; BDVER2-NEXT: fsubp %st, %st(2) # sched: [5:1.00] ; BDVER2-NEXT: fisubs (%ecx) # sched: [10:1.00] ; BDVER2-NEXT: fisubl (%eax) # sched: [10:1.00] ; BDVER2-NEXT: #NO_APP @@ -5227,8 +5227,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fsubp %st(1) # sched: [3:1.00] -; BTVER2-NEXT: fsubp %st(2) # sched: [3:1.00] +; BTVER2-NEXT: fsubp %st, %st(1) # sched: [3:1.00] +; BTVER2-NEXT: fsubp %st, %st(2) # sched: [3:1.00] ; BTVER2-NEXT: fisubs (%ecx) # sched: [8:1.00] ; BTVER2-NEXT: fisubl (%eax) # sched: [8:1.00] ; BTVER2-NEXT: #NO_APP @@ -5239,8 +5239,8 @@ define void @test_fsubp_fisub(i16 *%a0, i32 *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fsubp %st(1) # sched: [3:1.00] -; ZNVER1-NEXT: fsubp %st(2) # sched: [3:1.00] +; ZNVER1-NEXT: fsubp %st, %st(1) # sched: [3:1.00] +; ZNVER1-NEXT: fsubp %st, %st(2) # sched: [3:1.00] ; ZNVER1-NEXT: fisubs (%ecx) # sched: [10:1.00] ; ZNVER1-NEXT: fisubl (%eax) # sched: [10:1.00] ; ZNVER1-NEXT: #NO_APP @@ -5255,8 +5255,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fsubr %st(0), %st(1) -; GENERIC-NEXT: fsubr %st(2) +; GENERIC-NEXT: fsubr %st, %st(1) +; GENERIC-NEXT: fsubr %st(2), %st ; GENERIC-NEXT: fsubrs (%ecx) ; GENERIC-NEXT: fsubrl (%eax) ; GENERIC-NEXT: #NO_APP @@ -5267,8 +5267,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fsubr %st(0), %st(1) # sched: [5:5.00] -; ATOM-NEXT: fsubr %st(2) # sched: [5:5.00] +; ATOM-NEXT: fsubr %st, %st(1) # sched: [5:5.00] +; ATOM-NEXT: fsubr %st(2), %st # sched: [5:5.00] ; ATOM-NEXT: fsubrs (%ecx) # sched: [5:5.00] ; ATOM-NEXT: fsubrl (%eax) # sched: [5:5.00] ; ATOM-NEXT: #NO_APP @@ -5279,8 +5279,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fsubr %st(0), %st(1) # sched: [3:1.00] -; SLM-NEXT: fsubr %st(2) # sched: [3:1.00] +; SLM-NEXT: fsubr %st, %st(1) # sched: [3:1.00] +; SLM-NEXT: fsubr %st(2), %st # sched: [3:1.00] ; SLM-NEXT: fsubrs (%ecx) # sched: [6:1.00] ; SLM-NEXT: fsubrl (%eax) # sched: [6:1.00] ; SLM-NEXT: #NO_APP @@ -5291,8 +5291,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fsubr %st(0), %st(1) # sched: [3:1.00] -; SANDY-NEXT: fsubr %st(2) # sched: [3:1.00] +; SANDY-NEXT: fsubr %st, %st(1) # sched: [3:1.00] +; SANDY-NEXT: fsubr %st(2), %st # sched: [3:1.00] ; SANDY-NEXT: fsubrs (%ecx) # sched: [10:1.00] ; SANDY-NEXT: fsubrl (%eax) # sched: [10:1.00] ; SANDY-NEXT: #NO_APP @@ -5303,8 +5303,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fsubr %st(0), %st(1) # sched: [3:1.00] -; HASWELL-NEXT: fsubr %st(2) # sched: [3:1.00] +; HASWELL-NEXT: fsubr %st, %st(1) # sched: [3:1.00] +; HASWELL-NEXT: fsubr %st(2), %st # sched: [3:1.00] ; HASWELL-NEXT: fsubrs (%ecx) # sched: [10:1.00] ; HASWELL-NEXT: fsubrl (%eax) # sched: [10:1.00] ; HASWELL-NEXT: #NO_APP @@ -5315,8 +5315,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fsubr %st(0), %st(1) # sched: [3:1.00] -; BROADWELL-NEXT: fsubr %st(2) # sched: [3:1.00] +; BROADWELL-NEXT: fsubr %st, %st(1) # sched: [3:1.00] +; BROADWELL-NEXT: fsubr %st(2), %st # sched: [3:1.00] ; BROADWELL-NEXT: fsubrs (%ecx) # sched: [9:1.00] ; BROADWELL-NEXT: fsubrl (%eax) # sched: [9:1.00] ; BROADWELL-NEXT: #NO_APP @@ -5327,8 +5327,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fsubr %st(0), %st(1) # sched: [3:1.00] -; SKYLAKE-NEXT: fsubr %st(2) # sched: [3:1.00] +; SKYLAKE-NEXT: fsubr %st, %st(1) # sched: [3:1.00] +; SKYLAKE-NEXT: fsubr %st(2), %st # sched: [3:1.00] ; SKYLAKE-NEXT: fsubrs (%ecx) # sched: [10:1.00] ; SKYLAKE-NEXT: fsubrl (%eax) # sched: [10:1.00] ; SKYLAKE-NEXT: #NO_APP @@ -5339,8 +5339,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fsubr %st(0), %st(1) # sched: [3:1.00] -; SKX-NEXT: fsubr %st(2) # sched: [3:1.00] +; SKX-NEXT: fsubr %st, %st(1) # sched: [3:1.00] +; SKX-NEXT: fsubr %st(2), %st # sched: [3:1.00] ; SKX-NEXT: fsubrs (%ecx) # sched: [10:1.00] ; SKX-NEXT: fsubrl (%eax) # sched: [10:1.00] ; SKX-NEXT: #NO_APP @@ -5351,8 +5351,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fsubr %st(0), %st(1) # sched: [5:1.00] -; BDVER2-NEXT: fsubr %st(2) # sched: [5:1.00] +; BDVER2-NEXT: fsubr %st, %st(1) # sched: [5:1.00] +; BDVER2-NEXT: fsubr %st(2), %st # sched: [5:1.00] ; BDVER2-NEXT: fsubrs (%ecx) # sched: [10:1.00] ; BDVER2-NEXT: fsubrl (%eax) # sched: [10:1.00] ; BDVER2-NEXT: #NO_APP @@ -5363,8 +5363,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fsubr %st(0), %st(1) # sched: [3:1.00] -; BTVER2-NEXT: fsubr %st(2) # sched: [3:1.00] +; BTVER2-NEXT: fsubr %st, %st(1) # sched: [3:1.00] +; BTVER2-NEXT: fsubr %st(2), %st # sched: [3:1.00] ; BTVER2-NEXT: fsubrs (%ecx) # sched: [8:1.00] ; BTVER2-NEXT: fsubrl (%eax) # sched: [8:1.00] ; BTVER2-NEXT: #NO_APP @@ -5375,8 +5375,8 @@ define void @test_fsubr(float *%a0, double *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fsubr %st(0), %st(1) # sched: [3:1.00] -; ZNVER1-NEXT: fsubr %st(2) # sched: [3:1.00] +; ZNVER1-NEXT: fsubr %st, %st(1) # sched: [3:1.00] +; ZNVER1-NEXT: fsubr %st(2), %st # sched: [3:1.00] ; ZNVER1-NEXT: fsubrs (%ecx) # sched: [10:1.00] ; ZNVER1-NEXT: fsubrl (%eax) # sched: [10:1.00] ; ZNVER1-NEXT: #NO_APP @@ -5391,8 +5391,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax ; GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fsubrp %st(1) -; GENERIC-NEXT: fsubrp %st(2) +; GENERIC-NEXT: fsubrp %st, %st(1) +; GENERIC-NEXT: fsubrp %st, %st(2) ; GENERIC-NEXT: fisubrs (%ecx) ; GENERIC-NEXT: fisubrl (%eax) ; GENERIC-NEXT: #NO_APP @@ -5403,8 +5403,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [1:1.00] ; ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [1:1.00] ; ATOM-NEXT: #APP -; ATOM-NEXT: fsubrp %st(1) # sched: [5:5.00] -; ATOM-NEXT: fsubrp %st(2) # sched: [5:5.00] +; ATOM-NEXT: fsubrp %st, %st(1) # sched: [5:5.00] +; ATOM-NEXT: fsubrp %st, %st(2) # sched: [5:5.00] ; ATOM-NEXT: fisubrs (%ecx) # sched: [5:5.00] ; ATOM-NEXT: fisubrl (%eax) # sched: [5:5.00] ; ATOM-NEXT: #NO_APP @@ -5415,8 +5415,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; SLM-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [3:1.00] ; SLM-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [3:1.00] ; SLM-NEXT: #APP -; SLM-NEXT: fsubrp %st(1) # sched: [3:1.00] -; SLM-NEXT: fsubrp %st(2) # sched: [3:1.00] +; SLM-NEXT: fsubrp %st, %st(1) # sched: [3:1.00] +; SLM-NEXT: fsubrp %st, %st(2) # sched: [3:1.00] ; SLM-NEXT: fisubrs (%ecx) # sched: [6:1.00] ; SLM-NEXT: fisubrl (%eax) # sched: [6:1.00] ; SLM-NEXT: #NO_APP @@ -5427,8 +5427,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SANDY-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SANDY-NEXT: #APP -; SANDY-NEXT: fsubrp %st(1) # sched: [3:1.00] -; SANDY-NEXT: fsubrp %st(2) # sched: [3:1.00] +; SANDY-NEXT: fsubrp %st, %st(1) # sched: [3:1.00] +; SANDY-NEXT: fsubrp %st, %st(2) # sched: [3:1.00] ; SANDY-NEXT: fisubrs (%ecx) # sched: [13:2.00] ; SANDY-NEXT: fisubrl (%eax) # sched: [13:2.00] ; SANDY-NEXT: #NO_APP @@ -5439,8 +5439,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; HASWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fsubrp %st(1) # sched: [3:1.00] -; HASWELL-NEXT: fsubrp %st(2) # sched: [3:1.00] +; HASWELL-NEXT: fsubrp %st, %st(1) # sched: [3:1.00] +; HASWELL-NEXT: fsubrp %st, %st(2) # sched: [3:1.00] ; HASWELL-NEXT: fisubrs (%ecx) # sched: [13:2.00] ; HASWELL-NEXT: fisubrl (%eax) # sched: [13:2.00] ; HASWELL-NEXT: #NO_APP @@ -5451,8 +5451,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BROADWELL-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fsubrp %st(1) # sched: [3:1.00] -; BROADWELL-NEXT: fsubrp %st(2) # sched: [3:1.00] +; BROADWELL-NEXT: fsubrp %st, %st(1) # sched: [3:1.00] +; BROADWELL-NEXT: fsubrp %st, %st(2) # sched: [3:1.00] ; BROADWELL-NEXT: fisubrs (%ecx) # sched: [12:2.00] ; BROADWELL-NEXT: fisubrl (%eax) # sched: [12:2.00] ; BROADWELL-NEXT: #NO_APP @@ -5463,8 +5463,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKYLAKE-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fsubrp %st(1) # sched: [3:1.00] -; SKYLAKE-NEXT: fsubrp %st(2) # sched: [3:1.00] +; SKYLAKE-NEXT: fsubrp %st, %st(1) # sched: [3:1.00] +; SKYLAKE-NEXT: fsubrp %st, %st(2) # sched: [3:1.00] ; SKYLAKE-NEXT: fisubrs (%ecx) # sched: [13:2.00] ; SKYLAKE-NEXT: fisubrl (%eax) # sched: [13:2.00] ; SKYLAKE-NEXT: #NO_APP @@ -5475,8 +5475,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; SKX-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; SKX-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; SKX-NEXT: #APP -; SKX-NEXT: fsubrp %st(1) # sched: [3:1.00] -; SKX-NEXT: fsubrp %st(2) # sched: [3:1.00] +; SKX-NEXT: fsubrp %st, %st(1) # sched: [3:1.00] +; SKX-NEXT: fsubrp %st, %st(2) # sched: [3:1.00] ; SKX-NEXT: fisubrs (%ecx) # sched: [13:2.00] ; SKX-NEXT: fisubrl (%eax) # sched: [13:2.00] ; SKX-NEXT: #NO_APP @@ -5487,8 +5487,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:0.50] ; BDVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:0.50] ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fsubrp %st(1) # sched: [5:1.00] -; BDVER2-NEXT: fsubrp %st(2) # sched: [5:1.00] +; BDVER2-NEXT: fsubrp %st, %st(1) # sched: [5:1.00] +; BDVER2-NEXT: fsubrp %st, %st(2) # sched: [5:1.00] ; BDVER2-NEXT: fisubrs (%ecx) # sched: [10:1.00] ; BDVER2-NEXT: fisubrl (%eax) # sched: [10:1.00] ; BDVER2-NEXT: #NO_APP @@ -5499,8 +5499,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [5:1.00] ; BTVER2-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [5:1.00] ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fsubrp %st(1) # sched: [3:1.00] -; BTVER2-NEXT: fsubrp %st(2) # sched: [3:1.00] +; BTVER2-NEXT: fsubrp %st, %st(1) # sched: [3:1.00] +; BTVER2-NEXT: fsubrp %st, %st(2) # sched: [3:1.00] ; BTVER2-NEXT: fisubrs (%ecx) # sched: [8:1.00] ; BTVER2-NEXT: fisubrl (%eax) # sched: [8:1.00] ; BTVER2-NEXT: #NO_APP @@ -5511,8 +5511,8 @@ define void @test_fsubrp_fisubr(i16 *%a0, i32 *%a1) optsize { ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %eax # sched: [8:0.50] ; ZNVER1-NEXT: movl {{[0-9]+}}(%esp), %ecx # sched: [8:0.50] ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fsubrp %st(1) # sched: [3:1.00] -; ZNVER1-NEXT: fsubrp %st(2) # sched: [3:1.00] +; ZNVER1-NEXT: fsubrp %st, %st(1) # sched: [3:1.00] +; ZNVER1-NEXT: fsubrp %st, %st(2) # sched: [3:1.00] ; ZNVER1-NEXT: fisubrs (%ecx) # sched: [10:1.00] ; ZNVER1-NEXT: fisubrl (%eax) # sched: [10:1.00] ; ZNVER1-NEXT: #NO_APP @@ -5731,88 +5731,88 @@ define void @test_fucomi_fucomip() optsize { ; GENERIC-LABEL: test_fucomi_fucomip: ; GENERIC: # %bb.0: ; GENERIC-NEXT: #APP -; GENERIC-NEXT: fucomi %st(3) -; GENERIC-NEXT: fucompi %st(3) +; GENERIC-NEXT: fucomi %st(3), %st +; GENERIC-NEXT: fucompi %st(3), %st ; GENERIC-NEXT: #NO_APP ; GENERIC-NEXT: retl ; ; ATOM-LABEL: test_fucomi_fucomip: ; ATOM: # %bb.0: ; ATOM-NEXT: #APP -; ATOM-NEXT: fucomi %st(3) # sched: [9:4.50] -; ATOM-NEXT: fucompi %st(3) # sched: [9:4.50] +; ATOM-NEXT: fucomi %st(3), %st # sched: [9:4.50] +; ATOM-NEXT: fucompi %st(3), %st # sched: [9:4.50] ; ATOM-NEXT: #NO_APP ; ATOM-NEXT: retl # sched: [79:39.50] ; ; SLM-LABEL: test_fucomi_fucomip: ; SLM: # %bb.0: ; SLM-NEXT: #APP -; SLM-NEXT: fucomi %st(3) # sched: [3:1.00] -; SLM-NEXT: fucompi %st(3) # sched: [3:1.00] +; SLM-NEXT: fucomi %st(3), %st # sched: [3:1.00] +; SLM-NEXT: fucompi %st(3), %st # sched: [3:1.00] ; SLM-NEXT: #NO_APP ; SLM-NEXT: retl # sched: [4:1.00] ; ; SANDY-LABEL: test_fucomi_fucomip: ; SANDY: # %bb.0: ; SANDY-NEXT: #APP -; SANDY-NEXT: fucomi %st(3) # sched: [3:1.00] -; SANDY-NEXT: fucompi %st(3) # sched: [3:1.00] +; SANDY-NEXT: fucomi %st(3), %st # sched: [3:1.00] +; SANDY-NEXT: fucompi %st(3), %st # sched: [3:1.00] ; SANDY-NEXT: #NO_APP ; SANDY-NEXT: retl # sched: [6:1.00] ; ; HASWELL-LABEL: test_fucomi_fucomip: ; HASWELL: # %bb.0: ; HASWELL-NEXT: #APP -; HASWELL-NEXT: fucomi %st(3) # sched: [1:0.50] -; HASWELL-NEXT: fucompi %st(3) # sched: [1:0.50] +; HASWELL-NEXT: fucomi %st(3), %st # sched: [1:0.50] +; HASWELL-NEXT: fucompi %st(3), %st # sched: [1:0.50] ; HASWELL-NEXT: #NO_APP ; HASWELL-NEXT: retl # sched: [7:1.00] ; ; BROADWELL-LABEL: test_fucomi_fucomip: ; BROADWELL: # %bb.0: ; BROADWELL-NEXT: #APP -; BROADWELL-NEXT: fucomi %st(3) # sched: [3:1.00] -; BROADWELL-NEXT: fucompi %st(3) # sched: [3:1.00] +; BROADWELL-NEXT: fucomi %st(3), %st # sched: [3:1.00] +; BROADWELL-NEXT: fucompi %st(3), %st # sched: [3:1.00] ; BROADWELL-NEXT: #NO_APP ; BROADWELL-NEXT: retl # sched: [6:0.50] ; ; SKYLAKE-LABEL: test_fucomi_fucomip: ; SKYLAKE: # %bb.0: ; SKYLAKE-NEXT: #APP -; SKYLAKE-NEXT: fucomi %st(3) # sched: [2:1.00] -; SKYLAKE-NEXT: fucompi %st(3) # sched: [2:1.00] +; SKYLAKE-NEXT: fucomi %st(3), %st # sched: [2:1.00] +; SKYLAKE-NEXT: fucompi %st(3), %st # sched: [2:1.00] ; SKYLAKE-NEXT: #NO_APP ; SKYLAKE-NEXT: retl # sched: [6:0.50] ; ; SKX-LABEL: test_fucomi_fucomip: ; SKX: # %bb.0: ; SKX-NEXT: #APP -; SKX-NEXT: fucomi %st(3) # sched: [2:1.00] -; SKX-NEXT: fucompi %st(3) # sched: [2:1.00] +; SKX-NEXT: fucomi %st(3), %st # sched: [2:1.00] +; SKX-NEXT: fucompi %st(3), %st # sched: [2:1.00] ; SKX-NEXT: #NO_APP ; SKX-NEXT: retl # sched: [6:0.50] ; ; BDVER2-LABEL: test_fucomi_fucomip: ; BDVER2: # %bb.0: ; BDVER2-NEXT: #APP -; BDVER2-NEXT: fucomi %st(3) # sched: [1:1.00] -; BDVER2-NEXT: fucompi %st(3) # sched: [1:1.00] +; BDVER2-NEXT: fucomi %st(3), %st # sched: [1:1.00] +; BDVER2-NEXT: fucompi %st(3), %st # sched: [1:1.00] ; BDVER2-NEXT: #NO_APP ; BDVER2-NEXT: retl # sched: [5:1.00] ; ; BTVER2-LABEL: test_fucomi_fucomip: ; BTVER2: # %bb.0: ; BTVER2-NEXT: #APP -; BTVER2-NEXT: fucomi %st(3) # sched: [3:1.00] -; BTVER2-NEXT: fucompi %st(3) # sched: [3:1.00] +; BTVER2-NEXT: fucomi %st(3), %st # sched: [3:1.00] +; BTVER2-NEXT: fucompi %st(3), %st # sched: [3:1.00] ; BTVER2-NEXT: #NO_APP ; BTVER2-NEXT: retl # sched: [4:1.00] ; ; ZNVER1-LABEL: test_fucomi_fucomip: ; ZNVER1: # %bb.0: ; ZNVER1-NEXT: #APP -; ZNVER1-NEXT: fucomi %st(3) # sched: [9:0.50] -; ZNVER1-NEXT: fucompi %st(3) # sched: [9:0.50] +; ZNVER1-NEXT: fucomi %st(3), %st # sched: [9:0.50] +; ZNVER1-NEXT: fucompi %st(3), %st # sched: [9:0.50] ; ZNVER1-NEXT: #NO_APP ; ZNVER1-NEXT: retl # sched: [1:0.50] tail call void asm sideeffect "fucomi %st(3) \0A\09 fucomip %st(3)", ""() nounwind diff --git a/test/DebugInfo/Mips/eh_frame.ll b/test/DebugInfo/Mips/eh_frame.ll index 4687443cb1cf..122d0a7f6ab2 100644 --- a/test/DebugInfo/Mips/eh_frame.ll +++ b/test/DebugInfo/Mips/eh_frame.ll @@ -1,9 +1,21 @@ -; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips -O3 -filetype=obj -o - %s | llvm-readelf -r | FileCheck %s +; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips -relocation-model=static -O3 -filetype=obj -o - %s | \ +; RUN: llvm-readelf -r | FileCheck %s --check-prefix=CHECK-READELF +; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips -relocation-model=pic -O3 -filetype=obj -o - %s | \ +; RUN: llvm-readelf -r | FileCheck %s --check-prefix=CHECK-READELF +; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips -relocation-model=static -O3 -filetype=obj -o - %s | \ +; RUN: llvm-objdump -s -j .gcc_except_table - | FileCheck %s --check-prefix=CHECK-EXCEPT-TABLE-STATIC +; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips -relocation-model=pic -O3 -filetype=obj -o - %s | \ +; RUN: llvm-objdump -s -j .gcc_except_table - | FileCheck %s --check-prefix=CHECK-EXCEPT-TABLE-PIC -; CHECK: .rel.eh_frame -; CHECK: DW.ref.__gxx_personality_v0 -; CHECK-NEXT: .text -; CHECK-NEXT: .gcc_except_table +; CHECK-READELF: .rel.eh_frame +; CHECK-READELF: DW.ref.__gxx_personality_v0 +; CHECK-READELF-NEXT: .text +; CHECK-READELF-NEXT: .gcc_except_table + +; CHECK-EXCEPT-TABLE-STATIC: 0000 ff9b1501 0c011500 00150e23 01231e00 ...........#.#.. +; CHECK-EXCEPT-TABLE-STATIC: 0010 00010000 00000000 +; CHECK-EXCEPT-TABLE-PIC: 0000 ff9b1501 0c012d00 002d133f 013f2a00 ......-..-.?.?*. +; CHECK-EXCEPT-TABLE-PIC: 0010 00010000 00000000 ........ @_ZTIi = external constant i8* diff --git a/test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll b/test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll new file mode 100644 index 000000000000..d841c6c05c9b --- /dev/null +++ b/test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll @@ -0,0 +1,18 @@ +; MSan converts 2-element global_ctors to 3-element when adding the new entry. +; RUN: opt < %s -msan-with-comdat -S -passes=msan 2>&1 | FileCheck %s +; RUN: opt < %s -msan -msan-with-comdat -S | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK: $msan.module_ctor = comdat any +; CHECK: @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null }, { i32, void ()*, i8* } { i32 0, void ()* @msan.module_ctor, i8* bitcast (void ()* @msan.module_ctor to i8*) }] + +@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @f }] + +define internal void @f() { +entry: + ret void +} + +; CHECK: define internal void @msan.module_ctor() comdat { diff --git a/test/Instrumentation/MemorySanitizer/msan_basic.ll b/test/Instrumentation/MemorySanitizer/msan_basic.ll index f4cbc637ef1a..569c2320c5c9 100644 --- a/test/Instrumentation/MemorySanitizer/msan_basic.ll +++ b/test/Instrumentation/MemorySanitizer/msan_basic.ll @@ -9,7 +9,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -; CHECK: @llvm.global_ctors {{.*}} { i32 0, void ()* @__msan_init, i8* null } +; CHECK: @llvm.global_ctors {{.*}} { i32 0, void ()* @msan.module_ctor, i8* null } ; Check the presence and the linkage type of __msan_track_origins and ; other interface symbols. @@ -991,4 +991,5 @@ define i8* @MismatchingCallMustTailCall(i32 %a) sanitize_memory { ; CHECK-NEXT: ret i8* -; CHECK: declare void @__msan_init() +; CHECK-LABEL: define internal void @msan.module_ctor() { +; CHECK: call void @__msan_init() diff --git a/test/Instrumentation/MemorySanitizer/msan_llvm_is_constant.ll b/test/Instrumentation/MemorySanitizer/msan_llvm_is_constant.ll index b7847db06ac2..4f316be23579 100644 --- a/test/Instrumentation/MemorySanitizer/msan_llvm_is_constant.ll +++ b/test/Instrumentation/MemorySanitizer/msan_llvm_is_constant.ll @@ -1,6 +1,9 @@ ; Make sure MSan doesn't insert shadow checks for @llvm.is.constant.* arguments. +; RUN: opt < %s -msan-kernel=1 -S -passes=msan 2>&1 | FileCheck \ +; RUN: -check-prefixes=CHECK %s ; RUN: opt < %s -msan -msan-kernel=1 -S | FileCheck -check-prefixes=CHECK %s +; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck -check-prefixes=CHECK %s ; RUN: opt < %s -msan -S | FileCheck -check-prefixes=CHECK %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/MC/Disassembler/X86/fp-stack.txt b/test/MC/Disassembler/X86/fp-stack.txt index 8c4ad47eb873..1b1687b2a204 100644 --- a/test/MC/Disassembler/X86/fp-stack.txt +++ b/test/MC/Disassembler/X86/fp-stack.txt @@ -1,52 +1,52 @@ # RUN: llvm-mc --disassemble %s -triple=x86_64 | FileCheck %s # RUN: llvm-mc --disassemble %s -triple=i686-apple-darwin9 | FileCheck %s -# CHECK: fadd %st(0) +# CHECK: fadd %st(0), %st 0xd8,0xc0 -# CHECK: fadd %st(1) +# CHECK: fadd %st(1), %st 0xd8,0xc1 -# CHECK: fadd %st(2) +# CHECK: fadd %st(2), %st 0xd8,0xc2 -# CHECK: fadd %st(3) +# CHECK: fadd %st(3), %st 0xd8,0xc3 -# CHECK: fadd %st(4) +# CHECK: fadd %st(4), %st 0xd8,0xc4 -# CHECK: fadd %st(5) +# CHECK: fadd %st(5), %st 0xd8,0xc5 -# CHECK: fadd %st(6) +# CHECK: fadd %st(6), %st 0xd8,0xc6 -# CHECK: fadd %st(7) +# CHECK: fadd %st(7), %st 0xd8,0xc7 -# CHECK: fmul %st(0) +# CHECK: fmul %st(0), %st 0xd8,0xc8 -# CHECK: fmul %st(1) +# CHECK: fmul %st(1), %st 0xd8,0xc9 -# CHECK: fmul %st(2) +# CHECK: fmul %st(2), %st 0xd8,0xca -# CHECK: fmul %st(3) +# CHECK: fmul %st(3), %st 0xd8,0xcb -# CHECK: fmul %st(4) +# CHECK: fmul %st(4), %st 0xd8,0xcc -# CHECK: fmul %st(5) +# CHECK: fmul %st(5), %st 0xd8,0xcd -# CHECK: fmul %st(6) +# CHECK: fmul %st(6), %st 0xd8,0xce -# CHECK: fmul %st(7) +# CHECK: fmul %st(7), %st 0xd8,0xcf # CHECK: fcom %st(0) @@ -97,100 +97,100 @@ # CHECK: fcomp %st(7) 0xd8,0xdf -# CHECK: fsub %st(0) +# CHECK: fsub %st(0), %st 0xd8,0xe0 -# CHECK: fsub %st(1) +# CHECK: fsub %st(1), %st 0xd8,0xe1 -# CHECK: fsub %st(2) +# CHECK: fsub %st(2), %st 0xd8,0xe2 -# CHECK: fsub %st(3) +# CHECK: fsub %st(3), %st 0xd8,0xe3 -# CHECK: fsub %st(4) +# CHECK: fsub %st(4), %st 0xd8,0xe4 -# CHECK: fsub %st(5) +# CHECK: fsub %st(5), %st 0xd8,0xe5 -# CHECK: fsub %st(6) +# CHECK: fsub %st(6), %st 0xd8,0xe6 -# CHECK: fsub %st(7) +# CHECK: fsub %st(7), %st 0xd8,0xe7 -# CHECK: fsubr %st(0) +# CHECK: fsubr %st(0), %st 0xd8,0xe8 -# CHECK: fsubr %st(1) +# CHECK: fsubr %st(1), %st 0xd8,0xe9 -# CHECK: fsubr %st(2) +# CHECK: fsubr %st(2), %st 0xd8,0xea -# CHECK: fsubr %st(3) +# CHECK: fsubr %st(3), %st 0xd8,0xeb -# CHECK: fsubr %st(4) +# CHECK: fsubr %st(4), %st 0xd8,0xec -# CHECK: fsubr %st(5) +# CHECK: fsubr %st(5), %st 0xd8,0xed -# CHECK: fsubr %st(6) +# CHECK: fsubr %st(6), %st 0xd8,0xee -# CHECK: fsubr %st(7) +# CHECK: fsubr %st(7), %st 0xd8,0xef -# CHECK: fdiv %st(0) +# CHECK: fdiv %st(0), %st 0xd8,0xf0 -# CHECK: fdiv %st(1) +# CHECK: fdiv %st(1), %st 0xd8,0xf1 -# CHECK: fdiv %st(2) +# CHECK: fdiv %st(2), %st 0xd8,0xf2 -# CHECK: fdiv %st(3) +# CHECK: fdiv %st(3), %st 0xd8,0xf3 -# CHECK: fdiv %st(4) +# CHECK: fdiv %st(4), %st 0xd8,0xf4 -# CHECK: fdiv %st(5) +# CHECK: fdiv %st(5), %st 0xd8,0xf5 -# CHECK: fdiv %st(6) +# CHECK: fdiv %st(6), %st 0xd8,0xf6 -# CHECK: fdiv %st(7) +# CHECK: fdiv %st(7), %st 0xd8,0xf7 -# CHECK: fdivr %st(0) +# CHECK: fdivr %st(0), %st 0xd8,0xf8 -# CHECK: fdivr %st(1) +# CHECK: fdivr %st(1), %st 0xd8,0xf9 -# CHECK: fdivr %st(2) +# CHECK: fdivr %st(2), %st 0xd8,0xfa -# CHECK: fdivr %st(3) +# CHECK: fdivr %st(3), %st 0xd8,0xfb -# CHECK: fdivr %st(4) +# CHECK: fdivr %st(4), %st 0xd8,0xfc -# CHECK: fdivr %st(5) +# CHECK: fdivr %st(5), %st 0xd8,0xfd -# CHECK: fdivr %st(6) +# CHECK: fdivr %st(6), %st 0xd8,0xfe -# CHECK: fdivr %st(7) +# CHECK: fdivr %st(7), %st 0xd8,0xff # CHECK: fld %st(0) @@ -325,199 +325,199 @@ # CHECK: fcos 0xd9,0xff -# CHECK: fcmovb %st(0), %st(0) +# CHECK: fcmovb %st(0), %st 0xda,0xc0 -# CHECK: fcmovb %st(1), %st(0) +# CHECK: fcmovb %st(1), %st 0xda,0xc1 -# CHECK: fcmovb %st(2), %st(0) +# CHECK: fcmovb %st(2), %st 0xda,0xc2 -# CHECK: fcmovb %st(3), %st(0) +# CHECK: fcmovb %st(3), %st 0xda,0xc3 -# CHECK: fcmovb %st(4), %st(0) +# CHECK: fcmovb %st(4), %st 0xda,0xc4 -# CHECK: fcmovb %st(5), %st(0) +# CHECK: fcmovb %st(5), %st 0xda,0xc5 -# CHECK: fcmovb %st(6), %st(0) +# CHECK: fcmovb %st(6), %st 0xda,0xc6 -# CHECK: fcmovb %st(7), %st(0) +# CHECK: fcmovb %st(7), %st 0xda,0xc7 -# CHECK: fcmove %st(0), %st(0) +# CHECK: fcmove %st(0), %st 0xda,0xc8 -# CHECK: fcmove %st(1), %st(0) +# CHECK: fcmove %st(1), %st 0xda,0xc9 -# CHECK: fcmove %st(2), %st(0) +# CHECK: fcmove %st(2), %st 0xda,0xca -# CHECK: fcmove %st(3), %st(0) +# CHECK: fcmove %st(3), %st 0xda,0xcb -# CHECK: fcmove %st(4), %st(0) +# CHECK: fcmove %st(4), %st 0xda,0xcc -# CHECK: fcmove %st(5), %st(0) +# CHECK: fcmove %st(5), %st 0xda,0xcd -# CHECK: fcmove %st(6), %st(0) +# CHECK: fcmove %st(6), %st 0xda,0xce -# CHECK: fcmove %st(7), %st(0) +# CHECK: fcmove %st(7), %st 0xda,0xcf -# CHECK: fcmovbe %st(0), %st(0) +# CHECK: fcmovbe %st(0), %st 0xda,0xd0 -# CHECK: fcmovbe %st(1), %st(0) +# CHECK: fcmovbe %st(1), %st 0xda,0xd1 -# CHECK: fcmovbe %st(2), %st(0) +# CHECK: fcmovbe %st(2), %st 0xda,0xd2 -# CHECK: fcmovbe %st(3), %st(0) +# CHECK: fcmovbe %st(3), %st 0xda,0xd3 -# CHECK: fcmovbe %st(4), %st(0) +# CHECK: fcmovbe %st(4), %st 0xda,0xd4 -# CHECK: fcmovbe %st(5), %st(0) +# CHECK: fcmovbe %st(5), %st 0xda,0xd5 -# CHECK: fcmovbe %st(6), %st(0) +# CHECK: fcmovbe %st(6), %st 0xda,0xd6 -# CHECK: fcmovbe %st(7), %st(0) +# CHECK: fcmovbe %st(7), %st 0xda,0xd7 -# CHECK: fcmovu %st(0), %st(0) +# CHECK: fcmovu %st(0), %st 0xda,0xd8 -# CHECK: fcmovu %st(1), %st(0) +# CHECK: fcmovu %st(1), %st 0xda,0xd9 -# CHECK: fcmovu %st(2), %st(0) +# CHECK: fcmovu %st(2), %st 0xda,0xda -# CHECK: fcmovu %st(3), %st(0) +# CHECK: fcmovu %st(3), %st 0xda,0xdb -# CHECK: fcmovu %st(4), %st(0) +# CHECK: fcmovu %st(4), %st 0xda,0xdc -# CHECK: fcmovu %st(5), %st(0) +# CHECK: fcmovu %st(5), %st 0xda,0xdd -# CHECK: fcmovu %st(6), %st(0) +# CHECK: fcmovu %st(6), %st 0xda,0xde -# CHECK: fcmovu %st(7), %st(0) +# CHECK: fcmovu %st(7), %st 0xda,0xdf # CHECK: fucompp 0xda,0xe9 -# CHECK: fcmovnb %st(0), %st(0) +# CHECK: fcmovnb %st(0), %st 0xdb,0xc0 -# CHECK: fcmovnb %st(1), %st(0) +# CHECK: fcmovnb %st(1), %st 0xdb,0xc1 -# CHECK: fcmovnb %st(2), %st(0) +# CHECK: fcmovnb %st(2), %st 0xdb,0xc2 -# CHECK: fcmovnb %st(3), %st(0) +# CHECK: fcmovnb %st(3), %st 0xdb,0xc3 -# CHECK: fcmovnb %st(4), %st(0) +# CHECK: fcmovnb %st(4), %st 0xdb,0xc4 -# CHECK: fcmovnb %st(5), %st(0) +# CHECK: fcmovnb %st(5), %st 0xdb,0xc5 -# CHECK: fcmovnb %st(6), %st(0) +# CHECK: fcmovnb %st(6), %st 0xdb,0xc6 -# CHECK: fcmovnb %st(7), %st(0) +# CHECK: fcmovnb %st(7), %st 0xdb,0xc7 -# CHECK: fcmovne %st(0), %st(0) +# CHECK: fcmovne %st(0), %st 0xdb,0xc8 -# CHECK: fcmovne %st(1), %st(0) +# CHECK: fcmovne %st(1), %st 0xdb,0xc9 -# CHECK: fcmovne %st(2), %st(0) +# CHECK: fcmovne %st(2), %st 0xdb,0xca -# CHECK: fcmovne %st(3), %st(0) +# CHECK: fcmovne %st(3), %st 0xdb,0xcb -# CHECK: fcmovne %st(4), %st(0) +# CHECK: fcmovne %st(4), %st 0xdb,0xcc -# CHECK: fcmovne %st(5), %st(0) +# CHECK: fcmovne %st(5), %st 0xdb,0xcd -# CHECK: fcmovne %st(6), %st(0) +# CHECK: fcmovne %st(6), %st 0xdb,0xce -# CHECK: fcmovne %st(7), %st(0) +# CHECK: fcmovne %st(7), %st 0xdb,0xcf -# CHECK: fcmovnbe %st(0), %st(0) +# CHECK: fcmovnbe %st(0), %st 0xdb,0xd0 -# CHECK: fcmovnbe %st(1), %st(0) +# CHECK: fcmovnbe %st(1), %st 0xdb,0xd1 -# CHECK: fcmovnbe %st(2), %st(0) +# CHECK: fcmovnbe %st(2), %st 0xdb,0xd2 -# CHECK: fcmovnbe %st(3), %st(0) +# CHECK: fcmovnbe %st(3), %st 0xdb,0xd3 -# CHECK: fcmovnbe %st(4), %st(0) +# CHECK: fcmovnbe %st(4), %st 0xdb,0xd4 -# CHECK: fcmovnbe %st(5), %st(0) +# CHECK: fcmovnbe %st(5), %st 0xdb,0xd5 -# CHECK: fcmovnbe %st(6), %st(0) +# CHECK: fcmovnbe %st(6), %st 0xdb,0xd6 -# CHECK: fcmovnbe %st(7), %st(0) +# CHECK: fcmovnbe %st(7), %st 0xdb,0xd7 -# CHECK: fcmovnu %st(0), %st(0) +# CHECK: fcmovnu %st(0), %st 0xdb,0xd8 -# CHECK: fcmovnu %st(1), %st(0) +# CHECK: fcmovnu %st(1), %st 0xdb,0xd9 -# CHECK: fcmovnu %st(2), %st(0) +# CHECK: fcmovnu %st(2), %st 0xdb,0xda -# CHECK: fcmovnu %st(3), %st(0) +# CHECK: fcmovnu %st(3), %st 0xdb,0xdb -# CHECK: fcmovnu %st(4), %st(0) +# CHECK: fcmovnu %st(4), %st 0xdb,0xdc -# CHECK: fcmovnu %st(5), %st(0) +# CHECK: fcmovnu %st(5), %st 0xdb,0xdd -# CHECK: fcmovnu %st(6), %st(0) +# CHECK: fcmovnu %st(6), %st 0xdb,0xde -# CHECK: fcmovnu %st(7), %st(0) +# CHECK: fcmovnu %st(7), %st 0xdb,0xdf # CHECK: fnclex @@ -574,148 +574,148 @@ # CHECK: fcomi %st(7) 0xdb,0xf7 -# CHECK: fadd %st(0), %st(0) +# CHECK: fadd %st, %st(0) 0xdc,0xc0 -# CHECK: fadd %st(0), %st(1) +# CHECK: fadd %st, %st(1) 0xdc,0xc1 -# CHECK: fadd %st(0), %st(2) +# CHECK: fadd %st, %st(2) 0xdc,0xc2 -# CHECK: fadd %st(0), %st(3) +# CHECK: fadd %st, %st(3) 0xdc,0xc3 -# CHECK: fadd %st(0), %st(4) +# CHECK: fadd %st, %st(4) 0xdc,0xc4 -# CHECK: fadd %st(0), %st(5) +# CHECK: fadd %st, %st(5) 0xdc,0xc5 -# CHECK: fadd %st(0), %st(6) +# CHECK: fadd %st, %st(6) 0xdc,0xc6 -# CHECK: fadd %st(0), %st(7) +# CHECK: fadd %st, %st(7) 0xdc,0xc7 -# CHECK: fmul %st(0), %st(0) +# CHECK: fmul %st, %st(0) 0xdc,0xc8 -# CHECK: fmul %st(0), %st(1) +# CHECK: fmul %st, %st(1) 0xdc,0xc9 -# CHECK: fmul %st(0), %st(2) +# CHECK: fmul %st, %st(2) 0xdc,0xca -# CHECK: fmul %st(0), %st(3) +# CHECK: fmul %st, %st(3) 0xdc,0xcb -# CHECK: fmul %st(0), %st(4) +# CHECK: fmul %st, %st(4) 0xdc,0xcc -# CHECK: fmul %st(0), %st(5) +# CHECK: fmul %st, %st(5) 0xdc,0xcd -# CHECK: fmul %st(0), %st(6) +# CHECK: fmul %st, %st(6) 0xdc,0xce -# CHECK: fmul %st(0), %st(7) +# CHECK: fmul %st, %st(7) 0xdc,0xcf -# CHECK: fsub %st(0), %st(0) +# CHECK: fsub %st, %st(0) 0xdc,0xe0 -# CHECK: fsub %st(0), %st(1) +# CHECK: fsub %st, %st(1) 0xdc,0xe1 -# CHECK: fsub %st(0), %st(2) +# CHECK: fsub %st, %st(2) 0xdc,0xe2 -# CHECK: fsub %st(0), %st(3) +# CHECK: fsub %st, %st(3) 0xdc,0xe3 -# CHECK: fsub %st(0), %st(4) +# CHECK: fsub %st, %st(4) 0xdc,0xe4 -# CHECK: fsub %st(0), %st(5) +# CHECK: fsub %st, %st(5) 0xdc,0xe5 -# CHECK: fsub %st(0), %st(6) +# CHECK: fsub %st, %st(6) 0xdc,0xe6 -# CHECK: fsub %st(0), %st(7) +# CHECK: fsub %st, %st(7) 0xdc,0xe7 -# CHECK: fsubr %st(0), %st(0) +# CHECK: fsubr %st, %st(0) 0xdc,0xe8 -# CHECK: fsubr %st(0), %st(1) +# CHECK: fsubr %st, %st(1) 0xdc,0xe9 -# CHECK: fsubr %st(0), %st(2) +# CHECK: fsubr %st, %st(2) 0xdc,0xea -# CHECK: fsubr %st(0), %st(3) +# CHECK: fsubr %st, %st(3) 0xdc,0xeb -# CHECK: fsubr %st(0), %st(4) +# CHECK: fsubr %st, %st(4) 0xdc,0xec -# CHECK: fsubr %st(0), %st(5) +# CHECK: fsubr %st, %st(5) 0xdc,0xed -# CHECK: fsubr %st(0), %st(6) +# CHECK: fsubr %st, %st(6) 0xdc,0xee -# CHECK: fsubr %st(0), %st(7) +# CHECK: fsubr %st, %st(7) 0xdc,0xef -# CHECK: fdiv %st(0), %st(0) +# CHECK: fdiv %st, %st(0) 0xdc,0xf0 -# CHECK: fdiv %st(0), %st(1) +# CHECK: fdiv %st, %st(1) 0xdc,0xf1 -# CHECK: fdiv %st(0), %st(2) +# CHECK: fdiv %st, %st(2) 0xdc,0xf2 -# CHECK: fdiv %st(0), %st(3) +# CHECK: fdiv %st, %st(3) 0xdc,0xf3 -# CHECK: fdiv %st(0), %st(4) +# CHECK: fdiv %st, %st(4) 0xdc,0xf4 -# CHECK: fdiv %st(0), %st(5) +# CHECK: fdiv %st, %st(5) 0xdc,0xf5 -# CHECK: fdiv %st(0), %st(6) +# CHECK: fdiv %st, %st(6) 0xdc,0xf6 -# CHECK: fdiv %st(0), %st(7) +# CHECK: fdiv %st, %st(7) 0xdc,0xf7 -# CHECK: fdivr %st(0), %st(0) +# CHECK: fdivr %st, %st(0) 0xdc,0xf8 -# CHECK: fdivr %st(0), %st(1) +# CHECK: fdivr %st, %st(1) 0xdc,0xf9 -# CHECK: fdivr %st(0), %st(2) +# CHECK: fdivr %st, %st(2) 0xdc,0xfa -# CHECK: fdivr %st(0), %st(3) +# CHECK: fdivr %st, %st(3) 0xdc,0xfb -# CHECK: fdivr %st(0), %st(4) +# CHECK: fdivr %st, %st(4) 0xdc,0xfc -# CHECK: fdivr %st(0), %st(5) +# CHECK: fdivr %st, %st(5) 0xdc,0xfd -# CHECK: fdivr %st(0), %st(6) +# CHECK: fdivr %st, %st(6) 0xdc,0xfe -# CHECK: fdivr %st(0), %st(7) +# CHECK: fdivr %st, %st(7) 0xdc,0xff # CHECK: ffree %st(0) @@ -838,151 +838,151 @@ # CHECK: fucomp %st(7) 0xdd,0xef -# CHECK: faddp %st(0) +# CHECK: faddp %st, %st(0) 0xde,0xc0 -# CHECK: faddp %st(1) +# CHECK: faddp %st, %st(1) 0xde,0xc1 -# CHECK: faddp %st(2) +# CHECK: faddp %st, %st(2) 0xde,0xc2 -# CHECK: faddp %st(3) +# CHECK: faddp %st, %st(3) 0xde,0xc3 -# CHECK: faddp %st(4) +# CHECK: faddp %st, %st(4) 0xde,0xc4 -# CHECK: faddp %st(5) +# CHECK: faddp %st, %st(5) 0xde,0xc5 -# CHECK: faddp %st(6) +# CHECK: faddp %st, %st(6) 0xde,0xc6 -# CHECK: faddp %st(7) +# CHECK: faddp %st, %st(7) 0xde,0xc7 -# CHECK: fmulp %st(0) +# CHECK: fmulp %st, %st(0) 0xde,0xc8 -# CHECK: fmulp %st(1) +# CHECK: fmulp %st, %st(1) 0xde,0xc9 -# CHECK: fmulp %st(2) +# CHECK: fmulp %st, %st(2) 0xde,0xca -# CHECK: fmulp %st(3) +# CHECK: fmulp %st, %st(3) 0xde,0xcb -# CHECK: fmulp %st(4) +# CHECK: fmulp %st, %st(4) 0xde,0xcc -# CHECK: fmulp %st(5) +# CHECK: fmulp %st, %st(5) 0xde,0xcd -# CHECK: fmulp %st(6) +# CHECK: fmulp %st, %st(6) 0xde,0xce -# CHECK: fmulp %st(7) +# CHECK: fmulp %st, %st(7) 0xde,0xcf # CHECK: fcompp 0xde,0xd9 -# CHECK: fsubp %st(0) +# CHECK: fsubp %st, %st(0) 0xde,0xe0 -# CHECK: fsubp %st(1) +# CHECK: fsubp %st, %st(1) 0xde,0xe1 -# CHECK: fsubp %st(2) +# CHECK: fsubp %st, %st(2) 0xde,0xe2 -# CHECK: fsubp %st(3) +# CHECK: fsubp %st, %st(3) 0xde,0xe3 -# CHECK: fsubp %st(4) +# CHECK: fsubp %st, %st(4) 0xde,0xe4 -# CHECK: fsubp %st(5) +# CHECK: fsubp %st, %st(5) 0xde,0xe5 -# CHECK: fsubp %st(6) +# CHECK: fsubp %st, %st(6) 0xde,0xe6 -# CHECK: fsubp %st(7) +# CHECK: fsubp %st, %st(7) 0xde,0xe7 -# CHECK: fsubrp %st(0) +# CHECK: fsubrp %st, %st(0) 0xde,0xe8 -# CHECK: fsubrp %st(1) +# CHECK: fsubrp %st, %st(1) 0xde,0xe9 -# CHECK: fsubrp %st(2) +# CHECK: fsubrp %st, %st(2) 0xde,0xea -# CHECK: fsubrp %st(3) +# CHECK: fsubrp %st, %st(3) 0xde,0xeb -# CHECK: fsubrp %st(4) +# CHECK: fsubrp %st, %st(4) 0xde,0xec -# CHECK: fsubrp %st(5) +# CHECK: fsubrp %st, %st(5) 0xde,0xed -# CHECK: fsubrp %st(6) +# CHECK: fsubrp %st, %st(6) 0xde,0xee -# CHECK: fsubrp %st(7) +# CHECK: fsubrp %st, %st(7) 0xde,0xef -# CHECK: fdivp %st(0) +# CHECK: fdivp %st, %st(0) 0xde,0xf0 -# CHECK: fdivp %st(1) +# CHECK: fdivp %st, %st(1) 0xde,0xf1 -# CHECK: fdivp %st(2) +# CHECK: fdivp %st, %st(2) 0xde,0xf2 -# CHECK: fdivp %st(3) +# CHECK: fdivp %st, %st(3) 0xde,0xf3 -# CHECK: fdivp %st(4) +# CHECK: fdivp %st, %st(4) 0xde,0xf4 -# CHECK: fdivp %st(5) +# CHECK: fdivp %st, %st(5) 0xde,0xf5 -# CHECK: fdivp %st(6) +# CHECK: fdivp %st, %st(6) 0xde,0xf6 -# CHECK: fdivp %st(7) +# CHECK: fdivp %st, %st(7) 0xde,0xf7 -# CHECK: fdivrp %st(0) +# CHECK: fdivrp %st, %st(0) 0xde,0xf8 -# CHECK: fdivrp %st(1) +# CHECK: fdivrp %st, %st(1) 0xde,0xf9 -# CHECK: fdivrp %st(2) +# CHECK: fdivrp %st, %st(2) 0xde,0xfa -# CHECK: fdivrp %st(3) +# CHECK: fdivrp %st, %st(3) 0xde,0xfb -# CHECK: fdivrp %st(4) +# CHECK: fdivrp %st, %st(4) 0xde,0xfc -# CHECK: fdivrp %st(5) +# CHECK: fdivrp %st, %st(5) 0xde,0xfd -# CHECK: fdivrp %st(6) +# CHECK: fdivrp %st, %st(6) 0xde,0xfe -# CHECK: fdivrp %st(7) +# CHECK: fdivrp %st, %st(7) 0xde,0xff # CHECK: ffreep %st(0) diff --git a/test/MC/Disassembler/X86/x86-16.txt b/test/MC/Disassembler/X86/x86-16.txt index 43cd09516c3b..286aa88489cb 100644 --- a/test/MC/Disassembler/X86/x86-16.txt +++ b/test/MC/Disassembler/X86/x86-16.txt @@ -759,10 +759,10 @@ # CHECK: strl %eax 0x66 0x0f 0x00 0xc8 -# CHECK: fsubp %st(1) +# CHECK: fsubp %st, %st(1) 0xde 0xe1 -# CHECK: fsubp %st(2) +# CHECK: fsubp %st, %st(2) 0xde 0xe2 # CHECKX: nop diff --git a/test/MC/MachO/file-single.s b/test/MC/MachO/file-single.s deleted file mode 100644 index 747af22750af..000000000000 --- a/test/MC/MachO/file-single.s +++ /dev/null @@ -1,8 +0,0 @@ -// RUN: not llvm-mc -triple i386-apple-darwin9 %s -o /dev/null 2>&1 | FileCheck %s - -// Previously this crashed MC. - -// CHECK: error: target does not support '.file' without a number - - .file "dir/foo" - nop diff --git a/test/MC/MachO/file.s b/test/MC/MachO/file.s index 3ddfb2efe224..eddbb599d97a 100644 --- a/test/MC/MachO/file.s +++ b/test/MC/MachO/file.s @@ -1,5 +1,8 @@ // RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | llvm-readobj -s -section-data | FileCheck %s +// This number-less file directive is ignored on MachO. + .file "bar/baz.s" + .file 1 "dir/foo" nop diff --git a/test/MC/WebAssembly/external-func-address.ll b/test/MC/WebAssembly/external-func-address.ll index 60ec23a1a8ed..8e36c76e84f3 100644 --- a/test/MC/WebAssembly/external-func-address.ll +++ b/test/MC/WebAssembly/external-func-address.ll @@ -8,7 +8,7 @@ target triple = "wasm32-unknown-unknown" declare void @f0(i32) #0 @ptr_to_f0 = hidden global void (i32)* @f0, align 4 -attributes #0 = { "wasm-import-module"="somewhere" } +attributes #0 = { "wasm-import-module"="somewhere" "wasm-import-name"="something" } declare void @f1(i32) #1 @ptr_to_f1 = hidden global void (i32)* @f1, align 4 @@ -47,7 +47,7 @@ define void @call(i32) { ; CHECK-NEXT: Kind: FUNCTION ; CHECK-NEXT: SigIndex: 1 ; CHECK: - Module: somewhere -; CHECK-NEXT: Field: f0 +; CHECK-NEXT: Field: something ; CHECK: - Module: env ; CHECK-NEXT: Field: f1 ; CHECK-NEXT: Kind: FUNCTION diff --git a/test/MC/WebAssembly/import-module.ll b/test/MC/WebAssembly/import-module.ll new file mode 100644 index 000000000000..461d5c20ae9b --- /dev/null +++ b/test/MC/WebAssembly/import-module.ll @@ -0,0 +1,31 @@ +; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s + +target triple = "wasm32-unknown-unknown" + +define void @test() { + call void @foo() + call void @plain() + ret void +} + +declare void @foo() #0 +declare void @plain() + +attributes #0 = { "wasm-import-module"="bar" "wasm-import-name"="qux" } + +; CHECK: - Type: IMPORT +; CHECK-NEXT: Imports: +; CHECK: - Module: bar +; CHECK-NEXT: Field: qux +; CHECK-NEXT: Kind: FUNCTION + +; CHECK: - Module: env +; CHECK-NEXT: Field: plain +; CHECK-NEXT: Kind: FUNCTION + +; CHECK: - Type: CUSTOM +; CHECK: Name: foo +; CHECK-NEXT: Flags: [ UNDEFINED ] + +; CHECK: Name: plain +; CHECK-NEXT: Flags: [ UNDEFINED ] diff --git a/test/MC/X86/PPRO-32.s b/test/MC/X86/PPRO-32.s index bbd933e58af0..6deea6de9c44 100644 --- a/test/MC/X86/PPRO-32.s +++ b/test/MC/X86/PPRO-32.s @@ -64,37 +64,37 @@ cmovpl %eax, %eax // CHECK: encoding: [0x0f,0x48,0xc0] cmovsl %eax, %eax -// CHECK: fcmovbe %st(4), %st(0) +// CHECK: fcmovbe %st(4), %st // CHECK: encoding: [0xda,0xd4] -fcmovbe %st(4), %st(0) +fcmovbe %st(4), %st -// CHECK: fcmovb %st(4), %st(0) +// CHECK: fcmovb %st(4), %st // CHECK: encoding: [0xda,0xc4] -fcmovb %st(4), %st(0) +fcmovb %st(4), %st -// CHECK: fcmove %st(4), %st(0) +// CHECK: fcmove %st(4), %st // CHECK: encoding: [0xda,0xcc] -fcmove %st(4), %st(0) +fcmove %st(4), %st -// CHECK: fcmovnbe %st(4), %st(0) +// CHECK: fcmovnbe %st(4), %st // CHECK: encoding: [0xdb,0xd4] -fcmovnbe %st(4), %st(0) +fcmovnbe %st(4), %st -// CHECK: fcmovnb %st(4), %st(0) +// CHECK: fcmovnb %st(4), %st // CHECK: encoding: [0xdb,0xc4] -fcmovnb %st(4), %st(0) +fcmovnb %st(4), %st -// CHECK: fcmovne %st(4), %st(0) +// CHECK: fcmovne %st(4), %st // CHECK: encoding: [0xdb,0xcc] -fcmovne %st(4), %st(0) +fcmovne %st(4), %st -// CHECK: fcmovnu %st(4), %st(0) +// CHECK: fcmovnu %st(4), %st // CHECK: encoding: [0xdb,0xdc] -fcmovnu %st(4), %st(0) +fcmovnu %st(4), %st -// CHECK: fcmovu %st(4), %st(0) +// CHECK: fcmovu %st(4), %st // CHECK: encoding: [0xda,0xdc] -fcmovu %st(4), %st(0) +fcmovu %st(4), %st // CHECK: fcomi %st(4) // CHECK: encoding: [0xdb,0xf4] diff --git a/test/MC/X86/PPRO-64.s b/test/MC/X86/PPRO-64.s index a41d4a0f93cc..8004772e8f3d 100644 --- a/test/MC/X86/PPRO-64.s +++ b/test/MC/X86/PPRO-64.s @@ -64,37 +64,37 @@ cmovpl %r13d, %r13d // CHECK: encoding: [0x45,0x0f,0x48,0xed] cmovsl %r13d, %r13d -// CHECK: fcmovbe %st(4), %st(0) +// CHECK: fcmovbe %st(4), %st // CHECK: encoding: [0xda,0xd4] -fcmovbe %st(4), %st(0) +fcmovbe %st(4), %st -// CHECK: fcmovb %st(4), %st(0) +// CHECK: fcmovb %st(4), %st // CHECK: encoding: [0xda,0xc4] -fcmovb %st(4), %st(0) +fcmovb %st(4), %st -// CHECK: fcmove %st(4), %st(0) +// CHECK: fcmove %st(4), %st // CHECK: encoding: [0xda,0xcc] -fcmove %st(4), %st(0) +fcmove %st(4), %st -// CHECK: fcmovnbe %st(4), %st(0) +// CHECK: fcmovnbe %st(4), %st // CHECK: encoding: [0xdb,0xd4] -fcmovnbe %st(4), %st(0) +fcmovnbe %st(4), %st -// CHECK: fcmovnb %st(4), %st(0) +// CHECK: fcmovnb %st(4), %st // CHECK: encoding: [0xdb,0xc4] -fcmovnb %st(4), %st(0) +fcmovnb %st(4), %st -// CHECK: fcmovne %st(4), %st(0) +// CHECK: fcmovne %st(4), %st // CHECK: encoding: [0xdb,0xcc] -fcmovne %st(4), %st(0) +fcmovne %st(4), %st -// CHECK: fcmovnu %st(4), %st(0) +// CHECK: fcmovnu %st(4), %st // CHECK: encoding: [0xdb,0xdc] -fcmovnu %st(4), %st(0) +fcmovnu %st(4), %st -// CHECK: fcmovu %st(4), %st(0) +// CHECK: fcmovu %st(4), %st // CHECK: encoding: [0xda,0xdc] -fcmovu %st(4), %st(0) +fcmovu %st(4), %st // CHECK: fcomi %st(4) // CHECK: encoding: [0xdb,0xf4] diff --git a/test/MC/X86/X87-32.s b/test/MC/X86/X87-32.s index 967763de93e0..d414ab65b7dc 100755 --- a/test/MC/X86/X87-32.s +++ b/test/MC/X86/X87-32.s @@ -31,7 +31,7 @@ faddl 64(%edx,%eax) // CHECK: encoding: [0xdc,0x02] faddl (%edx) -// CHECK: faddp %st(4) +// CHECK: faddp %st, %st(4) // CHECK: encoding: [0xde,0xc4] faddp %st(4) @@ -59,11 +59,11 @@ fadds 64(%edx,%eax) // CHECK: encoding: [0xd8,0x02] fadds (%edx) -// CHECK: fadd %st(0), %st(4) +// CHECK: fadd %st, %st(4) // CHECK: encoding: [0xdc,0xc4] -fadd %st(0), %st(4) +fadd %st, %st(4) -// CHECK: fadd %st(4) +// CHECK: fadd %st(4), %st // CHECK: encoding: [0xd8,0xc4] fadd %st(4) @@ -259,7 +259,7 @@ fdivl 64(%edx,%eax) // CHECK: encoding: [0xdc,0x32] fdivl (%edx) -// CHECK: fdivp %st(4) +// CHECK: fdivp %st, %st(4) // CHECK: encoding: [0xde,0xf4] fdivp %st(4) @@ -287,7 +287,7 @@ fdivrl 64(%edx,%eax) // CHECK: encoding: [0xdc,0x3a] fdivrl (%edx) -// CHECK: fdivrp %st(4) +// CHECK: fdivrp %st, %st(4) // CHECK: encoding: [0xde,0xfc] fdivrp %st(4) @@ -315,11 +315,11 @@ fdivrs 64(%edx,%eax) // CHECK: encoding: [0xd8,0x3a] fdivrs (%edx) -// CHECK: fdivr %st(0), %st(4) +// CHECK: fdivr %st, %st(4) // CHECK: encoding: [0xdc,0xfc] -fdivr %st(0), %st(4) +fdivr %st, %st(4) -// CHECK: fdivr %st(4) +// CHECK: fdivr %st(4), %st // CHECK: encoding: [0xd8,0xfc] fdivr %st(4) @@ -347,11 +347,11 @@ fdivs 64(%edx,%eax) // CHECK: encoding: [0xd8,0x32] fdivs (%edx) -// CHECK: fdiv %st(0), %st(4) +// CHECK: fdiv %st, %st(4) // CHECK: encoding: [0xdc,0xf4] -fdiv %st(0), %st(4) +fdiv %st, %st(4) -// CHECK: fdiv %st(4) +// CHECK: fdiv %st(4), %st // CHECK: encoding: [0xd8,0xf4] fdiv %st(4) @@ -1119,7 +1119,7 @@ fmull 64(%edx,%eax) // CHECK: encoding: [0xdc,0x0a] fmull (%edx) -// CHECK: fmulp %st(4) +// CHECK: fmulp %st, %st(4) // CHECK: encoding: [0xde,0xcc] fmulp %st(4) @@ -1147,11 +1147,11 @@ fmuls 64(%edx,%eax) // CHECK: encoding: [0xd8,0x0a] fmuls (%edx) -// CHECK: fmul %st(0), %st(4) +// CHECK: fmul %st, %st(4) // CHECK: encoding: [0xdc,0xcc] -fmul %st(0), %st(4) +fmul %st, %st(4) -// CHECK: fmul %st(4) +// CHECK: fmul %st(4), %st // CHECK: encoding: [0xd8,0xcc] fmul %st(4) @@ -1479,7 +1479,7 @@ fsubl 64(%edx,%eax) // CHECK: encoding: [0xdc,0x22] fsubl (%edx) -// CHECK: fsubp %st(4) +// CHECK: fsubp %st, %st(4) // CHECK: encoding: [0xde,0xe4] fsubp %st(4) @@ -1507,7 +1507,7 @@ fsubrl 64(%edx,%eax) // CHECK: encoding: [0xdc,0x2a] fsubrl (%edx) -// CHECK: fsubrp %st(4) +// CHECK: fsubrp %st, %st(4) // CHECK: encoding: [0xde,0xec] fsubrp %st(4) @@ -1535,11 +1535,11 @@ fsubrs 64(%edx,%eax) // CHECK: encoding: [0xd8,0x2a] fsubrs (%edx) -// CHECK: fsubr %st(0), %st(4) +// CHECK: fsubr %st, %st(4) // CHECK: encoding: [0xdc,0xec] -fsubr %st(0), %st(4) +fsubr %st, %st(4) -// CHECK: fsubr %st(4) +// CHECK: fsubr %st(4), %st // CHECK: encoding: [0xd8,0xec] fsubr %st(4) @@ -1567,11 +1567,11 @@ fsubs 64(%edx,%eax) // CHECK: encoding: [0xd8,0x22] fsubs (%edx) -// CHECK: fsub %st(0), %st(4) +// CHECK: fsub %st, %st(4) // CHECK: encoding: [0xdc,0xe4] -fsub %st(0), %st(4) +fsub %st, %st(4) -// CHECK: fsub %st(4) +// CHECK: fsub %st(4), %st // CHECK: encoding: [0xd8,0xe4] fsub %st(4) diff --git a/test/MC/X86/X87-64.s b/test/MC/X86/X87-64.s index a3b76b4e4b0a..1103f326ea04 100755 --- a/test/MC/X86/X87-64.s +++ b/test/MC/X86/X87-64.s @@ -31,7 +31,7 @@ faddl 64(%rdx,%rax) // CHECK: encoding: [0xdc,0x02] faddl (%rdx) -// CHECK: faddp %st(4) +// CHECK: faddp %st, %st(4) // CHECK: encoding: [0xde,0xc4] faddp %st(4) @@ -59,11 +59,11 @@ fadds 64(%rdx,%rax) // CHECK: encoding: [0xd8,0x02] fadds (%rdx) -// CHECK: fadd %st(0), %st(4) +// CHECK: fadd %st, %st(4) // CHECK: encoding: [0xdc,0xc4] -fadd %st(0), %st(4) +fadd %st, %st(4) -// CHECK: fadd %st(4) +// CHECK: fadd %st(4), %st // CHECK: encoding: [0xd8,0xc4] fadd %st(4) @@ -259,7 +259,7 @@ fdivl 64(%rdx,%rax) // CHECK: encoding: [0xdc,0x32] fdivl (%rdx) -// CHECK: fdivp %st(4) +// CHECK: fdivp %st, %st(4) // CHECK: encoding: [0xde,0xf4] fdivp %st(4) @@ -287,7 +287,7 @@ fdivrl 64(%rdx,%rax) // CHECK: encoding: [0xdc,0x3a] fdivrl (%rdx) -// CHECK: fdivrp %st(4) +// CHECK: fdivrp %st, %st(4) // CHECK: encoding: [0xde,0xfc] fdivrp %st(4) @@ -315,11 +315,11 @@ fdivrs 64(%rdx,%rax) // CHECK: encoding: [0xd8,0x3a] fdivrs (%rdx) -// CHECK: fdivr %st(0), %st(4) +// CHECK: fdivr %st, %st(4) // CHECK: encoding: [0xdc,0xfc] -fdivr %st(0), %st(4) +fdivr %st, %st(4) -// CHECK: fdivr %st(4) +// CHECK: fdivr %st(4), %st // CHECK: encoding: [0xd8,0xfc] fdivr %st(4) @@ -347,11 +347,11 @@ fdivs 64(%rdx,%rax) // CHECK: encoding: [0xd8,0x32] fdivs (%rdx) -// CHECK: fdiv %st(0), %st(4) +// CHECK: fdiv %st, %st(4) // CHECK: encoding: [0xdc,0xf4] -fdiv %st(0), %st(4) +fdiv %st, %st(4) -// CHECK: fdiv %st(4) +// CHECK: fdiv %st(4), %st // CHECK: encoding: [0xd8,0xf4] fdiv %st(4) @@ -1119,7 +1119,7 @@ fmull 64(%rdx,%rax) // CHECK: encoding: [0xdc,0x0a] fmull (%rdx) -// CHECK: fmulp %st(4) +// CHECK: fmulp %st, %st(4) // CHECK: encoding: [0xde,0xcc] fmulp %st(4) @@ -1147,9 +1147,9 @@ fmuls 64(%rdx,%rax) // CHECK: encoding: [0xd8,0x0a] fmuls (%rdx) -// CHECK: fmul %st(0), %st(4) +// CHECK: fmul %st, %st(4) // CHECK: encoding: [0xdc,0xcc] -fmul %st(0), %st(4) +fmul %st, %st(4) // CHECK: fmul %st(4) // CHECK: encoding: [0xd8,0xcc] @@ -1479,7 +1479,7 @@ fsubl 64(%rdx,%rax) // CHECK: encoding: [0xdc,0x22] fsubl (%rdx) -// CHECK: fsubp %st(4) +// CHECK: fsubp %st, %st(4) // CHECK: encoding: [0xde,0xe4] fsubp %st(4) @@ -1507,7 +1507,7 @@ fsubrl 64(%rdx,%rax) // CHECK: encoding: [0xdc,0x2a] fsubrl (%rdx) -// CHECK: fsubrp %st(4) +// CHECK: fsubrp %st, %st(4) // CHECK: encoding: [0xde,0xec] fsubrp %st(4) @@ -1535,11 +1535,11 @@ fsubrs 64(%rdx,%rax) // CHECK: encoding: [0xd8,0x2a] fsubrs (%rdx) -// CHECK: fsubr %st(0), %st(4) +// CHECK: fsubr %st, %st(4) // CHECK: encoding: [0xdc,0xec] -fsubr %st(0), %st(4) +fsubr %st, %st(4) -// CHECK: fsubr %st(4) +// CHECK: fsubr %st(4), %st // CHECK: encoding: [0xd8,0xec] fsubr %st(4) @@ -1567,11 +1567,11 @@ fsubs 64(%rdx,%rax) // CHECK: encoding: [0xd8,0x22] fsubs (%rdx) -// CHECK: fsub %st(0), %st(4) +// CHECK: fsub %st, %st(4) // CHECK: encoding: [0xdc,0xe4] -fsub %st(0), %st(4) +fsub %st, %st(4) -// CHECK: fsub %st(4) +// CHECK: fsub %st(4), %st // CHECK: encoding: [0xd8,0xe4] fsub %st(4) diff --git a/test/MC/X86/intel-syntax-2.s b/test/MC/X86/intel-syntax-2.s index aead5766db4d..b23965ae52e8 100644 --- a/test/MC/X86/intel-syntax-2.s +++ b/test/MC/X86/intel-syntax-2.s @@ -18,14 +18,14 @@ _test2: _test3: fadd -// CHECK: faddp %st(1) +// CHECK: faddp %st, %st(1) fmul -// CHECK: fmulp %st(1) +// CHECK: fmulp %st, %st(1) fsub -// CHECK: fsubp %st(1) +// CHECK: fsubp %st, %st(1) fsubr -// CHECK: fsubrp %st(1) +// CHECK: fsubrp %st, %st(1) fdiv -// CHECK: fdivp %st(1) +// CHECK: fdivp %st, %st(1) fdivr -// CHECK: fdivrp %st(1) +// CHECK: fdivrp %st, %st(1) diff --git a/test/MC/X86/intel-syntax.s b/test/MC/X86/intel-syntax.s index 428a7e4ec41f..171357e1f521 100644 --- a/test/MC/X86/intel-syntax.s +++ b/test/MC/X86/intel-syntax.s @@ -556,12 +556,12 @@ fnstsw fnstsw AX fnstsw WORD PTR [EAX] -// CHECK: faddp %st(1) -// CHECK: fmulp %st(1) -// CHECK: fsubrp %st(1) -// CHECK: fsubp %st(1) -// CHECK: fdivrp %st(1) -// CHECK: fdivp %st(1) +// CHECK: faddp %st, %st(1) +// CHECK: fmulp %st, %st(1) +// CHECK: fsubrp %st, %st(1) +// CHECK: fsubp %st, %st(1) +// CHECK: fdivrp %st, %st(1) +// CHECK: fdivp %st, %st(1) faddp ST(1), ST(0) fmulp ST(1), ST(0) fsubp ST(1), ST(0) @@ -569,12 +569,12 @@ fsubrp ST(1), ST(0) fdivp ST(1), ST(0) fdivrp ST(1), ST(0) -// CHECK: faddp %st(1) -// CHECK: fmulp %st(1) -// CHECK: fsubrp %st(1) -// CHECK: fsubp %st(1) -// CHECK: fdivrp %st(1) -// CHECK: fdivp %st(1) +// CHECK: faddp %st, %st(1) +// CHECK: fmulp %st, %st(1) +// CHECK: fsubrp %st, %st(1) +// CHECK: fsubp %st, %st(1) +// CHECK: fdivrp %st, %st(1) +// CHECK: fdivp %st, %st(1) faddp ST(0), ST(1) fmulp ST(0), ST(1) fsubp ST(0), ST(1) @@ -582,12 +582,12 @@ fsubrp ST(0), ST(1) fdivp ST(0), ST(1) fdivrp ST(0), ST(1) -// CHECK: faddp %st(1) -// CHECK: fmulp %st(1) -// CHECK: fsubrp %st(1) -// CHECK: fsubp %st(1) -// CHECK: fdivrp %st(1) -// CHECK: fdivp %st(1) +// CHECK: faddp %st, %st(1) +// CHECK: fmulp %st, %st(1) +// CHECK: fsubrp %st, %st(1) +// CHECK: fsubp %st, %st(1) +// CHECK: fdivrp %st, %st(1) +// CHECK: fdivp %st, %st(1) faddp ST(1) fmulp ST(1) fsubp ST(1) @@ -596,12 +596,12 @@ fdivp ST(1) fdivrp ST(1) -// CHECK: faddp %st(1) -// CHECK: fmulp %st(1) -// CHECK: fsubrp %st(1) -// CHECK: fsubp %st(1) -// CHECK: fdivrp %st(1) -// CHECK: fdivp %st(1) +// CHECK: faddp %st, %st(1) +// CHECK: fmulp %st, %st(1) +// CHECK: fsubrp %st, %st(1) +// CHECK: fsubp %st, %st(1) +// CHECK: fdivrp %st, %st(1) +// CHECK: fdivp %st, %st(1) fadd fmul fsub @@ -609,12 +609,12 @@ fsubr fdiv fdivr -// CHECK: faddp %st(1) -// CHECK: fmulp %st(1) -// CHECK: fsubrp %st(1) -// CHECK: fsubp %st(1) -// CHECK: fdivrp %st(1) -// CHECK: fdivp %st(1) +// CHECK: faddp %st, %st(1) +// CHECK: fmulp %st, %st(1) +// CHECK: fsubrp %st, %st(1) +// CHECK: fsubp %st, %st(1) +// CHECK: fdivrp %st, %st(1) +// CHECK: fdivp %st, %st(1) faddp fmulp fsubp @@ -622,12 +622,12 @@ fsubrp fdivp fdivrp -// CHECK: fadd %st(1) -// CHECK: fmul %st(1) -// CHECK: fsub %st(1) -// CHECK: fsubr %st(1) -// CHECK: fdiv %st(1) -// CHECK: fdivr %st(1) +// CHECK: fadd %st(1), %st +// CHECK: fmul %st(1), %st +// CHECK: fsub %st(1), %st +// CHECK: fsubr %st(1), %st +// CHECK: fdiv %st(1), %st +// CHECK: fdivr %st(1), %st fadd ST(0), ST(1) fmul ST(0), ST(1) fsub ST(0), ST(1) @@ -635,12 +635,12 @@ fsubr ST(0), ST(1) fdiv ST(0), ST(1) fdivr ST(0), ST(1) -// CHECK: fadd %st(0), %st(1) -// CHECK: fmul %st(0), %st(1) -// CHECK: fsubr %st(0), %st(1) -// CHECK: fsub %st(0), %st(1) -// CHECK: fdivr %st(0), %st(1) -// CHECK: fdiv %st(0), %st(1) +// CHECK: fadd %st, %st(1) +// CHECK: fmul %st, %st(1) +// CHECK: fsubr %st, %st(1) +// CHECK: fsub %st, %st(1) +// CHECK: fdivr %st, %st(1) +// CHECK: fdiv %st, %st(1) fadd ST(1), ST(0) fmul ST(1), ST(0) fsub ST(1), ST(0) @@ -648,12 +648,12 @@ fsubr ST(1), ST(0) fdiv ST(1), ST(0) fdivr ST(1), ST(0) -// CHECK: fadd %st(1) -// CHECK: fmul %st(1) -// CHECK: fsub %st(1) -// CHECK: fsubr %st(1) -// CHECK: fdiv %st(1) -// CHECK: fdivr %st(1) +// CHECK: fadd %st(1), %st +// CHECK: fmul %st(1), %st +// CHECK: fsub %st(1), %st +// CHECK: fsubr %st(1), %st +// CHECK: fdiv %st(1), %st +// CHECK: fdivr %st(1), %st fadd ST(1) fmul ST(1) fsub ST(1) diff --git a/test/MC/X86/x86-16.s b/test/MC/X86/x86-16.s index 50263beaa675..88ee77a6d414 100644 --- a/test/MC/X86/x86-16.s +++ b/test/MC/X86/x86-16.s @@ -920,11 +920,11 @@ pshufw $90, %mm4, %mm0 str %eax -// CHECK: fsubp +// CHECK: fsubp %st, %st(1) // CHECK: encoding: [0xde,0xe1] fsubp %st,%st(1) -// CHECK: fsubp %st(2) +// CHECK: fsubp %st, %st(2) // CHECK: encoding: [0xde,0xe2] fsubp %st, %st(2) diff --git a/test/MC/X86/x86-32-coverage.s b/test/MC/X86/x86-32-coverage.s index 32281f412164..ba59fb357b97 100644 --- a/test/MC/X86/x86-32-coverage.s +++ b/test/MC/X86/x86-32-coverage.s @@ -2472,11 +2472,11 @@ // CHECK: encoding: [0xda,0x05,0x78,0x56,0x34,0x12] fiaddl 0x12345678 -// CHECK: faddp %st(2) +// CHECK: faddp %st, %st(2) // CHECK: encoding: [0xde,0xc2] faddp %st(2) -// CHECK: fsub %st(2) +// CHECK: fsub %st(2), %st // CHECK: encoding: [0xd8,0xe2] fsub %st(2) @@ -2504,11 +2504,11 @@ // CHECK: encoding: [0xda,0x25,0x78,0x56,0x34,0x12] fisubl 0x12345678 -// CHECK: fsubp %st(2) +// CHECK: fsubp %st, %st(2) // CHECK: encoding: [0xde,0xe2] fsubp %st(2) -// CHECK: fsubr %st(2) +// CHECK: fsubr %st(2), %st // CHECK: encoding: [0xd8,0xea] fsubr %st(2) @@ -2536,11 +2536,11 @@ // CHECK: encoding: [0xda,0x2d,0x78,0x56,0x34,0x12] fisubrl 0x12345678 -// CHECK: fsubrp %st(2) +// CHECK: fsubrp %st, %st(2) // CHECK: encoding: [0xde,0xea] fsubrp %st(2) -// CHECK: fmul %st(2) +// CHECK: fmul %st(2), %st // CHECK: encoding: [0xd8,0xca] fmul %st(2) @@ -2568,11 +2568,11 @@ // CHECK: encoding: [0xda,0x0d,0x78,0x56,0x34,0x12] fimull 0x12345678 -// CHECK: fmulp %st(2) +// CHECK: fmulp %st, %st(2) // CHECK: encoding: [0xde,0xca] fmulp %st(2) -// CHECK: fdiv %st(2) +// CHECK: fdiv %st(2), %st // CHECK: encoding: [0xd8,0xf2] fdiv %st(2) @@ -2600,11 +2600,11 @@ // CHECK: encoding: [0xda,0x35,0x78,0x56,0x34,0x12] fidivl 0x12345678 -// CHECK: fdivp %st(2) +// CHECK: fdivp %st, %st(2) // CHECK: encoding: [0xde,0xf2] fdivp %st(2) -// CHECK: fdivr %st(2) +// CHECK: fdivr %st(2), %st // CHECK: encoding: [0xd8,0xfa] fdivr %st(2) @@ -2632,7 +2632,7 @@ // CHECK: encoding: [0xda,0x3d,0x78,0x56,0x34,0x12] fidivrl 0x12345678 -// CHECK: fdivrp %st(2) +// CHECK: fdivrp %st, %st(2) // CHECK: encoding: [0xde,0xfa] fdivrp %st(2) @@ -2876,35 +2876,35 @@ // CHECK: encoding: [0x0f,0x0b] ud2 -// CHECK: fcmovb %st(2), %st(0) +// CHECK: fcmovb %st(2), %st // CHECK: encoding: [0xda,0xc2] fcmovb %st(2),%st -// CHECK: fcmove %st(2), %st(0) +// CHECK: fcmove %st(2), %st // CHECK: encoding: [0xda,0xca] fcmove %st(2),%st -// CHECK: fcmovbe %st(2), %st(0) +// CHECK: fcmovbe %st(2), %st // CHECK: encoding: [0xda,0xd2] fcmovbe %st(2),%st -// CHECK: fcmovu %st(2), %st(0) +// CHECK: fcmovu %st(2), %st // CHECK: encoding: [0xda,0xda] fcmovu %st(2),%st -// CHECK: fcmovnb %st(2), %st(0) +// CHECK: fcmovnb %st(2), %st // CHECK: encoding: [0xdb,0xc2] fcmovnb %st(2),%st -// CHECK: fcmovne %st(2), %st(0) +// CHECK: fcmovne %st(2), %st // CHECK: encoding: [0xdb,0xca] fcmovne %st(2),%st -// CHECK: fcmovnbe %st(2), %st(0) +// CHECK: fcmovnbe %st(2), %st // CHECK: encoding: [0xdb,0xd2] fcmovnbe %st(2),%st -// CHECK: fcmovnu %st(2), %st(0) +// CHECK: fcmovnu %st(2), %st // CHECK: encoding: [0xdb,0xda] fcmovnu %st(2),%st diff --git a/test/MC/X86/x86-32.s b/test/MC/X86/x86-32.s index 69d360325934..1593c26b9d02 100644 --- a/test/MC/X86/x86-32.s +++ b/test/MC/X86/x86-32.s @@ -1055,7 +1055,7 @@ pshufw $90, %mm4, %mm0 fsubp %st,%st(1) // PR9164 -// CHECK: fsubp %st(2) +// CHECK: fsubp %st, %st(2) // CHECK: encoding: [0xde,0xe2] fsubp %st, %st(2) diff --git a/test/MC/X86/x86-64.s b/test/MC/X86/x86-64.s index df811a6c4cf2..e35ba19fc4f2 100644 --- a/test/MC/X86/x86-64.s +++ b/test/MC/X86/x86-64.s @@ -307,13 +307,13 @@ insl (%dx), %es:(%rdi) // CHECK: fxch %st(1) // CHECK: fucom %st(1) // CHECK: fucomp %st(1) -// CHECK: faddp %st(1) -// CHECK: faddp %st(0) -// CHECK: fsubp %st(1) -// CHECK: fsubrp %st(1) -// CHECK: fmulp %st(1) -// CHECK: fdivp %st(1) -// CHECK: fdivrp %st(1) +// CHECK: faddp %st, %st(1) +// CHECK: faddp %st, %st(0) +// CHECK: fsubp %st, %st(1) +// CHECK: fsubrp %st, %st(1) +// CHECK: fmulp %st, %st(1) +// CHECK: fdivp %st, %st(1) +// CHECK: fdivrp %st, %st(1) fxch fucom @@ -416,21 +416,21 @@ enter $0x7ace,$0x7f mov %cs, %ax // rdar://8456391 -fcmovb %st(1), %st(0) // CHECK: fcmovb %st(1), %st(0) -fcmove %st(1), %st(0) // CHECK: fcmove %st(1), %st(0) -fcmovbe %st(1), %st(0) // CHECK: fcmovbe %st(1), %st(0) -fcmovu %st(1), %st(0) // CHECK: fcmovu %st(1), %st(0) +fcmovb %st(1), %st // CHECK: fcmovb %st(1), %st +fcmove %st(1), %st // CHECK: fcmove %st(1), %st +fcmovbe %st(1), %st // CHECK: fcmovbe %st(1), %st +fcmovu %st(1), %st // CHECK: fcmovu %st(1), %st -fcmovnb %st(1), %st(0) // CHECK: fcmovnb %st(1), %st(0) -fcmovne %st(1), %st(0) // CHECK: fcmovne %st(1), %st(0) -fcmovnbe %st(1), %st(0) // CHECK: fcmovnbe %st(1), %st(0) -fcmovnu %st(1), %st(0) // CHECK: fcmovnu %st(1), %st(0) +fcmovnb %st(1), %st // CHECK: fcmovnb %st(1), %st +fcmovne %st(1), %st // CHECK: fcmovne %st(1), %st +fcmovnbe %st(1), %st // CHECK: fcmovnbe %st(1), %st +fcmovnu %st(1), %st // CHECK: fcmovnu %st(1), %st -fcmovnae %st(1), %st(0) // CHECK: fcmovb %st(1), %st(0) -fcmovna %st(1), %st(0) // CHECK: fcmovbe %st(1), %st(0) +fcmovnae %st(1), %st // CHECK: fcmovb %st(1), %st +fcmovna %st(1), %st // CHECK: fcmovbe %st(1), %st -fcmovae %st(1), %st(0) // CHECK: fcmovnb %st(1), %st(0) -fcmova %st(1), %st(0) // CHECK: fcmovnbe %st(1), %st(0) +fcmovae %st(1), %st // CHECK: fcmovnb %st(1), %st +fcmova %st(1), %st // CHECK: fcmovnbe %st(1), %st // rdar://8456417 .byte (88 + 1) & 15 // CHECK: .byte 9 @@ -456,20 +456,20 @@ mov %rdx, %db15 // CHECK: encoding: [0x44,0x0f,0x23,0xfa] // rdar://8456371 - Handle commutable instructions written backward. -// CHECK: faddp %st(1) -// CHECK: fmulp %st(2) +// CHECK: faddp %st, %st(1) +// CHECK: fmulp %st, %st(2) faddp %st, %st(1) fmulp %st, %st(2) // rdar://8468087 - Encode these accurately, they are not synonyms. -// CHECK: fmul %st(0), %st(1) +// CHECK: fmul %st, %st(1) // CHECK: encoding: [0xdc,0xc9] // CHECK: fmul %st(1) // CHECK: encoding: [0xd8,0xc9] fmul %st, %st(1) fmul %st(1), %st -// CHECK: fadd %st(0), %st(1) +// CHECK: fadd %st, %st(1) // CHECK: encoding: [0xdc,0xc1] // CHECK: fadd %st(1) // CHECK: encoding: [0xd8,0xc1] @@ -582,15 +582,15 @@ movmskpd %xmm6, %eax // CHECK: encoding: [0x66,0x0f,0x50,0xc6] // rdar://8491845 - Gas supports commuted forms of non-commutable instructions. -fdivrp %st(0), %st(1) // CHECK: encoding: [0xde,0xf9] -fdivrp %st(1), %st(0) // CHECK: encoding: [0xde,0xf9] +fdivrp %st, %st(1) // CHECK: encoding: [0xde,0xf9] +fdivrp %st(1), %st // CHECK: encoding: [0xde,0xf9] -fsubrp %st(0), %st(1) // CHECK: encoding: [0xde,0xe9] -fsubrp %st(1), %st(0) // CHECK: encoding: [0xde,0xe9] +fsubrp %st, %st(1) // CHECK: encoding: [0xde,0xe9] +fsubrp %st(1), %st // CHECK: encoding: [0xde,0xe9] // also PR8861 -fdivp %st(0), %st(1) // CHECK: encoding: [0xde,0xf1] -fdivp %st(1), %st(0) // CHECK: encoding: [0xde,0xf1] +fdivp %st, %st(1) // CHECK: encoding: [0xde,0xf1] +fdivp %st(1), %st // CHECK: encoding: [0xde,0xf1] movl foo(%rip), %eax @@ -1391,38 +1391,38 @@ clac // CHECK: encoding: [0x0f,0x01,0xcb] stac -// CHECK: faddp %st(1) -// CHECK: fmulp %st(1) -// CHECK: fsubp %st(1) -// CHECK: fsubrp %st(1) -// CHECK: fdivp %st(1) -// CHECK: fdivrp %st(1) -faddp %st(0), %st(1) -fmulp %st(0), %st(1) -fsubp %st(0), %st(1) -fsubrp %st(0), %st(1) -fdivp %st(0), %st(1) -fdivrp %st(0), %st(1) +// CHECK: faddp %st, %st(1) +// CHECK: fmulp %st, %st(1) +// CHECK: fsubp %st, %st(1) +// CHECK: fsubrp %st, %st(1) +// CHECK: fdivp %st, %st(1) +// CHECK: fdivrp %st, %st(1) +faddp %st, %st(1) +fmulp %st, %st(1) +fsubp %st, %st(1) +fsubrp %st, %st(1) +fdivp %st, %st(1) +fdivrp %st, %st(1) -// CHECK: faddp %st(1) -// CHECK: fmulp %st(1) -// CHECK: fsubp %st(1) -// CHECK: fsubrp %st(1) -// CHECK: fdivp %st(1) -// CHECK: fdivrp %st(1) -faddp %st(1), %st(0) -fmulp %st(1), %st(0) -fsubp %st(1), %st(0) -fsubrp %st(1), %st(0) -fdivp %st(1), %st(0) -fdivrp %st(1), %st(0) +// CHECK: faddp %st, %st(1) +// CHECK: fmulp %st, %st(1) +// CHECK: fsubp %st, %st(1) +// CHECK: fsubrp %st, %st(1) +// CHECK: fdivp %st, %st(1) +// CHECK: fdivrp %st, %st(1) +faddp %st(1), %st +fmulp %st(1), %st +fsubp %st(1), %st +fsubrp %st(1), %st +fdivp %st(1), %st +fdivrp %st(1), %st -// CHECK: faddp %st(1) -// CHECK: fmulp %st(1) -// CHECK: fsubp %st(1) -// CHECK: fsubrp %st(1) -// CHECK: fdivp %st(1) -// CHECK: fdivrp %st(1) +// CHECK: faddp %st, %st(1) +// CHECK: fmulp %st, %st(1) +// CHECK: fsubp %st, %st(1) +// CHECK: fsubrp %st, %st(1) +// CHECK: fdivp %st, %st(1) +// CHECK: fdivrp %st, %st(1) faddp %st(1) fmulp %st(1) fsubp %st(1) @@ -1430,12 +1430,12 @@ fsubrp %st(1) fdivp %st(1) fdivrp %st(1) -// CHECK: faddp %st(1) -// CHECK: fmulp %st(1) -// CHECK: fsubp %st(1) -// CHECK: fsubrp %st(1) -// CHECK: fdivp %st(1) -// CHECK: fdivrp %st(1) +// CHECK: faddp %st, %st(1) +// CHECK: fmulp %st, %st(1) +// CHECK: fsubp %st, %st(1) +// CHECK: fsubrp %st, %st(1) +// CHECK: fdivp %st, %st(1) +// CHECK: fdivrp %st, %st(1) faddp fmulp fsubp @@ -1449,25 +1449,25 @@ fdivrp // CHECK: fsubr %st(1) // CHECK: fdiv %st(1) // CHECK: fdivr %st(1) -fadd %st(1), %st(0) -fmul %st(1), %st(0) -fsub %st(1), %st(0) -fsubr %st(1), %st(0) -fdiv %st(1), %st(0) -fdivr %st(1), %st(0) +fadd %st(1), %st +fmul %st(1), %st +fsub %st(1), %st +fsubr %st(1), %st +fdiv %st(1), %st +fdivr %st(1), %st -// CHECK: fadd %st(0), %st(1) -// CHECK: fmul %st(0), %st(1) -// CHECK: fsub %st(0), %st(1) -// CHECK: fsubr %st(0), %st(1) -// CHECK: fdiv %st(0), %st(1) -// CHECK: fdivr %st(0), %st(1) -fadd %st(0), %st(1) -fmul %st(0), %st(1) -fsub %st(0), %st(1) -fsubr %st(0), %st(1) -fdiv %st(0), %st(1) -fdivr %st(0), %st(1) +// CHECK: fadd %st, %st(1) +// CHECK: fmul %st, %st(1) +// CHECK: fsub %st, %st(1) +// CHECK: fsubr %st, %st(1) +// CHECK: fdiv %st, %st(1) +// CHECK: fdivr %st, %st(1) +fadd %st, %st(1) +fmul %st, %st(1) +fsub %st, %st(1) +fsubr %st, %st(1) +fdiv %st, %st(1) +fdivr %st, %st(1) // CHECK: fadd %st(1) // CHECK: fmul %st(1) diff --git a/test/Transforms/InstCombine/double-float-shrink-1.ll b/test/Transforms/InstCombine/double-float-shrink-1.ll index c170f2ca74ba..e8f7f720b152 100644 --- a/test/Transforms/InstCombine/double-float-shrink-1.ll +++ b/test/Transforms/InstCombine/double-float-shrink-1.ll @@ -1,8 +1,8 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -instcombine -S | FileCheck %s - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" +; RUN: opt < %s -instcombine -S -mtriple x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=CHECK,LINUX,ISC99 +; RUN: opt < %s -instcombine -S -mtriple x86_64-pc-win32 | FileCheck %s --check-prefixes=CHECK,ISC99 +; RUN: opt < %s -instcombine -S -mtriple x86_64-pc-windows-msvc16 | FileCheck %s --check-prefixes=CHECK,MS64,ISC89 +; RUN: opt < %s -instcombine -S -mtriple i386-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,ISC99 +; RUN: opt < %s -instcombine -S -mtriple i686-pc-windows-msvc17 | FileCheck %s --check-prefixes=CHECK,MS32,ISC89 ; Check for and against shrinkage when using the ; unsafe-fp-math function attribute on a math lib @@ -12,8 +12,10 @@ target triple = "x86_64-unknown-linux-gnu" define float @acos_test1(float %f) { ; CHECK-LABEL: @acos_test1( -; CHECK-NEXT: [[ACOSF:%.*]] = call fast float @acosf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[ACOSF]] +; LINUX-NEXT: [[ACOSF:%.*]] = call fast float @acosf(float [[F:%.*]]) +; LINUX-NEXT: ret float [[ACOSF]] +; MS32: [[ACOSF:%.*]] = call fast double @acos(double [[F:%.*]]) +; MS64-NEXT: [[ACOSF:%.*]] = call fast float @acosf(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @acos(double %conv) @@ -34,8 +36,9 @@ define double @acos_test2(float %f) { define float @acosh_test1(float %f) { ; CHECK-LABEL: @acosh_test1( -; CHECK-NEXT: [[ACOSHF:%.*]] = call fast float @acoshf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[ACOSHF]] +; ISC99-NEXT: [[ACOSHF:%.*]] = call fast float @acoshf(float [[F:%.*]]) +; ISC99-NEXT: ret float [[ACOSHF]] +; ISC89: [[ACOSHF:%.*]] = call fast double @acosh(double [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @acosh(double %conv) @@ -56,8 +59,10 @@ define double @acosh_test2(float %f) { define float @asin_test1(float %f) { ; CHECK-LABEL: @asin_test1( -; CHECK-NEXT: [[ASINF:%.*]] = call fast float @asinf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[ASINF]] +; LINUX-NEXT: [[ASINF:%.*]] = call fast float @asinf(float [[F:%.*]]) +; LINUX-NEXT: ret float [[ASINF]] +; MS32: [[ASINF:%.*]] = call fast double @asin(double [[F:%.*]]) +; MS64-NEXT: [[ASINF:%.*]] = call fast float @asinf(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @asin(double %conv) @@ -78,8 +83,9 @@ define double @asin_test2(float %f) { define float @asinh_test1(float %f) { ; CHECK-LABEL: @asinh_test1( -; CHECK-NEXT: [[ASINHF:%.*]] = call fast float @asinhf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[ASINHF]] +; ISC99-NEXT: [[ASINHF:%.*]] = call fast float @asinhf(float [[F:%.*]]) +; ISC99-NEXT: ret float [[ASINHF]] +; ISC89: [[ASINHF:%.*]] = call fast double @asinh(double [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @asinh(double %conv) @@ -100,8 +106,10 @@ define double @asinh_test2(float %f) { define float @atan_test1(float %f) { ; CHECK-LABEL: @atan_test1( -; CHECK-NEXT: [[ATANF:%.*]] = call fast float @atanf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[ATANF]] +; LINUX-NEXT: [[ATANF:%.*]] = call fast float @atanf(float [[F:%.*]]) +; LINUX-NEXT: ret float [[ATANF]] +; MS32: [[ATANF:%.*]] = call fast double @atan(double [[F:%.*]]) +; MS64-NEXT: [[ATANF:%.*]] = call fast float @atanf(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @atan(double %conv) @@ -122,8 +130,9 @@ define double @atan_test2(float %f) { define float @atanh_test1(float %f) { ; CHECK-LABEL: @atanh_test1( -; CHECK-NEXT: [[ATANHF:%.*]] = call fast float @atanhf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[ATANHF]] +; ISC99-NEXT: [[ATANHF:%.*]] = call fast float @atanhf(float [[F:%.*]]) +; ISC99-NEXT: ret float [[ATANHF]] +; ISC89: [[ATANHF:%.*]] = call fast double @atanh(double [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @atanh(double %conv) @@ -144,8 +153,9 @@ define double @atanh_test2(float %f) { define float @cbrt_test1(float %f) { ; CHECK-LABEL: @cbrt_test1( -; CHECK-NEXT: [[CBRTF:%.*]] = call fast float @cbrtf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[CBRTF]] +; ISC99-NEXT: [[CBRTF:%.*]] = call fast float @cbrtf(float [[F:%.*]]) +; ISC99-NEXT: ret float [[CBRTF]] +; ISC89: [[CBRTF:%.*]] = call fast double @cbrt(double [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @cbrt(double %conv) @@ -166,8 +176,10 @@ define double @cbrt_test2(float %f) { define float @exp_test1(float %f) { ; CHECK-LABEL: @exp_test1( -; CHECK-NEXT: [[EXPF:%.*]] = call fast float @expf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[EXPF]] +; LINUX-NEXT: [[EXPF:%.*]] = call fast float @expf(float [[F:%.*]]) +; LINUX-NEXT: ret float [[EXPF]] +; MS32: [[EXPF:%.*]] = call fast double @exp(double [[F:%.*]]) +; MS64-NEXT: [[EXPF:%.*]] = call fast float @expf(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @exp(double %conv) @@ -188,8 +200,9 @@ define double @exp_test2(float %f) { define float @expm1_test1(float %f) { ; CHECK-LABEL: @expm1_test1( -; CHECK-NEXT: [[EXPM1F:%.*]] = call fast float @expm1f(float [[F:%.*]]) -; CHECK-NEXT: ret float [[EXPM1F]] +; ISC99-NEXT: [[EXPM1F:%.*]] = call fast float @expm1f(float [[F:%.*]]) +; ISC99-NEXT: ret float [[EXPM1F]] +; ISC89: [[EXPM1F:%.*]] = call fast double @expm1(double [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @expm1(double %conv) @@ -236,8 +249,10 @@ define double @exp10_test2(float %f) { define float @log_test1(float %f) { ; CHECK-LABEL: @log_test1( -; CHECK-NEXT: [[LOGF:%.*]] = call fast float @logf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[LOGF]] +; LINUX-NEXT: [[LOGF:%.*]] = call fast float @logf(float [[F:%.*]]) +; LINUX-NEXT: ret float [[LOGF]] +; MS32: [[LOGF:%.*]] = call fast double @log(double [[F:%.*]]) +; MS64-NEXT: [[LOGF:%.*]] = call fast float @logf(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @log(double %conv) @@ -258,8 +273,10 @@ define double @log_test2(float %f) { define float @log10_test1(float %f) { ; CHECK-LABEL: @log10_test1( -; CHECK-NEXT: [[LOG10F:%.*]] = call fast float @log10f(float [[F:%.*]]) -; CHECK-NEXT: ret float [[LOG10F]] +; LINUX-NEXT: [[LOG10F:%.*]] = call fast float @log10f(float [[F:%.*]]) +; LINUX-NEXT: ret float [[LOG10F]] +; MS32: [[LOG10F:%.*]] = call fast double @log10(double [[F:%.*]]) +; MS64-NEXT: [[LOG10F:%.*]] = call fast float @log10f(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @log10(double %conv) @@ -280,8 +297,9 @@ define double @log10_test2(float %f) { define float @log1p_test1(float %f) { ; CHECK-LABEL: @log1p_test1( -; CHECK-NEXT: [[LOG1PF:%.*]] = call fast float @log1pf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[LOG1PF]] +; ISC99-NEXT: [[LOG1PF:%.*]] = call fast float @log1pf(float [[F:%.*]]) +; ISC99-NEXT: ret float [[LOG1PF]] +; ISC89: [[LOG1PF:%.*]] = call fast double @log1p(double [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @log1p(double %conv) @@ -302,8 +320,9 @@ define double @log1p_test2(float %f) { define float @log2_test1(float %f) { ; CHECK-LABEL: @log2_test1( -; CHECK-NEXT: [[LOG2F:%.*]] = call fast float @log2f(float [[F:%.*]]) -; CHECK-NEXT: ret float [[LOG2F]] +; ISC99-NEXT: [[LOG2F:%.*]] = call fast float @log2f(float [[F:%.*]]) +; ISC99-NEXT: ret float [[LOG2F]] +; ISC89: [[LOG2F:%.*]] = call fast double @log2(double [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @log2(double %conv) @@ -324,8 +343,10 @@ define double @log2_test2(float %f) { define float @logb_test1(float %f) { ; CHECK-LABEL: @logb_test1( -; CHECK-NEXT: [[LOGBF:%.*]] = call fast float @logbf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[LOGBF]] +; LINUX-NEXT: [[LOGBF:%.*]] = call fast float @logbf(float [[F:%.*]]) +; LINUX-NEXT: ret float [[LOGBF]] +; MS32: [[POWF:%.*]] = call fast double @logb(double [[F:%.*]]) +; MS64-NEXT: [[LOGBF:%.*]] = call fast float @logbf(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @logb(double %conv) @@ -346,8 +367,10 @@ define double @logb_test2(float %f) { define float @pow_test1(float %f, float %g) { ; CHECK-LABEL: @pow_test1( -; CHECK-NEXT: [[POWF:%.*]] = call fast float @powf(float %f, float %g) -; CHECK-NEXT: ret float [[POWF]] +; LINUX-NEXT: [[POWF:%.*]] = call fast float @powf(float %f, float %g) +; LINUX-NEXT: ret float [[POWF]] +; MS32: [[POWF:%.*]] = call fast double @pow(double %df, double %dg) +; MS64-NEXT: [[POWF:%.*]] = call fast float @powf(float %f, float %g) ; %df = fpext float %f to double %dg = fpext float %g to double @@ -369,8 +392,10 @@ define double @pow_test2(float %f, float %g) { define float @sin_test1(float %f) { ; CHECK-LABEL: @sin_test1( -; CHECK-NEXT: [[SINF:%.*]] = call fast float @sinf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[SINF]] +; LINUX-NEXT: [[SINF:%.*]] = call fast float @sinf(float [[F:%.*]]) +; LINUX-NEXT: ret float [[SINF]] +; MS32: [[SINF:%.*]] = call fast double @sin(double [[F:%.*]]) +; MS64-NEXT: [[SINF:%.*]] = call fast float @sinf(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @sin(double %conv) @@ -391,8 +416,10 @@ define double @sin_test2(float %f) { define float @sqrt_test1(float %f) { ; CHECK-LABEL: @sqrt_test1( -; CHECK-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[SQRTF]] +; LINUX-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[F:%.*]]) +; LINUX-NEXT: ret float [[SQRTF]] +; MS32: [[SQRTF:%.*]] = call double @sqrt(double [[F:%.*]]) +; MS64-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call double @sqrt(double %conv) @@ -413,8 +440,10 @@ define double @sqrt_test2(float %f) { define float @sqrt_int_test1(float %f) { ; CHECK-LABEL: @sqrt_int_test1( -; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.sqrt.f32(float [[F:%.*]]) -; CHECK-NEXT: ret float [[TMP1]] +; LINUX-NEXT: [[TMP1:%.*]] = call float @llvm.sqrt.f32(float [[F:%.*]]) +; LINUX-NEXT: ret float [[TMP1]] +; MS32: [[TMP1:%.*]] = call double @llvm.sqrt.f64(double [[F:%.*]]) +; MS64-NEXT: [[TMP1:%.*]] = call float @llvm.sqrt.f32(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call double @llvm.sqrt.f64(double %conv) @@ -435,8 +464,10 @@ define double @sqrt_int_test2(float %f) { define float @tan_test1(float %f) { ; CHECK-LABEL: @tan_test1( -; CHECK-NEXT: [[TANF:%.*]] = call fast float @tanf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[TANF]] +; LINUX-NEXT: [[TANF:%.*]] = call fast float @tanf(float [[F:%.*]]) +; LINUX-NEXT: ret float [[TANF]] +; MS32: [[TANF:%.*]] = call fast double @tan(double [[F:%.*]]) +; MS64-NEXT: [[TANF:%.*]] = call fast float @tanf(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @tan(double %conv) @@ -456,8 +487,10 @@ define double @tan_test2(float %f) { } define float @tanh_test1(float %f) { ; CHECK-LABEL: @tanh_test1( -; CHECK-NEXT: [[TANHF:%.*]] = call fast float @tanhf(float [[F:%.*]]) -; CHECK-NEXT: ret float [[TANHF]] +; LINUX-NEXT: [[TANHF:%.*]] = call fast float @tanhf(float [[F:%.*]]) +; LINUX-NEXT: ret float [[TANHF]] +; MS32: [[TANHF:%.*]] = call fast double @tanh(double [[F:%.*]]) +; MS64-NEXT: [[TANHF:%.*]] = call fast float @tanhf(float [[F:%.*]]) ; %conv = fpext float %f to double %call = call fast double @tanh(double %conv) @@ -480,8 +513,9 @@ define double @tanh_test2(float %f) { ; flags are propagated for shrunken *binary* double FP calls. define float @max1(float %a, float %b) { ; CHECK-LABEL: @max1( -; CHECK-NEXT: [[FMAXF:%.*]] = call arcp float @fmaxf(float [[A:%.*]], float [[B:%.*]]) -; CHECK-NEXT: ret float [[FMAXF]] +; ISC99-NEXT: [[FMAXF:%.*]] = call arcp float @fmaxf(float [[A:%.*]], float [[B:%.*]]) +; ISC99-NEXT: ret float [[FMAXF]] +; ISC89: [[FMAXF:%.*]] = call arcp double @fmax(double [[A:%.*]], double [[B:%.*]]) ; %c = fpext float %a to double %d = fpext float %b to double diff --git a/test/Transforms/InstCombine/double-float-shrink-2.ll b/test/Transforms/InstCombine/double-float-shrink-2.ll index 5bdeaf7d9d7e..76e497bd68fc 100644 --- a/test/Transforms/InstCombine/double-float-shrink-2.ll +++ b/test/Transforms/InstCombine/double-float-shrink-2.ll @@ -1,11 +1,11 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck -check-prefix=ALL -check-prefix=DO-SIMPLIFY %s -; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck -check-prefix=ALL -check-prefix=DONT-SIMPLIFY %s -; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck -check-prefix=ALL -check-prefix=C89-SIMPLIFY %s -; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck -check-prefix=ALL -check-prefix=DO-SIMPLIFY %s -; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck -check-prefix=ALL -check-prefix=DO-SIMPLIFY %s -; RUN: opt < %s -instcombine -S -mtriple "sparc-sun-solaris" | FileCheck -check-prefix=ALL -check-prefix=DO-SIMPLIFY %s -; RUN: opt < %s -enable-debugify -instcombine -S -mtriple "x86_64-pc-win32" 2>&1 | FileCheck -check-prefix=DBG-VALID %s +; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck %s +; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck %s +; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck %s +; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck %s +; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck %s +; RUN: opt < %s -instcombine -S -mtriple "sparc-sun-solaris" | FileCheck %s +; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" -enable-debugify 2>&1 | FileCheck --check-prefix=DBG-VALID %s declare double @floor(double) declare double @ceil(double) @@ -36,9 +36,9 @@ declare double @llvm.trunc.f64(double) declare <2 x double> @llvm.trunc.v2f64(<2 x double>) define float @test_shrink_libcall_floor(float %C) { -; ALL-LABEL: @test_shrink_libcall_floor( -; ALL-NEXT: [[F:%.*]] = call float @llvm.floor.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_libcall_floor( +; CHECK-NEXT: [[F:%.*]] = call float @llvm.floor.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[F]] ; %D = fpext float %C to double ; --> floorf @@ -48,9 +48,9 @@ define float @test_shrink_libcall_floor(float %C) { } define float @test_shrink_libcall_ceil(float %C) { -; ALL-LABEL: @test_shrink_libcall_ceil( -; ALL-NEXT: [[F:%.*]] = call float @llvm.ceil.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_libcall_ceil( +; CHECK-NEXT: [[F:%.*]] = call float @llvm.ceil.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[F]] ; %D = fpext float %C to double ; --> ceilf @@ -60,21 +60,9 @@ define float @test_shrink_libcall_ceil(float %C) { } define float @test_shrink_libcall_round(float %C) { -; DO-SIMPLIFY-LABEL: @test_shrink_libcall_round( -; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.round.f32(float [[C:%.*]]) -; DO-SIMPLIFY-NEXT: ret float [[F]] -; -; DONT-SIMPLIFY-LABEL: @test_shrink_libcall_round( -; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double -; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @round(double [[D]]) -; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; DONT-SIMPLIFY-NEXT: ret float [[F]] -; -; C89-SIMPLIFY-LABEL: @test_shrink_libcall_round( -; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double -; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @round(double [[D]]) -; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; C89-SIMPLIFY-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_libcall_round( +; CHECK-NEXT: [[F:%.*]] = call float @llvm.round.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[F]] ; %D = fpext float %C to double ; --> roundf @@ -84,21 +72,9 @@ define float @test_shrink_libcall_round(float %C) { } define float @test_shrink_libcall_nearbyint(float %C) { -; DO-SIMPLIFY-LABEL: @test_shrink_libcall_nearbyint( -; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]]) -; DO-SIMPLIFY-NEXT: ret float [[F]] -; -; DONT-SIMPLIFY-LABEL: @test_shrink_libcall_nearbyint( -; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double -; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @nearbyint(double [[D]]) -; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; DONT-SIMPLIFY-NEXT: ret float [[F]] -; -; C89-SIMPLIFY-LABEL: @test_shrink_libcall_nearbyint( -; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double -; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @nearbyint(double [[D]]) -; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; C89-SIMPLIFY-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_libcall_nearbyint( +; CHECK-NEXT: [[F:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[F]] ; %D = fpext float %C to double ; --> nearbyintf @@ -108,21 +84,9 @@ define float @test_shrink_libcall_nearbyint(float %C) { } define float @test_shrink_libcall_trunc(float %C) { -; DO-SIMPLIFY-LABEL: @test_shrink_libcall_trunc( -; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]]) -; DO-SIMPLIFY-NEXT: ret float [[F]] -; -; DONT-SIMPLIFY-LABEL: @test_shrink_libcall_trunc( -; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double -; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @trunc(double [[D]]) -; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; DONT-SIMPLIFY-NEXT: ret float [[F]] -; -; C89-SIMPLIFY-LABEL: @test_shrink_libcall_trunc( -; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double -; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @trunc(double [[D]]) -; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; C89-SIMPLIFY-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_libcall_trunc( +; CHECK-NEXT: [[F:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[F]] ; %D = fpext float %C to double ; --> truncf @@ -132,11 +96,11 @@ define float @test_shrink_libcall_trunc(float %C) { } ; This is replaced with the intrinsic, which does the right thing on -; all platforms. +; CHECK platforms. define float @test_shrink_libcall_fabs(float %C) { -; ALL-LABEL: @test_shrink_libcall_fabs( -; ALL-NEXT: [[F:%.*]] = call float @llvm.fabs.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_libcall_fabs( +; CHECK-NEXT: [[F:%.*]] = call float @llvm.fabs.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[F]] ; %D = fpext float %C to double %E = call double @fabs(double %D) @@ -146,9 +110,9 @@ define float @test_shrink_libcall_fabs(float %C) { ; Make sure fast math flags are preserved define float @test_shrink_libcall_fabs_fast(float %C) { -; ALL-LABEL: @test_shrink_libcall_fabs_fast( -; ALL-NEXT: [[F:%.*]] = call fast float @llvm.fabs.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_libcall_fabs_fast( +; CHECK-NEXT: [[F:%.*]] = call fast float @llvm.fabs.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[F]] ; %D = fpext float %C to double %E = call fast double @fabs(double %D) @@ -157,9 +121,9 @@ define float @test_shrink_libcall_fabs_fast(float %C) { } define float @test_shrink_intrin_ceil(float %C) { -; ALL-LABEL: @test_shrink_intrin_ceil( -; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.ceil.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[TMP1]] +; CHECK-LABEL: @test_shrink_intrin_ceil( +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ceil.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[TMP1]] ; %D = fpext float %C to double %E = call double @llvm.ceil.f64(double %D) @@ -168,9 +132,9 @@ define float @test_shrink_intrin_ceil(float %C) { } define float @test_shrink_intrin_fabs(float %C) { -; ALL-LABEL: @test_shrink_intrin_fabs( -; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[TMP1]] +; CHECK-LABEL: @test_shrink_intrin_fabs( +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[TMP1]] ; %D = fpext float %C to double %E = call double @llvm.fabs.f64(double %D) @@ -179,9 +143,9 @@ define float @test_shrink_intrin_fabs(float %C) { } define float @test_shrink_intrin_floor(float %C) { -; ALL-LABEL: @test_shrink_intrin_floor( -; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.floor.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[TMP1]] +; CHECK-LABEL: @test_shrink_intrin_floor( +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.floor.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[TMP1]] ; %D = fpext float %C to double %E = call double @llvm.floor.f64(double %D) @@ -190,9 +154,9 @@ define float @test_shrink_intrin_floor(float %C) { } define float @test_shrink_intrin_nearbyint(float %C) { -; ALL-LABEL: @test_shrink_intrin_nearbyint( -; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[TMP1]] +; CHECK-LABEL: @test_shrink_intrin_nearbyint( +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[TMP1]] ; %D = fpext float %C to double %E = call double @llvm.nearbyint.f64(double %D) @@ -201,9 +165,9 @@ define float @test_shrink_intrin_nearbyint(float %C) { } define half @test_shrink_intrin_rint(half %C) { -; ALL-LABEL: @test_shrink_intrin_rint( -; ALL-NEXT: [[TMP1:%.*]] = call half @llvm.rint.f16(half [[C:%.*]]) -; ALL-NEXT: ret half [[TMP1]] +; CHECK-LABEL: @test_shrink_intrin_rint( +; CHECK-NEXT: [[TMP1:%.*]] = call half @llvm.rint.f16(half [[C:%.*]]) +; CHECK-NEXT: ret half [[TMP1]] ; %D = fpext half %C to float %E = call float @llvm.rint.f32(float %D) @@ -212,9 +176,9 @@ define half @test_shrink_intrin_rint(half %C) { } define float @test_shrink_intrin_round(float %C) { -; ALL-LABEL: @test_shrink_intrin_round( -; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.round.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[TMP1]] +; CHECK-LABEL: @test_shrink_intrin_round( +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.round.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[TMP1]] ; %D = fpext float %C to double %E = call double @llvm.round.f64(double %D) @@ -223,9 +187,9 @@ define float @test_shrink_intrin_round(float %C) { } define float @test_shrink_intrin_trunc(float %C) { -; ALL-LABEL: @test_shrink_intrin_trunc( -; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[TMP1]] +; CHECK-LABEL: @test_shrink_intrin_trunc( +; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[TMP1]] ; %D = fpext float %C to double %E = call double @llvm.trunc.f64(double %D) @@ -237,12 +201,12 @@ declare void @use_v2f64(<2 x double>) declare void @use_v2f32(<2 x float>) define <2 x float> @test_shrink_intrin_ceil_multi_use(<2 x float> %C) { -; ALL-LABEL: @test_shrink_intrin_ceil_multi_use( -; ALL-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double> -; ALL-NEXT: [[E:%.*]] = call <2 x double> @llvm.ceil.v2f64(<2 x double> [[D]]) -; ALL-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float> -; ALL-NEXT: call void @use_v2f64(<2 x double> [[D]]) -; ALL-NEXT: ret <2 x float> [[F]] +; CHECK-LABEL: @test_shrink_intrin_ceil_multi_use( +; CHECK-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double> +; CHECK-NEXT: [[E:%.*]] = call <2 x double> @llvm.ceil.v2f64(<2 x double> [[D]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float> +; CHECK-NEXT: call void @use_v2f64(<2 x double> [[D]]) +; CHECK-NEXT: ret <2 x float> [[F]] ; %D = fpext <2 x float> %C to <2 x double> %E = call <2 x double> @llvm.ceil.v2f64(<2 x double> %D) @@ -252,11 +216,11 @@ define <2 x float> @test_shrink_intrin_ceil_multi_use(<2 x float> %C) { } define <2 x float> @test_shrink_intrin_fabs_multi_use(<2 x float> %C) { -; ALL-LABEL: @test_shrink_intrin_fabs_multi_use( -; ALL-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[C:%.*]]) -; ALL-NEXT: [[E:%.*]] = fpext <2 x float> [[TMP1]] to <2 x double> -; ALL-NEXT: call void @use_v2f64(<2 x double> [[E]]) -; ALL-NEXT: ret <2 x float> [[TMP1]] +; CHECK-LABEL: @test_shrink_intrin_fabs_multi_use( +; CHECK-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[C:%.*]]) +; CHECK-NEXT: [[E:%.*]] = fpext <2 x float> [[TMP1]] to <2 x double> +; CHECK-NEXT: call void @use_v2f64(<2 x double> [[E]]) +; CHECK-NEXT: ret <2 x float> [[TMP1]] ; %D = fpext <2 x float> %C to <2 x double> %E = call <2 x double> @llvm.fabs.v2f64(<2 x double> %D) @@ -266,13 +230,13 @@ define <2 x float> @test_shrink_intrin_fabs_multi_use(<2 x float> %C) { } define <2 x float> @test_shrink_intrin_floor_multi_use(<2 x float> %C) { -; ALL-LABEL: @test_shrink_intrin_floor_multi_use( -; ALL-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double> -; ALL-NEXT: [[E:%.*]] = call <2 x double> @llvm.floor.v2f64(<2 x double> [[D]]) -; ALL-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float> -; ALL-NEXT: call void @use_v2f64(<2 x double> [[D]]) -; ALL-NEXT: call void @use_v2f64(<2 x double> [[E]]) -; ALL-NEXT: ret <2 x float> [[F]] +; CHECK-LABEL: @test_shrink_intrin_floor_multi_use( +; CHECK-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double> +; CHECK-NEXT: [[E:%.*]] = call <2 x double> @llvm.floor.v2f64(<2 x double> [[D]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float> +; CHECK-NEXT: call void @use_v2f64(<2 x double> [[D]]) +; CHECK-NEXT: call void @use_v2f64(<2 x double> [[E]]) +; CHECK-NEXT: ret <2 x float> [[F]] ; %D = fpext <2 x float> %C to <2 x double> %E = call <2 x double> @llvm.floor.v2f64(<2 x double> %D) @@ -283,12 +247,12 @@ define <2 x float> @test_shrink_intrin_floor_multi_use(<2 x float> %C) { } define <2 x float> @test_shrink_intrin_nearbyint_multi_use(<2 x float> %C) { -; ALL-LABEL: @test_shrink_intrin_nearbyint_multi_use( -; ALL-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double> -; ALL-NEXT: [[E:%.*]] = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> [[D]]) -; ALL-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float> -; ALL-NEXT: call void @use_v2f64(<2 x double> [[D]]) -; ALL-NEXT: ret <2 x float> [[F]] +; CHECK-LABEL: @test_shrink_intrin_nearbyint_multi_use( +; CHECK-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double> +; CHECK-NEXT: [[E:%.*]] = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> [[D]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float> +; CHECK-NEXT: call void @use_v2f64(<2 x double> [[D]]) +; CHECK-NEXT: ret <2 x float> [[F]] ; %D = fpext <2 x float> %C to <2 x double> %E = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %D) @@ -298,11 +262,11 @@ define <2 x float> @test_shrink_intrin_nearbyint_multi_use(<2 x float> %C) { } define <2 x half> @test_shrink_intrin_rint_multi_use(<2 x half> %C) { -; ALL-LABEL: @test_shrink_intrin_rint_multi_use( -; ALL-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.rint.v2f16(<2 x half> [[C:%.*]]) -; ALL-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x float> -; ALL-NEXT: call void @use_v2f32(<2 x float> [[E]]) -; ALL-NEXT: ret <2 x half> [[TMP1]] +; CHECK-LABEL: @test_shrink_intrin_rint_multi_use( +; CHECK-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.rint.v2f16(<2 x half> [[C:%.*]]) +; CHECK-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x float> +; CHECK-NEXT: call void @use_v2f32(<2 x float> [[E]]) +; CHECK-NEXT: ret <2 x half> [[TMP1]] ; %D = fpext <2 x half> %C to <2 x float> %E = call <2 x float> @llvm.rint.v2f32(<2 x float> %D) @@ -312,13 +276,13 @@ define <2 x half> @test_shrink_intrin_rint_multi_use(<2 x half> %C) { } define <2 x float> @test_shrink_intrin_round_multi_use(<2 x float> %C) { -; ALL-LABEL: @test_shrink_intrin_round_multi_use( -; ALL-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double> -; ALL-NEXT: [[E:%.*]] = call <2 x double> @llvm.round.v2f64(<2 x double> [[D]]) -; ALL-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float> -; ALL-NEXT: call void @use_v2f64(<2 x double> [[D]]) -; ALL-NEXT: call void @use_v2f64(<2 x double> [[E]]) -; ALL-NEXT: ret <2 x float> [[F]] +; CHECK-LABEL: @test_shrink_intrin_round_multi_use( +; CHECK-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double> +; CHECK-NEXT: [[E:%.*]] = call <2 x double> @llvm.round.v2f64(<2 x double> [[D]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float> +; CHECK-NEXT: call void @use_v2f64(<2 x double> [[D]]) +; CHECK-NEXT: call void @use_v2f64(<2 x double> [[E]]) +; CHECK-NEXT: ret <2 x float> [[F]] ; %D = fpext <2 x float> %C to <2 x double> %E = call <2 x double> @llvm.round.v2f64(<2 x double> %D) @@ -329,12 +293,12 @@ define <2 x float> @test_shrink_intrin_round_multi_use(<2 x float> %C) { } define <2 x float> @test_shrink_intrin_trunc_multi_use(<2 x float> %C) { -; ALL-LABEL: @test_shrink_intrin_trunc_multi_use( -; ALL-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double> -; ALL-NEXT: [[E:%.*]] = call <2 x double> @llvm.trunc.v2f64(<2 x double> [[D]]) -; ALL-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float> -; ALL-NEXT: call void @use_v2f64(<2 x double> [[D]]) -; ALL-NEXT: ret <2 x float> [[F]] +; CHECK-LABEL: @test_shrink_intrin_trunc_multi_use( +; CHECK-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double> +; CHECK-NEXT: [[E:%.*]] = call <2 x double> @llvm.trunc.v2f64(<2 x double> [[D]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float> +; CHECK-NEXT: call void @use_v2f64(<2 x double> [[D]]) +; CHECK-NEXT: ret <2 x float> [[F]] ; %D = fpext <2 x float> %C to <2 x double> %E = call <2 x double> @llvm.trunc.v2f64(<2 x double> %D) @@ -345,9 +309,9 @@ define <2 x float> @test_shrink_intrin_trunc_multi_use(<2 x float> %C) { ; Make sure fast math flags are preserved define float @test_shrink_intrin_fabs_fast(float %C) { -; ALL-LABEL: @test_shrink_intrin_fabs_fast( -; ALL-NEXT: [[TMP1:%.*]] = call fast float @llvm.fabs.f32(float [[C:%.*]]) -; ALL-NEXT: ret float [[TMP1]] +; CHECK-LABEL: @test_shrink_intrin_fabs_fast( +; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.fabs.f32(float [[C:%.*]]) +; CHECK-NEXT: ret float [[TMP1]] ; %D = fpext float %C to double %E = call fast double @llvm.fabs.f64(double %D) @@ -356,10 +320,10 @@ define float @test_shrink_intrin_fabs_fast(float %C) { } define float @test_no_shrink_intrin_floor(double %D) { -; ALL-LABEL: @test_no_shrink_intrin_floor( -; ALL-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D:%.*]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_no_shrink_intrin_floor( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; CHECK-NEXT: ret float [[F]] ; %E = call double @llvm.floor.f64(double %D) %F = fptrunc double %E to float @@ -367,10 +331,10 @@ define float @test_no_shrink_intrin_floor(double %D) { } define float @test_no_shrink_intrin_ceil(double %D) { -; ALL-LABEL: @test_no_shrink_intrin_ceil( -; ALL-NEXT: [[E:%.*]] = call double @llvm.ceil.f64(double [[D:%.*]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_no_shrink_intrin_ceil( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.ceil.f64(double [[D:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; CHECK-NEXT: ret float [[F]] ; %E = call double @llvm.ceil.f64(double %D) %F = fptrunc double %E to float @@ -378,10 +342,10 @@ define float @test_no_shrink_intrin_ceil(double %D) { } define float @test_no_shrink_intrin_round(double %D) { -; ALL-LABEL: @test_no_shrink_intrin_round( -; ALL-NEXT: [[E:%.*]] = call double @llvm.round.f64(double [[D:%.*]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_no_shrink_intrin_round( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.round.f64(double [[D:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; CHECK-NEXT: ret float [[F]] ; %E = call double @llvm.round.f64(double %D) %F = fptrunc double %E to float @@ -389,10 +353,10 @@ define float @test_no_shrink_intrin_round(double %D) { } define float @test_no_shrink_intrin_nearbyint(double %D) { -; ALL-LABEL: @test_no_shrink_intrin_nearbyint( -; ALL-NEXT: [[E:%.*]] = call double @llvm.nearbyint.f64(double [[D:%.*]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_no_shrink_intrin_nearbyint( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.nearbyint.f64(double [[D:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; CHECK-NEXT: ret float [[F]] ; %E = call double @llvm.nearbyint.f64(double %D) %F = fptrunc double %E to float @@ -400,10 +364,10 @@ define float @test_no_shrink_intrin_nearbyint(double %D) { } define float @test_no_shrink_intrin_trunc(double %D) { -; ALL-LABEL: @test_no_shrink_intrin_trunc( -; ALL-NEXT: [[E:%.*]] = call double @llvm.trunc.f64(double [[D:%.*]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_no_shrink_intrin_trunc( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.trunc.f64(double [[D:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; CHECK-NEXT: ret float [[F]] ; %E = call double @llvm.trunc.f64(double %D) %F = fptrunc double %E to float @@ -411,10 +375,10 @@ define float @test_no_shrink_intrin_trunc(double %D) { } define float @test_shrink_intrin_fabs_double_src(double %D) { -; ALL-LABEL: @test_shrink_intrin_fabs_double_src( -; ALL-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to float -; ALL-NEXT: [[F:%.*]] = call float @llvm.fabs.f32(float [[TMP1]]) -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_intrin_fabs_double_src( +; CHECK-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to float +; CHECK-NEXT: [[F:%.*]] = call float @llvm.fabs.f32(float [[TMP1]]) +; CHECK-NEXT: ret float [[F]] ; %E = call double @llvm.fabs.f64(double %D) %F = fptrunc double %E to float @@ -423,10 +387,10 @@ define float @test_shrink_intrin_fabs_double_src(double %D) { ; Make sure fast math flags are preserved define float @test_shrink_intrin_fabs_fast_double_src(double %D) { -; ALL-LABEL: @test_shrink_intrin_fabs_fast_double_src( -; ALL-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to float -; ALL-NEXT: [[F:%.*]] = call fast float @llvm.fabs.f32(float [[TMP1]]) -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_intrin_fabs_fast_double_src( +; CHECK-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to float +; CHECK-NEXT: [[F:%.*]] = call fast float @llvm.fabs.f32(float [[TMP1]]) +; CHECK-NEXT: ret float [[F]] ; %E = call fast double @llvm.fabs.f64(double %D) %F = fptrunc double %E to float @@ -434,8 +398,8 @@ define float @test_shrink_intrin_fabs_fast_double_src(double %D) { } define float @test_shrink_float_convertible_constant_intrin_floor() { -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_floor( -; ALL-NEXT: ret float 2.000000e+00 +; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_floor( +; CHECK-NEXT: ret float 2.000000e+00 ; %E = call double @llvm.floor.f64(double 2.1) %F = fptrunc double %E to float @@ -443,8 +407,8 @@ define float @test_shrink_float_convertible_constant_intrin_floor() { } define float @test_shrink_float_convertible_constant_intrin_ceil() { -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_ceil( -; ALL-NEXT: ret float 3.000000e+00 +; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_ceil( +; CHECK-NEXT: ret float 3.000000e+00 ; %E = call double @llvm.ceil.f64(double 2.1) %F = fptrunc double %E to float @@ -452,8 +416,8 @@ define float @test_shrink_float_convertible_constant_intrin_ceil() { } define float @test_shrink_float_convertible_constant_intrin_round() { -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_round( -; ALL-NEXT: ret float 2.000000e+00 +; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_round( +; CHECK-NEXT: ret float 2.000000e+00 ; %E = call double @llvm.round.f64(double 2.1) %F = fptrunc double %E to float @@ -461,8 +425,8 @@ define float @test_shrink_float_convertible_constant_intrin_round() { } define float @test_shrink_float_convertible_constant_intrin_nearbyint() { -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_nearbyint( -; ALL-NEXT: ret float 2.000000e+00 +; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_nearbyint( +; CHECK-NEXT: ret float 2.000000e+00 ; %E = call double @llvm.nearbyint.f64(double 2.1) %F = fptrunc double %E to float @@ -470,8 +434,8 @@ define float @test_shrink_float_convertible_constant_intrin_nearbyint() { } define float @test_shrink_float_convertible_constant_intrin_trunc() { -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_trunc( -; ALL-NEXT: ret float 2.000000e+00 +; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_trunc( +; CHECK-NEXT: ret float 2.000000e+00 ; %E = call double @llvm.trunc.f64(double 2.1) %F = fptrunc double %E to float @@ -479,8 +443,8 @@ define float @test_shrink_float_convertible_constant_intrin_trunc() { } define float @test_shrink_float_convertible_constant_intrin_fabs() { -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_fabs( -; ALL-NEXT: ret float 0x4000CCCCC0000000 +; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_fabs( +; CHECK-NEXT: ret float 0x4000CCCCC0000000 ; %E = call double @llvm.fabs.f64(double 2.1) %F = fptrunc double %E to float @@ -489,8 +453,8 @@ define float @test_shrink_float_convertible_constant_intrin_fabs() { ; Make sure fast math flags are preserved define float @test_shrink_float_convertible_constant_intrin_fabs_fast() { -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_fabs_fast( -; ALL-NEXT: ret float 0x4000CCCCC0000000 +; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_fabs_fast( +; CHECK-NEXT: ret float 0x4000CCCCC0000000 ; %E = call fast double @llvm.fabs.f64(double 2.1) %F = fptrunc double %E to float @@ -498,10 +462,10 @@ define float @test_shrink_float_convertible_constant_intrin_fabs_fast() { } define half @test_no_shrink_mismatched_type_intrin_floor(double %D) { -; ALL-LABEL: @test_no_shrink_mismatched_type_intrin_floor( -; ALL-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D:%.*]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to half -; ALL-NEXT: ret half [[F]] +; CHECK-LABEL: @test_no_shrink_mismatched_type_intrin_floor( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to half +; CHECK-NEXT: ret half [[F]] ; %E = call double @llvm.floor.f64(double %D) %F = fptrunc double %E to half @@ -509,10 +473,10 @@ define half @test_no_shrink_mismatched_type_intrin_floor(double %D) { } define half @test_no_shrink_mismatched_type_intrin_ceil(double %D) { -; ALL-LABEL: @test_no_shrink_mismatched_type_intrin_ceil( -; ALL-NEXT: [[E:%.*]] = call double @llvm.ceil.f64(double [[D:%.*]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to half -; ALL-NEXT: ret half [[F]] +; CHECK-LABEL: @test_no_shrink_mismatched_type_intrin_ceil( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.ceil.f64(double [[D:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to half +; CHECK-NEXT: ret half [[F]] ; %E = call double @llvm.ceil.f64(double %D) %F = fptrunc double %E to half @@ -520,10 +484,10 @@ define half @test_no_shrink_mismatched_type_intrin_ceil(double %D) { } define half @test_no_shrink_mismatched_type_intrin_round(double %D) { -; ALL-LABEL: @test_no_shrink_mismatched_type_intrin_round( -; ALL-NEXT: [[E:%.*]] = call double @llvm.round.f64(double [[D:%.*]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to half -; ALL-NEXT: ret half [[F]] +; CHECK-LABEL: @test_no_shrink_mismatched_type_intrin_round( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.round.f64(double [[D:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to half +; CHECK-NEXT: ret half [[F]] ; %E = call double @llvm.round.f64(double %D) %F = fptrunc double %E to half @@ -531,10 +495,10 @@ define half @test_no_shrink_mismatched_type_intrin_round(double %D) { } define half @test_no_shrink_mismatched_type_intrin_nearbyint(double %D) { -; ALL-LABEL: @test_no_shrink_mismatched_type_intrin_nearbyint( -; ALL-NEXT: [[E:%.*]] = call double @llvm.nearbyint.f64(double [[D:%.*]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to half -; ALL-NEXT: ret half [[F]] +; CHECK-LABEL: @test_no_shrink_mismatched_type_intrin_nearbyint( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.nearbyint.f64(double [[D:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to half +; CHECK-NEXT: ret half [[F]] ; %E = call double @llvm.nearbyint.f64(double %D) %F = fptrunc double %E to half @@ -542,10 +506,10 @@ define half @test_no_shrink_mismatched_type_intrin_nearbyint(double %D) { } define half @test_no_shrink_mismatched_type_intrin_trunc(double %D) { -; ALL-LABEL: @test_no_shrink_mismatched_type_intrin_trunc( -; ALL-NEXT: [[E:%.*]] = call double @llvm.trunc.f64(double [[D:%.*]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to half -; ALL-NEXT: ret half [[F]] +; CHECK-LABEL: @test_no_shrink_mismatched_type_intrin_trunc( +; CHECK-NEXT: [[E:%.*]] = call double @llvm.trunc.f64(double [[D:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to half +; CHECK-NEXT: ret half [[F]] ; %E = call double @llvm.trunc.f64(double %D) %F = fptrunc double %E to half @@ -553,10 +517,10 @@ define half @test_no_shrink_mismatched_type_intrin_trunc(double %D) { } define half @test_shrink_mismatched_type_intrin_fabs_double_src(double %D) { -; ALL-LABEL: @test_shrink_mismatched_type_intrin_fabs_double_src( -; ALL-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to half -; ALL-NEXT: [[F:%.*]] = call half @llvm.fabs.f16(half [[TMP1]]) -; ALL-NEXT: ret half [[F]] +; CHECK-LABEL: @test_shrink_mismatched_type_intrin_fabs_double_src( +; CHECK-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to half +; CHECK-NEXT: [[F:%.*]] = call half @llvm.fabs.f16(half [[TMP1]]) +; CHECK-NEXT: ret half [[F]] ; %E = call double @llvm.fabs.f64(double %D) %F = fptrunc double %E to half @@ -565,10 +529,10 @@ define half @test_shrink_mismatched_type_intrin_fabs_double_src(double %D) { ; Make sure fast math flags are preserved define half @test_mismatched_type_intrin_fabs_fast_double_src(double %D) { -; ALL-LABEL: @test_mismatched_type_intrin_fabs_fast_double_src( -; ALL-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to half -; ALL-NEXT: [[F:%.*]] = call fast half @llvm.fabs.f16(half [[TMP1]]) -; ALL-NEXT: ret half [[F]] +; CHECK-LABEL: @test_mismatched_type_intrin_fabs_fast_double_src( +; CHECK-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to half +; CHECK-NEXT: [[F:%.*]] = call fast half @llvm.fabs.f16(half [[TMP1]]) +; CHECK-NEXT: ret half [[F]] ; %E = call fast double @llvm.fabs.f64(double %D) %F = fptrunc double %E to half @@ -576,10 +540,10 @@ define half @test_mismatched_type_intrin_fabs_fast_double_src(double %D) { } define <2 x double> @test_shrink_intrin_floor_fp16_vec(<2 x half> %C) { -; ALL-LABEL: @test_shrink_intrin_floor_fp16_vec( -; ALL-NEXT: [[TMP1:%.*]] = call arcp <2 x half> @llvm.floor.v2f16(<2 x half> [[C:%.*]]) -; ALL-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double> -; ALL-NEXT: ret <2 x double> [[E]] +; CHECK-LABEL: @test_shrink_intrin_floor_fp16_vec( +; CHECK-NEXT: [[TMP1:%.*]] = call arcp <2 x half> @llvm.floor.v2f16(<2 x half> [[C:%.*]]) +; CHECK-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double> +; CHECK-NEXT: ret <2 x double> [[E]] ; %D = fpext <2 x half> %C to <2 x double> %E = call arcp <2 x double> @llvm.floor.v2f64(<2 x double> %D) @@ -587,10 +551,10 @@ define <2 x double> @test_shrink_intrin_floor_fp16_vec(<2 x half> %C) { } define float @test_shrink_intrin_ceil_fp16_src(half %C) { -; ALL-LABEL: @test_shrink_intrin_ceil_fp16_src( -; ALL-NEXT: [[TMP1:%.*]] = call half @llvm.ceil.f16(half [[C:%.*]]) -; ALL-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_intrin_ceil_fp16_src( +; CHECK-NEXT: [[TMP1:%.*]] = call half @llvm.ceil.f16(half [[C:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float +; CHECK-NEXT: ret float [[F]] ; %D = fpext half %C to double %E = call double @llvm.ceil.f64(double %D) @@ -599,10 +563,10 @@ define float @test_shrink_intrin_ceil_fp16_src(half %C) { } define <2 x double> @test_shrink_intrin_round_fp16_vec(<2 x half> %C) { -; ALL-LABEL: @test_shrink_intrin_round_fp16_vec( -; ALL-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.round.v2f16(<2 x half> [[C:%.*]]) -; ALL-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double> -; ALL-NEXT: ret <2 x double> [[E]] +; CHECK-LABEL: @test_shrink_intrin_round_fp16_vec( +; CHECK-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.round.v2f16(<2 x half> [[C:%.*]]) +; CHECK-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double> +; CHECK-NEXT: ret <2 x double> [[E]] ; %D = fpext <2 x half> %C to <2 x double> %E = call <2 x double> @llvm.round.v2f64(<2 x double> %D) @@ -610,10 +574,10 @@ define <2 x double> @test_shrink_intrin_round_fp16_vec(<2 x half> %C) { } define float @test_shrink_intrin_nearbyint_fp16_src(half %C) { -; ALL-LABEL: @test_shrink_intrin_nearbyint_fp16_src( -; ALL-NEXT: [[TMP1:%.*]] = call half @llvm.nearbyint.f16(half [[C:%.*]]) -; ALL-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_intrin_nearbyint_fp16_src( +; CHECK-NEXT: [[TMP1:%.*]] = call half @llvm.nearbyint.f16(half [[C:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float +; CHECK-NEXT: ret float [[F]] ; %D = fpext half %C to double %E = call double @llvm.nearbyint.f64(double %D) @@ -622,10 +586,10 @@ define float @test_shrink_intrin_nearbyint_fp16_src(half %C) { } define <2 x double> @test_shrink_intrin_trunc_fp16_src(<2 x half> %C) { -; ALL-LABEL: @test_shrink_intrin_trunc_fp16_src( -; ALL-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.trunc.v2f16(<2 x half> [[C:%.*]]) -; ALL-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double> -; ALL-NEXT: ret <2 x double> [[E]] +; CHECK-LABEL: @test_shrink_intrin_trunc_fp16_src( +; CHECK-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.trunc.v2f16(<2 x half> [[C:%.*]]) +; CHECK-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double> +; CHECK-NEXT: ret <2 x double> [[E]] ; %D = fpext <2 x half> %C to <2 x double> %E = call <2 x double> @llvm.trunc.v2f64(<2 x double> %D) @@ -633,10 +597,10 @@ define <2 x double> @test_shrink_intrin_trunc_fp16_src(<2 x half> %C) { } define float @test_shrink_intrin_fabs_fp16_src(half %C) { -; ALL-LABEL: @test_shrink_intrin_fabs_fp16_src( -; ALL-NEXT: [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[C:%.*]]) -; ALL-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_intrin_fabs_fp16_src( +; CHECK-NEXT: [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[C:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float +; CHECK-NEXT: ret float [[F]] ; %D = fpext half %C to double %E = call double @llvm.fabs.f64(double %D) @@ -646,10 +610,10 @@ define float @test_shrink_intrin_fabs_fp16_src(half %C) { ; Make sure fast math flags are preserved define float @test_shrink_intrin_fabs_fast_fp16_src(half %C) { -; ALL-LABEL: @test_shrink_intrin_fabs_fast_fp16_src( -; ALL-NEXT: [[TMP1:%.*]] = call fast half @llvm.fabs.f16(half [[C:%.*]]) -; ALL-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_shrink_intrin_fabs_fast_fp16_src( +; CHECK-NEXT: [[TMP1:%.*]] = call fast half @llvm.fabs.f16(half [[C:%.*]]) +; CHECK-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float +; CHECK-NEXT: ret float [[F]] ; %D = fpext half %C to double %E = call fast double @llvm.fabs.f64(double %D) @@ -658,12 +622,12 @@ define float @test_shrink_intrin_fabs_fast_fp16_src(half %C) { } define float @test_no_shrink_intrin_floor_multi_use_fpext(half %C) { -; ALL-LABEL: @test_no_shrink_intrin_floor_multi_use_fpext( -; ALL-NEXT: [[D:%.*]] = fpext half [[C:%.*]] to double -; ALL-NEXT: store volatile double [[D]], double* undef, align 8 -; ALL-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_no_shrink_intrin_floor_multi_use_fpext( +; CHECK-NEXT: [[D:%.*]] = fpext half [[C:%.*]] to double +; CHECK-NEXT: store volatile double [[D]], double* undef, align 8 +; CHECK-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; CHECK-NEXT: ret float [[F]] ; %D = fpext half %C to double store volatile double %D, double* undef @@ -673,12 +637,12 @@ define float @test_no_shrink_intrin_floor_multi_use_fpext(half %C) { } define float @test_no_shrink_intrin_fabs_multi_use_fpext(half %C) { -; ALL-LABEL: @test_no_shrink_intrin_fabs_multi_use_fpext( -; ALL-NEXT: [[D:%.*]] = fpext half [[C:%.*]] to double -; ALL-NEXT: store volatile double [[D]], double* undef, align 8 -; ALL-NEXT: [[E:%.*]] = call double @llvm.fabs.f64(double [[D]]) -; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float -; ALL-NEXT: ret float [[F]] +; CHECK-LABEL: @test_no_shrink_intrin_fabs_multi_use_fpext( +; CHECK-NEXT: [[D:%.*]] = fpext half [[C:%.*]] to double +; CHECK-NEXT: store volatile double [[D]], double* undef, align 8 +; CHECK-NEXT: [[E:%.*]] = call double @llvm.fabs.f64(double [[D]]) +; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; CHECK-NEXT: ret float [[F]] ; %D = fpext half %C to double store volatile double %D, double* undef diff --git a/test/Transforms/InstCombine/pow-1.ll b/test/Transforms/InstCombine/pow-1.ll index 672ec70e71ec..957e2488b721 100644 --- a/test/Transforms/InstCombine/pow-1.ll +++ b/test/Transforms/InstCombine/pow-1.ll @@ -1,15 +1,18 @@ ; Test that the pow library call simplifier works correctly. ; -; RUN: opt -instcombine -S < %s | FileCheck %s --check-prefixes=ANY -; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.9 | FileCheck %s --check-prefixes=ANY,CHECK-EXP10 -; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios7.0 | FileCheck %s --check-prefixes=ANY,CHECK-EXP10 -; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.8 | FileCheck %s --check-prefixes=ANY,CHECK-NO-EXP10 -; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios6.0 | FileCheck %s --check-prefixes=ANY,CHECK-NO-EXP10 -; RUN: opt -instcombine -S < %s -mtriple=x86_64-netbsd | FileCheck %s --check-prefixes=ANY,CHECK-NO-EXP10 -; RUN: opt -instcombine -S < %s -mtriple=arm-apple-tvos9.0 | FileCheck %s --check-prefixes=ANY,CHECK-EXP10 -; RUN: opt -instcombine -S < %s -mtriple=arm-apple-watchos2.0 | FileCheck %s --check-prefixes=ANY,CHECK-EXP10 +; RUN: opt -instcombine -S < %s | FileCheck %s --check-prefixes=CHECK,ANY +; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.9 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-EXP10 +; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios7.0 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-EXP10 +; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.8 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-NO-EXP10 +; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios6.0 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-NO-EXP10 +; RUN: opt -instcombine -S < %s -mtriple=x86_64-netbsd | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-NO-EXP10 +; RUN: opt -instcombine -S < %s -mtriple=arm-apple-tvos9.0 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-EXP10 +; RUN: opt -instcombine -S < %s -mtriple=arm-apple-watchos2.0 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-EXP10 ; rdar://7251832 -; RUN: opt -instcombine -S < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK-WIN +; RUN: opt -instcombine -S < %s -mtriple=i386-pc-windows-msvc18 | FileCheck %s --check-prefixes=CHECK,MSVC,VC32,CHECK-NO-EXP10 +; RUN: opt -instcombine -S < %s -mtriple=i386-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,MSVC,VC51,VC19,CHECK-NO-EXP10 +; RUN: opt -instcombine -S < %s -mtriple=x86_64-pc-windows-msvc18 | FileCheck %s --check-prefixes=CHECK,MSVC,VC64,CHECK-NO-EXP10 +; RUN: opt -instcombine -S < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,MSVC,VC83,VC19,CHECK-NO-EXP10 ; NOTE: The readonly attribute on the pow call should be preserved ; in the cases below where pow is transformed into another function call. @@ -23,32 +26,39 @@ declare <2 x double> @llvm.pow.v2f64(<2 x double>, <2 x double>) nounwind readon ; Check pow(1.0, x) -> 1.0. define float @test_simplify1(float %x) { -; ANY-LABEL: @test_simplify1( +; CHECK-LABEL: @test_simplify1( ; ANY-NEXT: ret float 1.000000e+00 +; VC32-NEXT: [[POW:%.*]] = call float @powf(float 1.000000e+00, float [[X:%.*]]) +; VC32-NEXT: ret float [[POW]] +; VC64-NEXT: ret float 1.000000e+00 ; %retval = call float @powf(float 1.0, float %x) ret float %retval } define <2 x float> @test_simplify1v(<2 x float> %x) { -; ANY-LABEL: @test_simplify1v( +; CHECK-LABEL: @test_simplify1v( ; ANY-NEXT: ret <2 x float> +; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> , <2 x float> [[X:%.*]]) +; MSVC-NEXT: ret <2 x float> [[POW]] ; %retval = call <2 x float> @llvm.pow.v2f32(<2 x float> , <2 x float> %x) ret <2 x float> %retval } define double @test_simplify2(double %x) { -; ANY-LABEL: @test_simplify2( -; ANY-NEXT: ret double 1.000000e+00 +; CHECK-LABEL: @test_simplify2( +; CHECK-NEXT: ret double 1.000000e+00 ; %retval = call double @pow(double 1.0, double %x) ret double %retval } define <2 x double> @test_simplify2v(<2 x double> %x) { -; ANY-LABEL: @test_simplify2v( +; CHECK-LABEL: @test_simplify2v( ; ANY-NEXT: ret <2 x double> +; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> , <2 x double> [[X:%.*]]) +; MSVC-NEXT: ret <2 x double> [[POW]] ; %retval = call <2 x double> @llvm.pow.v2f64(<2 x double> , <2 x double> %x) ret <2 x double> %retval @@ -57,104 +67,114 @@ define <2 x double> @test_simplify2v(<2 x double> %x) { ; Check pow(2.0 ** n, x) -> exp2(n * x). define float @test_simplify3(float %x) { -; ANY-LABEL: @test_simplify3( -; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[X:%.*]]) [[NUW_RO:#[0-9]+]] +; CHECK-LABEL: @test_simplify3( +; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[X:%.*]]) ; ANY-NEXT: ret float [[EXP2F]] -; -; CHECK-WIN-LABEL: @test_simplify3( -; CHECK-WIN-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]]) -; CHECK-WIN-NEXT: ret float [[POW]] +; VC32-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]]) +; VC32-NEXT: ret float [[POW]] +; VC51-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]]) +; VC51-NEXT: ret float [[POW]] +; VC64-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]]) +; VC64-NEXT: ret float [[POW]] +; VC83-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[X:%.*]]) +; VC83-NEXT: ret float [[EXP2F]] ; %retval = call float @powf(float 2.0, float %x) ret float %retval } define double @test_simplify3n(double %x) { -; ANY-LABEL: @test_simplify3n( +; CHECK-LABEL: @test_simplify3n( ; ANY-NEXT: [[MUL:%.*]] = fmul double [[X:%.*]], -2.000000e+00 -; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]]) [[NUW_RO]] +; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]]) ; ANY-NEXT: ret double [[EXP2]] -; -; CHECK-WIN-LABEL: @test_simplify3n( -; CHECK-WIN-NEXT: [[POW:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]]) -; CHECK-WIN-NEXT: ret double [[POW]] +; VC19-NEXT: [[MUL:%.*]] = fmul double [[X:%.*]], -2.000000e+00 +; VC19-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]]) +; VC19-NEXT: ret double [[EXP2]] +; VC32-NEXT: [[POW:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]]) +; VC32-NEXT: ret double [[POW]] +; VC64-NEXT: [[POW:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]]) +; VC64-NEXT: ret double [[POW]] ; %retval = call double @pow(double 0.25, double %x) ret double %retval } define <2 x float> @test_simplify3v(<2 x float> %x) { -; ANY-LABEL: @test_simplify3v( +; CHECK-LABEL: @test_simplify3v( ; ANY-NEXT: [[EXP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[X:%.*]]) ; ANY-NEXT: ret <2 x float> [[EXP2]] -; -; CHECK-WIN-LABEL: @test_simplify3v( -; CHECK-WIN-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> , <2 x float> [[X:%.*]]) -; CHECK-WIN-NEXT: ret <2 x float> [[POW]] +; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> , <2 x float> [[X:%.*]]) +; MSVC-NEXT: ret <2 x float> [[POW]] ; %retval = call <2 x float> @llvm.pow.v2f32(<2 x float> , <2 x float> %x) ret <2 x float> %retval } define <2 x double> @test_simplify3vn(<2 x double> %x) { -; ANY-LABEL: @test_simplify3vn( +; CHECK-LABEL: @test_simplify3vn( ; ANY-NEXT: [[MUL:%.*]] = fmul <2 x double> [[X:%.*]], ; ANY-NEXT: [[EXP2:%.*]] = call <2 x double> @llvm.exp2.v2f64(<2 x double> [[MUL]]) ; ANY-NEXT: ret <2 x double> [[EXP2]] +; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> , <2 x double> [[X:%.*]]) +; MSVC-NEXT: ret <2 x double> [[POW]] ; %retval = call <2 x double> @llvm.pow.v2f64(<2 x double> , <2 x double> %x) ret <2 x double> %retval } define double @test_simplify4(double %x) { -; ANY-LABEL: @test_simplify4( -; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]]) [[NUW_RO]] +; CHECK-LABEL: @test_simplify4( +; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]]) ; ANY-NEXT: ret double [[EXP2]] -; -; CHECK-WIN-LABEL: @test_simplify4( -; CHECK-WIN-NEXT: [[POW:%.*]] = call double @pow(double 2.000000e+00, double [[X:%.*]]) -; CHECK-WIN-NEXT: ret double [[POW]] +; VC19-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]]) +; VC19-NEXT: ret double [[EXP2]] +; VC32-NEXT: [[POW:%.*]] = call double @pow(double 2.000000e+00, double [[X:%.*]]) +; VC32-NEXT: ret double [[POW]] +; VC64-NEXT: [[POW:%.*]] = call double @pow(double 2.000000e+00, double [[X:%.*]]) +; VC64-NEXT: ret double [[POW]] ; %retval = call double @pow(double 2.0, double %x) ret double %retval } define float @test_simplify4n(float %x) { -; ANY-LABEL: @test_simplify4n( +; CHECK-LABEL: @test_simplify4n( ; ANY-NEXT: [[MUL:%.*]] = fmul float [[X:%.*]], 3.000000e+00 -; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[MUL]]) [[NUW_RO]] +; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[MUL]]) ; ANY-NEXT: ret float [[EXP2F]] -; -; CHECK-WIN-LABEL: @test_simplify4n( -; CHECK-WIN-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]]) -; CHECK-WIN-NEXT: ret float [[POW]] +; VC32-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]]) +; VC32-NEXT: ret float [[POW]] +; VC51-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]]) +; VC51-NEXT: ret float [[POW]] +; VC64-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]]) +; VC64-NEXT: ret float [[POW]] +; VC83-NEXT: [[MUL:%.*]] = fmul float [[X:%.*]], 3.000000e+00 +; VC83-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[MUL]]) +; VC83-NEXT: ret float [[EXP2F]] ; %retval = call float @powf(float 8.0, float %x) ret float %retval } define <2 x double> @test_simplify4v(<2 x double> %x) { -; ANY-LABEL: @test_simplify4v( +; CHECK-LABEL: @test_simplify4v( ; ANY-NEXT: [[EXP2:%.*]] = call <2 x double> @llvm.exp2.v2f64(<2 x double> [[X:%.*]]) ; ANY-NEXT: ret <2 x double> [[EXP2]] -; -; CHECK-WIN-LABEL: @test_simplify4v( -; CHECK-WIN-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> , <2 x double> [[X:%.*]]) -; CHECK-WIN-NEXT: ret <2 x double> [[POW]] +; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> , <2 x double> [[X:%.*]]) +; MSVC-NEXT: ret <2 x double> [[POW]] ; %retval = call <2 x double> @llvm.pow.v2f64(<2 x double> , <2 x double> %x) ret <2 x double> %retval } define <2 x float> @test_simplify4vn(<2 x float> %x) { -; ANY-LABEL: @test_simplify4vn( +; CHECK-LABEL: @test_simplify4vn( ; ANY-NEXT: [[MUL:%.*]] = fsub <2 x float> , [[X:%.*]] ; ANY-NEXT: [[EXP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[MUL]]) ; ANY-NEXT: ret <2 x float> [[EXP2]] -; -; CHECK-WIN-LABEL: @test_simplify4vn( -; CHECK-WIN-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> , <2 x float> [[X:%.*]]) -; CHECK-WIN-NEXT: ret <2 x float> [[POW]] +; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> , <2 x float> [[X:%.*]]) +; MSVC-NEXT: ret <2 x float> [[POW]] ; %retval = call <2 x float> @llvm.pow.v2f32(<2 x float> , <2 x float> %x) ret <2 x float> %retval @@ -163,32 +183,42 @@ define <2 x float> @test_simplify4vn(<2 x float> %x) { ; Check pow(x, 0.0) -> 1.0. define float @test_simplify5(float %x) { -; ANY-LABEL: @test_simplify5( +; CHECK-LABEL: @test_simplify5( ; ANY-NEXT: ret float 1.000000e+00 +; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 0.000000e+00) +; VC32-NEXT: ret float [[POW]] +; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 0.000000e+00) +; VC51-NEXT: ret float [[POW]] +; VC64-NEXT: ret float 1.000000e+00 +; VC83-NEXT: ret float 1.000000e+00 ; %retval = call float @powf(float %x, float 0.0) ret float %retval } define <2 x float> @test_simplify5v(<2 x float> %x) { -; ANY-LABEL: @test_simplify5v( +; CHECK-LABEL: @test_simplify5v( ; ANY-NEXT: ret <2 x float> +; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> zeroinitializer) +; MSVC-NEXT: ret <2 x float> [[POW]] ; %retval = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> ) ret <2 x float> %retval } define double @test_simplify6(double %x) { -; ANY-LABEL: @test_simplify6( -; ANY-NEXT: ret double 1.000000e+00 +; CHECK-LABEL: @test_simplify6( +; CHECK-NEXT: ret double 1.000000e+00 ; %retval = call double @pow(double %x, double 0.0) ret double %retval } define <2 x double> @test_simplify6v(<2 x double> %x) { -; ANY-LABEL: @test_simplify6v( +; CHECK-LABEL: @test_simplify6v( ; ANY-NEXT: ret <2 x double> +; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> zeroinitializer) +; MSVC-NEXT: ret <2 x double> [[POW]] ; %retval = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> ) ret <2 x double> %retval @@ -197,24 +227,38 @@ define <2 x double> @test_simplify6v(<2 x double> %x) { ; Check pow(x, 0.5) -> fabs(sqrt(x)), where x != -infinity. define float @test_simplify7(float %x) { -; ANY-LABEL: @test_simplify7( -; ANY-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) [[NUW_RO]] +; CHECK-LABEL: @test_simplify7( +; ANY-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) ; ANY-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]]) ; ANY-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000 ; ANY-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]] ; ANY-NEXT: ret float [[TMP1]] +; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 5.000000e-01) +; VC32-NEXT: ret float [[POW]] +; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 5.000000e-01) +; VC51-NEXT: ret float [[POW]] +; VC64-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) +; VC64-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]]) +; VC64-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000 +; VC64-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]] +; VC64-NEXT: ret float [[TMP1]] +; VC83-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) +; VC83-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]]) +; VC83-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000 +; VC83-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]] +; VC83-NEXT: ret float [[TMP1]] ; %retval = call float @powf(float %x, float 0.5) ret float %retval } define double @test_simplify8(double %x) { -; ANY-LABEL: @test_simplify8( -; ANY-NEXT: [[SQRT:%.*]] = call double @sqrt(double [[X:%.*]]) [[NUW_RO]] -; ANY-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]]) -; ANY-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000 -; ANY-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]] -; ANY-NEXT: ret double [[TMP1]] +; CHECK-LABEL: @test_simplify8( +; CHECK-NEXT: [[SQRT:%.*]] = call double @sqrt(double [[X:%.*]]) +; CHECK-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]]) +; CHECK-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000 +; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]] +; CHECK-NEXT: ret double [[TMP1]] ; %retval = call double @pow(double %x, double 0.5) ret double %retval @@ -223,16 +267,22 @@ define double @test_simplify8(double %x) { ; Check pow(-infinity, 0.5) -> +infinity. define float @test_simplify9(float %x) { -; ANY-LABEL: @test_simplify9( +; CHECK-LABEL: @test_simplify9( ; ANY-NEXT: ret float 0x7FF0000000000000 +; VC32-NEXT: [[POW:%.*]] = call float @powf(float 0xFFF0000000000000, float 5.000000e-01) +; VC32-NEXT: ret float [[POW]] +; VC51-NEXT: [[POW:%.*]] = call float @powf(float 0xFFF0000000000000, float 5.000000e-01) +; VC51-NEXT: ret float [[POW]] +; VC64-NEXT: ret float 0x7FF0000000000000 +; VC83-NEXT: ret float 0x7FF0000000000000 ; %retval = call float @powf(float 0xFFF0000000000000, float 0.5) ret float %retval } define double @test_simplify10(double %x) { -; ANY-LABEL: @test_simplify10( -; ANY-NEXT: ret double 0x7FF0000000000000 +; CHECK-LABEL: @test_simplify10( +; CHECK-NEXT: ret double 0x7FF0000000000000 ; %retval = call double @pow(double 0xFFF0000000000000, double 0.5) ret double %retval @@ -241,32 +291,42 @@ define double @test_simplify10(double %x) { ; Check pow(x, 1.0) -> x. define float @test_simplify11(float %x) { -; ANY-LABEL: @test_simplify11( +; CHECK-LABEL: @test_simplify11( ; ANY-NEXT: ret float [[X:%.*]] +; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 1.000000e+00) +; VC32-NEXT: ret float [[POW]] +; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 1.000000e+00) +; VC51-NEXT: ret float [[POW]] +; VC64-NEXT: ret float [[X:%.*]] +; VC83-NEXT: ret float [[X:%.*]] ; %retval = call float @powf(float %x, float 1.0) ret float %retval } define <2 x float> @test_simplify11v(<2 x float> %x) { -; ANY-LABEL: @test_simplify11v( +; CHECK-LABEL: @test_simplify11v( ; ANY-NEXT: ret <2 x float> [[X:%.*]] +; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> ) +; MSVC-NEXT: ret <2 x float> [[POW]] ; %retval = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> ) ret <2 x float> %retval } define double @test_simplify12(double %x) { -; ANY-LABEL: @test_simplify12( -; ANY-NEXT: ret double [[X:%.*]] +; CHECK-LABEL: @test_simplify12( +; CHECK-NEXT: ret double [[X:%.*]] ; %retval = call double @pow(double %x, double 1.0) ret double %retval } define <2 x double> @test_simplify12v(<2 x double> %x) { -; ANY-LABEL: @test_simplify12v( +; CHECK-LABEL: @test_simplify12v( ; ANY-NEXT: ret <2 x double> [[X:%.*]] +; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> ) +; MSVC-NEXT: ret <2 x double> [[POW]] ; %retval = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> ) ret <2 x double> %retval @@ -275,36 +335,48 @@ define <2 x double> @test_simplify12v(<2 x double> %x) { ; Check pow(x, 2.0) -> x*x. define float @pow2_strict(float %x) { -; ANY-LABEL: @pow2_strict( +; CHECK-LABEL: @pow2_strict( ; ANY-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]] ; ANY-NEXT: ret float [[SQUARE]] +; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 2.000000e+00) +; VC32-NEXT: ret float [[POW]] +; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 2.000000e+00) +; VC51-NEXT: ret float [[POW]] +; VC64-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]] +; VC64-NEXT: ret float [[SQUARE]] +; VC83-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]] +; VC83-NEXT: ret float [[SQUARE]] ; %r = call float @powf(float %x, float 2.0) ret float %r } define <2 x float> @pow2_strictv(<2 x float> %x) { -; ANY-LABEL: @pow2_strictv( +; CHECK-LABEL: @pow2_strictv( ; ANY-NEXT: [[SQUARE:%.*]] = fmul <2 x float> [[X:%.*]], [[X]] ; ANY-NEXT: ret <2 x float> [[SQUARE]] +; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> ) +; MSVC-NEXT: ret <2 x float> [[POW]] ; %r = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> ) ret <2 x float> %r } define double @pow2_double_strict(double %x) { -; ANY-LABEL: @pow2_double_strict( -; ANY-NEXT: [[SQUARE:%.*]] = fmul double [[X:%.*]], [[X]] -; ANY-NEXT: ret double [[SQUARE]] +; CHECK-LABEL: @pow2_double_strict( +; CHECK-NEXT: [[SQUARE:%.*]] = fmul double [[X:%.*]], [[X]] +; CHECK-NEXT: ret double [[SQUARE]] ; %r = call double @pow(double %x, double 2.0) ret double %r } define <2 x double> @pow2_double_strictv(<2 x double> %x) { -; ANY-LABEL: @pow2_double_strictv( +; CHECK-LABEL: @pow2_double_strictv( ; ANY-NEXT: [[SQUARE:%.*]] = fmul <2 x double> [[X:%.*]], [[X]] ; ANY-NEXT: ret <2 x double> [[SQUARE]] +; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> ) +; MSVC-NEXT: ret <2 x double> [[POW]] ; %r = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> ) ret <2 x double> %r @@ -313,9 +385,17 @@ define <2 x double> @pow2_double_strictv(<2 x double> %x) { ; Don't drop the FMF - PR35601 ( https://bugs.llvm.org/show_bug.cgi?id=35601 ) define float @pow2_fast(float %x) { -; ANY-LABEL: @pow2_fast( +; CHECK-LABEL: @pow2_fast( ; ANY-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]] ; ANY-NEXT: ret float [[SQUARE]] +; VC32-NEXT: [[POW:%.*]] = call fast float @powf(float [[X:%.*]], float 2.000000e+00) +; VC32-NEXT: ret float [[POW]] +; VC51-NEXT: [[POW:%.*]] = call fast float @powf(float [[X:%.*]], float 2.000000e+00) +; VC51-NEXT: ret float [[POW]] +; VC64-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]] +; VC64-NEXT: ret float [[SQUARE]] +; VC83-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]] +; VC83-NEXT: ret float [[SQUARE]] ; %r = call fast float @powf(float %x, float 2.0) ret float %r @@ -324,48 +404,60 @@ define float @pow2_fast(float %x) { ; Check pow(x, -1.0) -> 1.0/x. define float @pow_neg1_strict(float %x) { -; ANY-LABEL: @pow_neg1_strict( +; CHECK-LABEL: @pow_neg1_strict( ; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]] ; ANY-NEXT: ret float [[RECIPROCAL]] +; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float -1.000000e+00) +; VC32-NEXT: ret float [[POW]] +; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float -1.000000e+00) +; VC51-NEXT: ret float [[POW]] +; VC64-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]] +; VC64-NEXT: ret float [[RECIPROCAL]] +; VC83-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]] +; VC83-NEXT: ret float [[RECIPROCAL]] ; %r = call float @powf(float %x, float -1.0) ret float %r } define <2 x float> @pow_neg1_strictv(<2 x float> %x) { -; ANY-LABEL: @pow_neg1_strictv( +; CHECK-LABEL: @pow_neg1_strictv( ; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv <2 x float> , [[X:%.*]] ; ANY-NEXT: ret <2 x float> [[RECIPROCAL]] +; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> ) +; MSVC-NEXT: ret <2 x float> [[POW]] ; %r = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> ) ret <2 x float> %r } define double @pow_neg1_double_fast(double %x) { -; ANY-LABEL: @pow_neg1_double_fast( -; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv fast double 1.000000e+00, [[X:%.*]] -; ANY-NEXT: ret double [[RECIPROCAL]] +; CHECK-LABEL: @pow_neg1_double_fast( +; CHECK-NEXT: [[RECIPROCAL:%.*]] = fdiv fast double 1.000000e+00, [[X:%.*]] +; CHECK-NEXT: ret double [[RECIPROCAL]] ; %r = call fast double @pow(double %x, double -1.0) ret double %r } define <2 x double> @pow_neg1_double_fastv(<2 x double> %x) { -; ANY-LABEL: @pow_neg1_double_fastv( +; CHECK-LABEL: @pow_neg1_double_fastv( ; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv fast <2 x double> , [[X:%.*]] ; ANY-NEXT: ret <2 x double> [[RECIPROCAL]] +; MSVC-NEXT: [[POW:%.*]] = call fast <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> ) +; MSVC-NEXT: ret <2 x double> [[POW]] ; %r = call fast <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> ) ret <2 x double> %r } define double @test_simplify17(double %x) { -; ANY-LABEL: @test_simplify17( -; ANY-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]]) -; ANY-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]]) -; ANY-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000 -; ANY-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]] -; ANY-NEXT: ret double [[TMP1]] +; CHECK-LABEL: @test_simplify17( +; CHECK-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]]) +; CHECK-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]]) +; CHECK-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000 +; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]] +; CHECK-NEXT: ret double [[TMP1]] ; %retval = call double @llvm.pow.f64(double %x, double 0.5) ret double %retval @@ -374,29 +466,23 @@ define double @test_simplify17(double %x) { ; Check pow(10.0, x) -> __exp10(x) on OS X 10.9+ and iOS 7.0+. define float @test_simplify18(float %x) { -; CHECK-EXP10-LABEL: @test_simplify18( -; CHECK-EXP10-NEXT: [[__EXP10F:%.*]] = call float @__exp10f(float [[X:%.*]]) [[NUW_RO]] -; CHECK-EXP10-NEXT: ret float [[__EXP10F]] -; -; CHECK-NO-EXP10-LABEL: @test_simplify18( -; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+01, float [[X:%.*]]) -; CHECK-NO-EXP10-NEXT: ret float [[RETVAL]] +; CHECK-LABEL: @test_simplify18( +; CHECK-EXP10-NEXT: [[__EXP10F:%.*]] = call float @__exp10f(float [[X:%.*]]) +; CHECK-EXP10-NEXT: ret float [[__EXP10F]] +; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+01, float [[X:%.*]]) +; CHECK-NO-EXP10-NEXT: ret float [[RETVAL]] ; %retval = call float @powf(float 10.0, float %x) ret float %retval } define double @test_simplify19(double %x) { -; CHECK-EXP10-LABEL: @test_simplify19( -; CHECK-EXP10-NEXT: [[__EXP10:%.*]] = call double @__exp10(double [[X:%.*]]) [[NUW_RO]] -; CHECK-EXP10-NEXT: ret double [[__EXP10]] -; -; CHECK-NO-EXP10-LABEL: @test_simplify19( -; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call double @pow(double 1.000000e+01, double [[X:%.*]]) -; CHECK-NO-EXP10-NEXT: ret double [[RETVAL]] +; CHECK-LABEL: @test_simplify19( +; CHECK-EXP10-NEXT: [[__EXP10:%.*]] = call double @__exp10(double [[X:%.*]]) +; CHECK-EXP10-NEXT: ret double [[__EXP10]] +; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call double @pow(double 1.000000e+01, double [[X:%.*]]) +; CHECK-NO-EXP10-NEXT: ret double [[RETVAL]] ; %retval = call double @pow(double 10.0, double %x) ret double %retval } - -; CHECK-EXP10: attributes [[NUW_RO]] = { nounwind readonly } diff --git a/test/Transforms/InstCombine/win-math.ll b/test/Transforms/InstCombine/win-math.ll index 36947791393d..38ed949e949d 100644 --- a/test/Transforms/InstCombine/win-math.ll +++ b/test/Transforms/InstCombine/win-math.ll @@ -1,17 +1,21 @@ -; RUN: opt -O2 -S -mtriple=i386-pc-win32 < %s | FileCheck %s -check-prefix=WIN32 -; RUN: opt -O2 -S -mtriple=x86_64-pc-win32 < %s | FileCheck %s -check-prefix=WIN64 -; RUN: opt -O2 -S -mtriple=i386-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW32 -; RUN: opt -O2 -S -mtriple=x86_64-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW64 +; RUN: opt < %s -O2 -S -mtriple=i386-pc-windows-msvc18 | FileCheck %s --check-prefixes=CHECK,MSVCXX,MSVC32 +; RUN: opt < %s -O2 -S -mtriple=i386-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,MSVC19,MSVC51 +; RUN: opt < %s -O2 -S -mtriple=x86_64-pc-windows-msvc17 | FileCheck %s --check-prefixes=CHECK,MSVCXX,MSVC64 +; RUN: opt < %s -O2 -S -mtriple=x86_64-pc-win32 | FileCheck %s --check-prefixes=CHECK,MSVC19,MSVC83 +; RUN: opt < %s -O2 -S -mtriple=i386-pc-mingw32 | FileCheck %s --check-prefixes=CHECK,MINGW32 +; RUN: opt < %s -O2 -S -mtriple=x86_64-pc-mingw32 | FileCheck %s --check-prefixes=CHECK,MINGW64 ; x86 win32 msvcrt does not provide entry points for single-precision libm. -; x86-64 win32 msvcrt does (except for fabsf) -; msvcrt does not provide C99 math, but mingw32 does. +; x86-64 win32 msvcrt does, but with exceptions +; msvcrt does not provide all of C99 math, but mingw32 does. declare double @acos(double %x) define float @float_acos(float %x) nounwind readnone { -; WIN32-LABEL: @float_acos( -; WIN32-NOT: float @acosf -; WIN32: double @acos +; CHECK-LABEL: @float_acos( +; MSVCXX-NOT: float @acosf +; MSVCXX: double @acos +; MSVC19-NOT: float @acosf +; MSVC19: double @acos %1 = fpext float %x to double %2 = call double @acos(double %1) %3 = fptrunc double %2 to float @@ -20,9 +24,11 @@ define float @float_acos(float %x) nounwind readnone { declare double @asin(double %x) define float @float_asin(float %x) nounwind readnone { -; WIN32-LABEL: @float_asin( -; WIN32-NOT: float @asinf -; WIN32: double @asin +; CHECK-LABEL: @float_asin( +; MSVCXX-NOT: float @asinf +; MSVCXX: double @asin +; MSVC19-NOT: float @asinf +; MSVC19: double @asin %1 = fpext float %x to double %2 = call double @asin(double %1) %3 = fptrunc double %2 to float @@ -31,9 +37,11 @@ define float @float_asin(float %x) nounwind readnone { declare double @atan(double %x) define float @float_atan(float %x) nounwind readnone { -; WIN32-LABEL: @float_atan( -; WIN32-NOT: float @atanf -; WIN32: double @atan +; CHECK-LABEL: @float_atan( +; MSVCXX-NOT: float @atanf +; MSVCXX: double @atan +; MSVC19-NOT: float @atanf +; MSVC19: double @atan %1 = fpext float %x to double %2 = call double @atan(double %1) %3 = fptrunc double %2 to float @@ -42,9 +50,11 @@ define float @float_atan(float %x) nounwind readnone { declare double @atan2(double %x, double %y) define float @float_atan2(float %x, float %y) nounwind readnone { -; WIN32-LABEL: @float_atan2( -; WIN32-NOT: float @atan2f -; WIN32: double @atan2 +; CHECK-LABEL: @float_atan2( +; MSVCXX-NOT: float @atan2f +; MSVCXX: double @atan2 +; MSVC19-NOT: float @atan2f +; MSVC19: double @atan2 %1 = fpext float %x to double %2 = fpext float %y to double %3 = call double @atan2(double %1, double %2) @@ -54,18 +64,15 @@ define float @float_atan2(float %x, float %y) nounwind readnone { declare double @ceil(double %x) define float @float_ceil(float %x) nounwind readnone { -; WIN32-LABEL: @float_ceil( -; WIN32-NOT: float @ceilf -; WIN32: float @llvm.ceil.f32 -; WIN64-LABEL: @float_ceil( -; WIN64: float @llvm.ceil.f32 -; WIN64-NOT: double @ceil -; MINGW32-LABEL: @float_ceil( -; MINGW32: float @llvm.ceil.f32 +; CHECK-LABEL: @float_ceil( +; MSVCXX-NOT: float @ceilf +; MSVCXX: float @llvm.ceil.f32 +; MSVC19-NOT: double @ceil +; MSVC19: float @llvm.ceil.f32 ; MINGW32-NOT: double @ceil -; MINGW64-LABEL: @float_ceil( -; MINGW64: float @llvm.ceil.f32 +; MINGW32: float @llvm.ceil.f32 ; MINGW64-NOT: double @ceil +; MINGW64: float @llvm.ceil.f32 %1 = fpext float %x to double %2 = call double @ceil(double %1) %3 = fptrunc double %2 to float @@ -74,10 +81,11 @@ define float @float_ceil(float %x) nounwind readnone { declare double @_copysign(double %x) define float @float_copysign(float %x) nounwind readnone { -; WIN32-LABEL: @float_copysign( -; WIN32-NOT: float @copysignf -; WIN32-NOT: float @_copysignf -; WIN32: double @_copysign +; CHECK-LABEL: @float_copysign( +; MSVCXX-NOT: float @_copysignf +; MSVCXX: double @_copysign +; MSVC19-NOT: float @_copysignf +; MSVC19: double @_copysign %1 = fpext float %x to double %2 = call double @_copysign(double %1) %3 = fptrunc double %2 to float @@ -86,9 +94,11 @@ define float @float_copysign(float %x) nounwind readnone { declare double @cos(double %x) define float @float_cos(float %x) nounwind readnone { -; WIN32-LABEL: @float_cos( -; WIN32-NOT: float @cosf -; WIN32: double @cos +; CHECK-LABEL: @float_cos( +; MSVCXX-NOT: float @cosf +; MSVCXX: double @cos +; MSVC19-NOT: float @cosf +; MSVC19: double @cos %1 = fpext float %x to double %2 = call double @cos(double %1) %3 = fptrunc double %2 to float @@ -97,9 +107,11 @@ define float @float_cos(float %x) nounwind readnone { declare double @cosh(double %x) define float @float_cosh(float %x) nounwind readnone { -; WIN32-LABEL: @float_cosh( -; WIN32-NOT: float @coshf -; WIN32: double @cosh +; CHECK-LABEL: @float_cosh( +; MSVCXX-NOT: float @coshf +; MSVCXX: double @cosh +; MSVC19-NOT: float @coshf +; MSVC19: double @cosh %1 = fpext float %x to double %2 = call double @cosh(double %1) %3 = fptrunc double %2 to float @@ -108,9 +120,11 @@ define float @float_cosh(float %x) nounwind readnone { declare double @exp(double %x, double %y) define float @float_exp(float %x, float %y) nounwind readnone { -; WIN32-LABEL: @float_exp( -; WIN32-NOT: float @expf -; WIN32: double @exp +; CHECK-LABEL: @float_exp( +; MSVCXX-NOT: float @expf +; MSVCXX: double @exp +; MSVC19-NOT: float @expf +; MSVC19: double @exp %1 = fpext float %x to double %2 = fpext float %y to double %3 = call double @exp(double %1, double %2) @@ -120,12 +134,11 @@ define float @float_exp(float %x, float %y) nounwind readnone { declare double @fabs(double %x, double %y) define float @float_fabs(float %x, float %y) nounwind readnone { -; WIN32-LABEL: @float_fabs( -; WIN32-NOT: float @fabsf -; WIN32: double @fabs -; WIN64-LABEL: @float_fabs( -; WIN64-NOT: float @fabsf -; WIN64: double @fabs +; CHECK-LABEL: @float_fabs( +; MSVCXX-NOT: float @fabsf +; MSVCXX: double @fabs +; MSVC19-NOT: float @fabsf +; MSVC19: double @fabs %1 = fpext float %x to double %2 = fpext float %y to double %3 = call double @fabs(double %1, double %2) @@ -135,18 +148,15 @@ define float @float_fabs(float %x, float %y) nounwind readnone { declare double @floor(double %x) define float @float_floor(float %x) nounwind readnone { -; WIN32-LABEL: @float_floor( -; WIN32-NOT: float @floorf -; WIN32: float @llvm.floor.f32 -; WIN64-LABEL: @float_floor( -; WIN64: float @llvm.floor.f32 -; WIN64-NOT: double @floor -; MINGW32-LABEL: @float_floor( -; MINGW32: float @llvm.floor.f32 +; CHECK-LABEL: @float_floor( +; MSVCXX-NOT: float @floorf +; MSVCXX: float @llvm.floor.f32 +; MSVC19-NOT: double @floor +; MSVC19: float @llvm.floor.f32 ; MINGW32-NOT: double @floor -; MINGW64-LABEL: @float_floor( -; MINGW64: float @llvm.floor.f32 +; MINGW32: float @llvm.floor.f32 ; MINGW64-NOT: double @floor +; MINGW64: float @llvm.floor.f32 %1 = fpext float %x to double %2 = call double @floor(double %1) %3 = fptrunc double %2 to float @@ -155,9 +165,11 @@ define float @float_floor(float %x) nounwind readnone { declare double @fmod(double %x, double %y) define float @float_fmod(float %x, float %y) nounwind readnone { -; WIN32-LABEL: @float_fmod( -; WIN32-NOT: float @fmodf -; WIN32: double @fmod +; MSVCXX-LABEL: @float_fmod( +; MSVCXX-NOT: float @fmodf +; MSVCXX: double @fmod +; MSVC19-NOT: float @fmodf +; MSVC19: double @fmod %1 = fpext float %x to double %2 = fpext float %y to double %3 = call double @fmod(double %1, double %2) @@ -167,20 +179,37 @@ define float @float_fmod(float %x, float %y) nounwind readnone { declare double @log(double %x) define float @float_log(float %x) nounwind readnone { -; WIN32-LABEL: @float_log( -; WIN32-NOT: float @logf -; WIN32: double @log +; CHECK-LABEL: @float_log( +; MSVCXX-NOT: float @logf +; MSVCXX: double @log +; MSVC19-NOT: float @logf +; MSVC19: double @log %1 = fpext float %x to double %2 = call double @log(double %1) %3 = fptrunc double %2 to float ret float %3 } +declare double @logb(double %x) +define float @float_logb(float %x) nounwind readnone { +; CHECK-LABEL: @float_logb( +; MSVCXX-NOT: float @logbf +; MSVCXX: double @logb +; MSVC19-NOT: float @logbf +; MSVC19: double @logb + %1 = fpext float %x to double + %2 = call double @logb(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + declare double @pow(double %x, double %y) define float @float_pow(float %x, float %y) nounwind readnone { -; WIN32-LABEL: @float_pow( -; WIN32-NOT: float @powf -; WIN32: double @pow +; CHECK-LABEL: @float_pow( +; MSVCXX-NOT: float @powf +; MSVCXX: double @pow +; MSVC19-NOT: float @powf +; MSVC19: double @pow %1 = fpext float %x to double %2 = fpext float %y to double %3 = call double @pow(double %1, double %2) @@ -190,9 +219,11 @@ define float @float_pow(float %x, float %y) nounwind readnone { declare double @sin(double %x) define float @float_sin(float %x) nounwind readnone { -; WIN32-LABEL: @float_sin( -; WIN32-NOT: float @sinf -; WIN32: double @sin +; CHECK-LABEL: @float_sin( +; MSVCXX-NOT: float @sinf +; MSVCXX: double @sin +; MSVC19-NOT: float @sinf +; MSVC19: double @sin %1 = fpext float %x to double %2 = call double @sin(double %1) %3 = fptrunc double %2 to float @@ -201,9 +232,11 @@ define float @float_sin(float %x) nounwind readnone { declare double @sinh(double %x) define float @float_sinh(float %x) nounwind readnone { -; WIN32-LABEL: @float_sinh( -; WIN32-NOT: float @sinhf -; WIN32: double @sinh +; CHECK-LABEL: @float_sinh( +; MSVCXX-NOT: float @sinhf +; MSVCXX: double @sinh +; MSVC19-NOT: float @sinhf +; MSVC19: double @sinh %1 = fpext float %x to double %2 = call double @sinh(double %1) %3 = fptrunc double %2 to float @@ -212,18 +245,19 @@ define float @float_sinh(float %x) nounwind readnone { declare double @sqrt(double %x) define float @float_sqrt(float %x) nounwind readnone { -; WIN32-LABEL: @float_sqrt( -; WIN32-NOT: float @sqrtf -; WIN32: double @sqrt -; WIN64-LABEL: @float_sqrt( -; WIN64: float @sqrtf -; WIN64-NOT: double @sqrt -; MINGW32-LABEL: @float_sqrt( -; MINGW32: float @sqrtf +; CHECK-LABEL: @float_sqrt( +; MSVC32-NOT: float @sqrtf +; MSVC32: double @sqrt +; MSVC51-NOT: float @sqrtf +; MSVC51: double @sqrt +; MSVC64-NOT: double @sqrt +; MSVC64: float @sqrtf +; MSVC83-NOT: double @sqrt +; MSVC83: float @sqrtf ; MINGW32-NOT: double @sqrt -; MINGW64-LABEL: @float_sqrt( -; MINGW64: float @sqrtf +; MINGW32: float @sqrtf ; MINGW64-NOT: double @sqrt +; MINGW64: float @sqrtf %1 = fpext float %x to double %2 = call double @sqrt(double %1) %3 = fptrunc double %2 to float @@ -232,9 +266,11 @@ define float @float_sqrt(float %x) nounwind readnone { declare double @tan(double %x) define float @float_tan(float %x) nounwind readnone { -; WIN32-LABEL: @float_tan( -; WIN32-NOT: float @tanf -; WIN32: double @tan +; CHECK-LABEL: @float_tan( +; MSVCXX-NOT: float @tanf +; MSVCXX: double @tan +; MSVC19-NOT: float @tanf +; MSVC19: double @tan %1 = fpext float %x to double %2 = call double @tan(double %1) %3 = fptrunc double %2 to float @@ -243,30 +279,29 @@ define float @float_tan(float %x) nounwind readnone { declare double @tanh(double %x) define float @float_tanh(float %x) nounwind readnone { -; WIN32-LABEL: @float_tanh( -; WIN32-NOT: float @tanhf -; WIN32: double @tanh +; CHECK-LABEL: @float_tanh( +; MSVCXX-NOT: float @tanhf +; MSVCXX: double @tanh +; MSVC19-NOT: float @tanhf +; MSVC19: double @tanh %1 = fpext float %x to double %2 = call double @tanh(double %1) %3 = fptrunc double %2 to float ret float %3 } -; win32 does not have round; mingw32 does +; win32 does not have roundf; mingw32 does declare double @round(double %x) define float @float_round(float %x) nounwind readnone { -; WIN32-LABEL: @float_round( -; WIN32-NOT: float @roundf -; WIN32: double @round -; WIN64-LABEL: @float_round( -; WIN64-NOT: float @roundf -; WIN64: double @round -; MINGW32-LABEL: @float_round( -; MINGW32: float @llvm.round.f32 +; CHECK-LABEL: @float_round( +; MSVCXX-NOT: double @roundf +; MSVCXX: double @round +; MSVC19-NOT: double @round +; MSVC19: float @llvm.round.f32 ; MINGW32-NOT: double @round -; MINGW64-LABEL: @float_round( -; MINGW64: float @llvm.round.f32 +; MINGW32: float @llvm.round.f32 ; MINGW64-NOT: double @round +; MINGW64: float @llvm.round.f32 %1 = fpext float %x to double %2 = call double @round(double %1) %3 = fptrunc double %2 to float @@ -275,26 +310,26 @@ define float @float_round(float %x) nounwind readnone { declare float @powf(float, float) -; win32 lacks sqrtf&fabsf, win64 lacks fabsf, but +; win32 lacks sqrtf & fabsf, win64 lacks fabsf, but ; calls to the intrinsics can be emitted instead. define float @float_powsqrt(float %x) nounwind readnone { -; WIN32-LABEL: @float_powsqrt( -; WIN32-NOT: float @sqrtf -; WIN32: float @powf - -; WIN64-LABEL: @float_powsqrt( -; WIN64: float @sqrtf -; WIN64: float @llvm.fabs.f32( -; WIN64-NOT: float @powf - -; MINGW32-LABEL: @float_powsqrt( +; CHECK-LABEL: @float_powsqrt( +; MSVC32-NOT: float @sqrtf +; MSVC32: float @powf +; MSVC51-NOT: float @sqrtf +; MSVC51: float @powf +; MSVC64-NOT: float @powf +; MSVC64: float @sqrtf +; MSVC64: float @llvm.fabs.f32( +; MSVC83-NOT: float @powf +; MSVC83: float @sqrtf +; MSVC83: float @llvm.fabs.f32( +; MINGW32-NOT: float @powf ; MINGW32: float @sqrtf ; MINGW32: float @llvm.fabs.f32 -; MINGW32-NOT: float @powf -; MINGW64-LABEL: @float_powsqrt( +; MINGW64-NOT: float @powf ; MINGW64: float @sqrtf ; MINGW64: float @llvm.fabs.f32( -; MINGW64-NOT: float @powf %1 = call float @powf(float %x, float 0.5) ret float %1 } diff --git a/test/tools/llvm-mca/X86/Atom/resources-x87.s b/test/tools/llvm-mca/X86/Atom/resources-x87.s index c7a990a892eb..eda0fdebb7d3 100644 --- a/test/tools/llvm-mca/X86/Atom/resources-x87.s +++ b/test/tools/llvm-mca/X86/Atom/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 99 49.50 U f2xm1 # CHECK-NEXT: 1 1 1.00 U fabs -# CHECK-NEXT: 1 5 5.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 5 5.00 U fadd %st(2) +# CHECK-NEXT: 1 5 5.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 5 5.00 U fadd %st(2), %st # CHECK-NEXT: 1 5 5.00 * U fadds (%ecx) # CHECK-NEXT: 1 5 5.00 * U faddl (%ecx) -# CHECK-NEXT: 1 5 5.00 U faddp %st(1) -# CHECK-NEXT: 1 5 5.00 U faddp %st(2) +# CHECK-NEXT: 1 5 5.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 5 5.00 U faddp %st, %st(2) # CHECK-NEXT: 1 5 5.00 * U fiadds (%ecx) # CHECK-NEXT: 1 5 5.00 * U fiaddl (%ecx) # CHECK-NEXT: 1 100 0.50 U fbld (%ecx) # CHECK-NEXT: 1 100 0.50 U fbstp (%eax) # CHECK-NEXT: 1 1 1.00 U fchs # CHECK-NEXT: 1 25 12.50 U fnclex -# CHECK-NEXT: 1 9 4.50 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 1 9 4.50 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 1 9 4.50 U fcmove %st(1), %st(0) -# CHECK-NEXT: 1 9 4.50 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 1 9 4.50 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 1 9 4.50 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 1 9 4.50 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 1 9 4.50 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 1 9 4.50 U fcmovb %st(1), %st +# CHECK-NEXT: 1 9 4.50 U fcmovbe %st(1), %st +# CHECK-NEXT: 1 9 4.50 U fcmove %st(1), %st +# CHECK-NEXT: 1 9 4.50 U fcmovnb %st(1), %st +# CHECK-NEXT: 1 9 4.50 U fcmovnbe %st(1), %st +# CHECK-NEXT: 1 9 4.50 U fcmovne %st(1), %st +# CHECK-NEXT: 1 9 4.50 U fcmovnu %st(1), %st +# CHECK-NEXT: 1 9 4.50 U fcmovu %st(1), %st # CHECK-NEXT: 1 5 5.00 U fcom %st(1) # CHECK-NEXT: 1 5 5.00 U fcom %st(3) # CHECK-NEXT: 1 5 5.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 1 5 5.00 U fcomps (%ecx) # CHECK-NEXT: 1 5 5.00 U fcompl (%eax) # CHECK-NEXT: 1 1 1.00 U fcompp -# CHECK-NEXT: 1 9 4.50 U fcomi %st(3) -# CHECK-NEXT: 1 9 4.50 U fcompi %st(3) +# CHECK-NEXT: 1 9 4.50 U fcomi %st(3), %st +# CHECK-NEXT: 1 9 4.50 U fcompi %st(3), %st # CHECK-NEXT: 1 174 87.00 U fcos # CHECK-NEXT: 1 1 0.50 U fdecstp -# CHECK-NEXT: 1 34 17.00 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 34 17.00 U fdiv %st(2) +# CHECK-NEXT: 1 34 17.00 U fdiv %st, %st(1) +# CHECK-NEXT: 1 34 17.00 U fdiv %st(2), %st # CHECK-NEXT: 1 34 17.00 * U fdivs (%ecx) # CHECK-NEXT: 1 34 17.00 * U fdivl (%eax) -# CHECK-NEXT: 1 34 17.00 U fdivp %st(1) -# CHECK-NEXT: 1 34 17.00 U fdivp %st(2) +# CHECK-NEXT: 1 34 17.00 U fdivp %st, %st(1) +# CHECK-NEXT: 1 34 17.00 U fdivp %st, %st(2) # CHECK-NEXT: 1 34 17.00 * U fidivs (%ecx) # CHECK-NEXT: 1 34 17.00 * U fidivl (%eax) -# CHECK-NEXT: 1 34 17.00 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 34 17.00 U fdivr %st(2) +# CHECK-NEXT: 1 34 17.00 U fdivr %st, %st(1) +# CHECK-NEXT: 1 34 17.00 U fdivr %st(2), %st # CHECK-NEXT: 1 34 17.00 * U fdivrs (%ecx) # CHECK-NEXT: 1 34 17.00 * U fdivrl (%eax) -# CHECK-NEXT: 1 34 17.00 U fdivrp %st(1) -# CHECK-NEXT: 1 34 17.00 U fdivrp %st(2) +# CHECK-NEXT: 1 34 17.00 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 34 17.00 U fdivrp %st, %st(2) # CHECK-NEXT: 1 34 17.00 * U fidivrs (%ecx) # CHECK-NEXT: 1 34 17.00 * U fidivrl (%eax) # CHECK-NEXT: 1 1 0.50 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 1 10 5.00 U fldln2 # CHECK-NEXT: 1 10 5.00 U fldpi # CHECK-NEXT: 1 1 0.50 U fldz -# CHECK-NEXT: 1 4 4.00 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 4 4.00 U fmul %st(2) +# CHECK-NEXT: 1 4 4.00 U fmul %st, %st(1) +# CHECK-NEXT: 1 4 4.00 U fmul %st(2), %st # CHECK-NEXT: 1 4 4.00 * U fmuls (%ecx) # CHECK-NEXT: 1 4 4.00 * U fmull (%eax) -# CHECK-NEXT: 1 4 4.00 U fmulp %st(1) -# CHECK-NEXT: 1 4 4.00 U fmulp %st(2) +# CHECK-NEXT: 1 4 4.00 U fmulp %st, %st(1) +# CHECK-NEXT: 1 4 4.00 U fmulp %st, %st(2) # CHECK-NEXT: 1 4 4.00 * U fimuls (%ecx) # CHECK-NEXT: 1 4 4.00 * U fimull (%eax) # CHECK-NEXT: 1 1 0.50 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 1 100 0.50 U frstor (%eax) # CHECK-NEXT: 1 1 0.50 U wait # CHECK-NEXT: 1 100 0.50 U fnsave (%eax) -# CHECK-NEXT: 1 5 5.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 5 5.00 U fsub %st(2) +# CHECK-NEXT: 1 5 5.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 5 5.00 U fsub %st(2), %st # CHECK-NEXT: 1 5 5.00 * U fsubs (%ecx) # CHECK-NEXT: 1 5 5.00 * U fsubl (%eax) -# CHECK-NEXT: 1 5 5.00 U fsubp %st(1) -# CHECK-NEXT: 1 5 5.00 U fsubp %st(2) +# CHECK-NEXT: 1 5 5.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 5 5.00 U fsubp %st, %st(2) # CHECK-NEXT: 1 5 5.00 * U fisubs (%ecx) # CHECK-NEXT: 1 5 5.00 * U fisubl (%eax) -# CHECK-NEXT: 1 5 5.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 5 5.00 U fsubr %st(2) +# CHECK-NEXT: 1 5 5.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 5 5.00 U fsubr %st(2), %st # CHECK-NEXT: 1 5 5.00 * U fsubrs (%ecx) # CHECK-NEXT: 1 5 5.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 5 5.00 U fsubrp %st(1) -# CHECK-NEXT: 1 5 5.00 U fsubrp %st(2) +# CHECK-NEXT: 1 5 5.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 5 5.00 U fsubrp %st, %st(2) # CHECK-NEXT: 1 5 5.00 * U fisubrs (%ecx) # CHECK-NEXT: 1 5 5.00 * U fisubrl (%eax) # CHECK-NEXT: 1 9 4.50 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 1 1 1.00 U fucomp %st(1) # CHECK-NEXT: 1 1 1.00 U fucomp %st(3) # CHECK-NEXT: 1 1 1.00 U fucompp -# CHECK-NEXT: 1 9 4.50 U fucomi %st(3) -# CHECK-NEXT: 1 9 4.50 U fucompi %st(3) +# CHECK-NEXT: 1 9 4.50 U fucomi %st(3), %st +# CHECK-NEXT: 1 9 4.50 U fucompi %st(3), %st # CHECK-NEXT: 1 1 0.50 U wait # CHECK-NEXT: 1 1 1.00 U fxam # CHECK-NEXT: 1 1 1.00 U fxch %st(1) @@ -367,26 +367,26 @@ fyl2xp1 # CHECK-NEXT: [0] [1] Instructions: # CHECK-NEXT: 49.50 49.50 f2xm1 # CHECK-NEXT: - 1.00 fabs -# CHECK-NEXT: 5.00 - fadd %st(0), %st(1) -# CHECK-NEXT: 5.00 - fadd %st(2) +# CHECK-NEXT: 5.00 - fadd %st, %st(1) +# CHECK-NEXT: 5.00 - fadd %st(2), %st # CHECK-NEXT: 5.00 - fadds (%ecx) # CHECK-NEXT: 5.00 - faddl (%ecx) -# CHECK-NEXT: 5.00 - faddp %st(1) -# CHECK-NEXT: 5.00 - faddp %st(2) +# CHECK-NEXT: 5.00 - faddp %st, %st(1) +# CHECK-NEXT: 5.00 - faddp %st, %st(2) # CHECK-NEXT: 5.00 - fiadds (%ecx) # CHECK-NEXT: 5.00 - fiaddl (%ecx) # CHECK-NEXT: 0.50 0.50 fbld (%ecx) # CHECK-NEXT: 0.50 0.50 fbstp (%eax) # CHECK-NEXT: - 1.00 fchs # CHECK-NEXT: 12.50 12.50 fnclex -# CHECK-NEXT: 4.50 4.50 fcmovb %st(1), %st(0) -# CHECK-NEXT: 4.50 4.50 fcmovbe %st(1), %st(0) -# CHECK-NEXT: 4.50 4.50 fcmove %st(1), %st(0) -# CHECK-NEXT: 4.50 4.50 fcmovnb %st(1), %st(0) -# CHECK-NEXT: 4.50 4.50 fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 4.50 4.50 fcmovne %st(1), %st(0) -# CHECK-NEXT: 4.50 4.50 fcmovnu %st(1), %st(0) -# CHECK-NEXT: 4.50 4.50 fcmovu %st(1), %st(0) +# CHECK-NEXT: 4.50 4.50 fcmovb %st(1), %st +# CHECK-NEXT: 4.50 4.50 fcmovbe %st(1), %st +# CHECK-NEXT: 4.50 4.50 fcmove %st(1), %st +# CHECK-NEXT: 4.50 4.50 fcmovnb %st(1), %st +# CHECK-NEXT: 4.50 4.50 fcmovnbe %st(1), %st +# CHECK-NEXT: 4.50 4.50 fcmovne %st(1), %st +# CHECK-NEXT: 4.50 4.50 fcmovnu %st(1), %st +# CHECK-NEXT: 4.50 4.50 fcmovu %st(1), %st # CHECK-NEXT: 5.00 - fcom %st(1) # CHECK-NEXT: 5.00 - fcom %st(3) # CHECK-NEXT: 5.00 - fcoms (%ecx) @@ -396,24 +396,24 @@ fyl2xp1 # CHECK-NEXT: 5.00 - fcomps (%ecx) # CHECK-NEXT: 5.00 - fcompl (%eax) # CHECK-NEXT: - 1.00 fcompp -# CHECK-NEXT: 4.50 4.50 fcomi %st(3) -# CHECK-NEXT: 4.50 4.50 fcompi %st(3) +# CHECK-NEXT: 4.50 4.50 fcomi %st(3), %st +# CHECK-NEXT: 4.50 4.50 fcompi %st(3), %st # CHECK-NEXT: 87.00 87.00 fcos # CHECK-NEXT: 0.50 0.50 fdecstp -# CHECK-NEXT: 17.00 17.00 fdiv %st(0), %st(1) -# CHECK-NEXT: 17.00 17.00 fdiv %st(2) +# CHECK-NEXT: 17.00 17.00 fdiv %st, %st(1) +# CHECK-NEXT: 17.00 17.00 fdiv %st(2), %st # CHECK-NEXT: 17.00 17.00 fdivs (%ecx) # CHECK-NEXT: 17.00 17.00 fdivl (%eax) -# CHECK-NEXT: 17.00 17.00 fdivp %st(1) -# CHECK-NEXT: 17.00 17.00 fdivp %st(2) +# CHECK-NEXT: 17.00 17.00 fdivp %st, %st(1) +# CHECK-NEXT: 17.00 17.00 fdivp %st, %st(2) # CHECK-NEXT: 17.00 17.00 fidivs (%ecx) # CHECK-NEXT: 17.00 17.00 fidivl (%eax) -# CHECK-NEXT: 17.00 17.00 fdivr %st(0), %st(1) -# CHECK-NEXT: 17.00 17.00 fdivr %st(2) +# CHECK-NEXT: 17.00 17.00 fdivr %st, %st(1) +# CHECK-NEXT: 17.00 17.00 fdivr %st(2), %st # CHECK-NEXT: 17.00 17.00 fdivrs (%ecx) # CHECK-NEXT: 17.00 17.00 fdivrl (%eax) -# CHECK-NEXT: 17.00 17.00 fdivrp %st(1) -# CHECK-NEXT: 17.00 17.00 fdivrp %st(2) +# CHECK-NEXT: 17.00 17.00 fdivrp %st, %st(1) +# CHECK-NEXT: 17.00 17.00 fdivrp %st, %st(2) # CHECK-NEXT: 17.00 17.00 fidivrs (%ecx) # CHECK-NEXT: 17.00 17.00 fidivrl (%eax) # CHECK-NEXT: 0.50 0.50 ffree %st(0) @@ -447,12 +447,12 @@ fyl2xp1 # CHECK-NEXT: 5.00 5.00 fldln2 # CHECK-NEXT: 5.00 5.00 fldpi # CHECK-NEXT: 0.50 0.50 fldz -# CHECK-NEXT: 4.00 - fmul %st(0), %st(1) -# CHECK-NEXT: 4.00 - fmul %st(2) +# CHECK-NEXT: 4.00 - fmul %st, %st(1) +# CHECK-NEXT: 4.00 - fmul %st(2), %st # CHECK-NEXT: 4.00 - fmuls (%ecx) # CHECK-NEXT: 4.00 - fmull (%eax) -# CHECK-NEXT: 4.00 - fmulp %st(1) -# CHECK-NEXT: 4.00 - fmulp %st(2) +# CHECK-NEXT: 4.00 - fmulp %st, %st(1) +# CHECK-NEXT: 4.00 - fmulp %st, %st(2) # CHECK-NEXT: 4.00 - fimuls (%ecx) # CHECK-NEXT: 4.00 - fimull (%eax) # CHECK-NEXT: 0.50 0.50 fnop @@ -480,20 +480,20 @@ fyl2xp1 # CHECK-NEXT: 0.50 0.50 frstor (%eax) # CHECK-NEXT: 0.50 0.50 wait # CHECK-NEXT: 0.50 0.50 fnsave (%eax) -# CHECK-NEXT: 5.00 - fsub %st(0), %st(1) -# CHECK-NEXT: 5.00 - fsub %st(2) +# CHECK-NEXT: 5.00 - fsub %st, %st(1) +# CHECK-NEXT: 5.00 - fsub %st(2), %st # CHECK-NEXT: 5.00 - fsubs (%ecx) # CHECK-NEXT: 5.00 - fsubl (%eax) -# CHECK-NEXT: 5.00 - fsubp %st(1) -# CHECK-NEXT: 5.00 - fsubp %st(2) +# CHECK-NEXT: 5.00 - fsubp %st, %st(1) +# CHECK-NEXT: 5.00 - fsubp %st, %st(2) # CHECK-NEXT: 5.00 - fisubs (%ecx) # CHECK-NEXT: 5.00 - fisubl (%eax) -# CHECK-NEXT: 5.00 - fsubr %st(0), %st(1) -# CHECK-NEXT: 5.00 - fsubr %st(2) +# CHECK-NEXT: 5.00 - fsubr %st, %st(1) +# CHECK-NEXT: 5.00 - fsubr %st(2), %st # CHECK-NEXT: 5.00 - fsubrs (%ecx) # CHECK-NEXT: 5.00 - fsubrl (%eax) -# CHECK-NEXT: 5.00 - fsubrp %st(1) -# CHECK-NEXT: 5.00 - fsubrp %st(2) +# CHECK-NEXT: 5.00 - fsubrp %st, %st(1) +# CHECK-NEXT: 5.00 - fsubrp %st, %st(2) # CHECK-NEXT: 5.00 - fisubrs (%ecx) # CHECK-NEXT: 5.00 - fisubrl (%eax) # CHECK-NEXT: 4.50 4.50 ftst @@ -502,8 +502,8 @@ fyl2xp1 # CHECK-NEXT: - 1.00 fucomp %st(1) # CHECK-NEXT: - 1.00 fucomp %st(3) # CHECK-NEXT: - 1.00 fucompp -# CHECK-NEXT: 4.50 4.50 fucomi %st(3) -# CHECK-NEXT: 4.50 4.50 fucompi %st(3) +# CHECK-NEXT: 4.50 4.50 fucomi %st(3), %st +# CHECK-NEXT: 4.50 4.50 fucompi %st(3), %st # CHECK-NEXT: 0.50 0.50 wait # CHECK-NEXT: 1.00 - fxam # CHECK-NEXT: 1.00 1.00 fxch %st(1) diff --git a/test/tools/llvm-mca/X86/BdVer2/resources-x87.s b/test/tools/llvm-mca/X86/BdVer2/resources-x87.s index ad72714c74c1..4cdddf01104b 100644 --- a/test/tools/llvm-mca/X86/BdVer2/resources-x87.s +++ b/test/tools/llvm-mca/X86/BdVer2/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 0.50 U f2xm1 # CHECK-NEXT: 1 1 1.00 U fabs -# CHECK-NEXT: 1 5 1.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 5 1.00 U fadd %st(2) +# CHECK-NEXT: 1 5 1.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fadd %st(2), %st # CHECK-NEXT: 1 10 1.00 * U fadds (%ecx) # CHECK-NEXT: 1 10 1.00 * U faddl (%ecx) -# CHECK-NEXT: 1 5 1.00 U faddp %st(1) -# CHECK-NEXT: 1 5 1.00 U faddp %st(2) +# CHECK-NEXT: 1 5 1.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U faddp %st, %st(2) # CHECK-NEXT: 1 10 1.00 * U fiadds (%ecx) # CHECK-NEXT: 1 10 1.00 * U fiaddl (%ecx) # CHECK-NEXT: 1 100 0.50 U fbld (%ecx) # CHECK-NEXT: 1 100 0.50 U fbstp (%eax) # CHECK-NEXT: 1 1 1.00 U fchs # CHECK-NEXT: 1 100 0.50 U fnclex -# CHECK-NEXT: 1 1 1.00 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 1 1 1.00 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 1 1 1.00 U fcmove %st(1), %st(0) -# CHECK-NEXT: 1 1 1.00 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 1 1 1.00 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 1 1 1.00 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 1 1 1.00 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 1 1 1.00 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 1 1 1.00 U fcmovb %st(1), %st +# CHECK-NEXT: 1 1 1.00 U fcmovbe %st(1), %st +# CHECK-NEXT: 1 1 1.00 U fcmove %st(1), %st +# CHECK-NEXT: 1 1 1.00 U fcmovnb %st(1), %st +# CHECK-NEXT: 1 1 1.00 U fcmovnbe %st(1), %st +# CHECK-NEXT: 1 1 1.00 U fcmovne %st(1), %st +# CHECK-NEXT: 1 1 1.00 U fcmovnu %st(1), %st +# CHECK-NEXT: 1 1 1.00 U fcmovu %st(1), %st # CHECK-NEXT: 2 1 1.00 U fcom %st(1) # CHECK-NEXT: 2 1 1.00 U fcom %st(3) # CHECK-NEXT: 1 6 1.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 1 6 1.00 U fcomps (%ecx) # CHECK-NEXT: 1 6 1.00 U fcompl (%eax) # CHECK-NEXT: 1 100 0.50 U fcompp -# CHECK-NEXT: 2 1 1.00 U fcomi %st(3) -# CHECK-NEXT: 2 1 1.00 U fcompi %st(3) +# CHECK-NEXT: 2 1 1.00 U fcomi %st(3), %st +# CHECK-NEXT: 2 1 1.00 U fcompi %st(3), %st # CHECK-NEXT: 1 100 0.50 U fcos # CHECK-NEXT: 1 100 0.50 U fdecstp -# CHECK-NEXT: 1 9 9.50 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 9 9.50 U fdiv %st(2) +# CHECK-NEXT: 1 9 9.50 U fdiv %st, %st(1) +# CHECK-NEXT: 1 9 9.50 U fdiv %st(2), %st # CHECK-NEXT: 1 14 9.50 * U fdivs (%ecx) # CHECK-NEXT: 1 14 9.50 * U fdivl (%eax) -# CHECK-NEXT: 1 9 9.50 U fdivp %st(1) -# CHECK-NEXT: 1 9 9.50 U fdivp %st(2) +# CHECK-NEXT: 1 9 9.50 U fdivp %st, %st(1) +# CHECK-NEXT: 1 9 9.50 U fdivp %st, %st(2) # CHECK-NEXT: 1 14 9.50 * U fidivs (%ecx) # CHECK-NEXT: 1 14 9.50 * U fidivl (%eax) -# CHECK-NEXT: 1 9 9.50 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 9 9.50 U fdivr %st(2) +# CHECK-NEXT: 1 9 9.50 U fdivr %st, %st(1) +# CHECK-NEXT: 1 9 9.50 U fdivr %st(2), %st # CHECK-NEXT: 1 14 9.50 * U fdivrs (%ecx) # CHECK-NEXT: 1 14 9.50 * U fdivrl (%eax) -# CHECK-NEXT: 1 9 9.50 U fdivrp %st(1) -# CHECK-NEXT: 1 9 9.50 U fdivrp %st(2) +# CHECK-NEXT: 1 9 9.50 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 9 9.50 U fdivrp %st, %st(2) # CHECK-NEXT: 1 14 9.50 * U fidivrs (%ecx) # CHECK-NEXT: 1 14 9.50 * U fidivrl (%eax) # CHECK-NEXT: 1 100 0.50 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 1 3 1.00 U fldln2 # CHECK-NEXT: 1 3 1.00 U fldpi # CHECK-NEXT: 1 3 1.00 U fldz -# CHECK-NEXT: 1 5 1.00 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 5 1.00 U fmul %st(2) +# CHECK-NEXT: 1 5 1.00 U fmul %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fmul %st(2), %st # CHECK-NEXT: 1 10 1.00 * U fmuls (%ecx) # CHECK-NEXT: 1 10 1.00 * U fmull (%eax) -# CHECK-NEXT: 1 5 1.00 U fmulp %st(1) -# CHECK-NEXT: 1 5 1.00 U fmulp %st(2) +# CHECK-NEXT: 1 5 1.00 U fmulp %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fmulp %st, %st(2) # CHECK-NEXT: 1 10 1.00 * U fimuls (%ecx) # CHECK-NEXT: 1 10 1.00 * U fimull (%eax) # CHECK-NEXT: 1 1 0.50 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 1 100 0.50 U frstor (%eax) # CHECK-NEXT: 1 100 0.50 U wait # CHECK-NEXT: 1 100 0.50 U fnsave (%eax) -# CHECK-NEXT: 1 5 1.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 5 1.00 U fsub %st(2) +# CHECK-NEXT: 1 5 1.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fsub %st(2), %st # CHECK-NEXT: 1 10 1.00 * U fsubs (%ecx) # CHECK-NEXT: 1 10 1.00 * U fsubl (%eax) -# CHECK-NEXT: 1 5 1.00 U fsubp %st(1) -# CHECK-NEXT: 1 5 1.00 U fsubp %st(2) +# CHECK-NEXT: 1 5 1.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fsubp %st, %st(2) # CHECK-NEXT: 1 10 1.00 * U fisubs (%ecx) # CHECK-NEXT: 1 10 1.00 * U fisubl (%eax) -# CHECK-NEXT: 1 5 1.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 5 1.00 U fsubr %st(2) +# CHECK-NEXT: 1 5 1.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fsubr %st(2), %st # CHECK-NEXT: 1 10 1.00 * U fsubrs (%ecx) # CHECK-NEXT: 1 10 1.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 5 1.00 U fsubrp %st(1) -# CHECK-NEXT: 1 5 1.00 U fsubrp %st(2) +# CHECK-NEXT: 1 5 1.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fsubrp %st, %st(2) # CHECK-NEXT: 1 10 1.00 * U fisubrs (%ecx) # CHECK-NEXT: 1 10 1.00 * U fisubrl (%eax) # CHECK-NEXT: 1 1 1.00 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 2 1 1.00 U fucomp %st(1) # CHECK-NEXT: 2 1 1.00 U fucomp %st(3) # CHECK-NEXT: 1 1 1.00 U fucompp -# CHECK-NEXT: 2 1 1.00 U fucomi %st(3) -# CHECK-NEXT: 2 1 1.00 U fucompi %st(3) +# CHECK-NEXT: 2 1 1.00 U fucomi %st(3), %st +# CHECK-NEXT: 2 1 1.00 U fucompi %st(3), %st # CHECK-NEXT: 1 100 0.50 U wait # CHECK-NEXT: 1 100 0.50 U fxam # CHECK-NEXT: 1 1 0.50 U fxch %st(1) @@ -388,26 +388,26 @@ fyl2xp1 # CHECK-NEXT: [0.0] [0.1] [1] [2] [3] [4] [5] [6] [7.0] [7.1] [8.0] [8.1] [9] [10] [11] [12] [13] [14] [15] [16.0] [16.1] [17] [18] Instructions: # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - f2xm1 # CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fabs -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fadd %st(0), %st(1) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fadd %st(2) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fadd %st, %st(1) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fadd %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fadds (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - faddl (%ecx) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - faddp %st(1) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - faddp %st(2) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - faddp %st, %st(1) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - faddp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fiadds (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fiaddl (%ecx) # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - fbld (%ecx) # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - fbstp (%eax) # CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fchs # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - fnclex -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovb %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovbe %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmove %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovnb %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovnbe %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovne %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovnu %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovu %st(1), %st(0) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovb %st(1), %st +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovbe %st(1), %st +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmove %st(1), %st +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovnb %st(1), %st +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovnbe %st(1), %st +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovne %st(1), %st +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovnu %st(1), %st +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcmovu %st(1), %st # CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcom %st(1) # CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcom %st(3) # CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fcoms (%ecx) @@ -417,24 +417,24 @@ fyl2xp1 # CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fcomps (%ecx) # CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fcompl (%eax) # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - fcompp -# CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcomi %st(3) -# CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcompi %st(3) +# CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcomi %st(3), %st +# CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fcompi %st(3), %st # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - fcos # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - fdecstp -# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdiv %st(0), %st(1) -# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdiv %st(2) +# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdiv %st, %st(1) +# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdiv %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - - 9.50 9.50 - - - - - 1.00 - - - 0.50 0.50 - - fdivs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 9.50 9.50 - - - - - 1.00 - - - 0.50 0.50 - - fdivl (%eax) -# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivp %st(1) -# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivp %st(2) +# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivp %st, %st(1) +# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - - 9.50 9.50 - - - - - 1.00 - - - 0.50 0.50 - - fidivs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 9.50 9.50 - - - - - 1.00 - - - 0.50 0.50 - - fidivl (%eax) -# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivr %st(0), %st(1) -# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivr %st(2) +# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivr %st, %st(1) +# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivr %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - - 9.50 9.50 - - - - - 1.00 - - - 0.50 0.50 - - fdivrs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 9.50 9.50 - - - - - 1.00 - - - 0.50 0.50 - - fdivrl (%eax) -# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivrp %st(1) -# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivrp %st(2) +# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivrp %st, %st(1) +# CHECK-NEXT: - - - - - - - - 9.50 9.50 - - - - - 1.00 - - - - - - - fdivrp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - - 9.50 9.50 - - - - - 1.00 - - - 0.50 0.50 - - fidivrs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 9.50 9.50 - - - - - 1.00 - - - 0.50 0.50 - - fidivrl (%eax) # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - ffree %st(0) @@ -468,12 +468,12 @@ fyl2xp1 # CHECK-NEXT: - - - - - - - - - - - - - 1.00 - 1.00 - - - - - - - fldln2 # CHECK-NEXT: - - - - - - - - - - - - - 1.00 - 1.00 - - - - - - - fldpi # CHECK-NEXT: - - - - - - - - - - - - - 1.00 - 1.00 - - - - - - - fldz -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fmul %st(0), %st(1) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fmul %st(2) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fmul %st, %st(1) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fmul %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - - 1.00 - - - 0.50 0.50 - - fmuls (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - - 1.00 - - - 0.50 0.50 - - fmull (%eax) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fmulp %st(1) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fmulp %st(2) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fmulp %st, %st(1) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fmulp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - - 1.00 - - - 0.50 0.50 - - fimuls (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - - 1.00 - - - 0.50 0.50 - - fimull (%eax) # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - fnop @@ -501,20 +501,20 @@ fyl2xp1 # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - frstor (%eax) # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - wait # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - fnsave (%eax) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsub %st(0), %st(1) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsub %st(2) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsub %st, %st(1) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsub %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fsubs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fsubl (%eax) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubp %st(1) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubp %st(2) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubp %st, %st(1) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fisubs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fisubl (%eax) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubr %st(0), %st(1) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubr %st(2) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubr %st, %st(1) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubr %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fsubrs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fsubrl (%eax) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubrp %st(1) -# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubrp %st(2) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubrp %st, %st(1) +# CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - 1.00 - - - - - - - - fsubrp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fisubrs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 0.50 - - - - 1.00 - - - - 0.50 0.50 - - fisubrl (%eax) # CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - ftst @@ -523,8 +523,8 @@ fyl2xp1 # CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fucomp %st(1) # CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fucomp %st(3) # CHECK-NEXT: - - - - - - - - 0.50 0.50 - - - - - 1.00 - - - - - - - fucompp -# CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fucomi %st(3) -# CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fucompi %st(3) +# CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fucomi %st(3), %st +# CHECK-NEXT: - - - - - 1.00 - - 0.50 0.50 - - - - 1.00 - - - - - - - - fucompi %st(3), %st # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - wait # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - fxam # CHECK-NEXT: - - - - - 0.50 0.50 - - - - - - - - - - - - - - - - fxch %st(1) diff --git a/test/tools/llvm-mca/X86/Broadwell/resources-x87.s b/test/tools/llvm-mca/X86/Broadwell/resources-x87.s index 5cb92be47eab..2f3a69da99d0 100644 --- a/test/tools/llvm-mca/X86/Broadwell/resources-x87.s +++ b/test/tools/llvm-mca/X86/Broadwell/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 0.25 U f2xm1 # CHECK-NEXT: 1 1 1.00 U fabs -# CHECK-NEXT: 1 3 1.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fadd %st(2) +# CHECK-NEXT: 1 3 1.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fadd %st(2), %st # CHECK-NEXT: 2 9 1.00 * U fadds (%ecx) # CHECK-NEXT: 2 9 1.00 * U faddl (%ecx) -# CHECK-NEXT: 1 3 1.00 U faddp %st(1) -# CHECK-NEXT: 1 3 1.00 U faddp %st(2) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(2) # CHECK-NEXT: 3 12 2.00 * U fiadds (%ecx) # CHECK-NEXT: 3 12 2.00 * U fiaddl (%ecx) # CHECK-NEXT: 1 100 0.25 U fbld (%ecx) # CHECK-NEXT: 2 1 1.00 U fbstp (%eax) # CHECK-NEXT: 1 1 1.00 U fchs # CHECK-NEXT: 4 4 1.00 U fnclex -# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st # CHECK-NEXT: 1 1 1.00 U fcom %st(1) # CHECK-NEXT: 1 1 1.00 U fcom %st(3) # CHECK-NEXT: 2 7 1.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 2 7 1.00 U fcomps (%ecx) # CHECK-NEXT: 2 7 1.00 U fcompl (%eax) # CHECK-NEXT: 1 100 0.25 U fcompp -# CHECK-NEXT: 1 3 1.00 U fcomi %st(3) -# CHECK-NEXT: 1 3 1.00 U fcompi %st(3) +# CHECK-NEXT: 1 3 1.00 U fcomi %st(3), %st +# CHECK-NEXT: 1 3 1.00 U fcompi %st(3), %st # CHECK-NEXT: 1 100 0.25 U fcos # CHECK-NEXT: 2 2 1.00 U fdecstp -# CHECK-NEXT: 1 15 1.00 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 20 1.00 U fdiv %st(2) +# CHECK-NEXT: 1 15 1.00 U fdiv %st, %st(1) +# CHECK-NEXT: 1 20 1.00 U fdiv %st(2), %st # CHECK-NEXT: 2 21 1.00 * U fdivs (%ecx) # CHECK-NEXT: 2 21 1.00 * U fdivl (%eax) -# CHECK-NEXT: 1 15 1.00 U fdivp %st(1) -# CHECK-NEXT: 1 15 1.00 U fdivp %st(2) +# CHECK-NEXT: 1 15 1.00 U fdivp %st, %st(1) +# CHECK-NEXT: 1 15 1.00 U fdivp %st, %st(2) # CHECK-NEXT: 3 24 1.00 * U fidivs (%ecx) # CHECK-NEXT: 3 24 1.00 * U fidivl (%eax) -# CHECK-NEXT: 1 20 1.00 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 15 1.00 U fdivr %st(2) +# CHECK-NEXT: 1 20 1.00 U fdivr %st, %st(1) +# CHECK-NEXT: 1 15 1.00 U fdivr %st(2), %st # CHECK-NEXT: 2 26 1.00 * U fdivrs (%ecx) # CHECK-NEXT: 2 26 1.00 * U fdivrl (%eax) -# CHECK-NEXT: 1 20 1.00 U fdivrp %st(1) -# CHECK-NEXT: 1 20 1.00 U fdivrp %st(2) +# CHECK-NEXT: 1 20 1.00 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 20 1.00 U fdivrp %st, %st(2) # CHECK-NEXT: 3 29 1.00 * U fidivrs (%ecx) # CHECK-NEXT: 3 29 1.00 * U fidivrl (%eax) # CHECK-NEXT: 1 100 0.25 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 2 1 1.00 U fldln2 # CHECK-NEXT: 2 1 1.00 U fldpi # CHECK-NEXT: 1 1 0.50 U fldz -# CHECK-NEXT: 1 5 1.00 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 5 1.00 U fmul %st(2) +# CHECK-NEXT: 1 5 1.00 U fmul %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fmul %st(2), %st # CHECK-NEXT: 2 11 1.00 * U fmuls (%ecx) # CHECK-NEXT: 2 11 1.00 * U fmull (%eax) -# CHECK-NEXT: 1 5 1.00 U fmulp %st(1) -# CHECK-NEXT: 1 5 1.00 U fmulp %st(2) +# CHECK-NEXT: 1 5 1.00 U fmulp %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fmulp %st, %st(2) # CHECK-NEXT: 3 14 1.00 * U fimuls (%ecx) # CHECK-NEXT: 3 14 1.00 * U fimull (%eax) # CHECK-NEXT: 1 1 0.50 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 1 100 0.25 U frstor (%eax) # CHECK-NEXT: 2 2 0.50 U wait # CHECK-NEXT: 1 100 0.25 U fnsave (%eax) -# CHECK-NEXT: 1 3 1.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsub %st(2) +# CHECK-NEXT: 1 3 1.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsub %st(2), %st # CHECK-NEXT: 2 9 1.00 * U fsubs (%ecx) # CHECK-NEXT: 2 9 1.00 * U fsubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(2) # CHECK-NEXT: 3 12 2.00 * U fisubs (%ecx) # CHECK-NEXT: 3 12 2.00 * U fisubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubr %st(2), %st # CHECK-NEXT: 2 9 1.00 * U fsubrs (%ecx) # CHECK-NEXT: 2 9 1.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(2) # CHECK-NEXT: 3 12 2.00 * U fisubrs (%ecx) # CHECK-NEXT: 3 12 2.00 * U fisubrl (%eax) # CHECK-NEXT: 1 3 1.00 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 1 1 1.00 U fucomp %st(1) # CHECK-NEXT: 1 1 1.00 U fucomp %st(3) # CHECK-NEXT: 1 3 1.00 U fucompp -# CHECK-NEXT: 1 3 1.00 U fucomi %st(3) -# CHECK-NEXT: 1 3 1.00 U fucompi %st(3) +# CHECK-NEXT: 1 3 1.00 U fucomi %st(3), %st +# CHECK-NEXT: 1 3 1.00 U fucompi %st(3), %st # CHECK-NEXT: 2 2 0.50 U wait # CHECK-NEXT: 1 100 0.25 U fxam # CHECK-NEXT: 12 14 4.00 U fxch %st(1) @@ -375,26 +375,26 @@ fyl2xp1 # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions: # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - f2xm1 # CHECK-NEXT: - - - - - - - 1.00 - - fabs -# CHECK-NEXT: - - - 1.00 - - - - - - fadd %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - fadd %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - fadd %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - fadd %st(2), %st # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fadds (%ecx) # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - faddl (%ecx) -# CHECK-NEXT: - - - 1.00 - - - - - - faddp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - faddp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - faddp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - faddp %st, %st(2) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fiadds (%ecx) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fiaddl (%ecx) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fbld (%ecx) # CHECK-NEXT: - - - - 0.33 0.33 1.00 - - 0.33 fbstp (%eax) # CHECK-NEXT: - - - - - - - 1.00 - - fchs # CHECK-NEXT: - - 1.00 1.00 - - - 1.00 1.00 - fnclex -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovb %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovbe %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmove %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnb %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnbe %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovne %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnu %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovu %st(1), %st(0) +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovb %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovbe %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmove %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnb %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnbe %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovne %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnu %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovu %st(1), %st # CHECK-NEXT: - - - 1.00 - - - - - - fcom %st(1) # CHECK-NEXT: - - - 1.00 - - - - - - fcom %st(3) # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fcoms (%ecx) @@ -404,24 +404,24 @@ fyl2xp1 # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fcomps (%ecx) # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fcompl (%eax) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fcompp -# CHECK-NEXT: - - - 1.00 - - - - - - fcomi %st(3) -# CHECK-NEXT: - - - 1.00 - - - - - - fcompi %st(3) +# CHECK-NEXT: - - - 1.00 - - - - - - fcomi %st(3), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcompi %st(3), %st # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fcos # CHECK-NEXT: - - 1.00 1.00 - - - - - - fdecstp -# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fidivs (%ecx) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fidivl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivrs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivrl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fidivrs (%ecx) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fidivrl (%eax) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - ffree %st(0) @@ -455,12 +455,12 @@ fyl2xp1 # CHECK-NEXT: - - 1.00 1.00 - - - - - - fldln2 # CHECK-NEXT: - - 1.00 1.00 - - - - - - fldpi # CHECK-NEXT: - - 0.50 0.50 - - - - - - fldz -# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fmuls (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fmull (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fimuls (%ecx) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fimull (%eax) # CHECK-NEXT: - - 0.50 0.50 - - - - - - fnop @@ -488,20 +488,20 @@ fyl2xp1 # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - frstor (%eax) # CHECK-NEXT: - - 0.50 0.50 - - - 0.50 0.50 - wait # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fnsave (%eax) -# CHECK-NEXT: - - - 1.00 - - - - - - fsub %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - fsub %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - fsub %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - fsub %st(2), %st # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fsubs (%ecx) # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fsubl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubp %st, %st(2) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fisubs (%ecx) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fisubl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubr %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubr %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubr %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubr %st(2), %st # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fsubrs (%ecx) # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fsubrl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubrp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubrp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubrp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubrp %st, %st(2) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fisubrs (%ecx) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fisubrl (%eax) # CHECK-NEXT: - - - 1.00 - - - - - - ftst @@ -510,8 +510,8 @@ fyl2xp1 # CHECK-NEXT: - - - 1.00 - - - - - - fucomp %st(1) # CHECK-NEXT: - - - 1.00 - - - - - - fucomp %st(3) # CHECK-NEXT: - - - 1.00 - - - - - - fucompp -# CHECK-NEXT: - - - 1.00 - - - - - - fucomi %st(3) -# CHECK-NEXT: - - - 1.00 - - - - - - fucompi %st(3) +# CHECK-NEXT: - - - 1.00 - - - - - - fucomi %st(3), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fucompi %st(3), %st # CHECK-NEXT: - - 0.50 0.50 - - - 0.50 0.50 - wait # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fxam # CHECK-NEXT: - - 3.25 2.25 - - - 1.25 5.25 - fxch %st(1) diff --git a/test/tools/llvm-mca/X86/BtVer2/resources-x87.s b/test/tools/llvm-mca/X86/BtVer2/resources-x87.s index a0e431f6dfe4..2b6b2c497273 100644 --- a/test/tools/llvm-mca/X86/BtVer2/resources-x87.s +++ b/test/tools/llvm-mca/X86/BtVer2/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 0.50 U f2xm1 # CHECK-NEXT: 1 2 1.00 U fabs -# CHECK-NEXT: 1 3 1.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fadd %st(2) +# CHECK-NEXT: 1 3 1.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fadd %st(2), %st # CHECK-NEXT: 1 8 1.00 * U fadds (%ecx) # CHECK-NEXT: 1 8 1.00 * U faddl (%ecx) -# CHECK-NEXT: 1 3 1.00 U faddp %st(1) -# CHECK-NEXT: 1 3 1.00 U faddp %st(2) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(2) # CHECK-NEXT: 1 8 1.00 * U fiadds (%ecx) # CHECK-NEXT: 1 8 1.00 * U fiaddl (%ecx) # CHECK-NEXT: 1 100 0.50 U fbld (%ecx) # CHECK-NEXT: 1 100 0.50 U fbstp (%eax) # CHECK-NEXT: 1 2 1.00 U fchs # CHECK-NEXT: 1 100 0.50 U fnclex -# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st # CHECK-NEXT: 1 3 1.00 U fcom %st(1) # CHECK-NEXT: 1 3 1.00 U fcom %st(3) # CHECK-NEXT: 1 8 1.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 1 8 1.00 U fcomps (%ecx) # CHECK-NEXT: 1 8 1.00 U fcompl (%eax) # CHECK-NEXT: 1 100 0.50 U fcompp -# CHECK-NEXT: 1 3 1.00 U fcomi %st(3) -# CHECK-NEXT: 1 3 1.00 U fcompi %st(3) +# CHECK-NEXT: 1 3 1.00 U fcomi %st(3), %st +# CHECK-NEXT: 1 3 1.00 U fcompi %st(3), %st # CHECK-NEXT: 1 100 0.50 U fcos # CHECK-NEXT: 1 100 0.50 U fdecstp -# CHECK-NEXT: 1 19 19.00 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 19 19.00 U fdiv %st(2) +# CHECK-NEXT: 1 19 19.00 U fdiv %st, %st(1) +# CHECK-NEXT: 1 19 19.00 U fdiv %st(2), %st # CHECK-NEXT: 1 24 19.00 * U fdivs (%ecx) # CHECK-NEXT: 1 24 19.00 * U fdivl (%eax) -# CHECK-NEXT: 1 19 19.00 U fdivp %st(1) -# CHECK-NEXT: 1 19 19.00 U fdivp %st(2) +# CHECK-NEXT: 1 19 19.00 U fdivp %st, %st(1) +# CHECK-NEXT: 1 19 19.00 U fdivp %st, %st(2) # CHECK-NEXT: 1 24 19.00 * U fidivs (%ecx) # CHECK-NEXT: 1 24 19.00 * U fidivl (%eax) -# CHECK-NEXT: 1 19 19.00 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 19 19.00 U fdivr %st(2) +# CHECK-NEXT: 1 19 19.00 U fdivr %st, %st(1) +# CHECK-NEXT: 1 19 19.00 U fdivr %st(2), %st # CHECK-NEXT: 1 24 19.00 * U fdivrs (%ecx) # CHECK-NEXT: 1 24 19.00 * U fdivrl (%eax) -# CHECK-NEXT: 1 19 19.00 U fdivrp %st(1) -# CHECK-NEXT: 1 19 19.00 U fdivrp %st(2) +# CHECK-NEXT: 1 19 19.00 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 19 19.00 U fdivrp %st, %st(2) # CHECK-NEXT: 1 24 19.00 * U fidivrs (%ecx) # CHECK-NEXT: 1 24 19.00 * U fidivrl (%eax) # CHECK-NEXT: 1 100 0.50 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 1 3 1.00 U fldln2 # CHECK-NEXT: 1 3 1.00 U fldpi # CHECK-NEXT: 1 3 1.00 U fldz -# CHECK-NEXT: 1 2 1.00 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 2 1.00 U fmul %st(2) +# CHECK-NEXT: 1 2 1.00 U fmul %st, %st(1) +# CHECK-NEXT: 1 2 1.00 U fmul %st(2), %st # CHECK-NEXT: 1 7 1.00 * U fmuls (%ecx) # CHECK-NEXT: 1 7 1.00 * U fmull (%eax) -# CHECK-NEXT: 1 2 1.00 U fmulp %st(1) -# CHECK-NEXT: 1 2 1.00 U fmulp %st(2) +# CHECK-NEXT: 1 2 1.00 U fmulp %st, %st(1) +# CHECK-NEXT: 1 2 1.00 U fmulp %st, %st(2) # CHECK-NEXT: 1 7 1.00 * U fimuls (%ecx) # CHECK-NEXT: 1 7 1.00 * U fimull (%eax) # CHECK-NEXT: 1 1 0.50 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 1 100 0.50 U frstor (%eax) # CHECK-NEXT: 1 100 0.50 U wait # CHECK-NEXT: 1 100 0.50 U fnsave (%eax) -# CHECK-NEXT: 1 3 1.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsub %st(2) +# CHECK-NEXT: 1 3 1.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsub %st(2), %st # CHECK-NEXT: 1 8 1.00 * U fsubs (%ecx) # CHECK-NEXT: 1 8 1.00 * U fsubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(2) # CHECK-NEXT: 1 8 1.00 * U fisubs (%ecx) # CHECK-NEXT: 1 8 1.00 * U fisubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubr %st(2), %st # CHECK-NEXT: 1 8 1.00 * U fsubrs (%ecx) # CHECK-NEXT: 1 8 1.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(2) # CHECK-NEXT: 1 8 1.00 * U fisubrs (%ecx) # CHECK-NEXT: 1 8 1.00 * U fisubrl (%eax) # CHECK-NEXT: 1 3 1.00 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 1 3 1.00 U fucomp %st(1) # CHECK-NEXT: 1 3 1.00 U fucomp %st(3) # CHECK-NEXT: 1 3 1.00 U fucompp -# CHECK-NEXT: 1 3 1.00 U fucomi %st(3) -# CHECK-NEXT: 1 3 1.00 U fucompi %st(3) +# CHECK-NEXT: 1 3 1.00 U fucomi %st(3), %st +# CHECK-NEXT: 1 3 1.00 U fucompi %st(3), %st # CHECK-NEXT: 1 100 0.50 U wait # CHECK-NEXT: 1 100 0.50 U fxam # CHECK-NEXT: 1 1 0.50 U fxch %st(1) @@ -379,26 +379,26 @@ fyl2xp1 # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] Instructions: # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - f2xm1 # CHECK-NEXT: - - - - 1.00 - 1.00 - - - - - - - fabs -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fadd %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fadd %st(2) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fadd %st, %st(1) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fadd %st(2), %st # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fadds (%ecx) # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - faddl (%ecx) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - faddp %st(1) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - faddp %st(2) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - faddp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - faddp %st, %st(2) # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fiadds (%ecx) # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fiaddl (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - fbld (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - fbstp (%eax) # CHECK-NEXT: - - - - 1.00 - 1.00 - - - - - - - fchs # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - fnclex -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovb %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovbe %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmove %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovnb %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovnbe %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovne %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovnu %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovu %st(1), %st(0) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovb %st(1), %st +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovbe %st(1), %st +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmove %st(1), %st +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovnb %st(1), %st +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovnbe %st(1), %st +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovne %st(1), %st +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovnu %st(1), %st +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fcmovu %st(1), %st # CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fcom %st(1) # CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fcom %st(3) # CHECK-NEXT: 1.00 - - 1.00 - 1.00 - 1.00 - - - - - - fcoms (%ecx) @@ -408,24 +408,24 @@ fyl2xp1 # CHECK-NEXT: 1.00 - - 1.00 - 1.00 - 1.00 - - - - - - fcomps (%ecx) # CHECK-NEXT: 1.00 - - 1.00 - 1.00 - 1.00 - - - - - - fcompl (%eax) # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - fcompp -# CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fcomi %st(3) -# CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fcompi %st(3) +# CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fcomi %st(3), %st +# CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fcompi %st(3), %st # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - fcos # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - fdecstp -# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdiv %st(0), %st(1) -# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdiv %st(2) +# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdiv %st, %st(1) +# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdiv %st(2), %st # CHECK-NEXT: - - - - 19.00 - 1.00 1.00 - - - - - - fdivs (%ecx) # CHECK-NEXT: - - - - 19.00 - 1.00 1.00 - - - - - - fdivl (%eax) -# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivp %st(1) -# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivp %st(2) +# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivp %st, %st(1) +# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivp %st, %st(2) # CHECK-NEXT: - - - - 19.00 - 1.00 1.00 - - - - - - fidivs (%ecx) # CHECK-NEXT: - - - - 19.00 - 1.00 1.00 - - - - - - fidivl (%eax) -# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivr %st(0), %st(1) -# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivr %st(2) +# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivr %st, %st(1) +# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivr %st(2), %st # CHECK-NEXT: - - - - 19.00 - 1.00 1.00 - - - - - - fdivrs (%ecx) # CHECK-NEXT: - - - - 19.00 - 1.00 1.00 - - - - - - fdivrl (%eax) -# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivrp %st(1) -# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivrp %st(2) +# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivrp %st, %st(1) +# CHECK-NEXT: - - - - 19.00 - 1.00 - - - - - - - fdivrp %st, %st(2) # CHECK-NEXT: - - - - 19.00 - 1.00 1.00 - - - - - - fidivrs (%ecx) # CHECK-NEXT: - - - - 19.00 - 1.00 1.00 - - - - - - fidivrl (%eax) # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - ffree %st(0) @@ -459,12 +459,12 @@ fyl2xp1 # CHECK-NEXT: - - - - - - 1.00 - - - 1.00 - - - fldln2 # CHECK-NEXT: - - - - - - 1.00 - - - 1.00 - - - fldpi # CHECK-NEXT: - - - - - - 1.00 - - - 1.00 - - - fldz -# CHECK-NEXT: - - - - 1.00 - 1.00 - - - - - - - fmul %st(0), %st(1) -# CHECK-NEXT: - - - - 1.00 - 1.00 - - - - - - - fmul %st(2) +# CHECK-NEXT: - - - - 1.00 - 1.00 - - - - - - - fmul %st, %st(1) +# CHECK-NEXT: - - - - 1.00 - 1.00 - - - - - - - fmul %st(2), %st # CHECK-NEXT: - - - - 1.00 - 1.00 1.00 - - - - - - fmuls (%ecx) # CHECK-NEXT: - - - - 1.00 - 1.00 1.00 - - - - - - fmull (%eax) -# CHECK-NEXT: - - - - 1.00 - 1.00 - - - - - - - fmulp %st(1) -# CHECK-NEXT: - - - - 1.00 - 1.00 - - - - - - - fmulp %st(2) +# CHECK-NEXT: - - - - 1.00 - 1.00 - - - - - - - fmulp %st, %st(1) +# CHECK-NEXT: - - - - 1.00 - 1.00 - - - - - - - fmulp %st, %st(2) # CHECK-NEXT: - - - - 1.00 - 1.00 1.00 - - - - - - fimuls (%ecx) # CHECK-NEXT: - - - - 1.00 - 1.00 1.00 - - - - - - fimull (%eax) # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - fnop @@ -492,20 +492,20 @@ fyl2xp1 # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - frstor (%eax) # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - wait # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - fnsave (%eax) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsub %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsub %st(2) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsub %st, %st(1) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsub %st(2), %st # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fsubs (%ecx) # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fsubl (%eax) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubp %st(1) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubp %st(2) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubp %st, %st(2) # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fisubs (%ecx) # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fisubl (%eax) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubr %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubr %st(2) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubr %st, %st(1) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubr %st(2), %st # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fsubrs (%ecx) # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fsubrl (%eax) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubrp %st(1) -# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubrp %st(2) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubrp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - 1.00 - - - - - - - - fsubrp %st, %st(2) # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fisubrs (%ecx) # CHECK-NEXT: - - - 1.00 - 1.00 - 1.00 - - - - - - fisubrl (%eax) # CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - ftst @@ -514,8 +514,8 @@ fyl2xp1 # CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fucomp %st(1) # CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fucomp %st(3) # CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fucompp -# CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fucomi %st(3) -# CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fucompi %st(3) +# CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fucomi %st(3), %st +# CHECK-NEXT: 1.00 - - 1.00 - 1.00 - - - - - - - - fucompi %st(3), %st # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - wait # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - fxam # CHECK-NEXT: 0.50 0.50 - - - - - - - - - - - - fxch %st(1) diff --git a/test/tools/llvm-mca/X86/Generic/resources-x87.s b/test/tools/llvm-mca/X86/Generic/resources-x87.s index 1cba9a7d77fc..1f3e51e58b33 100644 --- a/test/tools/llvm-mca/X86/Generic/resources-x87.s +++ b/test/tools/llvm-mca/X86/Generic/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 0.33 U f2xm1 # CHECK-NEXT: 1 1 1.00 U fabs -# CHECK-NEXT: 1 3 1.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fadd %st(2) +# CHECK-NEXT: 1 3 1.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fadd %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fadds (%ecx) # CHECK-NEXT: 2 10 1.00 * U faddl (%ecx) -# CHECK-NEXT: 1 3 1.00 U faddp %st(1) -# CHECK-NEXT: 1 3 1.00 U faddp %st(2) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fiadds (%ecx) # CHECK-NEXT: 3 13 2.00 * U fiaddl (%ecx) # CHECK-NEXT: 1 100 0.33 U fbld (%ecx) # CHECK-NEXT: 1 100 0.33 U fbstp (%eax) # CHECK-NEXT: 1 1 1.00 U fchs # CHECK-NEXT: 1 100 0.33 U fnclex -# CHECK-NEXT: 3 3 2.00 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmove %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 3 3 2.00 U fcmovb %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovbe %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmove %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovnb %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovnbe %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovne %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovnu %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovu %st(1), %st # CHECK-NEXT: 1 1 1.00 U fcom %st(1) # CHECK-NEXT: 1 1 1.00 U fcom %st(3) # CHECK-NEXT: 2 8 1.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 2 8 1.00 U fcomps (%ecx) # CHECK-NEXT: 2 8 1.00 U fcompl (%eax) # CHECK-NEXT: 1 100 0.33 U fcompp -# CHECK-NEXT: 3 3 1.00 U fcomi %st(3) -# CHECK-NEXT: 3 3 1.00 U fcompi %st(3) +# CHECK-NEXT: 3 3 1.00 U fcomi %st(3), %st +# CHECK-NEXT: 3 3 1.00 U fcompi %st(3), %st # CHECK-NEXT: 1 100 0.33 U fcos # CHECK-NEXT: 1 1 1.00 U fdecstp -# CHECK-NEXT: 1 14 14.00 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 14 14.00 U fdiv %st(2) +# CHECK-NEXT: 1 14 14.00 U fdiv %st, %st(1) +# CHECK-NEXT: 1 14 14.00 U fdiv %st(2), %st # CHECK-NEXT: 2 31 1.00 * U fdivs (%ecx) # CHECK-NEXT: 2 31 1.00 * U fdivl (%eax) -# CHECK-NEXT: 1 14 14.00 U fdivp %st(1) -# CHECK-NEXT: 1 14 14.00 U fdivp %st(2) +# CHECK-NEXT: 1 14 14.00 U fdivp %st, %st(1) +# CHECK-NEXT: 1 14 14.00 U fdivp %st, %st(2) # CHECK-NEXT: 3 34 1.00 * U fidivs (%ecx) # CHECK-NEXT: 3 34 1.00 * U fidivl (%eax) -# CHECK-NEXT: 1 14 14.00 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 14 14.00 U fdivr %st(2) +# CHECK-NEXT: 1 14 14.00 U fdivr %st, %st(1) +# CHECK-NEXT: 1 14 14.00 U fdivr %st(2), %st # CHECK-NEXT: 2 31 1.00 * U fdivrs (%ecx) # CHECK-NEXT: 2 31 1.00 * U fdivrl (%eax) -# CHECK-NEXT: 1 14 14.00 U fdivrp %st(1) -# CHECK-NEXT: 1 14 14.00 U fdivrp %st(2) +# CHECK-NEXT: 1 14 14.00 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 14 14.00 U fdivrp %st, %st(2) # CHECK-NEXT: 3 34 1.00 * U fidivrs (%ecx) # CHECK-NEXT: 3 34 1.00 * U fidivrl (%eax) # CHECK-NEXT: 1 1 1.00 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 2 1 1.00 U fldln2 # CHECK-NEXT: 2 1 1.00 U fldpi # CHECK-NEXT: 1 1 1.00 U fldz -# CHECK-NEXT: 1 5 1.00 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 5 1.00 U fmul %st(2) +# CHECK-NEXT: 1 5 1.00 U fmul %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fmul %st(2), %st # CHECK-NEXT: 2 12 1.00 * U fmuls (%ecx) # CHECK-NEXT: 2 12 1.00 * U fmull (%eax) -# CHECK-NEXT: 1 5 1.00 U fmulp %st(1) -# CHECK-NEXT: 1 5 1.00 U fmulp %st(2) +# CHECK-NEXT: 1 5 1.00 U fmulp %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fmulp %st, %st(2) # CHECK-NEXT: 3 15 1.00 * U fimuls (%ecx) # CHECK-NEXT: 3 15 1.00 * U fimull (%eax) # CHECK-NEXT: 1 1 1.00 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 1 100 0.33 U frstor (%eax) # CHECK-NEXT: 1 100 0.33 U wait # CHECK-NEXT: 1 100 0.33 U fnsave (%eax) -# CHECK-NEXT: 1 3 1.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsub %st(2) +# CHECK-NEXT: 1 3 1.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsub %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fsubs (%ecx) # CHECK-NEXT: 2 10 1.00 * U fsubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fisubs (%ecx) # CHECK-NEXT: 3 13 2.00 * U fisubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubr %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fsubrs (%ecx) # CHECK-NEXT: 2 10 1.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fisubrs (%ecx) # CHECK-NEXT: 3 13 2.00 * U fisubrl (%eax) # CHECK-NEXT: 1 3 1.00 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 1 1 1.00 U fucomp %st(1) # CHECK-NEXT: 1 1 1.00 U fucomp %st(3) # CHECK-NEXT: 1 3 1.00 U fucompp -# CHECK-NEXT: 3 3 1.00 U fucomi %st(3) -# CHECK-NEXT: 3 3 1.00 U fucompi %st(3) +# CHECK-NEXT: 3 3 1.00 U fucomi %st(3), %st +# CHECK-NEXT: 3 3 1.00 U fucompi %st(3), %st # CHECK-NEXT: 1 100 0.33 U wait # CHECK-NEXT: 1 100 0.33 U fxam # CHECK-NEXT: 1 1 0.33 U fxch %st(1) @@ -373,26 +373,26 @@ fyl2xp1 # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions: # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - f2xm1 # CHECK-NEXT: - - - - - 1.00 - - fabs -# CHECK-NEXT: - - - 1.00 - - - - fadd %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - fadd %st(2) +# CHECK-NEXT: - - - 1.00 - - - - fadd %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - fadd %st(2), %st # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fadds (%ecx) # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 faddl (%ecx) -# CHECK-NEXT: - - - 1.00 - - - - faddp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - faddp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - faddp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - faddp %st, %st(2) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fiadds (%ecx) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fiaddl (%ecx) # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fbld (%ecx) # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fbstp (%eax) # CHECK-NEXT: - - - - - 1.00 - - fchs # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fnclex -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovb %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovbe %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmove %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnb %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnbe %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovne %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnu %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovu %st(1), %st(0) +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovb %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovbe %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmove %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnb %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnbe %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovne %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnu %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovu %st(1), %st # CHECK-NEXT: - - - 1.00 - - - - fcom %st(1) # CHECK-NEXT: - - - 1.00 - - - - fcom %st(3) # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fcoms (%ecx) @@ -402,24 +402,24 @@ fyl2xp1 # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fcomps (%ecx) # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fcompl (%eax) # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fcompp -# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fcomi %st(3) -# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fcompi %st(3) +# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fcomi %st(3), %st +# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fcompi %st(3), %st # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fcos # CHECK-NEXT: - - - - - 1.00 - - fdecstp -# CHECK-NEXT: - 14.00 1.00 - - - - - fdiv %st(0), %st(1) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdiv %st(2) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdiv %st, %st(1) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdiv %st(2), %st # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fdivs (%ecx) # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fdivl (%eax) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivp %st(1) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivp %st(2) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivp %st, %st(1) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fidivs (%ecx) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fidivl (%eax) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivr %st(0), %st(1) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivr %st(2) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivr %st, %st(1) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivr %st(2), %st # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fdivrs (%ecx) # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fdivrl (%eax) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivrp %st(1) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivrp %st(2) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivrp %st, %st(1) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivrp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fidivrs (%ecx) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fidivrl (%eax) # CHECK-NEXT: - - - - - 1.00 - - ffree %st(0) @@ -453,12 +453,12 @@ fyl2xp1 # CHECK-NEXT: - - 1.00 1.00 - - - - fldln2 # CHECK-NEXT: - - 1.00 1.00 - - - - fldpi # CHECK-NEXT: - - - - - 1.00 - - fldz -# CHECK-NEXT: - - 1.00 - - - - - fmul %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - fmul %st(2) +# CHECK-NEXT: - - 1.00 - - - - - fmul %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - fmul %st(2), %st # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fmuls (%ecx) # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fmull (%eax) -# CHECK-NEXT: - - 1.00 - - - - - fmulp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - fmulp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - fmulp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - fmulp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fimuls (%ecx) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fimull (%eax) # CHECK-NEXT: - - - - - 1.00 - - fnop @@ -486,20 +486,20 @@ fyl2xp1 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - frstor (%eax) # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - wait # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fnsave (%eax) -# CHECK-NEXT: - - - 1.00 - - - - fsub %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - fsub %st(2) +# CHECK-NEXT: - - - 1.00 - - - - fsub %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - fsub %st(2), %st # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fsubs (%ecx) # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fsubl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - fsubp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - fsubp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - fsubp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - fsubp %st, %st(2) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fisubs (%ecx) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fisubl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - fsubr %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - fsubr %st(2) +# CHECK-NEXT: - - - 1.00 - - - - fsubr %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - fsubr %st(2), %st # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fsubrs (%ecx) # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fsubrl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - fsubrp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - fsubrp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - fsubrp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - fsubrp %st, %st(2) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fisubrs (%ecx) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fisubrl (%eax) # CHECK-NEXT: - - - 1.00 - - - - ftst @@ -508,8 +508,8 @@ fyl2xp1 # CHECK-NEXT: - - - 1.00 - - - - fucomp %st(1) # CHECK-NEXT: - - - 1.00 - - - - fucomp %st(3) # CHECK-NEXT: - - - 1.00 - - - - fucompp -# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fucomi %st(3) -# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fucompi %st(3) +# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fucomi %st(3), %st +# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fucompi %st(3), %st # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - wait # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fxam # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fxch %st(1) diff --git a/test/tools/llvm-mca/X86/Haswell/resources-x87.s b/test/tools/llvm-mca/X86/Haswell/resources-x87.s index 53006bbc3296..7da8b2802a9a 100644 --- a/test/tools/llvm-mca/X86/Haswell/resources-x87.s +++ b/test/tools/llvm-mca/X86/Haswell/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 0.25 U f2xm1 # CHECK-NEXT: 1 1 1.00 U fabs -# CHECK-NEXT: 1 3 1.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fadd %st(2) +# CHECK-NEXT: 1 3 1.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fadd %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fadds (%ecx) # CHECK-NEXT: 2 10 1.00 * U faddl (%ecx) -# CHECK-NEXT: 1 3 1.00 U faddp %st(1) -# CHECK-NEXT: 1 3 1.00 U faddp %st(2) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fiadds (%ecx) # CHECK-NEXT: 3 13 2.00 * U fiaddl (%ecx) # CHECK-NEXT: 43 47 10.75 U fbld (%ecx) # CHECK-NEXT: 2 1 1.00 U fbstp (%eax) # CHECK-NEXT: 1 1 1.00 U fchs # CHECK-NEXT: 4 4 1.00 U fnclex -# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st # CHECK-NEXT: 1 1 1.00 U fcom %st(1) # CHECK-NEXT: 1 1 1.00 U fcom %st(3) # CHECK-NEXT: 2 8 1.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 2 8 1.00 U fcomps (%ecx) # CHECK-NEXT: 2 8 1.00 U fcompl (%eax) # CHECK-NEXT: 2 1 0.50 U fcompp -# CHECK-NEXT: 3 1 0.50 U fcomi %st(3) -# CHECK-NEXT: 3 1 0.50 U fcompi %st(3) +# CHECK-NEXT: 3 1 0.50 U fcomi %st(3), %st +# CHECK-NEXT: 3 1 0.50 U fcompi %st(3), %st # CHECK-NEXT: 1 100 0.25 U fcos # CHECK-NEXT: 2 2 1.00 U fdecstp -# CHECK-NEXT: 1 24 1.00 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 20 1.00 U fdiv %st(2) +# CHECK-NEXT: 1 24 1.00 U fdiv %st, %st(1) +# CHECK-NEXT: 1 20 1.00 U fdiv %st(2), %st # CHECK-NEXT: 2 31 1.00 * U fdivs (%ecx) # CHECK-NEXT: 2 31 1.00 * U fdivl (%eax) -# CHECK-NEXT: 1 24 1.00 U fdivp %st(1) -# CHECK-NEXT: 1 24 1.00 U fdivp %st(2) +# CHECK-NEXT: 1 24 1.00 U fdivp %st, %st(1) +# CHECK-NEXT: 1 24 1.00 U fdivp %st, %st(2) # CHECK-NEXT: 3 34 1.00 * U fidivs (%ecx) # CHECK-NEXT: 3 34 1.00 * U fidivl (%eax) -# CHECK-NEXT: 1 20 1.00 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 24 1.00 U fdivr %st(2) +# CHECK-NEXT: 1 20 1.00 U fdivr %st, %st(1) +# CHECK-NEXT: 1 24 1.00 U fdivr %st(2), %st # CHECK-NEXT: 2 27 1.00 * U fdivrs (%ecx) # CHECK-NEXT: 2 27 1.00 * U fdivrl (%eax) -# CHECK-NEXT: 1 20 1.00 U fdivrp %st(1) -# CHECK-NEXT: 1 20 1.00 U fdivrp %st(2) +# CHECK-NEXT: 1 20 1.00 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 20 1.00 U fdivrp %st, %st(2) # CHECK-NEXT: 3 30 1.00 * U fidivrs (%ecx) # CHECK-NEXT: 3 30 1.00 * U fidivrl (%eax) # CHECK-NEXT: 1 1 0.50 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 2 1 1.00 U fldln2 # CHECK-NEXT: 2 1 1.00 U fldpi # CHECK-NEXT: 1 1 0.50 U fldz -# CHECK-NEXT: 1 5 1.00 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 5 1.00 U fmul %st(2) +# CHECK-NEXT: 1 5 1.00 U fmul %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fmul %st(2), %st # CHECK-NEXT: 2 12 1.00 * U fmuls (%ecx) # CHECK-NEXT: 2 12 1.00 * U fmull (%eax) -# CHECK-NEXT: 1 5 1.00 U fmulp %st(1) -# CHECK-NEXT: 1 5 1.00 U fmulp %st(2) +# CHECK-NEXT: 1 5 1.00 U fmulp %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fmulp %st, %st(2) # CHECK-NEXT: 3 15 1.00 * U fimuls (%ecx) # CHECK-NEXT: 3 15 1.00 * U fimull (%eax) # CHECK-NEXT: 1 1 0.50 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 90 1 22.50 U frstor (%eax) # CHECK-NEXT: 2 2 0.50 U wait # CHECK-NEXT: 147 1 36.75 U fnsave (%eax) -# CHECK-NEXT: 1 3 1.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsub %st(2) +# CHECK-NEXT: 1 3 1.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsub %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fsubs (%ecx) # CHECK-NEXT: 2 10 1.00 * U fsubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fisubs (%ecx) # CHECK-NEXT: 3 13 2.00 * U fisubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubr %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fsubrs (%ecx) # CHECK-NEXT: 2 10 1.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fisubrs (%ecx) # CHECK-NEXT: 3 13 2.00 * U fisubrl (%eax) # CHECK-NEXT: 1 1 1.00 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 1 1 1.00 U fucomp %st(1) # CHECK-NEXT: 1 1 1.00 U fucomp %st(3) # CHECK-NEXT: 2 1 0.50 U fucompp -# CHECK-NEXT: 3 1 0.50 U fucomi %st(3) -# CHECK-NEXT: 3 1 0.50 U fucompi %st(3) +# CHECK-NEXT: 3 1 0.50 U fucomi %st(3), %st +# CHECK-NEXT: 3 1 0.50 U fucompi %st(3), %st # CHECK-NEXT: 2 2 0.50 U wait # CHECK-NEXT: 2 1 2.00 U fxam # CHECK-NEXT: 15 17 4.00 U fxch %st(1) @@ -375,26 +375,26 @@ fyl2xp1 # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions: # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - f2xm1 # CHECK-NEXT: - - 1.00 - - - - - - - fabs -# CHECK-NEXT: - - - 1.00 - - - - - - fadd %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - fadd %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - fadd %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - fadd %st(2), %st # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fadds (%ecx) # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - faddl (%ecx) -# CHECK-NEXT: - - - 1.00 - - - - - - faddp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - faddp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - faddp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - faddp %st, %st(2) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fiadds (%ecx) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fiaddl (%ecx) # CHECK-NEXT: - - - - - - - - - - fbld (%ecx) # CHECK-NEXT: - - - - 0.33 0.33 1.00 - - 0.33 fbstp (%eax) # CHECK-NEXT: - - 1.00 - - - - - - - fchs # CHECK-NEXT: - - 1.00 1.00 - - - 1.00 1.00 - fnclex -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovb %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovbe %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmove %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnb %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnbe %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovne %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnu %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovu %st(1), %st(0) +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovb %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovbe %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmove %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnb %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnbe %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovne %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnu %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovu %st(1), %st # CHECK-NEXT: - - - 1.00 - - - - - - fcom %st(1) # CHECK-NEXT: - - - 1.00 - - - - - - fcom %st(3) # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fcoms (%ecx) @@ -404,24 +404,24 @@ fyl2xp1 # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fcomps (%ecx) # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fcompl (%eax) # CHECK-NEXT: - - 0.50 0.50 - - - - - - fcompp -# CHECK-NEXT: - - 0.50 0.50 - - - - - - fcomi %st(3) -# CHECK-NEXT: - - 0.50 0.50 - - - - - - fcompi %st(3) +# CHECK-NEXT: - - 0.50 0.50 - - - - - - fcomi %st(3), %st +# CHECK-NEXT: - - 0.50 0.50 - - - - - - fcompi %st(3), %st # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fcos # CHECK-NEXT: - - 1.00 1.00 - - - - - - fdecstp -# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fidivs (%ecx) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fidivl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivrs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivrl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fidivrs (%ecx) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fidivrl (%eax) # CHECK-NEXT: - - 0.50 0.50 - - - - - - ffree %st(0) @@ -455,12 +455,12 @@ fyl2xp1 # CHECK-NEXT: - - 1.00 1.00 - - - - - - fldln2 # CHECK-NEXT: - - 1.00 1.00 - - - - - - fldpi # CHECK-NEXT: - - 0.50 0.50 - - - - - - fldz -# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fmuls (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fmull (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fimuls (%ecx) # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - fimull (%eax) # CHECK-NEXT: - - 0.50 0.50 - - - - - - fnop @@ -488,20 +488,20 @@ fyl2xp1 # CHECK-NEXT: - - - - - - - - - - frstor (%eax) # CHECK-NEXT: - - 0.50 0.50 - - - 0.50 0.50 - wait # CHECK-NEXT: - - - - - - - - - - fnsave (%eax) -# CHECK-NEXT: - - - 1.00 - - - - - - fsub %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - fsub %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - fsub %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - fsub %st(2), %st # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fsubs (%ecx) # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fsubl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubp %st, %st(2) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fisubs (%ecx) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fisubl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubr %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubr %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubr %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubr %st(2), %st # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fsubrs (%ecx) # CHECK-NEXT: - - - 1.00 0.50 0.50 - - - - fsubrl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubrp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - - - fsubrp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubrp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - - - fsubrp %st, %st(2) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fisubrs (%ecx) # CHECK-NEXT: - - - 2.00 0.50 0.50 - - - - fisubrl (%eax) # CHECK-NEXT: - - - 1.00 - - - - - - ftst @@ -510,8 +510,8 @@ fyl2xp1 # CHECK-NEXT: - - - 1.00 - - - - - - fucomp %st(1) # CHECK-NEXT: - - - 1.00 - - - - - - fucomp %st(3) # CHECK-NEXT: - - 0.50 0.50 - - - - - - fucompp -# CHECK-NEXT: - - 0.50 0.50 - - - - - - fucomi %st(3) -# CHECK-NEXT: - - 0.50 0.50 - - - - - - fucompi %st(3) +# CHECK-NEXT: - - 0.50 0.50 - - - - - - fucomi %st(3), %st +# CHECK-NEXT: - - 0.50 0.50 - - - - - - fucompi %st(3), %st # CHECK-NEXT: - - 0.50 0.50 - - - 0.50 0.50 - wait # CHECK-NEXT: - - - 2.00 - - - - - - fxam # CHECK-NEXT: - - 4.00 3.00 - - - 3.00 5.00 - fxch %st(1) diff --git a/test/tools/llvm-mca/X86/SLM/resources-x87.s b/test/tools/llvm-mca/X86/SLM/resources-x87.s index fe5de61296f5..d6d42e957bfe 100644 --- a/test/tools/llvm-mca/X86/SLM/resources-x87.s +++ b/test/tools/llvm-mca/X86/SLM/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 1.00 U f2xm1 # CHECK-NEXT: 1 1 0.50 U fabs -# CHECK-NEXT: 1 3 1.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fadd %st(2) +# CHECK-NEXT: 1 3 1.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fadd %st(2), %st # CHECK-NEXT: 1 6 1.00 * U fadds (%ecx) # CHECK-NEXT: 1 6 1.00 * U faddl (%ecx) -# CHECK-NEXT: 1 3 1.00 U faddp %st(1) -# CHECK-NEXT: 1 3 1.00 U faddp %st(2) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(2) # CHECK-NEXT: 1 6 1.00 * U fiadds (%ecx) # CHECK-NEXT: 1 6 1.00 * U fiaddl (%ecx) # CHECK-NEXT: 1 100 1.00 U fbld (%ecx) # CHECK-NEXT: 1 100 1.00 U fbstp (%eax) # CHECK-NEXT: 1 1 0.50 U fchs # CHECK-NEXT: 1 100 1.00 U fnclex -# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st # CHECK-NEXT: 1 3 1.00 U fcom %st(1) # CHECK-NEXT: 1 3 1.00 U fcom %st(3) # CHECK-NEXT: 1 6 1.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 1 6 1.00 U fcomps (%ecx) # CHECK-NEXT: 1 6 1.00 U fcompl (%eax) # CHECK-NEXT: 1 100 1.00 U fcompp -# CHECK-NEXT: 1 3 1.00 U fcomi %st(3) -# CHECK-NEXT: 1 3 1.00 U fcompi %st(3) +# CHECK-NEXT: 1 3 1.00 U fcomi %st(3), %st +# CHECK-NEXT: 1 3 1.00 U fcompi %st(3), %st # CHECK-NEXT: 1 100 1.00 U fcos # CHECK-NEXT: 1 100 1.00 U fdecstp -# CHECK-NEXT: 1 19 17.00 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 19 17.00 U fdiv %st(2) +# CHECK-NEXT: 1 19 17.00 U fdiv %st, %st(1) +# CHECK-NEXT: 1 19 17.00 U fdiv %st(2), %st # CHECK-NEXT: 1 22 17.00 * U fdivs (%ecx) # CHECK-NEXT: 1 22 17.00 * U fdivl (%eax) -# CHECK-NEXT: 1 19 17.00 U fdivp %st(1) -# CHECK-NEXT: 1 19 17.00 U fdivp %st(2) +# CHECK-NEXT: 1 19 17.00 U fdivp %st, %st(1) +# CHECK-NEXT: 1 19 17.00 U fdivp %st, %st(2) # CHECK-NEXT: 1 22 17.00 * U fidivs (%ecx) # CHECK-NEXT: 1 22 17.00 * U fidivl (%eax) -# CHECK-NEXT: 1 19 17.00 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 19 17.00 U fdivr %st(2) +# CHECK-NEXT: 1 19 17.00 U fdivr %st, %st(1) +# CHECK-NEXT: 1 19 17.00 U fdivr %st(2), %st # CHECK-NEXT: 1 22 17.00 * U fdivrs (%ecx) # CHECK-NEXT: 1 22 17.00 * U fdivrl (%eax) -# CHECK-NEXT: 1 19 17.00 U fdivrp %st(1) -# CHECK-NEXT: 1 19 17.00 U fdivrp %st(2) +# CHECK-NEXT: 1 19 17.00 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 19 17.00 U fdivrp %st, %st(2) # CHECK-NEXT: 1 22 17.00 * U fidivrs (%ecx) # CHECK-NEXT: 1 22 17.00 * U fidivrl (%eax) # CHECK-NEXT: 1 100 1.00 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 2 1 1.00 U fldln2 # CHECK-NEXT: 2 1 1.00 U fldpi # CHECK-NEXT: 1 1 0.50 U fldz -# CHECK-NEXT: 1 5 2.00 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 5 2.00 U fmul %st(2) +# CHECK-NEXT: 1 5 2.00 U fmul %st, %st(1) +# CHECK-NEXT: 1 5 2.00 U fmul %st(2), %st # CHECK-NEXT: 1 8 2.00 * U fmuls (%ecx) # CHECK-NEXT: 1 8 2.00 * U fmull (%eax) -# CHECK-NEXT: 1 5 2.00 U fmulp %st(1) -# CHECK-NEXT: 1 5 2.00 U fmulp %st(2) +# CHECK-NEXT: 1 5 2.00 U fmulp %st, %st(1) +# CHECK-NEXT: 1 5 2.00 U fmulp %st, %st(2) # CHECK-NEXT: 1 8 2.00 * U fimuls (%ecx) # CHECK-NEXT: 1 8 2.00 * U fimull (%eax) # CHECK-NEXT: 1 1 0.50 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 1 100 1.00 U frstor (%eax) # CHECK-NEXT: 1 100 1.00 U wait # CHECK-NEXT: 1 100 1.00 U fnsave (%eax) -# CHECK-NEXT: 1 3 1.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsub %st(2) +# CHECK-NEXT: 1 3 1.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsub %st(2), %st # CHECK-NEXT: 1 6 1.00 * U fsubs (%ecx) # CHECK-NEXT: 1 6 1.00 * U fsubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(2) # CHECK-NEXT: 1 6 1.00 * U fisubs (%ecx) # CHECK-NEXT: 1 6 1.00 * U fisubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubr %st(2), %st # CHECK-NEXT: 1 6 1.00 * U fsubrs (%ecx) # CHECK-NEXT: 1 6 1.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(2) # CHECK-NEXT: 1 6 1.00 * U fisubrs (%ecx) # CHECK-NEXT: 1 6 1.00 * U fisubrl (%eax) # CHECK-NEXT: 1 3 1.00 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 1 3 1.00 U fucomp %st(1) # CHECK-NEXT: 1 3 1.00 U fucomp %st(3) # CHECK-NEXT: 1 3 1.00 U fucompp -# CHECK-NEXT: 1 3 1.00 U fucomi %st(3) -# CHECK-NEXT: 1 3 1.00 U fucompi %st(3) +# CHECK-NEXT: 1 3 1.00 U fucomi %st(3), %st +# CHECK-NEXT: 1 3 1.00 U fucompi %st(3), %st # CHECK-NEXT: 1 100 1.00 U wait # CHECK-NEXT: 1 100 1.00 U fxam # CHECK-NEXT: 1 1 0.50 U fxch %st(1) @@ -373,26 +373,26 @@ fyl2xp1 # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] Instructions: # CHECK-NEXT: - - - 1.00 - - - - f2xm1 # CHECK-NEXT: - - - 0.50 0.50 - - - fabs -# CHECK-NEXT: - - - - 1.00 - - - fadd %st(0), %st(1) -# CHECK-NEXT: - - - - 1.00 - - - fadd %st(2) +# CHECK-NEXT: - - - - 1.00 - - - fadd %st, %st(1) +# CHECK-NEXT: - - - - 1.00 - - - fadd %st(2), %st # CHECK-NEXT: - - - - 1.00 - - 1.00 fadds (%ecx) # CHECK-NEXT: - - - - 1.00 - - 1.00 faddl (%ecx) -# CHECK-NEXT: - - - - 1.00 - - - faddp %st(1) -# CHECK-NEXT: - - - - 1.00 - - - faddp %st(2) +# CHECK-NEXT: - - - - 1.00 - - - faddp %st, %st(1) +# CHECK-NEXT: - - - - 1.00 - - - faddp %st, %st(2) # CHECK-NEXT: - - - - 1.00 - - 1.00 fiadds (%ecx) # CHECK-NEXT: - - - - 1.00 - - 1.00 fiaddl (%ecx) # CHECK-NEXT: - - - 1.00 - - - - fbld (%ecx) # CHECK-NEXT: - - - 1.00 - - - - fbstp (%eax) # CHECK-NEXT: - - - 0.50 0.50 - - - fchs # CHECK-NEXT: - - - 1.00 - - - - fnclex -# CHECK-NEXT: - - - - 1.00 - - - fcmovb %st(1), %st(0) -# CHECK-NEXT: - - - - 1.00 - - - fcmovbe %st(1), %st(0) -# CHECK-NEXT: - - - - 1.00 - - - fcmove %st(1), %st(0) -# CHECK-NEXT: - - - - 1.00 - - - fcmovnb %st(1), %st(0) -# CHECK-NEXT: - - - - 1.00 - - - fcmovnbe %st(1), %st(0) -# CHECK-NEXT: - - - - 1.00 - - - fcmovne %st(1), %st(0) -# CHECK-NEXT: - - - - 1.00 - - - fcmovnu %st(1), %st(0) -# CHECK-NEXT: - - - - 1.00 - - - fcmovu %st(1), %st(0) +# CHECK-NEXT: - - - - 1.00 - - - fcmovb %st(1), %st +# CHECK-NEXT: - - - - 1.00 - - - fcmovbe %st(1), %st +# CHECK-NEXT: - - - - 1.00 - - - fcmove %st(1), %st +# CHECK-NEXT: - - - - 1.00 - - - fcmovnb %st(1), %st +# CHECK-NEXT: - - - - 1.00 - - - fcmovnbe %st(1), %st +# CHECK-NEXT: - - - - 1.00 - - - fcmovne %st(1), %st +# CHECK-NEXT: - - - - 1.00 - - - fcmovnu %st(1), %st +# CHECK-NEXT: - - - - 1.00 - - - fcmovu %st(1), %st # CHECK-NEXT: - - - - 1.00 - - - fcom %st(1) # CHECK-NEXT: - - - - 1.00 - - - fcom %st(3) # CHECK-NEXT: - - - - 1.00 - - 1.00 fcoms (%ecx) @@ -402,24 +402,24 @@ fyl2xp1 # CHECK-NEXT: - - - - 1.00 - - 1.00 fcomps (%ecx) # CHECK-NEXT: - - - - 1.00 - - 1.00 fcompl (%eax) # CHECK-NEXT: - - - 1.00 - - - - fcompp -# CHECK-NEXT: - - - - 1.00 - - - fcomi %st(3) -# CHECK-NEXT: - - - - 1.00 - - - fcompi %st(3) +# CHECK-NEXT: - - - - 1.00 - - - fcomi %st(3), %st +# CHECK-NEXT: - - - - 1.00 - - - fcompi %st(3), %st # CHECK-NEXT: - - - 1.00 - - - - fcos # CHECK-NEXT: - - - 1.00 - - - - fdecstp -# CHECK-NEXT: - 17.00 - 1.00 - - - - fdiv %st(0), %st(1) -# CHECK-NEXT: - 17.00 - 1.00 - - - - fdiv %st(2) +# CHECK-NEXT: - 17.00 - 1.00 - - - - fdiv %st, %st(1) +# CHECK-NEXT: - 17.00 - 1.00 - - - - fdiv %st(2), %st # CHECK-NEXT: - 17.00 - 1.00 - - - 1.00 fdivs (%ecx) # CHECK-NEXT: - 17.00 - 1.00 - - - 1.00 fdivl (%eax) -# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivp %st(1) -# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivp %st(2) +# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivp %st, %st(1) +# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivp %st, %st(2) # CHECK-NEXT: - 17.00 - 1.00 - - - 1.00 fidivs (%ecx) # CHECK-NEXT: - 17.00 - 1.00 - - - 1.00 fidivl (%eax) -# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivr %st(0), %st(1) -# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivr %st(2) +# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivr %st, %st(1) +# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivr %st(2), %st # CHECK-NEXT: - 17.00 - 1.00 - - - 1.00 fdivrs (%ecx) # CHECK-NEXT: - 17.00 - 1.00 - - - 1.00 fdivrl (%eax) -# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivrp %st(1) -# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivrp %st(2) +# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivrp %st, %st(1) +# CHECK-NEXT: - 17.00 - 1.00 - - - - fdivrp %st, %st(2) # CHECK-NEXT: - 17.00 - 1.00 - - - 1.00 fidivrs (%ecx) # CHECK-NEXT: - 17.00 - 1.00 - - - 1.00 fidivrl (%eax) # CHECK-NEXT: - - - 1.00 - - - - ffree %st(0) @@ -453,12 +453,12 @@ fyl2xp1 # CHECK-NEXT: - - - 1.00 1.00 - - - fldln2 # CHECK-NEXT: - - - 1.00 1.00 - - - fldpi # CHECK-NEXT: - - - 0.50 0.50 - - - fldz -# CHECK-NEXT: - - 2.00 1.00 - - - - fmul %st(0), %st(1) -# CHECK-NEXT: - - 2.00 1.00 - - - - fmul %st(2) +# CHECK-NEXT: - - 2.00 1.00 - - - - fmul %st, %st(1) +# CHECK-NEXT: - - 2.00 1.00 - - - - fmul %st(2), %st # CHECK-NEXT: - - 2.00 1.00 - - - 1.00 fmuls (%ecx) # CHECK-NEXT: - - 2.00 1.00 - - - 1.00 fmull (%eax) -# CHECK-NEXT: - - 2.00 1.00 - - - - fmulp %st(1) -# CHECK-NEXT: - - 2.00 1.00 - - - - fmulp %st(2) +# CHECK-NEXT: - - 2.00 1.00 - - - - fmulp %st, %st(1) +# CHECK-NEXT: - - 2.00 1.00 - - - - fmulp %st, %st(2) # CHECK-NEXT: - - 2.00 1.00 - - - 1.00 fimuls (%ecx) # CHECK-NEXT: - - 2.00 1.00 - - - 1.00 fimull (%eax) # CHECK-NEXT: - - - - - - - - fnop @@ -486,20 +486,20 @@ fyl2xp1 # CHECK-NEXT: - - - 1.00 - - - - frstor (%eax) # CHECK-NEXT: - - - 1.00 - - - - wait # CHECK-NEXT: - - - 1.00 - - - - fnsave (%eax) -# CHECK-NEXT: - - - - 1.00 - - - fsub %st(0), %st(1) -# CHECK-NEXT: - - - - 1.00 - - - fsub %st(2) +# CHECK-NEXT: - - - - 1.00 - - - fsub %st, %st(1) +# CHECK-NEXT: - - - - 1.00 - - - fsub %st(2), %st # CHECK-NEXT: - - - - 1.00 - - 1.00 fsubs (%ecx) # CHECK-NEXT: - - - - 1.00 - - 1.00 fsubl (%eax) -# CHECK-NEXT: - - - - 1.00 - - - fsubp %st(1) -# CHECK-NEXT: - - - - 1.00 - - - fsubp %st(2) +# CHECK-NEXT: - - - - 1.00 - - - fsubp %st, %st(1) +# CHECK-NEXT: - - - - 1.00 - - - fsubp %st, %st(2) # CHECK-NEXT: - - - - 1.00 - - 1.00 fisubs (%ecx) # CHECK-NEXT: - - - - 1.00 - - 1.00 fisubl (%eax) -# CHECK-NEXT: - - - - 1.00 - - - fsubr %st(0), %st(1) -# CHECK-NEXT: - - - - 1.00 - - - fsubr %st(2) +# CHECK-NEXT: - - - - 1.00 - - - fsubr %st, %st(1) +# CHECK-NEXT: - - - - 1.00 - - - fsubr %st(2), %st # CHECK-NEXT: - - - - 1.00 - - 1.00 fsubrs (%ecx) # CHECK-NEXT: - - - - 1.00 - - 1.00 fsubrl (%eax) -# CHECK-NEXT: - - - - 1.00 - - - fsubrp %st(1) -# CHECK-NEXT: - - - - 1.00 - - - fsubrp %st(2) +# CHECK-NEXT: - - - - 1.00 - - - fsubrp %st, %st(1) +# CHECK-NEXT: - - - - 1.00 - - - fsubrp %st, %st(2) # CHECK-NEXT: - - - - 1.00 - - 1.00 fisubrs (%ecx) # CHECK-NEXT: - - - - 1.00 - - 1.00 fisubrl (%eax) # CHECK-NEXT: - - - - 1.00 - - - ftst @@ -508,8 +508,8 @@ fyl2xp1 # CHECK-NEXT: - - - - 1.00 - - - fucomp %st(1) # CHECK-NEXT: - - - - 1.00 - - - fucomp %st(3) # CHECK-NEXT: - - - - 1.00 - - - fucompp -# CHECK-NEXT: - - - - 1.00 - - - fucomi %st(3) -# CHECK-NEXT: - - - - 1.00 - - - fucompi %st(3) +# CHECK-NEXT: - - - - 1.00 - - - fucomi %st(3), %st +# CHECK-NEXT: - - - - 1.00 - - - fucompi %st(3), %st # CHECK-NEXT: - - - 1.00 - - - - wait # CHECK-NEXT: - - - 1.00 - - - - fxam # CHECK-NEXT: - - - - - 0.50 0.50 - fxch %st(1) diff --git a/test/tools/llvm-mca/X86/SandyBridge/resources-x87.s b/test/tools/llvm-mca/X86/SandyBridge/resources-x87.s index 332f365f1fdd..1bed53326ced 100644 --- a/test/tools/llvm-mca/X86/SandyBridge/resources-x87.s +++ b/test/tools/llvm-mca/X86/SandyBridge/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 0.33 U f2xm1 # CHECK-NEXT: 1 1 1.00 U fabs -# CHECK-NEXT: 1 3 1.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fadd %st(2) +# CHECK-NEXT: 1 3 1.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fadd %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fadds (%ecx) # CHECK-NEXT: 2 10 1.00 * U faddl (%ecx) -# CHECK-NEXT: 1 3 1.00 U faddp %st(1) -# CHECK-NEXT: 1 3 1.00 U faddp %st(2) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fiadds (%ecx) # CHECK-NEXT: 3 13 2.00 * U fiaddl (%ecx) # CHECK-NEXT: 1 100 0.33 U fbld (%ecx) # CHECK-NEXT: 1 100 0.33 U fbstp (%eax) # CHECK-NEXT: 1 1 1.00 U fchs # CHECK-NEXT: 1 100 0.33 U fnclex -# CHECK-NEXT: 3 3 2.00 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmove %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 3 3 2.00 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 3 3 2.00 U fcmovb %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovbe %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmove %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovnb %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovnbe %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovne %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovnu %st(1), %st +# CHECK-NEXT: 3 3 2.00 U fcmovu %st(1), %st # CHECK-NEXT: 1 1 1.00 U fcom %st(1) # CHECK-NEXT: 1 1 1.00 U fcom %st(3) # CHECK-NEXT: 2 8 1.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 2 8 1.00 U fcomps (%ecx) # CHECK-NEXT: 2 8 1.00 U fcompl (%eax) # CHECK-NEXT: 1 100 0.33 U fcompp -# CHECK-NEXT: 3 3 1.00 U fcomi %st(3) -# CHECK-NEXT: 3 3 1.00 U fcompi %st(3) +# CHECK-NEXT: 3 3 1.00 U fcomi %st(3), %st +# CHECK-NEXT: 3 3 1.00 U fcompi %st(3), %st # CHECK-NEXT: 1 100 0.33 U fcos # CHECK-NEXT: 1 1 1.00 U fdecstp -# CHECK-NEXT: 1 14 14.00 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 14 14.00 U fdiv %st(2) +# CHECK-NEXT: 1 14 14.00 U fdiv %st, %st(1) +# CHECK-NEXT: 1 14 14.00 U fdiv %st(2), %st # CHECK-NEXT: 2 31 1.00 * U fdivs (%ecx) # CHECK-NEXT: 2 31 1.00 * U fdivl (%eax) -# CHECK-NEXT: 1 14 14.00 U fdivp %st(1) -# CHECK-NEXT: 1 14 14.00 U fdivp %st(2) +# CHECK-NEXT: 1 14 14.00 U fdivp %st, %st(1) +# CHECK-NEXT: 1 14 14.00 U fdivp %st, %st(2) # CHECK-NEXT: 3 34 1.00 * U fidivs (%ecx) # CHECK-NEXT: 3 34 1.00 * U fidivl (%eax) -# CHECK-NEXT: 1 14 14.00 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 14 14.00 U fdivr %st(2) +# CHECK-NEXT: 1 14 14.00 U fdivr %st, %st(1) +# CHECK-NEXT: 1 14 14.00 U fdivr %st(2), %st # CHECK-NEXT: 2 31 1.00 * U fdivrs (%ecx) # CHECK-NEXT: 2 31 1.00 * U fdivrl (%eax) -# CHECK-NEXT: 1 14 14.00 U fdivrp %st(1) -# CHECK-NEXT: 1 14 14.00 U fdivrp %st(2) +# CHECK-NEXT: 1 14 14.00 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 14 14.00 U fdivrp %st, %st(2) # CHECK-NEXT: 3 34 1.00 * U fidivrs (%ecx) # CHECK-NEXT: 3 34 1.00 * U fidivrl (%eax) # CHECK-NEXT: 1 1 1.00 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 2 1 1.00 U fldln2 # CHECK-NEXT: 2 1 1.00 U fldpi # CHECK-NEXT: 1 1 1.00 U fldz -# CHECK-NEXT: 1 5 1.00 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 5 1.00 U fmul %st(2) +# CHECK-NEXT: 1 5 1.00 U fmul %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fmul %st(2), %st # CHECK-NEXT: 2 12 1.00 * U fmuls (%ecx) # CHECK-NEXT: 2 12 1.00 * U fmull (%eax) -# CHECK-NEXT: 1 5 1.00 U fmulp %st(1) -# CHECK-NEXT: 1 5 1.00 U fmulp %st(2) +# CHECK-NEXT: 1 5 1.00 U fmulp %st, %st(1) +# CHECK-NEXT: 1 5 1.00 U fmulp %st, %st(2) # CHECK-NEXT: 3 15 1.00 * U fimuls (%ecx) # CHECK-NEXT: 3 15 1.00 * U fimull (%eax) # CHECK-NEXT: 1 1 1.00 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 1 100 0.33 U frstor (%eax) # CHECK-NEXT: 1 100 0.33 U wait # CHECK-NEXT: 1 100 0.33 U fnsave (%eax) -# CHECK-NEXT: 1 3 1.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsub %st(2) +# CHECK-NEXT: 1 3 1.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsub %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fsubs (%ecx) # CHECK-NEXT: 2 10 1.00 * U fsubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fisubs (%ecx) # CHECK-NEXT: 3 13 2.00 * U fisubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubr %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fsubrs (%ecx) # CHECK-NEXT: 2 10 1.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fisubrs (%ecx) # CHECK-NEXT: 3 13 2.00 * U fisubrl (%eax) # CHECK-NEXT: 1 3 1.00 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 1 1 1.00 U fucomp %st(1) # CHECK-NEXT: 1 1 1.00 U fucomp %st(3) # CHECK-NEXT: 1 3 1.00 U fucompp -# CHECK-NEXT: 3 3 1.00 U fucomi %st(3) -# CHECK-NEXT: 3 3 1.00 U fucompi %st(3) +# CHECK-NEXT: 3 3 1.00 U fucomi %st(3), %st +# CHECK-NEXT: 3 3 1.00 U fucompi %st(3), %st # CHECK-NEXT: 1 100 0.33 U wait # CHECK-NEXT: 1 100 0.33 U fxam # CHECK-NEXT: 1 1 0.33 U fxch %st(1) @@ -373,26 +373,26 @@ fyl2xp1 # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions: # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - f2xm1 # CHECK-NEXT: - - - - - 1.00 - - fabs -# CHECK-NEXT: - - - 1.00 - - - - fadd %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - fadd %st(2) +# CHECK-NEXT: - - - 1.00 - - - - fadd %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - fadd %st(2), %st # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fadds (%ecx) # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 faddl (%ecx) -# CHECK-NEXT: - - - 1.00 - - - - faddp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - faddp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - faddp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - faddp %st, %st(2) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fiadds (%ecx) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fiaddl (%ecx) # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fbld (%ecx) # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fbstp (%eax) # CHECK-NEXT: - - - - - 1.00 - - fchs # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fnclex -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovb %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovbe %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmove %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnb %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnbe %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovne %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnu %st(1), %st(0) -# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovu %st(1), %st(0) +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovb %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovbe %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmove %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnb %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnbe %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovne %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovnu %st(1), %st +# CHECK-NEXT: - - 0.50 - - 2.50 - - fcmovu %st(1), %st # CHECK-NEXT: - - - 1.00 - - - - fcom %st(1) # CHECK-NEXT: - - - 1.00 - - - - fcom %st(3) # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fcoms (%ecx) @@ -402,24 +402,24 @@ fyl2xp1 # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fcomps (%ecx) # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fcompl (%eax) # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fcompp -# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fcomi %st(3) -# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fcompi %st(3) +# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fcomi %st(3), %st +# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fcompi %st(3), %st # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fcos # CHECK-NEXT: - - - - - 1.00 - - fdecstp -# CHECK-NEXT: - 14.00 1.00 - - - - - fdiv %st(0), %st(1) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdiv %st(2) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdiv %st, %st(1) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdiv %st(2), %st # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fdivs (%ecx) # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fdivl (%eax) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivp %st(1) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivp %st(2) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivp %st, %st(1) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fidivs (%ecx) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fidivl (%eax) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivr %st(0), %st(1) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivr %st(2) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivr %st, %st(1) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivr %st(2), %st # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fdivrs (%ecx) # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fdivrl (%eax) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivrp %st(1) -# CHECK-NEXT: - 14.00 1.00 - - - - - fdivrp %st(2) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivrp %st, %st(1) +# CHECK-NEXT: - 14.00 1.00 - - - - - fdivrp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fidivrs (%ecx) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fidivrl (%eax) # CHECK-NEXT: - - - - - 1.00 - - ffree %st(0) @@ -453,12 +453,12 @@ fyl2xp1 # CHECK-NEXT: - - 1.00 1.00 - - - - fldln2 # CHECK-NEXT: - - 1.00 1.00 - - - - fldpi # CHECK-NEXT: - - - - - 1.00 - - fldz -# CHECK-NEXT: - - 1.00 - - - - - fmul %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - fmul %st(2) +# CHECK-NEXT: - - 1.00 - - - - - fmul %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - fmul %st(2), %st # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fmuls (%ecx) # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 fmull (%eax) -# CHECK-NEXT: - - 1.00 - - - - - fmulp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - fmulp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - fmulp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - fmulp %st, %st(2) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fimuls (%ecx) # CHECK-NEXT: - - 1.00 1.00 - - 0.50 0.50 fimull (%eax) # CHECK-NEXT: - - - - - 1.00 - - fnop @@ -486,20 +486,20 @@ fyl2xp1 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - frstor (%eax) # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - wait # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fnsave (%eax) -# CHECK-NEXT: - - - 1.00 - - - - fsub %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - fsub %st(2) +# CHECK-NEXT: - - - 1.00 - - - - fsub %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - fsub %st(2), %st # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fsubs (%ecx) # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fsubl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - fsubp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - fsubp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - fsubp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - fsubp %st, %st(2) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fisubs (%ecx) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fisubl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - fsubr %st(0), %st(1) -# CHECK-NEXT: - - - 1.00 - - - - fsubr %st(2) +# CHECK-NEXT: - - - 1.00 - - - - fsubr %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - fsubr %st(2), %st # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fsubrs (%ecx) # CHECK-NEXT: - - - 1.00 - - 0.50 0.50 fsubrl (%eax) -# CHECK-NEXT: - - - 1.00 - - - - fsubrp %st(1) -# CHECK-NEXT: - - - 1.00 - - - - fsubrp %st(2) +# CHECK-NEXT: - - - 1.00 - - - - fsubrp %st, %st(1) +# CHECK-NEXT: - - - 1.00 - - - - fsubrp %st, %st(2) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fisubrs (%ecx) # CHECK-NEXT: - - - 2.00 - - 0.50 0.50 fisubrl (%eax) # CHECK-NEXT: - - - 1.00 - - - - ftst @@ -508,8 +508,8 @@ fyl2xp1 # CHECK-NEXT: - - - 1.00 - - - - fucomp %st(1) # CHECK-NEXT: - - - 1.00 - - - - fucomp %st(3) # CHECK-NEXT: - - - 1.00 - - - - fucompp -# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fucomi %st(3) -# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fucompi %st(3) +# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fucomi %st(3), %st +# CHECK-NEXT: - - 1.00 1.00 - 1.00 - - fucompi %st(3), %st # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - wait # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fxam # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - fxch %st(1) diff --git a/test/tools/llvm-mca/X86/SkylakeClient/resources-x87.s b/test/tools/llvm-mca/X86/SkylakeClient/resources-x87.s index 7be9d699573a..6cd4439a25c1 100644 --- a/test/tools/llvm-mca/X86/SkylakeClient/resources-x87.s +++ b/test/tools/llvm-mca/X86/SkylakeClient/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 0.25 U f2xm1 # CHECK-NEXT: 1 1 1.00 U fabs -# CHECK-NEXT: 1 3 1.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fadd %st(2) +# CHECK-NEXT: 1 3 1.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fadd %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fadds (%ecx) # CHECK-NEXT: 2 10 1.00 * U faddl (%ecx) -# CHECK-NEXT: 1 3 1.00 U faddp %st(1) -# CHECK-NEXT: 1 3 1.00 U faddp %st(2) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fiadds (%ecx) # CHECK-NEXT: 3 13 2.00 * U fiaddl (%ecx) # CHECK-NEXT: 1 100 0.25 U fbld (%ecx) # CHECK-NEXT: 2 1 1.00 U fbstp (%eax) # CHECK-NEXT: 1 1 1.00 U fchs # CHECK-NEXT: 4 4 1.00 U fnclex -# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st # CHECK-NEXT: 1 1 1.00 U fcom %st(1) # CHECK-NEXT: 1 1 1.00 U fcom %st(3) # CHECK-NEXT: 2 8 1.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 2 8 1.00 U fcomps (%ecx) # CHECK-NEXT: 2 8 1.00 U fcompl (%eax) # CHECK-NEXT: 1 100 0.25 U fcompp -# CHECK-NEXT: 1 2 1.00 U fcomi %st(3) -# CHECK-NEXT: 1 2 1.00 U fcompi %st(3) +# CHECK-NEXT: 1 2 1.00 U fcomi %st(3), %st +# CHECK-NEXT: 1 2 1.00 U fcompi %st(3), %st # CHECK-NEXT: 1 100 0.25 U fcos # CHECK-NEXT: 2 2 1.00 U fdecstp -# CHECK-NEXT: 1 15 1.00 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 20 1.00 U fdiv %st(2) +# CHECK-NEXT: 1 15 1.00 U fdiv %st, %st(1) +# CHECK-NEXT: 1 20 1.00 U fdiv %st(2), %st # CHECK-NEXT: 2 22 1.00 * U fdivs (%ecx) # CHECK-NEXT: 2 22 1.00 * U fdivl (%eax) -# CHECK-NEXT: 1 15 1.00 U fdivp %st(1) -# CHECK-NEXT: 1 15 1.00 U fdivp %st(2) +# CHECK-NEXT: 1 15 1.00 U fdivp %st, %st(1) +# CHECK-NEXT: 1 15 1.00 U fdivp %st, %st(2) # CHECK-NEXT: 3 25 1.00 * U fidivs (%ecx) # CHECK-NEXT: 3 25 1.00 * U fidivl (%eax) -# CHECK-NEXT: 1 20 1.00 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 15 1.00 U fdivr %st(2) +# CHECK-NEXT: 1 20 1.00 U fdivr %st, %st(1) +# CHECK-NEXT: 1 15 1.00 U fdivr %st(2), %st # CHECK-NEXT: 2 27 1.00 * U fdivrs (%ecx) # CHECK-NEXT: 2 27 1.00 * U fdivrl (%eax) -# CHECK-NEXT: 1 20 1.00 U fdivrp %st(1) -# CHECK-NEXT: 1 20 1.00 U fdivrp %st(2) +# CHECK-NEXT: 1 20 1.00 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 20 1.00 U fdivrp %st, %st(2) # CHECK-NEXT: 3 30 1.00 * U fidivrs (%ecx) # CHECK-NEXT: 3 30 1.00 * U fidivrl (%eax) # CHECK-NEXT: 1 100 0.25 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 2 1 1.00 U fldln2 # CHECK-NEXT: 2 1 1.00 U fldpi # CHECK-NEXT: 1 1 0.50 U fldz -# CHECK-NEXT: 1 4 1.00 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 4 1.00 U fmul %st(2) +# CHECK-NEXT: 1 4 1.00 U fmul %st, %st(1) +# CHECK-NEXT: 1 4 1.00 U fmul %st(2), %st # CHECK-NEXT: 2 11 1.00 * U fmuls (%ecx) # CHECK-NEXT: 2 11 1.00 * U fmull (%eax) -# CHECK-NEXT: 1 4 1.00 U fmulp %st(1) -# CHECK-NEXT: 1 4 1.00 U fmulp %st(2) +# CHECK-NEXT: 1 4 1.00 U fmulp %st, %st(1) +# CHECK-NEXT: 1 4 1.00 U fmulp %st, %st(2) # CHECK-NEXT: 3 14 1.00 * U fimuls (%ecx) # CHECK-NEXT: 3 14 1.00 * U fimull (%eax) # CHECK-NEXT: 1 1 0.50 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 1 100 0.25 U frstor (%eax) # CHECK-NEXT: 2 2 0.50 U wait # CHECK-NEXT: 1 100 0.25 U fnsave (%eax) -# CHECK-NEXT: 1 3 1.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsub %st(2) +# CHECK-NEXT: 1 3 1.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsub %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fsubs (%ecx) # CHECK-NEXT: 2 10 1.00 * U fsubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fisubs (%ecx) # CHECK-NEXT: 3 13 2.00 * U fisubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubr %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fsubrs (%ecx) # CHECK-NEXT: 2 10 1.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fisubrs (%ecx) # CHECK-NEXT: 3 13 2.00 * U fisubrl (%eax) # CHECK-NEXT: 1 2 1.00 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 1 1 1.00 U fucomp %st(1) # CHECK-NEXT: 1 1 1.00 U fucomp %st(3) # CHECK-NEXT: 1 2 1.00 U fucompp -# CHECK-NEXT: 1 2 1.00 U fucomi %st(3) -# CHECK-NEXT: 1 2 1.00 U fucompi %st(3) +# CHECK-NEXT: 1 2 1.00 U fucomi %st(3), %st +# CHECK-NEXT: 1 2 1.00 U fucompi %st(3), %st # CHECK-NEXT: 2 2 0.50 U wait # CHECK-NEXT: 1 100 0.25 U fxam # CHECK-NEXT: 15 17 4.00 U fxch %st(1) @@ -375,26 +375,26 @@ fyl2xp1 # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions: # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - f2xm1 # CHECK-NEXT: - - 1.00 - - - - - - - fabs -# CHECK-NEXT: - - - - - - - 1.00 - - fadd %st(0), %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - fadd %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - fadd %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - fadd %st(2), %st # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fadds (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - faddl (%ecx) -# CHECK-NEXT: - - - - - - - 1.00 - - faddp %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - faddp %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - faddp %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - faddp %st, %st(2) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fiadds (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fiaddl (%ecx) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fbld (%ecx) # CHECK-NEXT: - - - - 0.33 0.33 1.00 - - 0.33 fbstp (%eax) # CHECK-NEXT: - - 1.00 - - - - - - - fchs # CHECK-NEXT: - - 1.00 1.00 - - - 1.00 1.00 - fnclex -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovb %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovbe %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmove %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnb %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnbe %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovne %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnu %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovu %st(1), %st(0) +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovb %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovbe %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmove %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnb %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnbe %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovne %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnu %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovu %st(1), %st # CHECK-NEXT: - - - - - - - 1.00 - - fcom %st(1) # CHECK-NEXT: - - - - - - - 1.00 - - fcom %st(3) # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fcoms (%ecx) @@ -404,24 +404,24 @@ fyl2xp1 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fcomps (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fcompl (%eax) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fcompp -# CHECK-NEXT: - - 1.00 - - - - - - - fcomi %st(3) -# CHECK-NEXT: - - 1.00 - - - - - - - fcompi %st(3) +# CHECK-NEXT: - - 1.00 - - - - - - - fcomi %st(3), %st +# CHECK-NEXT: - - 1.00 - - - - - - - fcompi %st(3), %st # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fcos # CHECK-NEXT: - - 1.00 - - - - 1.00 - - fdecstp -# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st, %st(2) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fidivs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fidivl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivrs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivrl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st, %st(2) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fidivrs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fidivrl (%eax) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - ffree %st(0) @@ -455,12 +455,12 @@ fyl2xp1 # CHECK-NEXT: - - 1.00 - - - - 1.00 - - fldln2 # CHECK-NEXT: - - 1.00 - - - - 1.00 - - fldpi # CHECK-NEXT: - - 0.50 - - - - 0.50 - - fldz -# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fmuls (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fmull (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st, %st(2) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fimuls (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fimull (%eax) # CHECK-NEXT: - - 0.50 - - - - 0.50 - - fnop @@ -488,20 +488,20 @@ fyl2xp1 # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - frstor (%eax) # CHECK-NEXT: - - 0.50 0.50 - - - 0.50 0.50 - wait # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fnsave (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - fsub %st(0), %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - fsub %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - fsub %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - fsub %st(2), %st # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fsubs (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fsubl (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubp %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubp %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubp %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubp %st, %st(2) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fisubs (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fisubl (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubr %st(0), %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubr %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubr %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubr %st(2), %st # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fsubrs (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fsubrl (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubrp %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubrp %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubrp %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubrp %st, %st(2) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fisubrs (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fisubrl (%eax) # CHECK-NEXT: - - 1.00 - - - - - - - ftst @@ -510,8 +510,8 @@ fyl2xp1 # CHECK-NEXT: - - - - - - - 1.00 - - fucomp %st(1) # CHECK-NEXT: - - - - - - - 1.00 - - fucomp %st(3) # CHECK-NEXT: - - 1.00 - - - - - - - fucompp -# CHECK-NEXT: - - 1.00 - - - - - - - fucomi %st(3) -# CHECK-NEXT: - - 1.00 - - - - - - - fucompi %st(3) +# CHECK-NEXT: - - 1.00 - - - - - - - fucomi %st(3), %st +# CHECK-NEXT: - - 1.00 - - - - - - - fucompi %st(3), %st # CHECK-NEXT: - - 0.50 0.50 - - - 0.50 0.50 - wait # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fxam # CHECK-NEXT: - - 4.00 2.00 - - - 4.00 5.00 - fxch %st(1) diff --git a/test/tools/llvm-mca/X86/SkylakeServer/resources-x87.s b/test/tools/llvm-mca/X86/SkylakeServer/resources-x87.s index aecb4a7ab921..75cca5297704 100644 --- a/test/tools/llvm-mca/X86/SkylakeServer/resources-x87.s +++ b/test/tools/llvm-mca/X86/SkylakeServer/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 0.25 U f2xm1 # CHECK-NEXT: 1 1 1.00 U fabs -# CHECK-NEXT: 1 3 1.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fadd %st(2) +# CHECK-NEXT: 1 3 1.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fadd %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fadds (%ecx) # CHECK-NEXT: 2 10 1.00 * U faddl (%ecx) -# CHECK-NEXT: 1 3 1.00 U faddp %st(1) -# CHECK-NEXT: 1 3 1.00 U faddp %st(2) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fiadds (%ecx) # CHECK-NEXT: 3 13 2.00 * U fiaddl (%ecx) # CHECK-NEXT: 1 100 0.25 U fbld (%ecx) # CHECK-NEXT: 2 1 1.00 U fbstp (%eax) # CHECK-NEXT: 1 1 1.00 U fchs # CHECK-NEXT: 4 4 1.00 U fnclex -# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 1 3 1.00 U fcmovb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmove %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnb %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnbe %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovne %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovnu %st(1), %st +# CHECK-NEXT: 1 3 1.00 U fcmovu %st(1), %st # CHECK-NEXT: 1 1 1.00 U fcom %st(1) # CHECK-NEXT: 1 1 1.00 U fcom %st(3) # CHECK-NEXT: 2 8 1.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 2 8 1.00 U fcomps (%ecx) # CHECK-NEXT: 2 8 1.00 U fcompl (%eax) # CHECK-NEXT: 1 100 0.25 U fcompp -# CHECK-NEXT: 1 2 1.00 U fcomi %st(3) -# CHECK-NEXT: 1 2 1.00 U fcompi %st(3) +# CHECK-NEXT: 1 2 1.00 U fcomi %st(3), %st +# CHECK-NEXT: 1 2 1.00 U fcompi %st(3), %st # CHECK-NEXT: 1 100 0.25 U fcos # CHECK-NEXT: 2 2 1.00 U fdecstp -# CHECK-NEXT: 1 15 1.00 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 20 1.00 U fdiv %st(2) +# CHECK-NEXT: 1 15 1.00 U fdiv %st, %st(1) +# CHECK-NEXT: 1 20 1.00 U fdiv %st(2), %st # CHECK-NEXT: 2 22 1.00 * U fdivs (%ecx) # CHECK-NEXT: 2 22 1.00 * U fdivl (%eax) -# CHECK-NEXT: 1 15 1.00 U fdivp %st(1) -# CHECK-NEXT: 1 15 1.00 U fdivp %st(2) +# CHECK-NEXT: 1 15 1.00 U fdivp %st, %st(1) +# CHECK-NEXT: 1 15 1.00 U fdivp %st, %st(2) # CHECK-NEXT: 3 25 1.00 * U fidivs (%ecx) # CHECK-NEXT: 3 25 1.00 * U fidivl (%eax) -# CHECK-NEXT: 1 20 1.00 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 15 1.00 U fdivr %st(2) +# CHECK-NEXT: 1 20 1.00 U fdivr %st, %st(1) +# CHECK-NEXT: 1 15 1.00 U fdivr %st(2), %st # CHECK-NEXT: 2 27 1.00 * U fdivrs (%ecx) # CHECK-NEXT: 2 27 1.00 * U fdivrl (%eax) -# CHECK-NEXT: 1 20 1.00 U fdivrp %st(1) -# CHECK-NEXT: 1 20 1.00 U fdivrp %st(2) +# CHECK-NEXT: 1 20 1.00 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 20 1.00 U fdivrp %st, %st(2) # CHECK-NEXT: 3 30 1.00 * U fidivrs (%ecx) # CHECK-NEXT: 3 30 1.00 * U fidivrl (%eax) # CHECK-NEXT: 1 100 0.25 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 2 1 1.00 U fldln2 # CHECK-NEXT: 2 1 1.00 U fldpi # CHECK-NEXT: 1 1 0.50 U fldz -# CHECK-NEXT: 1 4 1.00 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 4 1.00 U fmul %st(2) +# CHECK-NEXT: 1 4 1.00 U fmul %st, %st(1) +# CHECK-NEXT: 1 4 1.00 U fmul %st(2), %st # CHECK-NEXT: 2 11 1.00 * U fmuls (%ecx) # CHECK-NEXT: 2 11 1.00 * U fmull (%eax) -# CHECK-NEXT: 1 4 1.00 U fmulp %st(1) -# CHECK-NEXT: 1 4 1.00 U fmulp %st(2) +# CHECK-NEXT: 1 4 1.00 U fmulp %st, %st(1) +# CHECK-NEXT: 1 4 1.00 U fmulp %st, %st(2) # CHECK-NEXT: 3 14 1.00 * U fimuls (%ecx) # CHECK-NEXT: 3 14 1.00 * U fimull (%eax) # CHECK-NEXT: 1 1 0.50 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 1 100 0.25 U frstor (%eax) # CHECK-NEXT: 2 2 0.50 U wait # CHECK-NEXT: 1 100 0.25 U fnsave (%eax) -# CHECK-NEXT: 1 3 1.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsub %st(2) +# CHECK-NEXT: 1 3 1.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsub %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fsubs (%ecx) # CHECK-NEXT: 2 10 1.00 * U fsubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fisubs (%ecx) # CHECK-NEXT: 3 13 2.00 * U fisubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubr %st(2), %st # CHECK-NEXT: 2 10 1.00 * U fsubrs (%ecx) # CHECK-NEXT: 2 10 1.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(2) # CHECK-NEXT: 3 13 2.00 * U fisubrs (%ecx) # CHECK-NEXT: 3 13 2.00 * U fisubrl (%eax) # CHECK-NEXT: 1 2 1.00 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 1 1 1.00 U fucomp %st(1) # CHECK-NEXT: 1 1 1.00 U fucomp %st(3) # CHECK-NEXT: 1 2 1.00 U fucompp -# CHECK-NEXT: 1 2 1.00 U fucomi %st(3) -# CHECK-NEXT: 1 2 1.00 U fucompi %st(3) +# CHECK-NEXT: 1 2 1.00 U fucomi %st(3), %st +# CHECK-NEXT: 1 2 1.00 U fucompi %st(3), %st # CHECK-NEXT: 2 2 0.50 U wait # CHECK-NEXT: 1 100 0.25 U fxam # CHECK-NEXT: 15 17 4.00 U fxch %st(1) @@ -375,26 +375,26 @@ fyl2xp1 # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions: # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - f2xm1 # CHECK-NEXT: - - 1.00 - - - - - - - fabs -# CHECK-NEXT: - - - - - - - 1.00 - - fadd %st(0), %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - fadd %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - fadd %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - fadd %st(2), %st # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fadds (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - faddl (%ecx) -# CHECK-NEXT: - - - - - - - 1.00 - - faddp %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - faddp %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - faddp %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - faddp %st, %st(2) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fiadds (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fiaddl (%ecx) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fbld (%ecx) # CHECK-NEXT: - - - - 0.33 0.33 1.00 - - 0.33 fbstp (%eax) # CHECK-NEXT: - - 1.00 - - - - - - - fchs # CHECK-NEXT: - - 1.00 1.00 - - - 1.00 1.00 - fnclex -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovb %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovbe %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmove %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnb %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnbe %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovne %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnu %st(1), %st(0) -# CHECK-NEXT: - - - 1.00 - - - - - - fcmovu %st(1), %st(0) +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovb %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovbe %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmove %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnb %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnbe %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovne %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovnu %st(1), %st +# CHECK-NEXT: - - - 1.00 - - - - - - fcmovu %st(1), %st # CHECK-NEXT: - - - - - - - 1.00 - - fcom %st(1) # CHECK-NEXT: - - - - - - - 1.00 - - fcom %st(3) # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fcoms (%ecx) @@ -404,24 +404,24 @@ fyl2xp1 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fcomps (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fcompl (%eax) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fcompp -# CHECK-NEXT: - - 1.00 - - - - - - - fcomi %st(3) -# CHECK-NEXT: - - 1.00 - - - - - - - fcompi %st(3) +# CHECK-NEXT: - - 1.00 - - - - - - - fcomi %st(3), %st +# CHECK-NEXT: - - 1.00 - - - - - - - fcompi %st(3), %st # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fcos # CHECK-NEXT: - - 1.00 - - - - 1.00 - - fdecstp -# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdiv %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivp %st, %st(2) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fidivs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fidivl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivr %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivrs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fdivrl (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fdivrp %st, %st(2) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fidivrs (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fidivrl (%eax) # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - ffree %st(0) @@ -455,12 +455,12 @@ fyl2xp1 # CHECK-NEXT: - - 1.00 - - - - 1.00 - - fldln2 # CHECK-NEXT: - - 1.00 - - - - 1.00 - - fldpi # CHECK-NEXT: - - 0.50 - - - - 0.50 - - fldz -# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(0), %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fmul %st(2), %st # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fmuls (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - fmull (%eax) -# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st(1) -# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st(2) +# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st, %st(1) +# CHECK-NEXT: - - 1.00 - - - - - - - fmulp %st, %st(2) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fimuls (%ecx) # CHECK-NEXT: - - 1.00 - 0.50 0.50 - 1.00 - - fimull (%eax) # CHECK-NEXT: - - 0.50 - - - - 0.50 - - fnop @@ -488,20 +488,20 @@ fyl2xp1 # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - frstor (%eax) # CHECK-NEXT: - - 0.50 0.50 - - - 0.50 0.50 - wait # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fnsave (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - fsub %st(0), %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - fsub %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - fsub %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - fsub %st(2), %st # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fsubs (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fsubl (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubp %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubp %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubp %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubp %st, %st(2) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fisubs (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fisubl (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubr %st(0), %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubr %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubr %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubr %st(2), %st # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fsubrs (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - fsubrl (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubrp %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - fsubrp %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubrp %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - fsubrp %st, %st(2) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fisubrs (%ecx) # CHECK-NEXT: - - - - 0.50 0.50 - 2.00 - - fisubrl (%eax) # CHECK-NEXT: - - 1.00 - - - - - - - ftst @@ -510,8 +510,8 @@ fyl2xp1 # CHECK-NEXT: - - - - - - - 1.00 - - fucomp %st(1) # CHECK-NEXT: - - - - - - - 1.00 - - fucomp %st(3) # CHECK-NEXT: - - 1.00 - - - - - - - fucompp -# CHECK-NEXT: - - 1.00 - - - - - - - fucomi %st(3) -# CHECK-NEXT: - - 1.00 - - - - - - - fucompi %st(3) +# CHECK-NEXT: - - 1.00 - - - - - - - fucomi %st(3), %st +# CHECK-NEXT: - - 1.00 - - - - - - - fucompi %st(3), %st # CHECK-NEXT: - - 0.50 0.50 - - - 0.50 0.50 - wait # CHECK-NEXT: - - 0.25 0.25 - - - 0.25 0.25 - fxam # CHECK-NEXT: - - 4.00 2.00 - - - 4.00 5.00 - fxch %st(1) diff --git a/test/tools/llvm-mca/X86/Znver1/resources-x87.s b/test/tools/llvm-mca/X86/Znver1/resources-x87.s index 2f5f6ef08f1c..030b71fb7b63 100644 --- a/test/tools/llvm-mca/X86/Znver1/resources-x87.s +++ b/test/tools/llvm-mca/X86/Znver1/resources-x87.s @@ -5,7 +5,7 @@ f2xm1 fabs -fadd %st(0), %st(1) +fadd %st, %st(1) fadd %st(2) fadds (%ecx) faddl (%ecx) @@ -21,14 +21,14 @@ fchs fnclex -fcmovb %st(1), %st(0) -fcmovbe %st(1), %st(0) -fcmove %st(1), %st(0) -fcmovnb %st(1), %st(0) -fcmovnbe %st(1), %st(0) -fcmovne %st(1), %st(0) -fcmovnu %st(1), %st(0) -fcmovu %st(1), %st(0) +fcmovb %st(1), %st +fcmovbe %st(1), %st +fcmove %st(1), %st +fcmovnb %st(1), %st +fcmovnbe %st(1), %st +fcmovne %st(1), %st +fcmovnu %st(1), %st +fcmovu %st(1), %st fcom %st(1) fcom %st(3) @@ -47,7 +47,7 @@ fcos fdecstp -fdiv %st(0), %st(1) +fdiv %st, %st(1) fdiv %st(2) fdivs (%ecx) fdivl (%eax) @@ -56,7 +56,7 @@ fdivp %st(2) fidivs (%ecx) fidivl (%eax) -fdivr %st(0), %st(1) +fdivr %st, %st(1) fdivr %st(2) fdivrs (%ecx) fdivrl (%eax) @@ -106,7 +106,7 @@ fldln2 fldpi fldz -fmul %st(0), %st(1) +fmul %st, %st(1) fmul %st(2) fmuls (%ecx) fmull (%eax) @@ -153,7 +153,7 @@ fnstsw (%eax) frstor (%eax) fsave (%eax) -fsub %st(0), %st(1) +fsub %st, %st(1) fsub %st(2) fsubs (%ecx) fsubl (%eax) @@ -162,7 +162,7 @@ fsubp %st(2) fisubs (%ecx) fisubl (%eax) -fsubr %st(0), %st(1) +fsubr %st, %st(1) fsubr %st(2) fsubrs (%ecx) fsubrl (%eax) @@ -208,26 +208,26 @@ fyl2xp1 # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 0.25 U f2xm1 # CHECK-NEXT: 1 2 1.00 U fabs -# CHECK-NEXT: 1 3 1.00 U fadd %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fadd %st(2) +# CHECK-NEXT: 1 3 1.00 U fadd %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fadd %st(2), %st # CHECK-NEXT: 1 10 1.00 * U fadds (%ecx) # CHECK-NEXT: 1 10 1.00 * U faddl (%ecx) -# CHECK-NEXT: 1 3 1.00 U faddp %st(1) -# CHECK-NEXT: 1 3 1.00 U faddp %st(2) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U faddp %st, %st(2) # CHECK-NEXT: 1 10 1.00 * U fiadds (%ecx) # CHECK-NEXT: 1 10 1.00 * U fiaddl (%ecx) # CHECK-NEXT: 1 100 0.25 U fbld (%ecx) # CHECK-NEXT: 1 100 0.25 U fbstp (%eax) # CHECK-NEXT: 1 1 1.00 U fchs # CHECK-NEXT: 1 100 0.25 U fnclex -# CHECK-NEXT: 1 100 0.25 U fcmovb %st(1), %st(0) -# CHECK-NEXT: 1 100 0.25 U fcmovbe %st(1), %st(0) -# CHECK-NEXT: 1 100 0.25 U fcmove %st(1), %st(0) -# CHECK-NEXT: 1 100 0.25 U fcmovnb %st(1), %st(0) -# CHECK-NEXT: 1 100 0.25 U fcmovnbe %st(1), %st(0) -# CHECK-NEXT: 1 100 0.25 U fcmovne %st(1), %st(0) -# CHECK-NEXT: 1 100 0.25 U fcmovnu %st(1), %st(0) -# CHECK-NEXT: 1 100 0.25 U fcmovu %st(1), %st(0) +# CHECK-NEXT: 1 100 0.25 U fcmovb %st(1), %st +# CHECK-NEXT: 1 100 0.25 U fcmovbe %st(1), %st +# CHECK-NEXT: 1 100 0.25 U fcmove %st(1), %st +# CHECK-NEXT: 1 100 0.25 U fcmovnb %st(1), %st +# CHECK-NEXT: 1 100 0.25 U fcmovnbe %st(1), %st +# CHECK-NEXT: 1 100 0.25 U fcmovne %st(1), %st +# CHECK-NEXT: 1 100 0.25 U fcmovnu %st(1), %st +# CHECK-NEXT: 1 100 0.25 U fcmovu %st(1), %st # CHECK-NEXT: 1 1 1.00 U fcom %st(1) # CHECK-NEXT: 1 1 1.00 U fcom %st(3) # CHECK-NEXT: 1 8 1.00 U fcoms (%ecx) @@ -237,24 +237,24 @@ fyl2xp1 # CHECK-NEXT: 1 8 1.00 U fcomps (%ecx) # CHECK-NEXT: 1 8 1.00 U fcompl (%eax) # CHECK-NEXT: 1 1 1.00 U fcompp -# CHECK-NEXT: 1 9 0.50 U fcomi %st(3) -# CHECK-NEXT: 1 9 0.50 U fcompi %st(3) +# CHECK-NEXT: 1 9 0.50 U fcomi %st(3), %st +# CHECK-NEXT: 1 9 0.50 U fcompi %st(3), %st # CHECK-NEXT: 1 100 0.25 U fcos # CHECK-NEXT: 1 11 1.00 U fdecstp -# CHECK-NEXT: 1 15 1.00 U fdiv %st(0), %st(1) -# CHECK-NEXT: 1 15 1.00 U fdiv %st(2) +# CHECK-NEXT: 1 15 1.00 U fdiv %st, %st(1) +# CHECK-NEXT: 1 15 1.00 U fdiv %st(2), %st # CHECK-NEXT: 1 22 1.00 * U fdivs (%ecx) # CHECK-NEXT: 1 22 1.00 * U fdivl (%eax) -# CHECK-NEXT: 1 15 1.00 U fdivp %st(1) -# CHECK-NEXT: 1 15 1.00 U fdivp %st(2) +# CHECK-NEXT: 1 15 1.00 U fdivp %st, %st(1) +# CHECK-NEXT: 1 15 1.00 U fdivp %st, %st(2) # CHECK-NEXT: 1 22 1.00 * U fidivs (%ecx) # CHECK-NEXT: 1 22 1.00 * U fidivl (%eax) -# CHECK-NEXT: 1 15 1.00 U fdivr %st(0), %st(1) -# CHECK-NEXT: 1 15 1.00 U fdivr %st(2) +# CHECK-NEXT: 1 15 1.00 U fdivr %st, %st(1) +# CHECK-NEXT: 1 15 1.00 U fdivr %st(2), %st # CHECK-NEXT: 1 22 1.00 * U fdivrs (%ecx) # CHECK-NEXT: 1 22 1.00 * U fdivrl (%eax) -# CHECK-NEXT: 1 15 1.00 U fdivrp %st(1) -# CHECK-NEXT: 1 15 1.00 U fdivrp %st(2) +# CHECK-NEXT: 1 15 1.00 U fdivrp %st, %st(1) +# CHECK-NEXT: 1 15 1.00 U fdivrp %st, %st(2) # CHECK-NEXT: 1 22 1.00 * U fidivrs (%ecx) # CHECK-NEXT: 1 22 1.00 * U fidivrl (%eax) # CHECK-NEXT: 1 11 1.00 U ffree %st(0) @@ -288,12 +288,12 @@ fyl2xp1 # CHECK-NEXT: 1 11 1.00 U fldln2 # CHECK-NEXT: 1 11 1.00 U fldpi # CHECK-NEXT: 1 8 0.50 U fldz -# CHECK-NEXT: 1 3 0.50 U fmul %st(0), %st(1) -# CHECK-NEXT: 1 3 0.50 U fmul %st(2) +# CHECK-NEXT: 1 3 0.50 U fmul %st, %st(1) +# CHECK-NEXT: 1 3 0.50 U fmul %st(2), %st # CHECK-NEXT: 2 10 0.50 * U fmuls (%ecx) # CHECK-NEXT: 2 10 0.50 * U fmull (%eax) -# CHECK-NEXT: 1 3 0.50 U fmulp %st(1) -# CHECK-NEXT: 1 3 0.50 U fmulp %st(2) +# CHECK-NEXT: 1 3 0.50 U fmulp %st, %st(1) +# CHECK-NEXT: 1 3 0.50 U fmulp %st, %st(2) # CHECK-NEXT: 2 10 0.50 * U fimuls (%ecx) # CHECK-NEXT: 2 10 0.50 * U fimull (%eax) # CHECK-NEXT: 1 1 1.00 U fnop @@ -321,20 +321,20 @@ fyl2xp1 # CHECK-NEXT: 1 100 0.25 U frstor (%eax) # CHECK-NEXT: 1 1 1.00 U wait # CHECK-NEXT: 1 100 0.25 U fnsave (%eax) -# CHECK-NEXT: 1 3 1.00 U fsub %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsub %st(2) +# CHECK-NEXT: 1 3 1.00 U fsub %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsub %st(2), %st # CHECK-NEXT: 1 10 1.00 * U fsubs (%ecx) # CHECK-NEXT: 1 10 1.00 * U fsubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubp %st, %st(2) # CHECK-NEXT: 1 10 1.00 * U fisubs (%ecx) # CHECK-NEXT: 1 10 1.00 * U fisubl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(0), %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubr %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubr %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubr %st(2), %st # CHECK-NEXT: 1 10 1.00 * U fsubrs (%ecx) # CHECK-NEXT: 1 10 1.00 * U fsubrl (%eax) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(1) -# CHECK-NEXT: 1 3 1.00 U fsubrp %st(2) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(1) +# CHECK-NEXT: 1 3 1.00 U fsubrp %st, %st(2) # CHECK-NEXT: 1 10 1.00 * U fisubrs (%ecx) # CHECK-NEXT: 1 10 1.00 * U fisubrl (%eax) # CHECK-NEXT: 1 1 1.00 U ftst @@ -343,8 +343,8 @@ fyl2xp1 # CHECK-NEXT: 1 1 1.00 U fucomp %st(1) # CHECK-NEXT: 1 1 1.00 U fucomp %st(3) # CHECK-NEXT: 1 1 1.00 U fucompp -# CHECK-NEXT: 1 9 0.50 U fucomi %st(3) -# CHECK-NEXT: 1 9 0.50 U fucompi %st(3) +# CHECK-NEXT: 1 9 0.50 U fucomi %st(3), %st +# CHECK-NEXT: 1 9 0.50 U fucompi %st(3), %st # CHECK-NEXT: 1 1 1.00 U wait # CHECK-NEXT: 1 1 1.00 U fxam # CHECK-NEXT: 1 1 0.25 U fxch %st(1) @@ -377,26 +377,26 @@ fyl2xp1 # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] Instructions: # CHECK-NEXT: - - - - - - - - - - - - f2xm1 # CHECK-NEXT: - - - - - - - - - - 1.00 - fabs -# CHECK-NEXT: - - - - - - - 1.00 - - - - fadd %st(0), %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - - - fadd %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - - - fadd %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - - - fadd %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fadds (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - faddl (%ecx) -# CHECK-NEXT: - - - - - - - 1.00 - - - - faddp %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - - - faddp %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - - - faddp %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - - - faddp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fiadds (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fiaddl (%ecx) # CHECK-NEXT: - - - - - - - - - - - - fbld (%ecx) # CHECK-NEXT: - - - - - - - - - - - - fbstp (%eax) # CHECK-NEXT: - - - - - - - - - - 1.00 - fchs # CHECK-NEXT: - - - - - - - - - - - - fnclex -# CHECK-NEXT: - - - - - - - - - - - - fcmovb %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - - - - - fcmovbe %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - - - - - fcmove %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - - - - - fcmovnb %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - - - - - fcmovnbe %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - - - - - fcmovne %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - - - - - fcmovnu %st(1), %st(0) -# CHECK-NEXT: - - - - - - - - - - - - fcmovu %st(1), %st(0) +# CHECK-NEXT: - - - - - - - - - - - - fcmovb %st(1), %st +# CHECK-NEXT: - - - - - - - - - - - - fcmovbe %st(1), %st +# CHECK-NEXT: - - - - - - - - - - - - fcmove %st(1), %st +# CHECK-NEXT: - - - - - - - - - - - - fcmovnb %st(1), %st +# CHECK-NEXT: - - - - - - - - - - - - fcmovnbe %st(1), %st +# CHECK-NEXT: - - - - - - - - - - - - fcmovne %st(1), %st +# CHECK-NEXT: - - - - - - - - - - - - fcmovnu %st(1), %st +# CHECK-NEXT: - - - - - - - - - - - - fcmovu %st(1), %st # CHECK-NEXT: - - - - - - - 1.00 - - - - fcom %st(1) # CHECK-NEXT: - - - - - - - 1.00 - - - - fcom %st(3) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fcoms (%ecx) @@ -406,24 +406,24 @@ fyl2xp1 # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fcomps (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fcompl (%eax) # CHECK-NEXT: - - - - - - - 1.00 - - - - fcompp -# CHECK-NEXT: 0.50 0.50 - - - - - 0.50 - 0.50 - - fcomi %st(3) -# CHECK-NEXT: 0.50 0.50 - - - - - 0.50 - 0.50 - - fcompi %st(3) +# CHECK-NEXT: 0.50 0.50 - - - - - 0.50 - 0.50 - - fcomi %st(3), %st +# CHECK-NEXT: 0.50 0.50 - - - - - 0.50 - 0.50 - - fcompi %st(3), %st # CHECK-NEXT: - - - - - - - - - - - - fcos # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fdecstp -# CHECK-NEXT: - - - - - - - - - - 1.00 - fdiv %st(0), %st(1) -# CHECK-NEXT: - - - - - - - - - - 1.00 - fdiv %st(2) +# CHECK-NEXT: - - - - - - - - - - 1.00 - fdiv %st, %st(1) +# CHECK-NEXT: - - - - - - - - - - 1.00 - fdiv %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fdivs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fdivl (%eax) -# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivp %st(1) -# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivp %st(2) +# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivp %st, %st(1) +# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fidivs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fidivl (%eax) -# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivr %st(0), %st(1) -# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivr %st(2) +# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivr %st, %st(1) +# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivr %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fdivrs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fdivrl (%eax) -# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivrp %st(1) -# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivrp %st(2) +# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivrp %st, %st(1) +# CHECK-NEXT: - - - - - - - - - - 1.00 - fdivrp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fidivrs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fidivrl (%eax) # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - ffree %st(0) @@ -457,12 +457,12 @@ fyl2xp1 # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fldln2 # CHECK-NEXT: 0.50 0.50 - - - - - - - - 1.00 - fldpi # CHECK-NEXT: 0.50 0.50 - - - - - - 0.50 - 0.50 - fldz -# CHECK-NEXT: - - - - - - - 0.50 0.50 - - - fmul %st(0), %st(1) -# CHECK-NEXT: - - - - - - - 0.50 0.50 - - - fmul %st(2) +# CHECK-NEXT: - - - - - - - 0.50 0.50 - - - fmul %st, %st(1) +# CHECK-NEXT: - - - - - - - 0.50 0.50 - - - fmul %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - 0.50 0.50 - - - fmuls (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - 0.50 0.50 - - - fmull (%eax) -# CHECK-NEXT: - - - - - - - 0.50 0.50 - - - fmulp %st(1) -# CHECK-NEXT: - - - - - - - 0.50 0.50 - - - fmulp %st(2) +# CHECK-NEXT: - - - - - - - 0.50 0.50 - - - fmulp %st, %st(1) +# CHECK-NEXT: - - - - - - - 0.50 0.50 - - - fmulp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - 0.50 0.50 - - - fimuls (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - 0.50 0.50 - - - fimull (%eax) # CHECK-NEXT: - - - - - - - 1.00 - - - - fnop @@ -490,20 +490,20 @@ fyl2xp1 # CHECK-NEXT: - - - - - - - - - - - - frstor (%eax) # CHECK-NEXT: - - - - - - - 1.00 - - - - wait # CHECK-NEXT: - - - - - - - - - - - - fnsave (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - - - fsub %st(0), %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - - - fsub %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - - - fsub %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - - - fsub %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fsubs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fsubl (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubp %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubp %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubp %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fisubs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fisubl (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubr %st(0), %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubr %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubr %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubr %st(2), %st # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fsubrs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fsubrl (%eax) -# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubrp %st(1) -# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubrp %st(2) +# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubrp %st, %st(1) +# CHECK-NEXT: - - - - - - - 1.00 - - - - fsubrp %st, %st(2) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fisubrs (%ecx) # CHECK-NEXT: 0.50 0.50 - - - - - 1.00 - - - - fisubrl (%eax) # CHECK-NEXT: - - - - - - - 1.00 - - - - ftst @@ -512,8 +512,8 @@ fyl2xp1 # CHECK-NEXT: - - - - - - - 1.00 - - - - fucomp %st(1) # CHECK-NEXT: - - - - - - - 1.00 - - - - fucomp %st(3) # CHECK-NEXT: - - - - - - - 1.00 - - - - fucompp -# CHECK-NEXT: 0.50 0.50 - - - - - 0.50 - 0.50 - - fucomi %st(3) -# CHECK-NEXT: 0.50 0.50 - - - - - 0.50 - 0.50 - - fucompi %st(3) +# CHECK-NEXT: 0.50 0.50 - - - - - 0.50 - 0.50 - - fucomi %st(3), %st +# CHECK-NEXT: 0.50 0.50 - - - - - 0.50 - 0.50 - - fucompi %st(3), %st # CHECK-NEXT: - - - - - - - 1.00 - - - - wait # CHECK-NEXT: - - - - - - - - - - 1.00 - fxam # CHECK-NEXT: - - - - - - - 0.25 0.25 0.25 0.25 - fxch %st(1) diff --git a/tools/yaml2obj/yaml2wasm.cpp b/tools/yaml2obj/yaml2wasm.cpp index 2d3e3b71f086..7d08e62bcedd 100644 --- a/tools/yaml2obj/yaml2wasm.cpp +++ b/tools/yaml2obj/yaml2wasm.cpp @@ -172,7 +172,8 @@ int WasmWriter::writeSectionContent(raw_ostream &OS, case wasm::WASM_SYMBOL_TYPE_GLOBAL: case wasm::WASM_SYMBOL_TYPE_EVENT: encodeULEB128(Info.ElementIndex, SubSection.GetStream()); - if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0) + if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0 || + (Info.Flags & wasm::WASM_SYMBOL_EXPLICIT_NAME) != 0) writeStringRef(Info.Name, SubSection.GetStream()); break; case wasm::WASM_SYMBOL_TYPE_DATA: diff --git a/utils/TableGen/X86RecognizableInstr.cpp b/utils/TableGen/X86RecognizableInstr.cpp index 2f9b428b8cfe..463609edb73b 100644 --- a/utils/TableGen/X86RecognizableInstr.cpp +++ b/utils/TableGen/X86RecognizableInstr.cpp @@ -842,6 +842,7 @@ OperandType RecognizableInstr::typeFromString(const std::string &s, TYPE("f32mem", TYPE_M) TYPE("ssmem", TYPE_M) TYPE("RST", TYPE_ST) + TYPE("RSTi", TYPE_ST) TYPE("i128mem", TYPE_M) TYPE("i256mem", TYPE_M) TYPE("i512mem", TYPE_M) @@ -964,6 +965,7 @@ OperandEncoding RecognizableInstr::rmRegisterEncodingFromString(const std::string &s, uint8_t OpSize) { ENCODING("RST", ENCODING_FP) + ENCODING("RSTi", ENCODING_FP) ENCODING("GR16", ENCODING_RM) ENCODING("GR32", ENCODING_RM) ENCODING("GR32orGR64", ENCODING_RM) From 5df36aae6442dbc915e71d1f0339b615af064b1b Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 15 Feb 2019 20:49:05 +0000 Subject: [PATCH 2/4] Vendor import of clang release_80 branch r354130: https://llvm.org/svn/llvm-project/cfe/branches/release_80@354130 --- docs/AttributeReference.rst | 5175 ++++++++++++++++- docs/ClangCommandLineReference.rst | 208 +- include/clang/Basic/Attr.td | 26 +- include/clang/Basic/AttrDocs.td | 35 +- include/clang/Basic/BuiltinsAArch64.def | 4 +- include/clang/Basic/DiagnosticSemaKinds.td | 3 + include/clang/Basic/OpenCLOptions.h | 29 +- include/clang/Driver/Options.td | 4 +- include/clang/Parse/Parser.h | 5 - include/clang/Sema/Sema.h | 19 +- lib/Basic/Targets/PPC.h | 8 +- lib/CodeGen/CGBuiltin.cpp | 5 +- lib/CodeGen/CGDecl.cpp | 10 +- lib/CodeGen/CodeGenModule.cpp | 8 +- lib/CodeGen/TargetInfo.cpp | 16 + lib/Driver/ToolChains/MSVC.cpp | 8 +- lib/Frontend/InitPreprocessor.cpp | 7 +- lib/Headers/intrin.h | 4 +- lib/Parse/ParseObjc.cpp | 2 +- lib/Parse/ParseOpenMP.cpp | 14 +- lib/Parse/ParsePragma.cpp | 9 +- lib/Parse/ParseStmt.cpp | 26 +- lib/Parse/ParseStmtAsm.cpp | 2 +- lib/Sema/Sema.cpp | 7 +- lib/Sema/SemaChecking.cpp | 20 +- lib/Sema/SemaCoroutine.cpp | 17 +- lib/Sema/SemaDecl.cpp | 6 +- lib/Sema/SemaDeclAttr.cpp | 77 +- lib/Sema/SemaDeclCXX.cpp | 14 +- lib/Sema/SemaExpr.cpp | 5 +- lib/Sema/SemaExprCXX.cpp | 2 - lib/Sema/SemaLambda.cpp | 2 +- lib/Sema/SemaOpenMP.cpp | 55 +- lib/Sema/SemaStmt.cpp | 65 +- lib/Sema/TreeTransform.h | 15 +- .../Core/BugReporterVisitors.cpp | 29 +- test/Analysis/PR40625.cpp | 16 + test/Analysis/uninit-vals.m | 8 +- test/CXX/stmt.stmt/stmt.select/p3.cpp | 9 +- .../pragma-macro-token-caching.c | 2 +- test/CodeGen/arm64-microsoft-status-reg.cpp | 108 +- test/CodeGen/microsoft-no-common-align.c | 3 + test/CodeGen/powerpc_types.c | 2 + test/CodeGen/wasm-import-module.c | 11 + test/CodeGen/wasm-import-name.c | 11 + test/CodeGenCXX/trivial-auto-var-init.cpp | 26 + test/Driver/cl-options.c | 4 + ...a-attribute-supported-attributes-list.test | 3 + test/Parser/cxx1z-init-statement.cpp | 8 +- test/Parser/switch-recovery.cpp | 2 +- test/SemaCXX/cxx1z-init-statement.cpp | 8 +- test/SemaCXX/for-range-examples.cpp | 2 +- test/SemaCXX/warn-float-conversion.cpp | 12 +- test/SemaCXX/warn-unused-result.cpp | 40 - test/SemaObjC/attr-designated-init.m | 15 +- test/SemaObjC/conversion.m | 7 + test/SemaOpenCL/extension-version.cl | 114 +- test/SemaOpenCL/extensions.cl | 9 +- 58 files changed, 5910 insertions(+), 451 deletions(-) create mode 100644 test/Analysis/PR40625.cpp create mode 100644 test/CodeGen/wasm-import-module.c create mode 100644 test/CodeGen/wasm-import-name.c diff --git a/docs/AttributeReference.rst b/docs/AttributeReference.rst index a763ddeaeb10..01938f64f56c 100644 --- a/docs/AttributeReference.rst +++ b/docs/AttributeReference.rst @@ -1,13 +1,5176 @@ .. ------------------------------------------------------------------- NOTE: This file is automatically generated by running clang-tblgen - -gen-attr-docs. Do not edit this file by hand!! The contents for - this file are automatically generated by a server-side process. - - Please do not commit this file. The file exists for local testing - purposes only. + -gen-attr-docs. Do not edit this file by hand!! ------------------------------------------------------------------- =================== Attributes in Clang -=================== \ No newline at end of file +=================== +.. contents:: + :local: + +.. |br| raw:: html + +
+ +Introduction +============ + +This page lists the attributes currently supported by Clang. + +Function Attributes +=================== + + +#pragma omp declare simd +------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","","``omp declare simd``","" + +The `declare simd` construct can be applied to a function to enable the creation +of one or more versions that can process multiple arguments using SIMD +instructions from a single invocation in a SIMD loop. The `declare simd` +directive is a declarative directive. There may be multiple `declare simd` +directives for a function. The use of a `declare simd` construct on a function +enables the creation of SIMD versions of the associated function that can be +used to process multiple arguments from a single invocation from a SIMD loop +concurrently. +The syntax of the `declare simd` construct is as follows: + + .. code-block:: none + + #pragma omp declare simd [clause[[,] clause] ...] new-line + [#pragma omp declare simd [clause[[,] clause] ...] new-line] + [...] + function definition or declaration + +where clause is one of the following: + + .. code-block:: none + + simdlen(length) + linear(argument-list[:constant-linear-step]) + aligned(argument-list[:alignment]) + uniform(argument-list) + inbranch + notinbranch + + +#pragma omp declare target +-------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","","``omp declare target``","" + +The `declare target` directive specifies that variables and functions are mapped +to a device for OpenMP offload mechanism. + +The syntax of the declare target directive is as follows: + + .. code-block:: c + + #pragma omp declare target new-line + declarations-definition-seq + #pragma omp end declare target new-line + + +_Noreturn +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``_Noreturn``","","" + +A function declared as ``_Noreturn`` shall not return to its caller. The +compiler will generate a diagnostic for a function declared as ``_Noreturn`` +that appears to be capable of returning to its caller. + + +abi_tag +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``abi_tag``","``gnu::abi_tag``","","","","","Yes" + +The ``abi_tag`` attribute can be applied to a function, variable, class or +inline namespace declaration to modify the mangled name of the entity. It gives +the ability to distinguish between different versions of the same entity but +with different ABI versions supported. For example, a newer version of a class +could have a different set of data members and thus have a different size. Using +the ``abi_tag`` attribute, it is possible to have different mangled names for +a global variable of the class type. Therefore, the old code could keep using +the old manged name and the new code will use the new mangled name with tags. + + +acquire_capability, acquire_shared_capability +--------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``acquire_capability`` |br| ``acquire_shared_capability`` |br| ``exclusive_lock_function`` |br| ``shared_lock_function``","``clang::acquire_capability`` |br| ``clang::acquire_shared_capability``","","","","","" + +Marks a function as acquiring a capability. + + +alloc_align +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``alloc_align``","``gnu::alloc_align``","","","","","" + +Use ``__attribute__((alloc_align())`` on a function +declaration to specify that the return value of the function (which must be a +pointer type) is at least as aligned as the value of the indicated parameter. The +parameter is given by its index in the list of formal parameters; the first +parameter has index 1 unless the function is a C++ non-static member function, +in which case the first parameter has index 2 to account for the implicit ``this`` +parameter. + +.. code-block:: c++ + + // The returned pointer has the alignment specified by the first parameter. + void *a(size_t align) __attribute__((alloc_align(1))); + + // The returned pointer has the alignment specified by the second parameter. + void *b(void *v, size_t align) __attribute__((alloc_align(2))); + + // The returned pointer has the alignment specified by the second visible + // parameter, however it must be adjusted for the implicit 'this' parameter. + void *Foo::b(void *v, size_t align) __attribute__((alloc_align(3))); + +Note that this attribute merely informs the compiler that a function always +returns a sufficiently aligned pointer. It does not cause the compiler to +emit code to enforce that alignment. The behavior is undefined if the returned +poitner is not sufficiently aligned. + + +alloc_size +---------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``alloc_size``","``gnu::alloc_size``","","","","","Yes" + +The ``alloc_size`` attribute can be placed on functions that return pointers in +order to hint to the compiler how many bytes of memory will be available at the +returned pointer. ``alloc_size`` takes one or two arguments. + +- ``alloc_size(N)`` implies that argument number N equals the number of + available bytes at the returned pointer. +- ``alloc_size(N, M)`` implies that the product of argument number N and + argument number M equals the number of available bytes at the returned + pointer. + +Argument numbers are 1-based. + +An example of how to use ``alloc_size`` + +.. code-block:: c + + void *my_malloc(int a) __attribute__((alloc_size(1))); + void *my_calloc(int a, int b) __attribute__((alloc_size(1, 2))); + + int main() { + void *const p = my_malloc(100); + assert(__builtin_object_size(p, 0) == 100); + void *const a = my_calloc(20, 5); + assert(__builtin_object_size(a, 0) == 100); + } + +.. Note:: This attribute works differently in clang than it does in GCC. + Specifically, clang will only trace ``const`` pointers (as above); we give up + on pointers that are not marked as ``const``. In the vast majority of cases, + this is unimportant, because LLVM has support for the ``alloc_size`` + attribute. However, this may cause mildly unintuitive behavior when used with + other attributes, such as ``enable_if``. + + +artificial +---------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``artificial``","``gnu::artificial``","","","","","" + +The ``artificial`` attribute can be applied to an inline function. If such a +function is inlined, the attribute indicates that debuggers should associate +the resulting instructions with the call site, rather than with the +corresponding line within the inlined callee. + + +assert_capability, assert_shared_capability +------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``assert_capability`` |br| ``assert_shared_capability``","``clang::assert_capability`` |br| ``clang::assert_shared_capability``","","","","","" + +Marks a function that dynamically tests whether a capability is held, and halts +the program if it is not held. + + +assume_aligned +-------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``assume_aligned``","``gnu::assume_aligned``","","","","","Yes" + +Use ``__attribute__((assume_aligned([,]))`` on a function +declaration to specify that the return value of the function (which must be a +pointer type) has the specified offset, in bytes, from an address with the +specified alignment. The offset is taken to be zero if omitted. + +.. code-block:: c++ + + // The returned pointer value has 32-byte alignment. + void *a() __attribute__((assume_aligned (32))); + + // The returned pointer value is 4 bytes greater than an address having + // 32-byte alignment. + void *b() __attribute__((assume_aligned (32, 4))); + +Note that this attribute provides information to the compiler regarding a +condition that the code already ensures is true. It does not cause the compiler +to enforce the provided alignment assumption. + + +availability +------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``availability``","``clang::availability``","``clang::availability``","","","","Yes" + +The ``availability`` attribute can be placed on declarations to describe the +lifecycle of that declaration relative to operating system versions. Consider +the function declaration for a hypothetical function ``f``: + +.. code-block:: c++ + + void f(void) __attribute__((availability(macos,introduced=10.4,deprecated=10.6,obsoleted=10.7))); + +The availability attribute states that ``f`` was introduced in macOS 10.4, +deprecated in macOS 10.6, and obsoleted in macOS 10.7. This information +is used by Clang to determine when it is safe to use ``f``: for example, if +Clang is instructed to compile code for macOS 10.5, a call to ``f()`` +succeeds. If Clang is instructed to compile code for macOS 10.6, the call +succeeds but Clang emits a warning specifying that the function is deprecated. +Finally, if Clang is instructed to compile code for macOS 10.7, the call +fails because ``f()`` is no longer available. + +The availability attribute is a comma-separated list starting with the +platform name and then including clauses specifying important milestones in the +declaration's lifetime (in any order) along with additional information. Those +clauses can be: + +introduced=\ *version* + The first version in which this declaration was introduced. + +deprecated=\ *version* + The first version in which this declaration was deprecated, meaning that + users should migrate away from this API. + +obsoleted=\ *version* + The first version in which this declaration was obsoleted, meaning that it + was removed completely and can no longer be used. + +unavailable + This declaration is never available on this platform. + +message=\ *string-literal* + Additional message text that Clang will provide when emitting a warning or + error about use of a deprecated or obsoleted declaration. Useful to direct + users to replacement APIs. + +replacement=\ *string-literal* + Additional message text that Clang will use to provide Fix-It when emitting + a warning about use of a deprecated declaration. The Fix-It will replace + the deprecated declaration with the new declaration specified. + +Multiple availability attributes can be placed on a declaration, which may +correspond to different platforms. Only the availability attribute with the +platform corresponding to the target platform will be used; any others will be +ignored. If no availability attribute specifies availability for the current +target platform, the availability attributes are ignored. Supported platforms +are: + +``ios`` + Apple's iOS operating system. The minimum deployment target is specified by + the ``-mios-version-min=*version*`` or ``-miphoneos-version-min=*version*`` + command-line arguments. + +``macos`` + Apple's macOS operating system. The minimum deployment target is + specified by the ``-mmacosx-version-min=*version*`` command-line argument. + ``macosx`` is supported for backward-compatibility reasons, but it is + deprecated. + +``tvos`` + Apple's tvOS operating system. The minimum deployment target is specified by + the ``-mtvos-version-min=*version*`` command-line argument. + +``watchos`` + Apple's watchOS operating system. The minimum deployment target is specified by + the ``-mwatchos-version-min=*version*`` command-line argument. + +A declaration can typically be used even when deploying back to a platform +version prior to when the declaration was introduced. When this happens, the +declaration is `weakly linked +`_, +as if the ``weak_import`` attribute were added to the declaration. A +weakly-linked declaration may or may not be present a run-time, and a program +can determine whether the declaration is present by checking whether the +address of that declaration is non-NULL. + +The flag ``strict`` disallows using API when deploying back to a +platform version prior to when the declaration was introduced. An +attempt to use such API before its introduction causes a hard error. +Weakly-linking is almost always a better API choice, since it allows +users to query availability at runtime. + +If there are multiple declarations of the same entity, the availability +attributes must either match on a per-platform basis or later +declarations must not have availability attributes for that +platform. For example: + +.. code-block:: c + + void g(void) __attribute__((availability(macos,introduced=10.4))); + void g(void) __attribute__((availability(macos,introduced=10.4))); // okay, matches + void g(void) __attribute__((availability(ios,introduced=4.0))); // okay, adds a new platform + void g(void); // okay, inherits both macos and ios availability from above. + void g(void) __attribute__((availability(macos,introduced=10.5))); // error: mismatch + +When one method overrides another, the overriding method can be more widely available than the overridden method, e.g.,: + +.. code-block:: objc + + @interface A + - (id)method __attribute__((availability(macos,introduced=10.4))); + - (id)method2 __attribute__((availability(macos,introduced=10.4))); + @end + + @interface B : A + - (id)method __attribute__((availability(macos,introduced=10.3))); // okay: method moved into base class later + - (id)method __attribute__((availability(macos,introduced=10.5))); // error: this method was available via the base class in 10.4 + @end + +Starting with the macOS 10.12 SDK, the ``API_AVAILABLE`` macro from +```` can simplify the spelling: + +.. code-block:: objc + + @interface A + - (id)method API_AVAILABLE(macos(10.11))); + - (id)otherMethod API_AVAILABLE(macos(10.11), ios(11.0)); + @end + +Also see the documentation for `@available +`_ + + +carries_dependency +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``carries_dependency``","``carries_dependency``","","","","","Yes" + +The ``carries_dependency`` attribute specifies dependency propagation into and +out of functions. + +When specified on a function or Objective-C method, the ``carries_dependency`` +attribute means that the return value carries a dependency out of the function, +so that the implementation need not constrain ordering upon return from that +function. Implementations of the function and its caller may choose to preserve +dependencies instead of emitting memory ordering instructions such as fences. + +Note, this attribute does not change the meaning of the program, but may result +in generation of more efficient code. + + +cf_consumed +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``cf_consumed``","``clang::cf_consumed``","``clang::cf_consumed``","","","","Yes" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +cf_returns_not_retained +----------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``cf_returns_not_retained``","``clang::cf_returns_not_retained``","``clang::cf_returns_not_retained``","","","","" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +cf_returns_retained +------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``cf_returns_retained``","``clang::cf_returns_retained``","``clang::cf_returns_retained``","","","","" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +code_seg +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","``code_seg``","","","" + +The ``__declspec(code_seg)`` attribute enables the placement of code into separate +named segments that can be paged or locked in memory individually. This attribute +is used to control the placement of instantiated templates and compiler-generated +code. See the documentation for `__declspec(code_seg)`_ on MSDN. + +.. _`__declspec(code_seg)`: http://msdn.microsoft.com/en-us/library/dn636922.aspx + + +convergent +---------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``convergent``","``clang::convergent``","``clang::convergent``","","","","Yes" + +The ``convergent`` attribute can be placed on a function declaration. It is +translated into the LLVM ``convergent`` attribute, which indicates that the call +instructions of a function with this attribute cannot be made control-dependent +on any additional values. + +In languages designed for SPMD/SIMT programming model, e.g. OpenCL or CUDA, +the call instructions of a function with this attribute must be executed by +all work items or threads in a work group or sub group. + +This attribute is different from ``noduplicate`` because it allows duplicating +function calls if it can be proved that the duplicated function calls are +not made control-dependent on any additional values, e.g., unrolling a loop +executed by all work items. + +Sample usage: +.. code-block:: c + + void convfunc(void) __attribute__((convergent)); + // Setting it as a C++11 attribute is also valid in a C++ program. + // void convfunc(void) [[clang::convergent]]; + + +cpu_dispatch +------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``cpu_dispatch``","``clang::cpu_dispatch``","``clang::cpu_dispatch``","``cpu_dispatch``","","","Yes" + +The ``cpu_specific`` and ``cpu_dispatch`` attributes are used to define and +resolve multiversioned functions. This form of multiversioning provides a +mechanism for declaring versions across translation units and manually +specifying the resolved function list. A specified CPU defines a set of minimum +features that are required for the function to be called. The result of this is +that future processors execute the most restrictive version of the function the +new processor can execute. + +Function versions are defined with ``cpu_specific``, which takes one or more CPU +names as a parameter. For example: + +.. code-block:: c + + // Declares and defines the ivybridge version of single_cpu. + __attribute__((cpu_specific(ivybridge))) + void single_cpu(void){} + + // Declares and defines the atom version of single_cpu. + __attribute__((cpu_specific(atom))) + void single_cpu(void){} + + // Declares and defines both the ivybridge and atom version of multi_cpu. + __attribute__((cpu_specific(ivybridge, atom))) + void multi_cpu(void){} + +A dispatching (or resolving) function can be declared anywhere in a project's +source code with ``cpu_dispatch``. This attribute takes one or more CPU names +as a parameter (like ``cpu_specific``). Functions marked with ``cpu_dispatch`` +are not expected to be defined, only declared. If such a marked function has a +definition, any side effects of the function are ignored; trivial function +bodies are permissible for ICC compatibility. + +.. code-block:: c + + // Creates a resolver for single_cpu above. + __attribute__((cpu_dispatch(ivybridge, atom))) + void single_cpu(void){} + + // Creates a resolver for multi_cpu, but adds a 3rd version defined in another + // translation unit. + __attribute__((cpu_dispatch(ivybridge, atom, sandybridge))) + void multi_cpu(void){} + +Note that it is possible to have a resolving function that dispatches based on +more or fewer options than are present in the program. Specifying fewer will +result in the omitted options not being considered during resolution. Specifying +a version for resolution that isn't defined in the program will result in a +linking failure. + +It is also possible to specify a CPU name of ``generic`` which will be resolved +if the executing processor doesn't satisfy the features required in the CPU +name. The behavior of a program executing on a processor that doesn't satisfy +any option of a multiversioned function is undefined. + + +cpu_specific +------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``cpu_specific``","``clang::cpu_specific``","``clang::cpu_specific``","``cpu_specific``","","","Yes" + +The ``cpu_specific`` and ``cpu_dispatch`` attributes are used to define and +resolve multiversioned functions. This form of multiversioning provides a +mechanism for declaring versions across translation units and manually +specifying the resolved function list. A specified CPU defines a set of minimum +features that are required for the function to be called. The result of this is +that future processors execute the most restrictive version of the function the +new processor can execute. + +Function versions are defined with ``cpu_specific``, which takes one or more CPU +names as a parameter. For example: + +.. code-block:: c + + // Declares and defines the ivybridge version of single_cpu. + __attribute__((cpu_specific(ivybridge))) + void single_cpu(void){} + + // Declares and defines the atom version of single_cpu. + __attribute__((cpu_specific(atom))) + void single_cpu(void){} + + // Declares and defines both the ivybridge and atom version of multi_cpu. + __attribute__((cpu_specific(ivybridge, atom))) + void multi_cpu(void){} + +A dispatching (or resolving) function can be declared anywhere in a project's +source code with ``cpu_dispatch``. This attribute takes one or more CPU names +as a parameter (like ``cpu_specific``). Functions marked with ``cpu_dispatch`` +are not expected to be defined, only declared. If such a marked function has a +definition, any side effects of the function are ignored; trivial function +bodies are permissible for ICC compatibility. + +.. code-block:: c + + // Creates a resolver for single_cpu above. + __attribute__((cpu_dispatch(ivybridge, atom))) + void single_cpu(void){} + + // Creates a resolver for multi_cpu, but adds a 3rd version defined in another + // translation unit. + __attribute__((cpu_dispatch(ivybridge, atom, sandybridge))) + void multi_cpu(void){} + +Note that it is possible to have a resolving function that dispatches based on +more or fewer options than are present in the program. Specifying fewer will +result in the omitted options not being considered during resolution. Specifying +a version for resolution that isn't defined in the program will result in a +linking failure. + +It is also possible to specify a CPU name of ``generic`` which will be resolved +if the executing processor doesn't satisfy the features required in the CPU +name. The behavior of a program executing on a processor that doesn't satisfy +any option of a multiversioned function is undefined. + + +deprecated +---------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``deprecated``","``gnu::deprecated`` |br| ``deprecated``","``deprecated``","``deprecated``","","","" + +The ``deprecated`` attribute can be applied to a function, a variable, or a +type. This is useful when identifying functions, variables, or types that are +expected to be removed in a future version of a program. + +Consider the function declaration for a hypothetical function ``f``: + +.. code-block:: c++ + + void f(void) __attribute__((deprecated("message", "replacement"))); + +When spelled as `__attribute__((deprecated))`, the deprecated attribute can have +two optional string arguments. The first one is the message to display when +emitting the warning; the second one enables the compiler to provide a Fix-It +to replace the deprecated name with a new name. Otherwise, when spelled as +`[[gnu::deprecated]] or [[deprecated]]`, the attribute can have one optional +string argument which is the message to display when emitting the warning. + + +diagnose_if +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``diagnose_if``","","","","","","" + +The ``diagnose_if`` attribute can be placed on function declarations to emit +warnings or errors at compile-time if calls to the attributed function meet +certain user-defined criteria. For example: + +.. code-block:: c + + int abs(int a) + __attribute__((diagnose_if(a >= 0, "Redundant abs call", "warning"))); + int must_abs(int a) + __attribute__((diagnose_if(a >= 0, "Redundant abs call", "error"))); + + int val = abs(1); // warning: Redundant abs call + int val2 = must_abs(1); // error: Redundant abs call + int val3 = abs(val); + int val4 = must_abs(val); // Because run-time checks are not emitted for + // diagnose_if attributes, this executes without + // issue. + + +``diagnose_if`` is closely related to ``enable_if``, with a few key differences: + +* Overload resolution is not aware of ``diagnose_if`` attributes: they're + considered only after we select the best candidate from a given candidate set. +* Function declarations that differ only in their ``diagnose_if`` attributes are + considered to be redeclarations of the same function (not overloads). +* If the condition provided to ``diagnose_if`` cannot be evaluated, no + diagnostic will be emitted. + +Otherwise, ``diagnose_if`` is essentially the logical negation of ``enable_if``. + +As a result of bullet number two, ``diagnose_if`` attributes will stack on the +same function. For example: + +.. code-block:: c + + int foo() __attribute__((diagnose_if(1, "diag1", "warning"))); + int foo() __attribute__((diagnose_if(1, "diag2", "warning"))); + + int bar = foo(); // warning: diag1 + // warning: diag2 + int (*fooptr)(void) = foo; // warning: diag1 + // warning: diag2 + + constexpr int supportsAPILevel(int N) { return N < 5; } + int baz(int a) + __attribute__((diagnose_if(!supportsAPILevel(10), + "Upgrade to API level 10 to use baz", "error"))); + int baz(int a) + __attribute__((diagnose_if(!a, "0 is not recommended.", "warning"))); + + int (*bazptr)(int) = baz; // error: Upgrade to API level 10 to use baz + int v = baz(0); // error: Upgrade to API level 10 to use baz + +Query for this feature with ``__has_attribute(diagnose_if)``. + + +disable_tail_calls +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``disable_tail_calls``","``clang::disable_tail_calls``","``clang::disable_tail_calls``","","","","Yes" + +The ``disable_tail_calls`` attribute instructs the backend to not perform tail call optimization inside the marked function. + +For example: + + .. code-block:: c + + int callee(int); + + int foo(int a) __attribute__((disable_tail_calls)) { + return callee(a); // This call is not tail-call optimized. + } + +Marking virtual functions as ``disable_tail_calls`` is legal. + + .. code-block:: c++ + + int callee(int); + + class Base { + public: + [[clang::disable_tail_calls]] virtual int foo1() { + return callee(); // This call is not tail-call optimized. + } + }; + + class Derived1 : public Base { + public: + int foo1() override { + return callee(); // This call is tail-call optimized. + } + }; + + +enable_if +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``enable_if``","","","","","","Yes" + +.. Note:: Some features of this attribute are experimental. The meaning of + multiple enable_if attributes on a single declaration is subject to change in + a future version of clang. Also, the ABI is not standardized and the name + mangling may change in future versions. To avoid that, use asm labels. + +The ``enable_if`` attribute can be placed on function declarations to control +which overload is selected based on the values of the function's arguments. +When combined with the ``overloadable`` attribute, this feature is also +available in C. + +.. code-block:: c++ + + int isdigit(int c); + int isdigit(int c) __attribute__((enable_if(c <= -1 || c > 255, "chosen when 'c' is out of range"))) __attribute__((unavailable("'c' must have the value of an unsigned char or EOF"))); + + void foo(char c) { + isdigit(c); + isdigit(10); + isdigit(-10); // results in a compile-time error. + } + +The enable_if attribute takes two arguments, the first is an expression written +in terms of the function parameters, the second is a string explaining why this +overload candidate could not be selected to be displayed in diagnostics. The +expression is part of the function signature for the purposes of determining +whether it is a redeclaration (following the rules used when determining +whether a C++ template specialization is ODR-equivalent), but is not part of +the type. + +The enable_if expression is evaluated as if it were the body of a +bool-returning constexpr function declared with the arguments of the function +it is being applied to, then called with the parameters at the call site. If the +result is false or could not be determined through constant expression +evaluation, then this overload will not be chosen and the provided string may +be used in a diagnostic if the compile fails as a result. + +Because the enable_if expression is an unevaluated context, there are no global +state changes, nor the ability to pass information from the enable_if +expression to the function body. For example, suppose we want calls to +strnlen(strbuf, maxlen) to resolve to strnlen_chk(strbuf, maxlen, size of +strbuf) only if the size of strbuf can be determined: + +.. code-block:: c++ + + __attribute__((always_inline)) + static inline size_t strnlen(const char *s, size_t maxlen) + __attribute__((overloadable)) + __attribute__((enable_if(__builtin_object_size(s, 0) != -1))), + "chosen when the buffer size is known but 'maxlen' is not"))) + { + return strnlen_chk(s, maxlen, __builtin_object_size(s, 0)); + } + +Multiple enable_if attributes may be applied to a single declaration. In this +case, the enable_if expressions are evaluated from left to right in the +following manner. First, the candidates whose enable_if expressions evaluate to +false or cannot be evaluated are discarded. If the remaining candidates do not +share ODR-equivalent enable_if expressions, the overload resolution is +ambiguous. Otherwise, enable_if overload resolution continues with the next +enable_if attribute on the candidates that have not been discarded and have +remaining enable_if attributes. In this way, we pick the most specific +overload out of a number of viable overloads using enable_if. + +.. code-block:: c++ + + void f() __attribute__((enable_if(true, ""))); // #1 + void f() __attribute__((enable_if(true, ""))) __attribute__((enable_if(true, ""))); // #2 + + void g(int i, int j) __attribute__((enable_if(i, ""))); // #1 + void g(int i, int j) __attribute__((enable_if(j, ""))) __attribute__((enable_if(true))); // #2 + +In this example, a call to f() is always resolved to #2, as the first enable_if +expression is ODR-equivalent for both declarations, but #1 does not have another +enable_if expression to continue evaluating, so the next round of evaluation has +only a single candidate. In a call to g(1, 1), the call is ambiguous even though +#2 has more enable_if attributes, because the first enable_if expressions are +not ODR-equivalent. + +Query for this feature with ``__has_attribute(enable_if)``. + +Note that functions with one or more ``enable_if`` attributes may not have +their address taken, unless all of the conditions specified by said +``enable_if`` are constants that evaluate to ``true``. For example: + +.. code-block:: c + + const int TrueConstant = 1; + const int FalseConstant = 0; + int f(int a) __attribute__((enable_if(a > 0, ""))); + int g(int a) __attribute__((enable_if(a == 0 || a != 0, ""))); + int h(int a) __attribute__((enable_if(1, ""))); + int i(int a) __attribute__((enable_if(TrueConstant, ""))); + int j(int a) __attribute__((enable_if(FalseConstant, ""))); + + void fn() { + int (*ptr)(int); + ptr = &f; // error: 'a > 0' is not always true + ptr = &g; // error: 'a == 0 || a != 0' is not a truthy constant + ptr = &h; // OK: 1 is a truthy constant + ptr = &i; // OK: 'TrueConstant' is a truthy constant + ptr = &j; // error: 'FalseConstant' is a constant, but not truthy + } + +Because ``enable_if`` evaluation happens during overload resolution, +``enable_if`` may give unintuitive results when used with templates, depending +on when overloads are resolved. In the example below, clang will emit a +diagnostic about no viable overloads for ``foo`` in ``bar``, but not in ``baz``: + +.. code-block:: c++ + + double foo(int i) __attribute__((enable_if(i > 0, ""))); + void *foo(int i) __attribute__((enable_if(i <= 0, ""))); + template + auto bar() { return foo(I); } + + template + auto baz() { return foo(T::number); } + + struct WithNumber { constexpr static int number = 1; }; + void callThem() { + bar(); + baz(); + } + +This is because, in ``bar``, ``foo`` is resolved prior to template +instantiation, so the value for ``I`` isn't known (thus, both ``enable_if`` +conditions for ``foo`` fail). However, in ``baz``, ``foo`` is resolved during +template instantiation, so the value for ``T::number`` is known. + + +exclude_from_explicit_instantiation +----------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``exclude_from_explicit_instantiation``","``clang::exclude_from_explicit_instantiation``","``clang::exclude_from_explicit_instantiation``","","","","Yes" + +The ``exclude_from_explicit_instantiation`` attribute opts-out a member of a +class template from being part of explicit template instantiations of that +class template. This means that an explicit instantiation will not instantiate +members of the class template marked with the attribute, but also that code +where an extern template declaration of the enclosing class template is visible +will not take for granted that an external instantiation of the class template +would provide those members (which would otherwise be a link error, since the +explicit instantiation won't provide those members). For example, let's say we +don't want the ``data()`` method to be part of libc++'s ABI. To make sure it +is not exported from the dylib, we give it hidden visibility: + + .. code-block:: c++ + + // in + template + class basic_string { + public: + __attribute__((__visibility__("hidden"))) + const value_type* data() const noexcept { ... } + }; + + template class basic_string; + +Since an explicit template instantiation declaration for ``basic_string`` +is provided, the compiler is free to assume that ``basic_string::data()`` +will be provided by another translation unit, and it is free to produce an +external call to this function. However, since ``data()`` has hidden visibility +and the explicit template instantiation is provided in a shared library (as +opposed to simply another translation unit), ``basic_string::data()`` +won't be found and a link error will ensue. This happens because the compiler +assumes that ``basic_string::data()`` is part of the explicit template +instantiation declaration, when it really isn't. To tell the compiler that +``data()`` is not part of the explicit template instantiation declaration, the +``exclude_from_explicit_instantiation`` attribute can be used: + + .. code-block:: c++ + + // in + template + class basic_string { + public: + __attribute__((__visibility__("hidden"))) + __attribute__((exclude_from_explicit_instantiation)) + const value_type* data() const noexcept { ... } + }; + + template class basic_string; + +Now, the compiler won't assume that ``basic_string::data()`` is provided +externally despite there being an explicit template instantiation declaration: +the compiler will implicitly instantiate ``basic_string::data()`` in the +TUs where it is used. + +This attribute can be used on static and non-static member functions of class +templates, static data members of class templates and member classes of class +templates. + + +external_source_symbol +---------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``external_source_symbol``","``clang::external_source_symbol``","``clang::external_source_symbol``","","","","Yes" + +The ``external_source_symbol`` attribute specifies that a declaration originates +from an external source and describes the nature of that source. + +The fact that Clang is capable of recognizing declarations that were defined +externally can be used to provide better tooling support for mixed-language +projects or projects that rely on auto-generated code. For instance, an IDE that +uses Clang and that supports mixed-language projects can use this attribute to +provide a correct 'jump-to-definition' feature. For a concrete example, +consider a protocol that's defined in a Swift file: + +.. code-block:: swift + + @objc public protocol SwiftProtocol { + func method() + } + +This protocol can be used from Objective-C code by including a header file that +was generated by the Swift compiler. The declarations in that header can use +the ``external_source_symbol`` attribute to make Clang aware of the fact +that ``SwiftProtocol`` actually originates from a Swift module: + +.. code-block:: objc + + __attribute__((external_source_symbol(language="Swift",defined_in="module"))) + @protocol SwiftProtocol + @required + - (void) method; + @end + +Consequently, when 'jump-to-definition' is performed at a location that +references ``SwiftProtocol``, the IDE can jump to the original definition in +the Swift source file rather than jumping to the Objective-C declaration in the +auto-generated header file. + +The ``external_source_symbol`` attribute is a comma-separated list that includes +clauses that describe the origin and the nature of the particular declaration. +Those clauses can be: + +language=\ *string-literal* + The name of the source language in which this declaration was defined. + +defined_in=\ *string-literal* + The name of the source container in which the declaration was defined. The + exact definition of source container is language-specific, e.g. Swift's + source containers are modules, so ``defined_in`` should specify the Swift + module name. + +generated_declaration + This declaration was automatically generated by some tool. + +The clauses can be specified in any order. The clauses that are listed above are +all optional, but the attribute has to have at least one clause. + + +flatten +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``flatten``","``gnu::flatten``","","","","","Yes" + +The ``flatten`` attribute causes calls within the attributed function to +be inlined unless it is impossible to do so, for example if the body of the +callee is unavailable or if the callee has the ``noinline`` attribute. + + +force_align_arg_pointer +----------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``force_align_arg_pointer``","``gnu::force_align_arg_pointer``","","","","","" + +Use this attribute to force stack alignment. + +Legacy x86 code uses 4-byte stack alignment. Newer aligned SSE instructions +(like 'movaps') that work with the stack require operands to be 16-byte aligned. +This attribute realigns the stack in the function prologue to make sure the +stack can be used with SSE instructions. + +Note that the x86_64 ABI forces 16-byte stack alignment at the call site. +Because of this, 'force_align_arg_pointer' is not needed on x86_64, except in +rare cases where the caller does not align the stack properly (e.g. flow +jumps from i386 arch code). + + .. code-block:: c + + __attribute__ ((force_align_arg_pointer)) + void f () { + ... + } + + +format +------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``format``","``gnu::format``","","","","","" + +Clang supports the ``format`` attribute, which indicates that the function +accepts a ``printf`` or ``scanf``-like format string and corresponding +arguments or a ``va_list`` that contains these arguments. + +Please see `GCC documentation about format attribute +`_ to find details +about attribute syntax. + +Clang implements two kinds of checks with this attribute. + +#. Clang checks that the function with the ``format`` attribute is called with + a format string that uses format specifiers that are allowed, and that + arguments match the format string. This is the ``-Wformat`` warning, it is + on by default. + +#. Clang checks that the format string argument is a literal string. This is + the ``-Wformat-nonliteral`` warning, it is off by default. + + Clang implements this mostly the same way as GCC, but there is a difference + for functions that accept a ``va_list`` argument (for example, ``vprintf``). + GCC does not emit ``-Wformat-nonliteral`` warning for calls to such + functions. Clang does not warn if the format string comes from a function + parameter, where the function is annotated with a compatible attribute, + otherwise it warns. For example: + + .. code-block:: c + + __attribute__((__format__ (__scanf__, 1, 3))) + void foo(const char* s, char *buf, ...) { + va_list ap; + va_start(ap, buf); + + vprintf(s, ap); // warning: format string is not a string literal + } + + In this case we warn because ``s`` contains a format string for a + ``scanf``-like function, but it is passed to a ``printf``-like function. + + If the attribute is removed, clang still warns, because the format string is + not a string literal. + + Another example: + + .. code-block:: c + + __attribute__((__format__ (__printf__, 1, 3))) + void foo(const char* s, char *buf, ...) { + va_list ap; + va_start(ap, buf); + + vprintf(s, ap); // warning + } + + In this case Clang does not warn because the format string ``s`` and + the corresponding arguments are annotated. If the arguments are + incorrect, the caller of ``foo`` will receive a warning. + + +gnu_inline +---------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``gnu_inline``","``gnu::gnu_inline``","","","","","Yes" + +The ``gnu_inline`` changes the meaning of ``extern inline`` to use GNU inline +semantics, meaning: + +* If any declaration that is declared ``inline`` is not declared ``extern``, +then the ``inline`` keyword is just a hint. In particular, an out-of-line +definition is still emitted for a function with external linkage, even if all +call sites are inlined, unlike in C99 and C++ inline semantics. + +* If all declarations that are declared ``inline`` are also declared +``extern``, then the function body is present only for inlining and no +out-of-line version is emitted. + +Some important consequences: ``static inline`` emits an out-of-line +version if needed, a plain ``inline`` definition emits an out-of-line version +always, and an ``extern inline`` definition (in a header) followed by a +(non-``extern``) ``inline`` declaration in a source file emits an out-of-line +version of the function in that source file but provides the function body for +inlining to all includers of the header. + +Either ``__GNUC_GNU_INLINE__`` (GNU inline semantics) or +``__GNUC_STDC_INLINE__`` (C99 semantics) will be defined (they are mutually +exclusive). If ``__GNUC_STDC_INLINE__`` is defined, then the ``gnu_inline`` +function attribute can be used to get GNU inline semantics on a per function +basis. If ``__GNUC_GNU_INLINE__`` is defined, then the translation unit is +already being compiled with GNU inline semantics as the implied default. It is +unspecified which macro is defined in a C++ compilation. + +GNU inline semantics are the default behavior with ``-std=gnu89``, +``-std=c89``, ``-std=c94``, or ``-fgnu89-inline``. + + +ifunc +----- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``ifunc``","``gnu::ifunc``","","","","","Yes" + +``__attribute__((ifunc("resolver")))`` is used to mark that the address of a declaration should be resolved at runtime by calling a resolver function. + +The symbol name of the resolver function is given in quotes. A function with this name (after mangling) must be defined in the current translation unit; it may be ``static``. The resolver function should return a pointer. + +The ``ifunc`` attribute may only be used on a function declaration. A function declaration with an ``ifunc`` attribute is considered to be a definition of the declared entity. The entity must not have weak linkage; for example, in C++, it cannot be applied to a declaration if a definition at that location would be considered inline. + +Not all targets support this attribute. ELF target support depends on both the linker and runtime linker, and is available in at least lld 4.0 and later, binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later. Non-ELF targets currently do not support this attribute. + + +internal_linkage +---------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``internal_linkage``","``clang::internal_linkage``","``clang::internal_linkage``","","","","Yes" + +The ``internal_linkage`` attribute changes the linkage type of the declaration to internal. +This is similar to C-style ``static``, but can be used on classes and class methods. When applied to a class definition, +this attribute affects all methods and static data members of that class. +This can be used to contain the ABI of a C++ library by excluding unwanted class methods from the export tables. + + +interrupt (ARM) +--------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``interrupt``","``gnu::interrupt``","","","","","" + +Clang supports the GNU style ``__attribute__((interrupt("TYPE")))`` attribute on +ARM targets. This attribute may be attached to a function definition and +instructs the backend to generate appropriate function entry/exit code so that +it can be used directly as an interrupt service routine. + +The parameter passed to the interrupt attribute is optional, but if +provided it must be a string literal with one of the following values: "IRQ", +"FIQ", "SWI", "ABORT", "UNDEF". + +The semantics are as follows: + +- If the function is AAPCS, Clang instructs the backend to realign the stack to + 8 bytes on entry. This is a general requirement of the AAPCS at public + interfaces, but may not hold when an exception is taken. Doing this allows + other AAPCS functions to be called. +- If the CPU is M-class this is all that needs to be done since the architecture + itself is designed in such a way that functions obeying the normal AAPCS ABI + constraints are valid exception handlers. +- If the CPU is not M-class, the prologue and epilogue are modified to save all + non-banked registers that are used, so that upon return the user-mode state + will not be corrupted. Note that to avoid unnecessary overhead, only + general-purpose (integer) registers are saved in this way. If VFP operations + are needed, that state must be saved manually. + + Specifically, interrupt kinds other than "FIQ" will save all core registers + except "lr" and "sp". "FIQ" interrupts will save r0-r7. +- If the CPU is not M-class, the return instruction is changed to one of the + canonical sequences permitted by the architecture for exception return. Where + possible the function itself will make the necessary "lr" adjustments so that + the "preferred return address" is selected. + + Unfortunately the compiler is unable to make this guarantee for an "UNDEF" + handler, where the offset from "lr" to the preferred return address depends on + the execution state of the code which generated the exception. In this case + a sequence equivalent to "movs pc, lr" will be used. + + +interrupt (AVR) +--------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``interrupt``","``gnu::interrupt``","","","","","Yes" + +Clang supports the GNU style ``__attribute__((interrupt))`` attribute on +AVR targets. This attribute may be attached to a function definition and instructs +the backend to generate appropriate function entry/exit code so that it can be used +directly as an interrupt service routine. + +On the AVR, the hardware globally disables interrupts when an interrupt is executed. +The first instruction of an interrupt handler declared with this attribute is a SEI +instruction to re-enable interrupts. See also the signal attribute that +does not insert a SEI instruction. + + +interrupt (MIPS) +---------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``interrupt``","``gnu::interrupt``","","","","","Yes" + +Clang supports the GNU style ``__attribute__((interrupt("ARGUMENT")))`` attribute on +MIPS targets. This attribute may be attached to a function definition and instructs +the backend to generate appropriate function entry/exit code so that it can be used +directly as an interrupt service routine. + +By default, the compiler will produce a function prologue and epilogue suitable for +an interrupt service routine that handles an External Interrupt Controller (eic) +generated interrupt. This behaviour can be explicitly requested with the "eic" +argument. + +Otherwise, for use with vectored interrupt mode, the argument passed should be +of the form "vector=LEVEL" where LEVEL is one of the following values: +"sw0", "sw1", "hw0", "hw1", "hw2", "hw3", "hw4", "hw5". The compiler will +then set the interrupt mask to the corresponding level which will mask all +interrupts up to and including the argument. + +The semantics are as follows: + +- The prologue is modified so that the Exception Program Counter (EPC) and + Status coprocessor registers are saved to the stack. The interrupt mask is + set so that the function can only be interrupted by a higher priority + interrupt. The epilogue will restore the previous values of EPC and Status. + +- The prologue and epilogue are modified to save and restore all non-kernel + registers as necessary. + +- The FPU is disabled in the prologue, as the floating pointer registers are not + spilled to the stack. + +- The function return sequence is changed to use an exception return instruction. + +- The parameter sets the interrupt mask for the function corresponding to the + interrupt level specified. If no mask is specified the interrupt mask + defaults to "eic". + + +interrupt (RISCV) +----------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``interrupt``","``gnu::interrupt``","","","","","Yes" + +Clang supports the GNU style ``__attribute__((interrupt))`` attribute on RISCV +targets. This attribute may be attached to a function definition and instructs +the backend to generate appropriate function entry/exit code so that it can be +used directly as an interrupt service routine. + +Permissible values for this parameter are ``user``, ``supervisor``, +and ``machine``. If there is no parameter, then it defaults to machine. + +Repeated interrupt attribute on the same declaration will cause a warning +to be emitted. In case of repeated declarations, the last one prevails. + +Refer to: +https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Function-Attributes.html +https://riscv.org/specifications/privileged-isa/ +The RISC-V Instruction Set Manual Volume II: Privileged Architecture +Version 1.10. + + +kernel +------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``kernel``","","","","","","Yes" + +``__attribute__((kernel))`` is used to mark a ``kernel`` function in +RenderScript. + +In RenderScript, ``kernel`` functions are used to express data-parallel +computations. The RenderScript runtime efficiently parallelizes ``kernel`` +functions to run on computational resources such as multi-core CPUs and GPUs. +See the RenderScript_ documentation for more information. + +.. _RenderScript: https://developer.android.com/guide/topics/renderscript/compute.html + + +lifetimebound +------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``lifetimebound``","``clang::lifetimebound``","","","","","" + +The ``lifetimebound`` attribute indicates that a resource owned by +a function parameter or implicit object parameter +is retained by the return value of the annotated function +(or, for a parameter of a constructor, in the value of the constructed object). +It is only supported in C++. + +This attribute provides an experimental implementation of the facility +described in the C++ committee paper [http://wg21.link/p0936r0](P0936R0), +and is subject to change as the design of the corresponding functionality +changes. + + +long_call, far +-------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``long_call`` |br| ``far``","``gnu::long_call`` |br| ``gnu::far``","","","","","Yes" + +Clang supports the ``__attribute__((long_call))``, ``__attribute__((far))``, +and ``__attribute__((near))`` attributes on MIPS targets. These attributes may +only be added to function declarations and change the code generated +by the compiler when directly calling the function. The ``near`` attribute +allows calls to the function to be made using the ``jal`` instruction, which +requires the function to be located in the same naturally aligned 256MB +segment as the caller. The ``long_call`` and ``far`` attributes are synonyms +and require the use of a different call sequence that works regardless +of the distance between the functions. + +These attributes have no effect for position-independent code. + +These attributes take priority over command line switches such +as ``-mlong-calls`` and ``-mno-long-calls``. + + +micromips +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``micromips``","``gnu::micromips``","","","","","Yes" + +Clang supports the GNU style ``__attribute__((micromips))`` and +``__attribute__((nomicromips))`` attributes on MIPS targets. These attributes +may be attached to a function definition and instructs the backend to generate +or not to generate microMIPS code for that function. + +These attributes override the `-mmicromips` and `-mno-micromips` options +on the command line. + + +min_vector_width +---------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``min_vector_width``","``clang::min_vector_width``","``clang::min_vector_width``","","","","Yes" + +Clang supports the ``__attribute__((min_vector_width(width)))`` attribute. This +attribute may be attached to a function and informs the backend that this +function desires vectors of at least this width to be generated. Target-specific +maximum vector widths still apply. This means even if you ask for something +larger than the target supports, you will only get what the target supports. +This attribute is meant to be a hint to control target heuristics that may +generate narrower vectors than what the target hardware supports. + +This is currently used by the X86 target to allow some CPUs that support 512-bit +vectors to be limited to using 256-bit vectors to avoid frequency penalties. +This is currently enabled with the ``-prefer-vector-width=256`` command line +option. The ``min_vector_width`` attribute can be used to prevent the backend +from trying to split vector operations to match the ``prefer-vector-width``. All +X86 vector intrinsics from x86intrin.h already set this attribute. Additionally, +use of any of the X86-specific vector builtins will implicitly set this +attribute on the calling function. The intent is that explicitly writing vector +code using the X86 intrinsics will prevent ``prefer-vector-width`` from +affecting the code. + + +no_caller_saved_registers +------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``no_caller_saved_registers``","``gnu::no_caller_saved_registers``","","","","","" + +Use this attribute to indicate that the specified function has no +caller-saved registers. That is, all registers are callee-saved except for +registers used for passing parameters to the function or returning parameters +from the function. +The compiler saves and restores any modified registers that were not used for +passing or returning arguments to the function. + +The user can call functions specified with the 'no_caller_saved_registers' +attribute from an interrupt handler without saving and restoring all +call-clobbered registers. + +Note that 'no_caller_saved_registers' attribute is not a calling convention. +In fact, it only overrides the decision of which registers should be saved by +the caller, but not how the parameters are passed from the caller to the callee. + +For example: + + .. code-block:: c + + __attribute__ ((no_caller_saved_registers, fastcall)) + void f (int arg1, int arg2) { + ... + } + + In this case parameters 'arg1' and 'arg2' will be passed in registers. + In this case, on 32-bit x86 targets, the function 'f' will use ECX and EDX as + register parameters. However, it will not assume any scratch registers and + should save and restore any modified registers except for ECX and EDX. + + +no_sanitize +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``no_sanitize``","``clang::no_sanitize``","``clang::no_sanitize``","","","","Yes" + +Use the ``no_sanitize`` attribute on a function or a global variable +declaration to specify that a particular instrumentation or set of +instrumentations should not be applied. The attribute takes a list of +string literals, which have the same meaning as values accepted by the +``-fno-sanitize=`` flag. For example, +``__attribute__((no_sanitize("address", "thread")))`` specifies that +AddressSanitizer and ThreadSanitizer should not be applied to the +function or variable. + +See :ref:`Controlling Code Generation ` for a +full list of supported sanitizer flags. + + +no_sanitize_address, no_address_safety_analysis +----------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``no_address_safety_analysis`` |br| ``no_sanitize_address`` |br| ``no_sanitize_thread`` |br| ``no_sanitize_memory``","``gnu::no_address_safety_analysis`` |br| ``gnu::no_sanitize_address`` |br| ``gnu::no_sanitize_thread`` |br| ``clang::no_sanitize_memory``","``clang::no_sanitize_memory``","","","","Yes" + +.. _langext-address_sanitizer: + +Use ``__attribute__((no_sanitize_address))`` on a function or a global +variable declaration to specify that address safety instrumentation +(e.g. AddressSanitizer) should not be applied. + + +no_sanitize_memory +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``no_address_safety_analysis`` |br| ``no_sanitize_address`` |br| ``no_sanitize_thread`` |br| ``no_sanitize_memory``","``gnu::no_address_safety_analysis`` |br| ``gnu::no_sanitize_address`` |br| ``gnu::no_sanitize_thread`` |br| ``clang::no_sanitize_memory``","``clang::no_sanitize_memory``","","","","Yes" + +.. _langext-memory_sanitizer: + +Use ``__attribute__((no_sanitize_memory))`` on a function declaration to +specify that checks for uninitialized memory should not be inserted +(e.g. by MemorySanitizer). The function may still be instrumented by the tool +to avoid false positives in other places. + + +no_sanitize_thread +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``no_address_safety_analysis`` |br| ``no_sanitize_address`` |br| ``no_sanitize_thread`` |br| ``no_sanitize_memory``","``gnu::no_address_safety_analysis`` |br| ``gnu::no_sanitize_address`` |br| ``gnu::no_sanitize_thread`` |br| ``clang::no_sanitize_memory``","``clang::no_sanitize_memory``","","","","Yes" + +.. _langext-thread_sanitizer: + +Use ``__attribute__((no_sanitize_thread))`` on a function declaration to +specify that checks for data races on plain (non-atomic) memory accesses should +not be inserted by ThreadSanitizer. The function is still instrumented by the +tool to avoid false positives and provide meaningful stack traces. + + +no_split_stack +-------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``no_split_stack``","``gnu::no_split_stack``","","","","","Yes" + +The ``no_split_stack`` attribute disables the emission of the split stack +preamble for a particular function. It has no effect if ``-fsplit-stack`` +is not specified. + + +no_stack_protector +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``no_stack_protector``","``clang::no_stack_protector``","``clang::no_stack_protector``","","","","Yes" + +Clang supports the ``__attribute__((no_stack_protector))`` attribute which disables +the stack protector on the specified function. This attribute is useful for +selectively disabling the stack protector on some functions when building with +``-fstack-protector`` compiler option. + +For example, it disables the stack protector for the function ``foo`` but function +``bar`` will still be built with the stack protector with the ``-fstack-protector`` +option. + +.. code-block:: c + + int __attribute__((no_stack_protector)) + foo (int x); // stack protection will be disabled for foo. + + int bar(int y); // bar can be built with the stack protector. + + +noalias +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","``noalias``","","","" + +The ``noalias`` attribute indicates that the only memory accesses inside +function are loads and stores from objects pointed to by its pointer-typed +arguments, with arbitrary offsets. + + +nocf_check +---------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``nocf_check``","``gnu::nocf_check``","","","","","Yes" + +Jump Oriented Programming attacks rely on tampering with addresses used by +indirect call / jmp, e.g. redirect control-flow to non-programmer +intended bytes in the binary. +X86 Supports Indirect Branch Tracking (IBT) as part of Control-Flow +Enforcement Technology (CET). IBT instruments ENDBR instructions used to +specify valid targets of indirect call / jmp. +The ``nocf_check`` attribute has two roles: +1. Appertains to a function - do not add ENDBR instruction at the beginning of +the function. +2. Appertains to a function pointer - do not track the target function of this +pointer (by adding nocf_check prefix to the indirect-call instruction). + + +nodiscard, warn_unused_result +----------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``warn_unused_result``","``nodiscard`` |br| ``clang::warn_unused_result`` |br| ``gnu::warn_unused_result``","``nodiscard``","","","","Yes" + +Clang supports the ability to diagnose when the results of a function call +expression are discarded under suspicious circumstances. A diagnostic is +generated when a function or its return type is marked with ``[[nodiscard]]`` +(or ``__attribute__((warn_unused_result))``) and the function call appears as a +potentially-evaluated discarded-value expression that is not explicitly cast to +`void`. + +.. code-block: c++ + struct [[nodiscard]] error_info { /*...*/ }; + error_info enable_missile_safety_mode(); + + void launch_missiles(); + void test_missiles() { + enable_missile_safety_mode(); // diagnoses + launch_missiles(); + } + error_info &foo(); + void f() { foo(); } // Does not diagnose, error_info is a reference. + + +noduplicate +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``noduplicate``","``clang::noduplicate``","``clang::noduplicate``","","","","Yes" + +The ``noduplicate`` attribute can be placed on function declarations to control +whether function calls to this function can be duplicated or not as a result of +optimizations. This is required for the implementation of functions with +certain special requirements, like the OpenCL "barrier" function, that might +need to be run concurrently by all the threads that are executing in lockstep +on the hardware. For example this attribute applied on the function +"nodupfunc" in the code below avoids that: + +.. code-block:: c + + void nodupfunc() __attribute__((noduplicate)); + // Setting it as a C++11 attribute is also valid + // void nodupfunc() [[clang::noduplicate]]; + void foo(); + void bar(); + + nodupfunc(); + if (a > n) { + foo(); + } else { + bar(); + } + +gets possibly modified by some optimizations into code similar to this: + +.. code-block:: c + + if (a > n) { + nodupfunc(); + foo(); + } else { + nodupfunc(); + bar(); + } + +where the call to "nodupfunc" is duplicated and sunk into the two branches +of the condition. + + +nomicromips +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``nomicromips``","``gnu::nomicromips``","","","","","Yes" + +Clang supports the GNU style ``__attribute__((micromips))`` and +``__attribute__((nomicromips))`` attributes on MIPS targets. These attributes +may be attached to a function definition and instructs the backend to generate +or not to generate microMIPS code for that function. + +These attributes override the `-mmicromips` and `-mno-micromips` options +on the command line. + + +noreturn +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","``noreturn``","","","","","Yes" + +A function declared as ``[[noreturn]]`` shall not return to its caller. The +compiler will generate a diagnostic for a function declared as ``[[noreturn]]`` +that appears to be capable of returning to its caller. + + +not_tail_called +--------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``not_tail_called``","``clang::not_tail_called``","``clang::not_tail_called``","","","","Yes" + +The ``not_tail_called`` attribute prevents tail-call optimization on statically bound calls. It has no effect on indirect calls. Virtual functions, objective-c methods, and functions marked as ``always_inline`` cannot be marked as ``not_tail_called``. + +For example, it prevents tail-call optimization in the following case: + + .. code-block:: c + + int __attribute__((not_tail_called)) foo1(int); + + int foo2(int a) { + return foo1(a); // No tail-call optimization on direct calls. + } + +However, it doesn't prevent tail-call optimization in this case: + + .. code-block:: c + + int __attribute__((not_tail_called)) foo1(int); + + int foo2(int a) { + int (*fn)(int) = &foo1; + + // not_tail_called has no effect on an indirect call even if the call can be + // resolved at compile time. + return (*fn)(a); + } + +Marking virtual functions as ``not_tail_called`` is an error: + + .. code-block:: c++ + + class Base { + public: + // not_tail_called on a virtual function is an error. + [[clang::not_tail_called]] virtual int foo1(); + + virtual int foo2(); + + // Non-virtual functions can be marked ``not_tail_called``. + [[clang::not_tail_called]] int foo3(); + }; + + class Derived1 : public Base { + public: + int foo1() override; + + // not_tail_called on a virtual function is an error. + [[clang::not_tail_called]] int foo2() override; + }; + + +nothrow +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``nothrow``","``gnu::nothrow``","","``nothrow``","","","Yes" + +Clang supports the GNU style ``__attribute__((nothrow))`` and Microsoft style +``__declspec(nothrow)`` attribute as an equivalent of `noexcept` on function +declarations. This attribute informs the compiler that the annotated function +does not throw an exception. This prevents exception-unwinding. This attribute +is particularly useful on functions in the C Standard Library that are +guaranteed to not throw an exception. + + +ns_consumed +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``ns_consumed``","``clang::ns_consumed``","``clang::ns_consumed``","","","","Yes" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +ns_consumes_self +---------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``ns_consumes_self``","``clang::ns_consumes_self``","``clang::ns_consumes_self``","","","","Yes" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +ns_returns_autoreleased +----------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``ns_returns_autoreleased``","``clang::ns_returns_autoreleased``","``clang::ns_returns_autoreleased``","","","","" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +ns_returns_not_retained +----------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``ns_returns_not_retained``","``clang::ns_returns_not_retained``","``clang::ns_returns_not_retained``","","","","" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +ns_returns_retained +------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``ns_returns_retained``","``clang::ns_returns_retained``","``clang::ns_returns_retained``","","","","" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +objc_boxable +------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``objc_boxable``","``clang::objc_boxable``","``clang::objc_boxable``","","","","Yes" + +Structs and unions marked with the ``objc_boxable`` attribute can be used +with the Objective-C boxed expression syntax, ``@(...)``. + +**Usage**: ``__attribute__((objc_boxable))``. This attribute +can only be placed on a declaration of a trivially-copyable struct or union: + +.. code-block:: objc + + struct __attribute__((objc_boxable)) some_struct { + int i; + }; + union __attribute__((objc_boxable)) some_union { + int i; + float f; + }; + typedef struct __attribute__((objc_boxable)) _some_struct some_struct; + + // ... + + some_struct ss; + NSValue *boxed = @(ss); + + +objc_method_family +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``objc_method_family``","``clang::objc_method_family``","``clang::objc_method_family``","","","","Yes" + +Many methods in Objective-C have conventional meanings determined by their +selectors. It is sometimes useful to be able to mark a method as having a +particular conventional meaning despite not having the right selector, or as +not having the conventional meaning that its selector would suggest. For these +use cases, we provide an attribute to specifically describe the "method family" +that a method belongs to. + +**Usage**: ``__attribute__((objc_method_family(X)))``, where ``X`` is one of +``none``, ``alloc``, ``copy``, ``init``, ``mutableCopy``, or ``new``. This +attribute can only be placed at the end of a method declaration: + +.. code-block:: objc + + - (NSString *)initMyStringValue __attribute__((objc_method_family(none))); + +Users who do not wish to change the conventional meaning of a method, and who +merely want to document its non-standard retain and release semantics, should +use the retaining behavior attributes (``ns_returns_retained``, +``ns_returns_not_retained``, etc). + +Query for this feature with ``__has_attribute(objc_method_family)``. + + +objc_requires_super +------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``objc_requires_super``","``clang::objc_requires_super``","``clang::objc_requires_super``","","","","Yes" + +Some Objective-C classes allow a subclass to override a particular method in a +parent class but expect that the overriding method also calls the overridden +method in the parent class. For these cases, we provide an attribute to +designate that a method requires a "call to ``super``" in the overriding +method in the subclass. + +**Usage**: ``__attribute__((objc_requires_super))``. This attribute can only +be placed at the end of a method declaration: + +.. code-block:: objc + + - (void)foo __attribute__((objc_requires_super)); + +This attribute can only be applied the method declarations within a class, and +not a protocol. Currently this attribute does not enforce any placement of +where the call occurs in the overriding method (such as in the case of +``-dealloc`` where the call must appear at the end). It checks only that it +exists. + +Note that on both OS X and iOS that the Foundation framework provides a +convenience macro ``NS_REQUIRES_SUPER`` that provides syntactic sugar for this +attribute: + +.. code-block:: objc + + - (void)foo NS_REQUIRES_SUPER; + +This macro is conditionally defined depending on the compiler's support for +this attribute. If the compiler does not support the attribute the macro +expands to nothing. + +Operationally, when a method has this annotation the compiler will warn if the +implementation of an override in a subclass does not call super. For example: + +.. code-block:: objc + + warning: method possibly missing a [super AnnotMeth] call + - (void) AnnotMeth{}; + ^ + + +objc_runtime_name +----------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``objc_runtime_name``","``clang::objc_runtime_name``","``clang::objc_runtime_name``","","","","Yes" + +By default, the Objective-C interface or protocol identifier is used +in the metadata name for that object. The `objc_runtime_name` +attribute allows annotated interfaces or protocols to use the +specified string argument in the object's metadata name instead of the +default name. + +**Usage**: ``__attribute__((objc_runtime_name("MyLocalName")))``. This attribute +can only be placed before an @protocol or @interface declaration: + +.. code-block:: objc + + __attribute__((objc_runtime_name("MyLocalName"))) + @interface Message + @end + + +objc_runtime_visible +-------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``objc_runtime_visible``","``clang::objc_runtime_visible``","``clang::objc_runtime_visible``","","","","Yes" + +This attribute specifies that the Objective-C class to which it applies is visible to the Objective-C runtime but not to the linker. Classes annotated with this attribute cannot be subclassed and cannot have categories defined for them. + + +optnone +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``optnone``","``clang::optnone``","``clang::optnone``","","","","Yes" + +The ``optnone`` attribute suppresses essentially all optimizations +on a function or method, regardless of the optimization level applied to +the compilation unit as a whole. This is particularly useful when you +need to debug a particular function, but it is infeasible to build the +entire application without optimization. Avoiding optimization on the +specified function can improve the quality of the debugging information +for that function. + +This attribute is incompatible with the ``always_inline`` and ``minsize`` +attributes. + + +os_consumed +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``os_consumed``","``clang::os_consumed``","``clang::os_consumed``","","","","Yes" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +os_consumes_this +---------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``os_consumes_this``","``clang::os_consumes_this``","``clang::os_consumes_this``","","","","" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +os_returns_not_retained +----------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``os_returns_not_retained``","``clang::os_returns_not_retained``","``clang::os_returns_not_retained``","","","","Yes" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +os_returns_retained +------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``os_returns_retained``","``clang::os_returns_retained``","``clang::os_returns_retained``","","","","Yes" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +os_returns_retained_on_non_zero +------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``os_returns_retained_on_non_zero``","``clang::os_returns_retained_on_non_zero``","``clang::os_returns_retained_on_non_zero``","","","","Yes" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +os_returns_retained_on_zero +--------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``os_returns_retained_on_zero``","``clang::os_returns_retained_on_zero``","``clang::os_returns_retained_on_zero``","","","","Yes" + +The behavior of a function with respect to reference counting for Foundation +(Objective-C), CoreFoundation (C) and OSObject (C++) is determined by a naming +convention (e.g. functions starting with "get" are assumed to return at +``+0``). + +It can be overriden using a family of the following attributes. In +Objective-C, the annotation ``__attribute__((ns_returns_retained))`` applied to +a function communicates that the object is returned at ``+1``, and the caller +is responsible for freeing it. +Similiarly, the annotation ``__attribute__((ns_returns_not_retained))`` +specifies that the object is returned at ``+0`` and the ownership remains with +the callee. +The annotation ``__attribute__((ns_consumes_self))`` specifies that +the Objective-C method call consumes the reference to ``self``, e.g. by +attaching it to a supplied parameter. +Additionally, parameters can have an annotation +``__attribute__((ns_consumed))``, which specifies that passing an owned object +as that parameter effectively transfers the ownership, and the caller is no +longer responsible for it. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +In C programs using CoreFoundation, a similar set of attributes: +``__attribute__((cf_returns_not_retained))``, +``__attribute__((cf_returns_retained))`` and ``__attribute__((cf_consumed))`` +have the same respective semantics when applied to CoreFoundation objects. +These attributes affect code generation when interacting with ARC code, and +they are used by the Clang Static Analyzer. + +Finally, in C++ interacting with XNU kernel (objects inheriting from OSObject), +the same attribute family is present: +``__attribute__((os_returns_not_retained))``, +``__attribute__((os_returns_retained))`` and ``__attribute__((os_consumed))``, +with the same respective semantics. +Similar to ``__attribute__((ns_consumes_self))``, +``__attribute__((os_consumes_this))`` specifies that the method call consumes +the reference to "this" (e.g., when attaching it to a different object supplied +as a parameter). +Out parameters (parameters the function is meant to write into, +either via pointers-to-pointers or references-to-pointers) +may be annotated with ``__attribute__((os_returns_retained))`` +or ``__attribute__((os_returns_not_retained))`` which specifies that the object +written into the out parameter should (or respectively should not) be released +after use. +Since often out parameters may or may not be written depending on the exit +code of the function, +annotations ``__attribute__((os_returns_retained_on_zero))`` +and ``__attribute__((os_returns_retained_on_non_zero))`` specify that +an out parameter at ``+1`` is written if and only if the function returns a zero +(respectively non-zero) error code. +Observe that return-code-dependent out parameter annotations are only +available for retained out parameters, as non-retained object do not have to be +released by the callee. +These attributes are only used by the Clang Static Analyzer. + +The family of attributes ``X_returns_X_retained`` can be added to functions, +C++ methods, and Objective-C methods and properties. +Attributes ``X_consumed`` can be added to parameters of methods, functions, +and Objective-C methods. + + +overloadable +------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``overloadable``","``clang::overloadable``","``clang::overloadable``","","","","Yes" + +Clang provides support for C++ function overloading in C. Function overloading +in C is introduced using the ``overloadable`` attribute. For example, one +might provide several overloaded versions of a ``tgsin`` function that invokes +the appropriate standard function computing the sine of a value with ``float``, +``double``, or ``long double`` precision: + +.. code-block:: c + + #include + float __attribute__((overloadable)) tgsin(float x) { return sinf(x); } + double __attribute__((overloadable)) tgsin(double x) { return sin(x); } + long double __attribute__((overloadable)) tgsin(long double x) { return sinl(x); } + +Given these declarations, one can call ``tgsin`` with a ``float`` value to +receive a ``float`` result, with a ``double`` to receive a ``double`` result, +etc. Function overloading in C follows the rules of C++ function overloading +to pick the best overload given the call arguments, with a few C-specific +semantics: + +* Conversion from ``float`` or ``double`` to ``long double`` is ranked as a + floating-point promotion (per C99) rather than as a floating-point conversion + (as in C++). + +* A conversion from a pointer of type ``T*`` to a pointer of type ``U*`` is + considered a pointer conversion (with conversion rank) if ``T`` and ``U`` are + compatible types. + +* A conversion from type ``T`` to a value of type ``U`` is permitted if ``T`` + and ``U`` are compatible types. This conversion is given "conversion" rank. + +* If no viable candidates are otherwise available, we allow a conversion from a + pointer of type ``T*`` to a pointer of type ``U*``, where ``T`` and ``U`` are + incompatible. This conversion is ranked below all other types of conversions. + Please note: ``U`` lacking qualifiers that are present on ``T`` is sufficient + for ``T`` and ``U`` to be incompatible. + +The declaration of ``overloadable`` functions is restricted to function +declarations and definitions. If a function is marked with the ``overloadable`` +attribute, then all declarations and definitions of functions with that name, +except for at most one (see the note below about unmarked overloads), must have +the ``overloadable`` attribute. In addition, redeclarations of a function with +the ``overloadable`` attribute must have the ``overloadable`` attribute, and +redeclarations of a function without the ``overloadable`` attribute must *not* +have the ``overloadable`` attribute. e.g., + +.. code-block:: c + + int f(int) __attribute__((overloadable)); + float f(float); // error: declaration of "f" must have the "overloadable" attribute + int f(int); // error: redeclaration of "f" must have the "overloadable" attribute + + int g(int) __attribute__((overloadable)); + int g(int) { } // error: redeclaration of "g" must also have the "overloadable" attribute + + int h(int); + int h(int) __attribute__((overloadable)); // error: declaration of "h" must not + // have the "overloadable" attribute + +Functions marked ``overloadable`` must have prototypes. Therefore, the +following code is ill-formed: + +.. code-block:: c + + int h() __attribute__((overloadable)); // error: h does not have a prototype + +However, ``overloadable`` functions are allowed to use a ellipsis even if there +are no named parameters (as is permitted in C++). This feature is particularly +useful when combined with the ``unavailable`` attribute: + +.. code-block:: c++ + + void honeypot(...) __attribute__((overloadable, unavailable)); // calling me is an error + +Functions declared with the ``overloadable`` attribute have their names mangled +according to the same rules as C++ function names. For example, the three +``tgsin`` functions in our motivating example get the mangled names +``_Z5tgsinf``, ``_Z5tgsind``, and ``_Z5tgsine``, respectively. There are two +caveats to this use of name mangling: + +* Future versions of Clang may change the name mangling of functions overloaded + in C, so you should not depend on an specific mangling. To be completely + safe, we strongly urge the use of ``static inline`` with ``overloadable`` + functions. + +* The ``overloadable`` attribute has almost no meaning when used in C++, + because names will already be mangled and functions are already overloadable. + However, when an ``overloadable`` function occurs within an ``extern "C"`` + linkage specification, it's name *will* be mangled in the same way as it + would in C. + +For the purpose of backwards compatibility, at most one function with the same +name as other ``overloadable`` functions may omit the ``overloadable`` +attribute. In this case, the function without the ``overloadable`` attribute +will not have its name mangled. + +For example: + +.. code-block:: c + + // Notes with mangled names assume Itanium mangling. + int f(int); + int f(double) __attribute__((overloadable)); + void foo() { + f(5); // Emits a call to f (not _Z1fi, as it would with an overload that + // was marked with overloadable). + f(1.0); // Emits a call to _Z1fd. + } + +Support for unmarked overloads is not present in some versions of clang. You may +query for it using ``__has_extension(overloadable_unmarked)``. + +Query for this attribute with ``__has_attribute(overloadable)``. + + +reinitializes +------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``reinitializes``","``clang::reinitializes``","","","","","" + +The ``reinitializes`` attribute can be applied to a non-static, non-const C++ +member function to indicate that this member function reinitializes the entire +object to a known state, independent of the previous state of the object. + +This attribute can be interpreted by static analyzers that warn about uses of an +object that has been left in an indeterminate state by a move operation. If a +member function marked with the ``reinitializes`` attribute is called on a +moved-from object, the analyzer can conclude that the object is no longer in an +indeterminate state. + +A typical example where this attribute would be used is on functions that clear +a container class: + +.. code-block:: c++ + + template + class Container { + public: + ... + [[clang::reinitializes]] void Clear(); + ... + }; + + +release_capability, release_shared_capability +--------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``release_capability`` |br| ``release_shared_capability`` |br| ``release_generic_capability`` |br| ``unlock_function``","``clang::release_capability`` |br| ``clang::release_shared_capability`` |br| ``clang::release_generic_capability`` |br| ``clang::unlock_function``","","","","","" + +Marks a function as releasing a capability. + + +short_call, near +---------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``short_call`` |br| ``near``","``gnu::short_call`` |br| ``gnu::near``","","","","","Yes" + +Clang supports the ``__attribute__((long_call))``, ``__attribute__((far))``, +``__attribute__((short__call))``, and ``__attribute__((near))`` attributes +on MIPS targets. These attributes may only be added to function declarations +and change the code generated by the compiler when directly calling +the function. The ``short_call`` and ``near`` attributes are synonyms and +allow calls to the function to be made using the ``jal`` instruction, which +requires the function to be located in the same naturally aligned 256MB segment +as the caller. The ``long_call`` and ``far`` attributes are synonyms and +require the use of a different call sequence that works regardless +of the distance between the functions. + +These attributes have no effect for position-independent code. + +These attributes take priority over command line switches such +as ``-mlong-calls`` and ``-mno-long-calls``. + + +signal +------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``signal``","``gnu::signal``","","","","","Yes" + +Clang supports the GNU style ``__attribute__((signal))`` attribute on +AVR targets. This attribute may be attached to a function definition and instructs +the backend to generate appropriate function entry/exit code so that it can be used +directly as an interrupt service routine. + +Interrupt handler functions defined with the signal attribute do not re-enable interrupts. + + +speculative_load_hardening +-------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``speculative_load_hardening``","``clang::speculative_load_hardening``","``clang::speculative_load_hardening``","","","","Yes" + +This attribute can be applied to a function declaration in order to indicate + that `Speculative Load Hardening `_ + should be enabled for the function body. This can also be applied to a method + in Objective C. + + Speculative Load Hardening is a best-effort mitigation against + information leak attacks that make use of control flow + miss-speculation - specifically miss-speculation of whether a branch + is taken or not. Typically vulnerabilities enabling such attacks are + classified as "Spectre variant #1". Notably, this does not attempt to + mitigate against miss-speculation of branch target, classified as + "Spectre variant #2" vulnerabilities. + + When inlining, the attribute is sticky. Inlining a function that + carries this attribute will cause the caller to gain the + attribute. This is intended to provide a maximally conservative model + where the code in a function annotated with this attribute will always + (even after inlining) end up hardened. + + +target +------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``target``","``gnu::target``","","","","","Yes" + +Clang supports the GNU style ``__attribute__((target("OPTIONS")))`` attribute. +This attribute may be attached to a function definition and instructs +the backend to use different code generation options than were passed on the +command line. + +The current set of options correspond to the existing "subtarget features" for +the target with or without a "-mno-" in front corresponding to the absence +of the feature, as well as ``arch="CPU"`` which will change the default "CPU" +for the function. + +Example "subtarget features" from the x86 backend include: "mmx", "sse", "sse4.2", +"avx", "xop" and largely correspond to the machine specific options handled by +the front end. + +Additionally, this attribute supports function multiversioning for ELF based +x86/x86-64 targets, which can be used to create multiple implementations of the +same function that will be resolved at runtime based on the priority of their +``target`` attribute strings. A function is considered a multiversioned function +if either two declarations of the function have different ``target`` attribute +strings, or if it has a ``target`` attribute string of ``default``. For +example: + + .. code-block:: c++ + + __attribute__((target("arch=atom"))) + void foo() {} // will be called on 'atom' processors. + __attribute__((target("default"))) + void foo() {} // will be called on any other processors. + +All multiversioned functions must contain a ``default`` (fallback) +implementation, otherwise usages of the function are considered invalid. +Additionally, a function may not become multiversioned after its first use. + + +try_acquire_capability, try_acquire_shared_capability +----------------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``try_acquire_capability`` |br| ``try_acquire_shared_capability``","``clang::try_acquire_capability`` |br| ``clang::try_acquire_shared_capability``","","","","","" + +Marks a function that attempts to acquire a capability. This function may fail to +actually acquire the capability; they accept a Boolean value determining +whether acquiring the capability means success (true), or failing to acquire +the capability means success (false). + + +xray_always_instrument, xray_never_instrument, xray_log_args +------------------------------------------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``xray_always_instrument`` |br| ``xray_never_instrument``","``clang::xray_always_instrument`` |br| ``clang::xray_never_instrument``","``clang::xray_always_instrument`` |br| ``clang::xray_never_instrument``","","","","Yes" + +``__attribute__((xray_always_instrument))`` or ``[[clang::xray_always_instrument]]`` is used to mark member functions (in C++), methods (in Objective C), and free functions (in C, C++, and Objective C) to be instrumented with XRay. This will cause the function to always have space at the beginning and exit points to allow for runtime patching. + +Conversely, ``__attribute__((xray_never_instrument))`` or ``[[clang::xray_never_instrument]]`` will inhibit the insertion of these instrumentation points. + +If a function has neither of these attributes, they become subject to the XRay heuristics used to determine whether a function should be instrumented or otherwise. + +``__attribute__((xray_log_args(N)))`` or ``[[clang::xray_log_args(N)]]`` is used to preserve N function arguments for the logging function. Currently, only N==1 is supported. + + +xray_always_instrument, xray_never_instrument, xray_log_args +------------------------------------------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``xray_log_args``","``clang::xray_log_args``","``clang::xray_log_args``","","","","Yes" + +``__attribute__((xray_always_instrument))`` or ``[[clang::xray_always_instrument]]`` is used to mark member functions (in C++), methods (in Objective C), and free functions (in C, C++, and Objective C) to be instrumented with XRay. This will cause the function to always have space at the beginning and exit points to allow for runtime patching. + +Conversely, ``__attribute__((xray_never_instrument))`` or ``[[clang::xray_never_instrument]]`` will inhibit the insertion of these instrumentation points. + +If a function has neither of these attributes, they become subject to the XRay heuristics used to determine whether a function should be instrumented or otherwise. + +``__attribute__((xray_log_args(N)))`` or ``[[clang::xray_log_args(N)]]`` is used to preserve N function arguments for the logging function. Currently, only N==1 is supported. + + +Variable Attributes +=================== + + +always_destroy +-------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``always_destroy``","``clang::always_destroy``","","","","","Yes" + +The ``always_destroy`` attribute specifies that a variable with static or thread +storage duration should have its exit-time destructor run. This attribute is the +default unless clang was invoked with -fno-c++-static-destructors. + + +dllexport +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``dllexport``","``gnu::dllexport``","","``dllexport``","","","Yes" + +The ``__declspec(dllexport)`` attribute declares a variable, function, or +Objective-C interface to be exported from the module. It is available under the +``-fdeclspec`` flag for compatibility with various compilers. The primary use +is for COFF object files which explicitly specify what interfaces are available +for external use. See the dllexport_ documentation on MSDN for more +information. + +.. _dllexport: https://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx + + +dllimport +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``dllimport``","``gnu::dllimport``","","``dllimport``","","","Yes" + +The ``__declspec(dllimport)`` attribute declares a variable, function, or +Objective-C interface to be imported from an external module. It is available +under the ``-fdeclspec`` flag for compatibility with various compilers. The +primary use is for COFF object files which explicitly specify what interfaces +are imported from external modules. See the dllimport_ documentation on MSDN +for more information. + +.. _dllimport: https://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx + + +init_seg +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","","``init_seg``","" + +The attribute applied by ``pragma init_seg()`` controls the section into +which global initialization function pointers are emitted. It is only +available with ``-fms-extensions``. Typically, this function pointer is +emitted into ``.CRT$XCU`` on Windows. The user can change the order of +initialization by using a different section name with the same +``.CRT$XC`` prefix and a suffix that sorts lexicographically before or +after the standard ``.CRT$XCU`` sections. See the init_seg_ +documentation on MSDN for more information. + +.. _init_seg: http://msdn.microsoft.com/en-us/library/7977wcck(v=vs.110).aspx + + +maybe_unused, unused +-------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``unused``","``maybe_unused`` |br| ``gnu::unused``","``maybe_unused``","","","","" + +When passing the ``-Wunused`` flag to Clang, entities that are unused by the +program may be diagnosed. The ``[[maybe_unused]]`` (or +``__attribute__((unused))``) attribute can be used to silence such diagnostics +when the entity cannot be removed. For instance, a local variable may exist +solely for use in an ``assert()`` statement, which makes the local variable +unused when ``NDEBUG`` is defined. + +The attribute may be applied to the declaration of a class, a typedef, a +variable, a function or method, a function parameter, an enumeration, an +enumerator, a non-static data member, or a label. + +.. code-block: c++ + #include + + [[maybe_unused]] void f([[maybe_unused]] bool thing1, + [[maybe_unused]] bool thing2) { + [[maybe_unused]] bool b = thing1 && thing2; + assert(b); + } + + +no_destroy +---------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``no_destroy``","``clang::no_destroy``","","","","","Yes" + +The ``no_destroy`` attribute specifies that a variable with static or thread +storage duration shouldn't have its exit-time destructor run. Annotating every +static and thread duration variable with this attribute is equivalent to +invoking clang with -fno-c++-static-destructors. + + +nodebug +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``nodebug``","``gnu::nodebug``","","","","","Yes" + +The ``nodebug`` attribute allows you to suppress debugging information for a +function or method, or for a variable that is not a parameter or a non-static +data member. + + +noescape +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``noescape``","``clang::noescape``","``clang::noescape``","","","","Yes" + +``noescape`` placed on a function parameter of a pointer type is used to inform +the compiler that the pointer cannot escape: that is, no reference to the object +the pointer points to that is derived from the parameter value will survive +after the function returns. Users are responsible for making sure parameters +annotated with ``noescape`` do not actuallly escape. + +For example: + +.. code-block:: c + + int *gp; + + void nonescapingFunc(__attribute__((noescape)) int *p) { + *p += 100; // OK. + } + + void escapingFunc(__attribute__((noescape)) int *p) { + gp = p; // Not OK. + } + +Additionally, when the parameter is a `block pointer +`, the same restriction +applies to copies of the block. For example: + +.. code-block:: c + + typedef void (^BlockTy)(); + BlockTy g0, g1; + + void nonescapingFunc(__attribute__((noescape)) BlockTy block) { + block(); // OK. + } + + void escapingFunc(__attribute__((noescape)) BlockTy block) { + g0 = block; // Not OK. + g1 = Block_copy(block); // Not OK either. + } + + +nosvm +----- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``nosvm``","","","","","","Yes" + +OpenCL 2.0 supports the optional ``__attribute__((nosvm))`` qualifier for +pointer variable. It informs the compiler that the pointer does not refer +to a shared virtual memory region. See OpenCL v2.0 s6.7.2 for details. + +Since it is not widely used and has been removed from OpenCL 2.1, it is ignored +by Clang. + + +objc_externally_retained +------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``objc_externally_retained``","``clang::objc_externally_retained``","``clang::objc_externally_retained``","","","","Yes" + +The ``objc_externally_retained`` attribute can be applied to strong local +variables, functions, methods, or blocks to opt into +`externally-retained semantics +`_. + +When applied to the definition of a function, method, or block, every parameter +of the function with implicit strong retainable object pointer type is +considered externally-retained, and becomes ``const``. By explicitly annotating +a parameter with ``__strong``, you can opt back into the default +non-externally-retained behaviour for that parameter. For instance, +``first_param`` is externally-retained below, but not ``second_param``: + +.. code-block:: objc + + __attribute__((objc_externally_retained)) + void f(NSArray *first_param, __strong NSArray *second_param) { + // ... + } + +Likewise, when applied to a strong local variable, that variable becomes +``const`` and is considered externally-retained. + +When compiled without ``-fobjc-arc``, this attribute is ignored. + + +pass_object_size +---------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``pass_object_size``","``clang::pass_object_size``","``clang::pass_object_size``","","","","Yes" + +.. Note:: The mangling of functions with parameters that are annotated with + ``pass_object_size`` is subject to change. You can get around this by + using ``__asm__("foo")`` to explicitly name your functions, thus preserving + your ABI; also, non-overloadable C functions with ``pass_object_size`` are + not mangled. + +The ``pass_object_size(Type)`` attribute can be placed on function parameters to +instruct clang to call ``__builtin_object_size(param, Type)`` at each callsite +of said function, and implicitly pass the result of this call in as an invisible +argument of type ``size_t`` directly after the parameter annotated with +``pass_object_size``. Clang will also replace any calls to +``__builtin_object_size(param, Type)`` in the function by said implicit +parameter. + +Example usage: + +.. code-block:: c + + int bzero1(char *const p __attribute__((pass_object_size(0)))) + __attribute__((noinline)) { + int i = 0; + for (/**/; i < (int)__builtin_object_size(p, 0); ++i) { + p[i] = 0; + } + return i; + } + + int main() { + char chars[100]; + int n = bzero1(&chars[0]); + assert(n == sizeof(chars)); + return 0; + } + +If successfully evaluating ``__builtin_object_size(param, Type)`` at the +callsite is not possible, then the "failed" value is passed in. So, using the +definition of ``bzero1`` from above, the following code would exit cleanly: + +.. code-block:: c + + int main2(int argc, char *argv[]) { + int n = bzero1(argv); + assert(n == -1); + return 0; + } + +``pass_object_size`` plays a part in overload resolution. If two overload +candidates are otherwise equally good, then the overload with one or more +parameters with ``pass_object_size`` is preferred. This implies that the choice +between two identical overloads both with ``pass_object_size`` on one or more +parameters will always be ambiguous; for this reason, having two such overloads +is illegal. For example: + +.. code-block:: c++ + + #define PS(N) __attribute__((pass_object_size(N))) + // OK + void Foo(char *a, char *b); // Overload A + // OK -- overload A has no parameters with pass_object_size. + void Foo(char *a PS(0), char *b PS(0)); // Overload B + // Error -- Same signature (sans pass_object_size) as overload B, and both + // overloads have one or more parameters with the pass_object_size attribute. + void Foo(void *a PS(0), void *b); + + // OK + void Bar(void *a PS(0)); // Overload C + // OK + void Bar(char *c PS(1)); // Overload D + + void main() { + char known[10], *unknown; + Foo(unknown, unknown); // Calls overload B + Foo(known, unknown); // Calls overload B + Foo(unknown, known); // Calls overload B + Foo(known, known); // Calls overload B + + Bar(known); // Calls overload D + Bar(unknown); // Calls overload D + } + +Currently, ``pass_object_size`` is a bit restricted in terms of its usage: + +* Only one use of ``pass_object_size`` is allowed per parameter. + +* It is an error to take the address of a function with ``pass_object_size`` on + any of its parameters. If you wish to do this, you can create an overload + without ``pass_object_size`` on any parameters. + +* It is an error to apply the ``pass_object_size`` attribute to parameters that + are not pointers. Additionally, any parameter that ``pass_object_size`` is + applied to must be marked ``const`` at its function's definition. + + +require_constant_initialization +------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``require_constant_initialization``","``clang::require_constant_initialization``","","","","","Yes" + +This attribute specifies that the variable to which it is attached is intended +to have a `constant initializer `_ +according to the rules of [basic.start.static]. The variable is required to +have static or thread storage duration. If the initialization of the variable +is not a constant initializer an error will be produced. This attribute may +only be used in C++. + +Note that in C++03 strict constant expression checking is not done. Instead +the attribute reports if Clang can emit the variable as a constant, even if it's +not technically a 'constant initializer'. This behavior is non-portable. + +Static storage duration variables with constant initializers avoid hard-to-find +bugs caused by the indeterminate order of dynamic initialization. They can also +be safely used during dynamic initialization across translation units. + +This attribute acts as a compile time assertion that the requirements +for constant initialization have been met. Since these requirements change +between dialects and have subtle pitfalls it's important to fail fast instead +of silently falling back on dynamic initialization. + +.. code-block:: c++ + + // -std=c++14 + #define SAFE_STATIC [[clang::require_constant_initialization]] + struct T { + constexpr T(int) {} + ~T(); // non-trivial + }; + SAFE_STATIC T x = {42}; // Initialization OK. Doesn't check destructor. + SAFE_STATIC T y = 42; // error: variable does not have a constant initializer + // copy initialization is not a constant expression on a non-literal type. + + +section, __declspec(allocate) +----------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``section``","``gnu::section``","","``allocate``","","","Yes" + +The ``section`` attribute allows you to specify a specific section a +global variable or function should be in after translation. + + +swift_context +------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``swift_context``","``clang::swift_context``","``clang::swift_context``","","","","Yes" + +The ``swift_context`` attribute marks a parameter of a ``swiftcall`` +function as having the special context-parameter ABI treatment. + +This treatment generally passes the context value in a special register +which is normally callee-preserved. + +A ``swift_context`` parameter must either be the last parameter or must be +followed by a ``swift_error_result`` parameter (which itself must always be +the last parameter). + +A context parameter must have pointer or reference type. + + +swift_error_result +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``swift_error_result``","``clang::swift_error_result``","``clang::swift_error_result``","","","","Yes" + +The ``swift_error_result`` attribute marks a parameter of a ``swiftcall`` +function as having the special error-result ABI treatment. + +This treatment generally passes the underlying error value in and out of +the function through a special register which is normally callee-preserved. +This is modeled in C by pretending that the register is addressable memory: + +- The caller appears to pass the address of a variable of pointer type. + The current value of this variable is copied into the register before + the call; if the call returns normally, the value is copied back into the + variable. + +- The callee appears to receive the address of a variable. This address + is actually a hidden location in its own stack, initialized with the + value of the register upon entry. When the function returns normally, + the value in that hidden location is written back to the register. + +A ``swift_error_result`` parameter must be the last parameter, and it must be +preceded by a ``swift_context`` parameter. + +A ``swift_error_result`` parameter must have type ``T**`` or ``T*&`` for some +type T. Note that no qualifiers are permitted on the intermediate level. + +It is undefined behavior if the caller does not pass a pointer or +reference to a valid object. + +The standard convention is that the error value itself (that is, the +value stored in the apparent argument) will be null upon function entry, +but this is not enforced by the ABI. + + +swift_indirect_result +--------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``swift_indirect_result``","``clang::swift_indirect_result``","``clang::swift_indirect_result``","","","","Yes" + +The ``swift_indirect_result`` attribute marks a parameter of a ``swiftcall`` +function as having the special indirect-result ABI treatment. + +This treatment gives the parameter the target's normal indirect-result +ABI treatment, which may involve passing it differently from an ordinary +parameter. However, only the first indirect result will receive this +treatment. Furthermore, low-level lowering may decide that a direct result +must be returned indirectly; if so, this will take priority over the +``swift_indirect_result`` parameters. + +A ``swift_indirect_result`` parameter must either be the first parameter or +follow another ``swift_indirect_result`` parameter. + +A ``swift_indirect_result`` parameter must have type ``T*`` or ``T&`` for +some object type ``T``. If ``T`` is a complete type at the point of +definition of a function, it is undefined behavior if the argument +value does not point to storage of adequate size and alignment for a +value of type ``T``. + +Making indirect results explicit in the signature allows C functions to +directly construct objects into them without relying on language +optimizations like C++'s named return value optimization (NRVO). + + +swiftcall +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``swiftcall``","``clang::swiftcall``","``clang::swiftcall``","","","","" + +The ``swiftcall`` attribute indicates that a function should be called +using the Swift calling convention for a function or function pointer. + +The lowering for the Swift calling convention, as described by the Swift +ABI documentation, occurs in multiple phases. The first, "high-level" +phase breaks down the formal parameters and results into innately direct +and indirect components, adds implicit paraameters for the generic +signature, and assigns the context and error ABI treatments to parameters +where applicable. The second phase breaks down the direct parameters +and results from the first phase and assigns them to registers or the +stack. The ``swiftcall`` convention only handles this second phase of +lowering; the C function type must accurately reflect the results +of the first phase, as follows: + +- Results classified as indirect by high-level lowering should be + represented as parameters with the ``swift_indirect_result`` attribute. + +- Results classified as direct by high-level lowering should be represented + as follows: + + - First, remove any empty direct results. + + - If there are no direct results, the C result type should be ``void``. + + - If there is one direct result, the C result type should be a type with + the exact layout of that result type. + + - If there are a multiple direct results, the C result type should be + a struct type with the exact layout of a tuple of those results. + +- Parameters classified as indirect by high-level lowering should be + represented as parameters of pointer type. + +- Parameters classified as direct by high-level lowering should be + omitted if they are empty types; otherwise, they should be represented + as a parameter type with a layout exactly matching the layout of the + Swift parameter type. + +- The context parameter, if present, should be represented as a trailing + parameter with the ``swift_context`` attribute. + +- The error result parameter, if present, should be represented as a + trailing parameter (always following a context parameter) with the + ``swift_error_result`` attribute. + +``swiftcall`` does not support variadic arguments or unprototyped functions. + +The parameter ABI treatment attributes are aspects of the function type. +A function type which which applies an ABI treatment attribute to a +parameter is a different type from an otherwise-identical function type +that does not. A single parameter may not have multiple ABI treatment +attributes. + +Support for this feature is target-dependent, although it should be +supported on every target that Swift supports. Query for this support +with ``__has_attribute(swiftcall)``. This implies support for the +``swift_context``, ``swift_error_result``, and ``swift_indirect_result`` +attributes. + + +thread +------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","``thread``","","","" + +The ``__declspec(thread)`` attribute declares a variable with thread local +storage. It is available under the ``-fms-extensions`` flag for MSVC +compatibility. See the documentation for `__declspec(thread)`_ on MSDN. + +.. _`__declspec(thread)`: http://msdn.microsoft.com/en-us/library/9w1sdazb.aspx + +In Clang, ``__declspec(thread)`` is generally equivalent in functionality to the +GNU ``__thread`` keyword. The variable must not have a destructor and must have +a constant initializer, if any. The attribute only applies to variables +declared with static storage duration, such as globals, class static data +members, and static locals. + + +tls_model +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``tls_model``","``gnu::tls_model``","","","","","Yes" + +The ``tls_model`` attribute allows you to specify which thread-local storage +model to use. It accepts the following strings: + +* global-dynamic +* local-dynamic +* initial-exec +* local-exec + +TLS models are mutually exclusive. + + +trivial_abi +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``trivial_abi``","``clang::trivial_abi``","","","","","Yes" + +The ``trivial_abi`` attribute can be applied to a C++ class, struct, or union. +It instructs the compiler to pass and return the type using the C ABI for the +underlying type when the type would otherwise be considered non-trivial for the +purpose of calls. +A class annotated with `trivial_abi` can have non-trivial destructors or copy/move constructors without automatically becoming non-trivial for the purposes of calls. For example: + + .. code-block:: c++ + + // A is trivial for the purposes of calls because `trivial_abi` makes the + // user-provided special functions trivial. + struct __attribute__((trivial_abi)) A { + ~A(); + A(const A &); + A(A &&); + int x; + }; + + // B's destructor and copy/move constructor are considered trivial for the + // purpose of calls because A is trivial. + struct B { + A a; + }; + +If a type is trivial for the purposes of calls, has a non-trivial destructor, +and is passed as an argument by value, the convention is that the callee will +destroy the object before returning. + +Attribute ``trivial_abi`` has no effect in the following cases: + +- The class directly declares a virtual base or virtual methods. +- The class has a base class that is non-trivial for the purposes of calls. +- The class has a non-static data member whose type is non-trivial for the purposes of calls, which includes: + + - classes that are non-trivial for the purposes of calls + - __weak-qualified types in Objective-C++ + - arrays of any of the above + + +uninitialized +------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``uninitialized``","``clang::uninitialized``","","","","","" + +The command-line parameter ``-ftrivial-auto-var-init=*`` can be used to +initialize trivial automatic stack variables. By default, trivial automatic +stack variables are uninitialized. This attribute is used to override the +command-line parameter, forcing variables to remain uninitialized. It has no +semantic meaning in that using uninitialized values is undefined behavior, +it rather documents the programmer's intent. + + +Type Attributes +=============== + + +__single_inhertiance, __multiple_inheritance, __virtual_inheritance +------------------------------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``__single_inheritance`` |br| ``__multiple_inheritance`` |br| ``__virtual_inheritance`` |br| ``__unspecified_inheritance``","","" + +This collection of keywords is enabled under ``-fms-extensions`` and controls +the pointer-to-member representation used on ``*-*-win32`` targets. + +The ``*-*-win32`` targets utilize a pointer-to-member representation which +varies in size and alignment depending on the definition of the underlying +class. + +However, this is problematic when a forward declaration is only available and +no definition has been made yet. In such cases, Clang is forced to utilize the +most general representation that is available to it. + +These keywords make it possible to use a pointer-to-member representation other +than the most general one regardless of whether or not the definition will ever +be present in the current translation unit. + +This family of keywords belong between the ``class-key`` and ``class-name``: + +.. code-block:: c++ + + struct __single_inheritance S; + int S::*i; + struct S {}; + +This keyword can be applied to class templates but only has an effect when used +on full specializations: + +.. code-block:: c++ + + template struct __single_inheritance A; // warning: inheritance model ignored on primary template + template struct __multiple_inheritance A; // warning: inheritance model ignored on partial specialization + template <> struct __single_inheritance A; + +Note that choosing an inheritance model less general than strictly necessary is +an error: + +.. code-block:: c++ + + struct __multiple_inheritance S; // error: inheritance model does not match definition + int S::*i; + struct S {}; + + +align_value +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``align_value``","","","","","","Yes" + +The align_value attribute can be added to the typedef of a pointer type or the +declaration of a variable of pointer or reference type. It specifies that the +pointer will point to, or the reference will bind to, only objects with at +least the provided alignment. This alignment value must be some positive power +of 2. + + .. code-block:: c + + typedef double * aligned_double_ptr __attribute__((align_value(64))); + void foo(double & x __attribute__((align_value(128)), + aligned_double_ptr y) { ... } + +If the pointer value does not have the specified alignment at runtime, the +behavior of the program is undefined. + + +empty_bases +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","``empty_bases``","","","" + +The empty_bases attribute permits the compiler to utilize the +empty-base-optimization more frequently. +This attribute only applies to struct, class, and union types. +It is only supported when using the Microsoft C++ ABI. + + +enum_extensibility +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``enum_extensibility``","``clang::enum_extensibility``","``clang::enum_extensibility``","","","","Yes" + +Attribute ``enum_extensibility`` is used to distinguish between enum definitions +that are extensible and those that are not. The attribute can take either +``closed`` or ``open`` as an argument. ``closed`` indicates a variable of the +enum type takes a value that corresponds to one of the enumerators listed in the +enum definition or, when the enum is annotated with ``flag_enum``, a value that +can be constructed using values corresponding to the enumerators. ``open`` +indicates a variable of the enum type can take any values allowed by the +standard and instructs clang to be more lenient when issuing warnings. + +.. code-block:: c + + enum __attribute__((enum_extensibility(closed))) ClosedEnum { + A0, A1 + }; + + enum __attribute__((enum_extensibility(open))) OpenEnum { + B0, B1 + }; + + enum __attribute__((enum_extensibility(closed),flag_enum)) ClosedFlagEnum { + C0 = 1 << 0, C1 = 1 << 1 + }; + + enum __attribute__((enum_extensibility(open),flag_enum)) OpenFlagEnum { + D0 = 1 << 0, D1 = 1 << 1 + }; + + void foo1() { + enum ClosedEnum ce; + enum OpenEnum oe; + enum ClosedFlagEnum cfe; + enum OpenFlagEnum ofe; + + ce = A1; // no warnings + ce = 100; // warning issued + oe = B1; // no warnings + oe = 100; // no warnings + cfe = C0 | C1; // no warnings + cfe = C0 | C1 | 4; // warning issued + ofe = D0 | D1; // no warnings + ofe = D0 | D1 | 4; // no warnings + } + + +flag_enum +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``flag_enum``","``clang::flag_enum``","``clang::flag_enum``","","","","Yes" + +This attribute can be added to an enumerator to signal to the compiler that it +is intended to be used as a flag type. This will cause the compiler to assume +that the range of the type includes all of the values that you can get by +manipulating bits of the enumerator when issuing warnings. + + +layout_version +-------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","``layout_version``","","","" + +The layout_version attribute requests that the compiler utilize the class +layout rules of a particular compiler version. +This attribute only applies to struct, class, and union types. +It is only supported when using the Microsoft C++ ABI. + + +lto_visibility_public +--------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``lto_visibility_public``","``clang::lto_visibility_public``","``clang::lto_visibility_public``","","","","Yes" + +See :doc:`LTOVisibility`. + + +noderef +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``noderef``","``clang::noderef``","``clang::noderef``","","","","" + +The ``noderef`` attribute causes clang to diagnose dereferences of annotated pointer types. +This is ideally used with pointers that point to special memory which cannot be read +from or written to, but allowing for the pointer to be used in pointer arithmetic. +The following are examples of valid expressions where dereferences are diagnosed: + +.. code-block:: c + + int __attribute__((noderef)) *p; + int x = *p; // warning + + int __attribute__((noderef)) **p2; + x = **p2; // warning + + int * __attribute__((noderef)) *p3; + p = *p3; // warning + + struct S { + int a; + }; + struct S __attribute__((noderef)) *s; + x = s->a; // warning + x = (*s).a; // warning + +Not all dereferences may diagnose a warning if the value directed by the pointer may not be +accessed. The following are examples of valid expressions where may not be diagnosed: + +.. code-block:: c + + int *q; + int __attribute__((noderef)) *p; + q = &*p; + q = *&p; + + struct S { + int a; + }; + struct S __attribute__((noderef)) *s; + p = &s->a; + p = &(*s).a; + +``noderef`` is currently only supported for pointers and arrays and not usable for +references or Objective-C object pointers. + +.. code-block: c++ + + int x = 2; + int __attribute__((noderef)) &y = x; // warning: 'noderef' can only be used on an array or pointer type + +.. code-block: objc + + id __attribute__((noderef)) obj = [NSObject new]; // warning: 'noderef' can only be used on an array or pointer type + + +novtable +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","``novtable``","","","" + +This attribute can be added to a class declaration or definition to signal to +the compiler that constructors and destructors will not reference the virtual +function table. It is only supported when using the Microsoft C++ ABI. + + +objc_subclassing_restricted +--------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``objc_subclassing_restricted``","``clang::objc_subclassing_restricted``","``clang::objc_subclassing_restricted``","","","","Yes" + +This attribute can be added to an Objective-C ``@interface`` declaration to +ensure that this class cannot be subclassed. + + +selectany +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``selectany``","``gnu::selectany``","","``selectany``","","","" + +This attribute appertains to a global symbol, causing it to have a weak +definition ( +`linkonce `_ +), allowing the linker to select any definition. + +For more information see +`gcc documentation `_ +or `msvc documentation `_. + + +transparent_union +----------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``transparent_union``","``gnu::transparent_union``","","","","","" + +This attribute can be applied to a union to change the behaviour of calls to +functions that have an argument with a transparent union type. The compiler +behaviour is changed in the following manner: + +- A value whose type is any member of the transparent union can be passed as an + argument without the need to cast that value. + +- The argument is passed to the function using the calling convention of the + first member of the transparent union. Consequently, all the members of the + transparent union should have the same calling convention as its first member. + +Transparent unions are not supported in C++. + + +Statement Attributes +==================== + + +#pragma clang loop +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","","``clang loop`` |br| ``unroll`` |br| ``nounroll`` |br| ``unroll_and_jam`` |br| ``nounroll_and_jam``","" + +The ``#pragma clang loop`` directive allows loop optimization hints to be +specified for the subsequent loop. The directive allows pipelining to be +disabled, or vectorization, interleaving, and unrolling to be enabled or disabled. +Vector width, interleave count, unrolling count, and the initiation interval +for pipelining can be explicitly specified. See `language extensions +`_ +for details. + + +#pragma unroll, #pragma nounroll +-------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","","``clang loop`` |br| ``unroll`` |br| ``nounroll`` |br| ``unroll_and_jam`` |br| ``nounroll_and_jam``","" + +Loop unrolling optimization hints can be specified with ``#pragma unroll`` and +``#pragma nounroll``. The pragma is placed immediately before a for, while, +do-while, or c++11 range-based for loop. + +Specifying ``#pragma unroll`` without a parameter directs the loop unroller to +attempt to fully unroll the loop if the trip count is known at compile time and +attempt to partially unroll the loop if the trip count is not known at compile +time: + +.. code-block:: c++ + + #pragma unroll + for (...) { + ... + } + +Specifying the optional parameter, ``#pragma unroll _value_``, directs the +unroller to unroll the loop ``_value_`` times. The parameter may optionally be +enclosed in parentheses: + +.. code-block:: c++ + + #pragma unroll 16 + for (...) { + ... + } + + #pragma unroll(16) + for (...) { + ... + } + +Specifying ``#pragma nounroll`` indicates that the loop should not be unrolled: + +.. code-block:: c++ + + #pragma nounroll + for (...) { + ... + } + +``#pragma unroll`` and ``#pragma unroll _value_`` have identical semantics to +``#pragma clang loop unroll(full)`` and +``#pragma clang loop unroll_count(_value_)`` respectively. ``#pragma nounroll`` +is equivalent to ``#pragma clang loop unroll(disable)``. See +`language extensions +`_ +for further details including limitations of the unroll hints. + + +__read_only, __write_only, __read_write (read_only, write_only, read_write) +--------------------------------------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``__read_only`` |br| ``read_only`` |br| ``__write_only`` |br| ``write_only`` |br| ``__read_write`` |br| ``read_write``","","" + +The access qualifiers must be used with image object arguments or pipe arguments +to declare if they are being read or written by a kernel or function. + +The read_only/__read_only, write_only/__write_only and read_write/__read_write +names are reserved for use as access qualifiers and shall not be used otherwise. + +.. code-block:: c + + kernel void + foo (read_only image2d_t imageA, + write_only image2d_t imageB) { + ... + } + +In the above example imageA is a read-only 2D image object, and imageB is a +write-only 2D image object. + +The read_write (or __read_write) qualifier can not be used with pipe. + +More details can be found in the OpenCL C language Spec v2.0, Section 6.6. + + +fallthrough +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","``fallthrough`` |br| ``clang::fallthrough``","``fallthrough``","","","","" + +The ``fallthrough`` (or ``clang::fallthrough``) attribute is used +to annotate intentional fall-through +between switch labels. It can only be applied to a null statement placed at a +point of execution between any statement and the next switch label. It is +common to mark these places with a specific comment, but this attribute is +meant to replace comments with a more strict annotation, which can be checked +by the compiler. This attribute doesn't change semantics of the code and can +be used wherever an intended fall-through occurs. It is designed to mimic +control-flow statements like ``break;``, so it can be placed in most places +where ``break;`` can, but only if there are no statements on the execution path +between it and the next switch label. + +By default, Clang does not warn on unannotated fallthrough from one ``switch`` +case to another. Diagnostics on fallthrough without a corresponding annotation +can be enabled with the ``-Wimplicit-fallthrough`` argument. + +Here is an example: + +.. code-block:: c++ + + // compile with -Wimplicit-fallthrough + switch (n) { + case 22: + case 33: // no warning: no statements between case labels + f(); + case 44: // warning: unannotated fall-through + g(); + [[clang::fallthrough]]; + case 55: // no warning + if (x) { + h(); + break; + } + else { + i(); + [[clang::fallthrough]]; + } + case 66: // no warning + p(); + [[clang::fallthrough]]; // warning: fallthrough annotation does not + // directly precede case label + q(); + case 77: // warning: unannotated fall-through + r(); + } + + +intel_reqd_sub_group_size +------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``intel_reqd_sub_group_size``","","","","","","Yes" + +The optional attribute intel_reqd_sub_group_size can be used to indicate that +the kernel must be compiled and executed with the specified subgroup size. When +this attribute is present, get_max_sub_group_size() is guaranteed to return the +specified integer value. This is important for the correctness of many subgroup +algorithms, and in some cases may be used by the compiler to generate more optimal +code. See `cl_intel_required_subgroup_size +` +for details. + + +opencl_unroll_hint +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``opencl_unroll_hint``","","","","","","" + +The opencl_unroll_hint attribute qualifier can be used to specify that a loop +(for, while and do loops) can be unrolled. This attribute qualifier can be +used to specify full unrolling or partial unrolling by a specified amount. +This is a compiler hint and the compiler may ignore this directive. See +`OpenCL v2.0 `_ +s6.11.5 for details. + + +suppress +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","``gsl::suppress``","","","","","" + +The ``[[gsl::suppress]]`` attribute suppresses specific +clang-tidy diagnostics for rules of the `C++ Core Guidelines`_ in a portable +way. The attribute can be attached to declarations, statements, and at +namespace scope. + +.. code-block:: c++ + + [[gsl::suppress("Rh-public")]] + void f_() { + int *p; + [[gsl::suppress("type")]] { + p = reinterpret_cast(7); + } + } + namespace N { + [[clang::suppress("type", "bounds")]]; + ... + } + +.. _`C++ Core Guidelines`: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#inforce-enforcement + + +AMD GPU Attributes +================== + + +amdgpu_flat_work_group_size +--------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``amdgpu_flat_work_group_size``","``clang::amdgpu_flat_work_group_size``","","","","","Yes" + +The flat work-group size is the number of work-items in the work-group size +specified when the kernel is dispatched. It is the product of the sizes of the +x, y, and z dimension of the work-group. + +Clang supports the +``__attribute__((amdgpu_flat_work_group_size(, )))`` attribute for the +AMDGPU target. This attribute may be attached to a kernel function definition +and is an optimization hint. + +```` parameter specifies the minimum flat work-group size, and ```` +parameter specifies the maximum flat work-group size (must be greater than +````) to which all dispatches of the kernel will conform. Passing ``0, 0`` +as ``, `` implies the default behavior (``128, 256``). + +If specified, the AMDGPU target backend might be able to produce better machine +code for barriers and perform scratch promotion by estimating available group +segment size. + +An error will be given if: + - Specified values violate subtarget specifications; + - Specified values are not compatible with values provided through other + attributes. + + +amdgpu_num_sgpr +--------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``amdgpu_num_sgpr``","``clang::amdgpu_num_sgpr``","","","","","Yes" + +Clang supports the ``__attribute__((amdgpu_num_sgpr()))`` and +``__attribute__((amdgpu_num_vgpr()))`` attributes for the AMDGPU +target. These attributes may be attached to a kernel function definition and are +an optimization hint. + +If these attributes are specified, then the AMDGPU target backend will attempt +to limit the number of SGPRs and/or VGPRs used to the specified value(s). The +number of used SGPRs and/or VGPRs may further be rounded up to satisfy the +allocation requirements or constraints of the subtarget. Passing ``0`` as +``num_sgpr`` and/or ``num_vgpr`` implies the default behavior (no limits). + +These attributes can be used to test the AMDGPU target backend. It is +recommended that the ``amdgpu_waves_per_eu`` attribute be used to control +resources such as SGPRs and VGPRs since it is aware of the limits for different +subtargets. + +An error will be given if: + - Specified values violate subtarget specifications; + - Specified values are not compatible with values provided through other + attributes; + - The AMDGPU target backend is unable to create machine code that can meet the + request. + + +amdgpu_num_vgpr +--------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``amdgpu_num_vgpr``","``clang::amdgpu_num_vgpr``","","","","","Yes" + +Clang supports the ``__attribute__((amdgpu_num_sgpr()))`` and +``__attribute__((amdgpu_num_vgpr()))`` attributes for the AMDGPU +target. These attributes may be attached to a kernel function definition and are +an optimization hint. + +If these attributes are specified, then the AMDGPU target backend will attempt +to limit the number of SGPRs and/or VGPRs used to the specified value(s). The +number of used SGPRs and/or VGPRs may further be rounded up to satisfy the +allocation requirements or constraints of the subtarget. Passing ``0`` as +``num_sgpr`` and/or ``num_vgpr`` implies the default behavior (no limits). + +These attributes can be used to test the AMDGPU target backend. It is +recommended that the ``amdgpu_waves_per_eu`` attribute be used to control +resources such as SGPRs and VGPRs since it is aware of the limits for different +subtargets. + +An error will be given if: + - Specified values violate subtarget specifications; + - Specified values are not compatible with values provided through other + attributes; + - The AMDGPU target backend is unable to create machine code that can meet the + request. + + +amdgpu_waves_per_eu +------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``amdgpu_waves_per_eu``","``clang::amdgpu_waves_per_eu``","","","","","Yes" + +A compute unit (CU) is responsible for executing the wavefronts of a work-group. +It is composed of one or more execution units (EU), which are responsible for +executing the wavefronts. An EU can have enough resources to maintain the state +of more than one executing wavefront. This allows an EU to hide latency by +switching between wavefronts in a similar way to symmetric multithreading on a +CPU. In order to allow the state for multiple wavefronts to fit on an EU, the +resources used by a single wavefront have to be limited. For example, the number +of SGPRs and VGPRs. Limiting such resources can allow greater latency hiding, +but can result in having to spill some register state to memory. + +Clang supports the ``__attribute__((amdgpu_waves_per_eu([, ])))`` +attribute for the AMDGPU target. This attribute may be attached to a kernel +function definition and is an optimization hint. + +```` parameter specifies the requested minimum number of waves per EU, and +*optional* ```` parameter specifies the requested maximum number of waves +per EU (must be greater than ```` if specified). If ```` is omitted, +then there is no restriction on the maximum number of waves per EU other than +the one dictated by the hardware for which the kernel is compiled. Passing +``0, 0`` as ``, `` implies the default behavior (no limits). + +If specified, this attribute allows an advanced developer to tune the number of +wavefronts that are capable of fitting within the resources of an EU. The AMDGPU +target backend can use this information to limit resources, such as number of +SGPRs, number of VGPRs, size of available group and private memory segments, in +such a way that guarantees that at least ```` wavefronts and at most +```` wavefronts are able to fit within the resources of an EU. Requesting +more wavefronts can hide memory latency but limits available registers which +can result in spilling. Requesting fewer wavefronts can help reduce cache +thrashing, but can reduce memory latency hiding. + +This attribute controls the machine code generated by the AMDGPU target backend +to ensure it is capable of meeting the requested values. However, when the +kernel is executed, there may be other reasons that prevent meeting the request, +for example, there may be wavefronts from other kernels executing on the EU. + +An error will be given if: + - Specified values violate subtarget specifications; + - Specified values are not compatible with values provided through other + attributes; + - The AMDGPU target backend is unable to create machine code that can meet the + request. + + +OpenCL Address Spaces +===================== +The address space qualifier may be used to specify the region of memory that is +used to allocate the object. OpenCL supports the following address spaces: +__generic(generic), __global(global), __local(local), __private(private), +__constant(constant). + + .. code-block:: c + + __constant int c = ...; + + __generic int* foo(global int* g) { + __local int* l; + private int p; + ... + return l; + } + +More details can be found in the OpenCL C language Spec v2.0, Section 6.5. + +constant +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``__constant`` |br| ``constant``","","" + +The constant address space attribute signals that an object is located in +a constant (non-modifiable) memory region. It is available to all work items. +Any type can be annotated with the constant address space attribute. Objects +with the constant address space qualifier can be declared in any scope and must +have an initializer. + + +generic +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``__generic`` |br| ``generic``","","" + +The generic address space attribute is only available with OpenCL v2.0 and later. +It can be used with pointer types. Variables in global and local scope and +function parameters in non-kernel functions can have the generic address space +type attribute. It is intended to be a placeholder for any other address space +except for '__constant' in OpenCL code which can be used with multiple address +spaces. + + +global +------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``__global`` |br| ``global``","","" + +The global address space attribute specifies that an object is allocated in +global memory, which is accessible by all work items. The content stored in this +memory area persists between kernel executions. Pointer types to the global +address space are allowed as function parameters or local variables. Starting +with OpenCL v2.0, the global address space can be used with global (program +scope) variables and static local variable as well. + + +local +----- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``__local`` |br| ``local``","","" + +The local address space specifies that an object is allocated in the local (work +group) memory area, which is accessible to all work items in the same work +group. The content stored in this memory region is not accessible after +the kernel execution ends. In a kernel function scope, any variable can be in +the local address space. In other scopes, only pointer types to the local address +space are allowed. Local address space variables cannot have an initializer. + + +private +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``__private`` |br| ``private``","","" + +The private address space specifies that an object is allocated in the private +(work item) memory. Other work items cannot access the same memory area and its +content is destroyed after work item execution ends. Local variables can be +declared in the private address space. Function arguments are always in the +private address space. Kernel function arguments of a pointer or an array type +cannot point to the private address space. + + +Calling Conventions +=================== +Clang supports several different calling conventions, depending on the target +platform and architecture. The calling convention used for a function determines +how parameters are passed, how results are returned to the caller, and other +low-level details of calling a function. + +aarch64_vector_pcs +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``aarch64_vector_pcs``","``clang::aarch64_vector_pcs``","``clang::aarch64_vector_pcs``","","","","" + +On AArch64 targets, this attribute changes the calling convention of a +function to preserve additional floating-point and Advanced SIMD registers +relative to the default calling convention used for AArch64. + +This means it is more efficient to call such functions from code that performs +extensive floating-point and vector calculations, because fewer live SIMD and FP +registers need to be saved. This property makes it well-suited for e.g. +floating-point or vector math library functions, which are typically leaf +functions that require a small number of registers. + +However, using this attribute also means that it is more expensive to call +a function that adheres to the default calling convention from within such +a function. Therefore, it is recommended that this attribute is only used +for leaf functions. + +For more information, see the documentation for `aarch64_vector_pcs`_ on +the Arm Developer website. + +.. _`aarch64_vector_pcs`: https://developer.arm.com/products/software-development-tools/hpc/arm-compiler-for-hpc/vector-function-abi + + +fastcall +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``fastcall``","``gnu::fastcall``","","","``__fastcall`` |br| ``_fastcall``","","" + +On 32-bit x86 targets, this attribute changes the calling convention of a +function to use ECX and EDX as register parameters and clear parameters off of +the stack on return. This convention does not support variadic calls or +unprototyped functions in C, and has no effect on x86_64 targets. This calling +convention is supported primarily for compatibility with existing code. Users +seeking register parameters should use the ``regparm`` attribute, which does +not require callee-cleanup. See the documentation for `__fastcall`_ on MSDN. + +.. _`__fastcall`: http://msdn.microsoft.com/en-us/library/6xa169sk.aspx + + +ms_abi +------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``ms_abi``","``gnu::ms_abi``","","","","","" + +On non-Windows x86_64 targets, this attribute changes the calling convention of +a function to match the default convention used on Windows x86_64. This +attribute has no effect on Windows targets or non-x86_64 targets. + + +pcs +--- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``pcs``","``gnu::pcs``","","","","","" + +On ARM targets, this attribute can be used to select calling conventions +similar to ``stdcall`` on x86. Valid parameter values are "aapcs" and +"aapcs-vfp". + + +preserve_all +------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``preserve_all``","``clang::preserve_all``","``clang::preserve_all``","","","","" + +On X86-64 and AArch64 targets, this attribute changes the calling convention of +a function. The ``preserve_all`` calling convention attempts to make the code +in the caller even less intrusive than the ``preserve_most`` calling convention. +This calling convention also behaves identical to the ``C`` calling convention +on how arguments and return values are passed, but it uses a different set of +caller/callee-saved registers. This removes the burden of saving and +recovering a large register set before and after the call in the caller. If +the arguments are passed in callee-saved registers, then they will be +preserved by the callee across the call. This doesn't apply for values +returned in callee-saved registers. + +- On X86-64 the callee preserves all general purpose registers, except for + R11. R11 can be used as a scratch register. Furthermore it also preserves + all floating-point registers (XMMs/YMMs). + +The idea behind this convention is to support calls to runtime functions +that don't need to call out to any other functions. + +This calling convention, like the ``preserve_most`` calling convention, will be +used by a future version of the Objective-C runtime and should be considered +experimental at this time. + + +preserve_most +------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``preserve_most``","``clang::preserve_most``","``clang::preserve_most``","","","","" + +On X86-64 and AArch64 targets, this attribute changes the calling convention of +a function. The ``preserve_most`` calling convention attempts to make the code +in the caller as unintrusive as possible. This convention behaves identically +to the ``C`` calling convention on how arguments and return values are passed, +but it uses a different set of caller/callee-saved registers. This alleviates +the burden of saving and recovering a large register set before and after the +call in the caller. If the arguments are passed in callee-saved registers, +then they will be preserved by the callee across the call. This doesn't +apply for values returned in callee-saved registers. + +- On X86-64 the callee preserves all general purpose registers, except for + R11. R11 can be used as a scratch register. Floating-point registers + (XMMs/YMMs) are not preserved and need to be saved by the caller. + +The idea behind this convention is to support calls to runtime functions +that have a hot path and a cold path. The hot path is usually a small piece +of code that doesn't use many registers. The cold path might need to call out to +another function and therefore only needs to preserve the caller-saved +registers, which haven't already been saved by the caller. The +`preserve_most` calling convention is very similar to the ``cold`` calling +convention in terms of caller/callee-saved registers, but they are used for +different types of function calls. ``coldcc`` is for function calls that are +rarely executed, whereas `preserve_most` function calls are intended to be +on the hot path and definitely executed a lot. Furthermore ``preserve_most`` +doesn't prevent the inliner from inlining the function call. + +This calling convention will be used by a future version of the Objective-C +runtime and should therefore still be considered experimental at this time. +Although this convention was created to optimize certain runtime calls to +the Objective-C runtime, it is not limited to this runtime and might be used +by other runtimes in the future too. The current implementation only +supports X86-64 and AArch64, but the intention is to support more architectures +in the future. + + +regcall +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``regcall``","``gnu::regcall``","","","``__regcall``","","" + +On x86 targets, this attribute changes the calling convention to +`__regcall`_ convention. This convention aims to pass as many arguments +as possible in registers. It also tries to utilize registers for the +return value whenever it is possible. + +.. _`__regcall`: https://software.intel.com/en-us/node/693069 + + +regparm +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``regparm``","``gnu::regparm``","","","","","" + +On 32-bit x86 targets, the regparm attribute causes the compiler to pass +the first three integer parameters in EAX, EDX, and ECX instead of on the +stack. This attribute has no effect on variadic functions, and all parameters +are passed via the stack as normal. + + +stdcall +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``stdcall``","``gnu::stdcall``","","","``__stdcall`` |br| ``_stdcall``","","" + +On 32-bit x86 targets, this attribute changes the calling convention of a +function to clear parameters off of the stack on return. This convention does +not support variadic calls or unprototyped functions in C, and has no effect on +x86_64 targets. This calling convention is used widely by the Windows API and +COM applications. See the documentation for `__stdcall`_ on MSDN. + +.. _`__stdcall`: http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx + + +thiscall +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``thiscall``","``gnu::thiscall``","","","``__thiscall`` |br| ``_thiscall``","","" + +On 32-bit x86 targets, this attribute changes the calling convention of a +function to use ECX for the first parameter (typically the implicit ``this`` +parameter of C++ methods) and clear parameters off of the stack on return. This +convention does not support variadic calls or unprototyped functions in C, and +has no effect on x86_64 targets. See the documentation for `__thiscall`_ on +MSDN. + +.. _`__thiscall`: http://msdn.microsoft.com/en-us/library/ek8tkfbw.aspx + + +vectorcall +---------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``vectorcall``","``clang::vectorcall``","``clang::vectorcall``","","``__vectorcall`` |br| ``_vectorcall``","","" + +On 32-bit x86 *and* x86_64 targets, this attribute changes the calling +convention of a function to pass vector parameters in SSE registers. + +On 32-bit x86 targets, this calling convention is similar to ``__fastcall``. +The first two integer parameters are passed in ECX and EDX. Subsequent integer +parameters are passed in memory, and callee clears the stack. On x86_64 +targets, the callee does *not* clear the stack, and integer parameters are +passed in RCX, RDX, R8, and R9 as is done for the default Windows x64 calling +convention. + +On both 32-bit x86 and x86_64 targets, vector and floating point arguments are +passed in XMM0-XMM5. Homogeneous vector aggregates of up to four elements are +passed in sequential SSE registers if enough are available. If AVX is enabled, +256 bit vectors are passed in YMM0-YMM5. Any vector or aggregate type that +cannot be passed in registers for any reason is passed by reference, which +allows the caller to align the parameter memory. + +See the documentation for `__vectorcall`_ on MSDN for more details. + +.. _`__vectorcall`: http://msdn.microsoft.com/en-us/library/dn375768.aspx + + +Consumed Annotation Checking +============================ +Clang supports additional attributes for checking basic resource management +properties, specifically for unique objects that have a single owning reference. +The following attributes are currently supported, although **the implementation +for these annotations is currently in development and are subject to change.** + +callable_when +------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``callable_when``","``clang::callable_when``","","","","","Yes" + +Use ``__attribute__((callable_when(...)))`` to indicate what states a method +may be called in. Valid states are unconsumed, consumed, or unknown. Each +argument to this attribute must be a quoted string. E.g.: + +``__attribute__((callable_when("unconsumed", "unknown")))`` + + +consumable +---------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``consumable``","``clang::consumable``","","","","","Yes" + +Each ``class`` that uses any of the typestate annotations must first be marked +using the ``consumable`` attribute. Failure to do so will result in a warning. + +This attribute accepts a single parameter that must be one of the following: +``unknown``, ``consumed``, or ``unconsumed``. + + +param_typestate +--------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``param_typestate``","``clang::param_typestate``","","","","","Yes" + +This attribute specifies expectations about function parameters. Calls to an +function with annotated parameters will issue a warning if the corresponding +argument isn't in the expected state. The attribute is also used to set the +initial state of the parameter when analyzing the function's body. + + +return_typestate +---------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``return_typestate``","``clang::return_typestate``","","","","","Yes" + +The ``return_typestate`` attribute can be applied to functions or parameters. +When applied to a function the attribute specifies the state of the returned +value. The function's body is checked to ensure that it always returns a value +in the specified state. On the caller side, values returned by the annotated +function are initialized to the given state. + +When applied to a function parameter it modifies the state of an argument after +a call to the function returns. The function's body is checked to ensure that +the parameter is in the expected state before returning. + + +set_typestate +------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``set_typestate``","``clang::set_typestate``","","","","","Yes" + +Annotate methods that transition an object into a new state with +``__attribute__((set_typestate(new_state)))``. The new state must be +unconsumed, consumed, or unknown. + + +test_typestate +-------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``test_typestate``","``clang::test_typestate``","","","","","Yes" + +Use ``__attribute__((test_typestate(tested_state)))`` to indicate that a method +returns true if the object is in the specified state.. + + +Type Safety Checking +==================== +Clang supports additional attributes to enable checking type safety properties +that can't be enforced by the C type system. To see warnings produced by these +checks, ensure that -Wtype-safety is enabled. Use cases include: + +* MPI library implementations, where these attributes enable checking that + the buffer type matches the passed ``MPI_Datatype``; +* for HDF5 library there is a similar use case to MPI; +* checking types of variadic functions' arguments for functions like + ``fcntl()`` and ``ioctl()``. + +You can detect support for these attributes with ``__has_attribute()``. For +example: + +.. code-block:: c++ + + #if defined(__has_attribute) + # if __has_attribute(argument_with_type_tag) && \ + __has_attribute(pointer_with_type_tag) && \ + __has_attribute(type_tag_for_datatype) + # define ATTR_MPI_PWT(buffer_idx, type_idx) __attribute__((pointer_with_type_tag(mpi,buffer_idx,type_idx))) + /* ... other macros ... */ + # endif + #endif + + #if !defined(ATTR_MPI_PWT) + # define ATTR_MPI_PWT(buffer_idx, type_idx) + #endif + + int MPI_Send(void *buf, int count, MPI_Datatype datatype /*, other args omitted */) + ATTR_MPI_PWT(1,3); + +argument_with_type_tag +---------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``argument_with_type_tag`` |br| ``pointer_with_type_tag``","``clang::argument_with_type_tag`` |br| ``clang::pointer_with_type_tag``","``clang::argument_with_type_tag`` |br| ``clang::pointer_with_type_tag``","","","","" + +Use ``__attribute__((argument_with_type_tag(arg_kind, arg_idx, +type_tag_idx)))`` on a function declaration to specify that the function +accepts a type tag that determines the type of some other argument. + +This attribute is primarily useful for checking arguments of variadic functions +(``pointer_with_type_tag`` can be used in most non-variadic cases). + +In the attribute prototype above: + * ``arg_kind`` is an identifier that should be used when annotating all + applicable type tags. + * ``arg_idx`` provides the position of a function argument. The expected type of + this function argument will be determined by the function argument specified + by ``type_tag_idx``. In the code example below, "3" means that the type of the + function's third argument will be determined by ``type_tag_idx``. + * ``type_tag_idx`` provides the position of a function argument. This function + argument will be a type tag. The type tag will determine the expected type of + the argument specified by ``arg_idx``. In the code example below, "2" means + that the type tag associated with the function's second argument should agree + with the type of the argument specified by ``arg_idx``. + +For example: + +.. code-block:: c++ + + int fcntl(int fd, int cmd, ...) + __attribute__(( argument_with_type_tag(fcntl,3,2) )); + // The function's second argument will be a type tag; this type tag will + // determine the expected type of the function's third argument. + + +pointer_with_type_tag +--------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``argument_with_type_tag`` |br| ``pointer_with_type_tag``","``clang::argument_with_type_tag`` |br| ``clang::pointer_with_type_tag``","``clang::argument_with_type_tag`` |br| ``clang::pointer_with_type_tag``","","","","" + +Use ``__attribute__((pointer_with_type_tag(ptr_kind, ptr_idx, type_tag_idx)))`` +on a function declaration to specify that the function accepts a type tag that +determines the pointee type of some other pointer argument. + +In the attribute prototype above: + * ``ptr_kind`` is an identifier that should be used when annotating all + applicable type tags. + * ``ptr_idx`` provides the position of a function argument; this function + argument will have a pointer type. The expected pointee type of this pointer + type will be determined by the function argument specified by + ``type_tag_idx``. In the code example below, "1" means that the pointee type + of the function's first argument will be determined by ``type_tag_idx``. + * ``type_tag_idx`` provides the position of a function argument; this function + argument will be a type tag. The type tag will determine the expected pointee + type of the pointer argument specified by ``ptr_idx``. In the code example + below, "3" means that the type tag associated with the function's third + argument should agree with the pointee type of the pointer argument specified + by ``ptr_idx``. + +For example: + +.. code-block:: c++ + + typedef int MPI_Datatype; + int MPI_Send(void *buf, int count, MPI_Datatype datatype /*, other args omitted */) + __attribute__(( pointer_with_type_tag(mpi,1,3) )); + // The function's 3rd argument will be a type tag; this type tag will + // determine the expected pointee type of the function's 1st argument. + + +type_tag_for_datatype +--------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``type_tag_for_datatype``","``clang::type_tag_for_datatype``","``clang::type_tag_for_datatype``","","","","" + +When declaring a variable, use +``__attribute__((type_tag_for_datatype(kind, type)))`` to create a type tag that +is tied to the ``type`` argument given to the attribute. + +In the attribute prototype above: + * ``kind`` is an identifier that should be used when annotating all applicable + type tags. + * ``type`` indicates the name of the type. + +Clang supports annotating type tags of two forms. + + * **Type tag that is a reference to a declared identifier.** + Use ``__attribute__((type_tag_for_datatype(kind, type)))`` when declaring that + identifier: + + .. code-block:: c++ + + typedef int MPI_Datatype; + extern struct mpi_datatype mpi_datatype_int + __attribute__(( type_tag_for_datatype(mpi,int) )); + #define MPI_INT ((MPI_Datatype) &mpi_datatype_int) + // &mpi_datatype_int is a type tag. It is tied to type "int". + + * **Type tag that is an integral literal.** + Declare a ``static const`` variable with an initializer value and attach + ``__attribute__((type_tag_for_datatype(kind, type)))`` on that declaration: + + .. code-block:: c++ + + typedef int MPI_Datatype; + static const MPI_Datatype mpi_datatype_int + __attribute__(( type_tag_for_datatype(mpi,int) )) = 42; + #define MPI_INT ((MPI_Datatype) 42) + // The number 42 is a type tag. It is tied to type "int". + + +The ``type_tag_for_datatype`` attribute also accepts an optional third argument +that determines how the type of the function argument specified by either +``arg_idx`` or ``ptr_idx`` is compared against the type associated with the type +tag. (Recall that for the ``argument_with_type_tag`` attribute, the type of the +function argument specified by ``arg_idx`` is compared against the type +associated with the type tag. Also recall that for the ``pointer_with_type_tag`` +attribute, the pointee type of the function argument specified by ``ptr_idx`` is +compared against the type associated with the type tag.) There are two supported +values for this optional third argument: + + * ``layout_compatible`` will cause types to be compared according to + layout-compatibility rules (In C++11 [class.mem] p 17, 18, see the + layout-compatibility rules for two standard-layout struct types and for two + standard-layout union types). This is useful when creating a type tag + associated with a struct or union type. For example: + + .. code-block:: c++ + + /* In mpi.h */ + typedef int MPI_Datatype; + struct internal_mpi_double_int { double d; int i; }; + extern struct mpi_datatype mpi_datatype_double_int + __attribute__(( type_tag_for_datatype(mpi, + struct internal_mpi_double_int, layout_compatible) )); + + #define MPI_DOUBLE_INT ((MPI_Datatype) &mpi_datatype_double_int) + + int MPI_Send(void *buf, int count, MPI_Datatype datatype, ...) + __attribute__(( pointer_with_type_tag(mpi,1,3) )); + + /* In user code */ + struct my_pair { double a; int b; }; + struct my_pair *buffer; + MPI_Send(buffer, 1, MPI_DOUBLE_INT /*, ... */); // no warning because the + // layout of my_pair is + // compatible with that of + // internal_mpi_double_int + + struct my_int_pair { int a; int b; } + struct my_int_pair *buffer2; + MPI_Send(buffer2, 1, MPI_DOUBLE_INT /*, ... */); // warning because the + // layout of my_int_pair + // does not match that of + // internal_mpi_double_int + + * ``must_be_null`` specifies that the function argument specified by either + ``arg_idx`` (for the ``argument_with_type_tag`` attribute) or ``ptr_idx`` (for + the ``pointer_with_type_tag`` attribute) should be a null pointer constant. + The second argument to the ``type_tag_for_datatype`` attribute is ignored. For + example: + + .. code-block:: c++ + + /* In mpi.h */ + typedef int MPI_Datatype; + extern struct mpi_datatype mpi_datatype_null + __attribute__(( type_tag_for_datatype(mpi, void, must_be_null) )); + + #define MPI_DATATYPE_NULL ((MPI_Datatype) &mpi_datatype_null) + int MPI_Send(void *buf, int count, MPI_Datatype datatype, ...) + __attribute__(( pointer_with_type_tag(mpi,1,3) )); + + /* In user code */ + struct my_pair { double a; int b; }; + struct my_pair *buffer; + MPI_Send(buffer, 1, MPI_DATATYPE_NULL /*, ... */); // warning: MPI_DATATYPE_NULL + // was specified but buffer + // is not a null pointer + + +Nullability Attributes +====================== +Whether a particular pointer may be "null" is an important concern when working with pointers in the C family of languages. The various nullability attributes indicate whether a particular pointer can be null or not, which makes APIs more expressive and can help static analysis tools identify bugs involving null pointers. Clang supports several kinds of nullability attributes: the ``nonnull`` and ``returns_nonnull`` attributes indicate which function or method parameters and result types can never be null, while nullability type qualifiers indicate which pointer types can be null (``_Nullable``) or cannot be null (``_Nonnull``). + +The nullability (type) qualifiers express whether a value of a given pointer type can be null (the ``_Nullable`` qualifier), doesn't have a defined meaning for null (the ``_Nonnull`` qualifier), or for which the purpose of null is unclear (the ``_Null_unspecified`` qualifier). Because nullability qualifiers are expressed within the type system, they are more general than the ``nonnull`` and ``returns_nonnull`` attributes, allowing one to express (for example) a nullable pointer to an array of nonnull pointers. Nullability qualifiers are written to the right of the pointer to which they apply. For example: + + .. code-block:: c + + // No meaningful result when 'ptr' is null (here, it happens to be undefined behavior). + int fetch(int * _Nonnull ptr) { return *ptr; } + + // 'ptr' may be null. + int fetch_or_zero(int * _Nullable ptr) { + return ptr ? *ptr : 0; + } + + // A nullable pointer to non-null pointers to const characters. + const char *join_strings(const char * _Nonnull * _Nullable strings, unsigned n); + +In Objective-C, there is an alternate spelling for the nullability qualifiers that can be used in Objective-C methods and properties using context-sensitive, non-underscored keywords. For example: + + .. code-block:: objective-c + + @interface NSView : NSResponder + - (nullable NSView *)ancestorSharedWithView:(nonnull NSView *)aView; + @property (assign, nullable) NSView *superview; + @property (readonly, nonnull) NSArray *subviews; + @end + +_Nonnull +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``_Nonnull``","","" + +The ``_Nonnull`` nullability qualifier indicates that null is not a meaningful value for a value of the ``_Nonnull`` pointer type. For example, given a declaration such as: + + .. code-block:: c + + int fetch(int * _Nonnull ptr); + +a caller of ``fetch`` should not provide a null value, and the compiler will produce a warning if it sees a literal null value passed to ``fetch``. Note that, unlike the declaration attribute ``nonnull``, the presence of ``_Nonnull`` does not imply that passing null is undefined behavior: ``fetch`` is free to consider null undefined behavior or (perhaps for backward-compatibility reasons) defensively handle null. + + +_Null_unspecified +----------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``_Null_unspecified``","","" + +The ``_Null_unspecified`` nullability qualifier indicates that neither the ``_Nonnull`` nor ``_Nullable`` qualifiers make sense for a particular pointer type. It is used primarily to indicate that the role of null with specific pointers in a nullability-annotated header is unclear, e.g., due to overly-complex implementations or historical factors with a long-lived API. + + +_Nullable +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "","","","","``_Nullable``","","" + +The ``_Nullable`` nullability qualifier indicates that a value of the ``_Nullable`` pointer type can be null. For example, given: + + .. code-block:: c + + int fetch_or_zero(int * _Nullable ptr); + +a caller of ``fetch_or_zero`` can provide null. + + +nonnull +------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``nonnull``","``gnu::nonnull``","","","","","" + +The ``nonnull`` attribute indicates that some function parameters must not be null, and can be used in several different ways. It's original usage (`from GCC `_) is as a function (or Objective-C method) attribute that specifies which parameters of the function are nonnull in a comma-separated list. For example: + + .. code-block:: c + + extern void * my_memcpy (void *dest, const void *src, size_t len) + __attribute__((nonnull (1, 2))); + +Here, the ``nonnull`` attribute indicates that parameters 1 and 2 +cannot have a null value. Omitting the parenthesized list of parameter indices means that all parameters of pointer type cannot be null: + + .. code-block:: c + + extern void * my_memcpy (void *dest, const void *src, size_t len) + __attribute__((nonnull)); + +Clang also allows the ``nonnull`` attribute to be placed directly on a function (or Objective-C method) parameter, eliminating the need to specify the parameter index ahead of type. For example: + + .. code-block:: c + + extern void * my_memcpy (void *dest __attribute__((nonnull)), + const void *src __attribute__((nonnull)), size_t len); + +Note that the ``nonnull`` attribute indicates that passing null to a non-null parameter is undefined behavior, which the optimizer may take advantage of to, e.g., remove null checks. The ``_Nonnull`` type qualifier indicates that a pointer cannot be null in a more general manner (because it is part of the type system) and does not imply undefined behavior, making it more widely applicable. + + +returns_nonnull +--------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "C2x", "``__declspec``", "Keyword", "``#pragma``", "``#pragma clang attribute``" + + "``returns_nonnull``","``gnu::returns_nonnull``","","","","","Yes" + +The ``returns_nonnull`` attribute indicates that a particular function (or Objective-C method) always returns a non-null pointer. For example, a particular system ``malloc`` might be defined to terminate a process when memory is not available rather than returning a null pointer: + + .. code-block:: c + + extern void * malloc (size_t size) __attribute__((returns_nonnull)); + +The ``returns_nonnull`` attribute implies that returning a null pointer is undefined behavior, which the optimizer may take advantage of. The ``_Nonnull`` type qualifier indicates that a pointer cannot be null in a more general manner (because it is part of the type system) and does not imply undefined behavior, making it more widely applicable + + diff --git a/docs/ClangCommandLineReference.rst b/docs/ClangCommandLineReference.rst index e852c3e38798..3dafac54a02b 100644 --- a/docs/ClangCommandLineReference.rst +++ b/docs/ClangCommandLineReference.rst @@ -198,6 +198,10 @@ Filename (or -) to write dependency output to Emit Clang AST files for source inputs +.. option:: -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang + +Trivial automatic variable initialization to zero is only here for benchmarks, it'll eventually be removed, and I'm OK with that because I'm only using it to benchmark + .. option:: -exported\_symbols\_list .. option:: -faligned-new= @@ -210,10 +214,6 @@ Use approximate transcendental functions Flush denormal floating point values to zero in CUDA device mode. -.. option:: -fcuda-rdc, -fno-cuda-rdc - -Generate relocatable device code, also known as separate compilation mode. - .. option:: -fcuda-short-ptr, -fno-cuda-short-ptr Use 32-bit pointers for accessing const/local/shared address spaces. @@ -222,6 +222,10 @@ Use 32-bit pointers for accessing const/local/shared address spaces. Reserve register r19 (Hexagon only) +.. option:: -fgpu-rdc, -fcuda-rdc, -fno-gpu-rdc + +Generate relocatable device code, also known as separate compilation mode. + .. option:: -fheinous-gnu-extensions .. option:: -flat\_namespace @@ -254,6 +258,10 @@ Use the gcc toolchain at the given directory Generate CodeView debug information +.. option:: -gcodeview-ghash, -gno-codeview-ghash + +Emit type record hashes in a .debug$H section + .. option:: -headerpad\_max\_install\_names .. option:: -help, --help @@ -288,6 +296,10 @@ Make the next included directory (-I or -F) an indexer header map .. option:: -mbig-endian, -EB +.. option:: -mbranch-protection= + +Enforce targets of indirect branches and function returns + .. option:: --migrate Run the migrator @@ -792,15 +804,7 @@ Don't use blacklist file for sanitizers .. option:: -fparse-all-comments -.. option:: -frecord-command-line, -frecord-gcc-switches, -fno-record-command-line, -fno-record-gcc-switches - -Generate a section named ".GCC.command.line" containing the clang driver -command-line. After linking, the section may contain multiple command lines, -which will be individually terminated by null bytes. Separate arguments within -a command line are combined with spaces; spaces and backslashes within an -argument are escaped with backslashes. This format differs from the format of -the equivalent section produced by GCC with the -frecord-gcc-switches flag. -This option is currently only supported on ELF targets. +.. option:: -frecord-command-line, -fno-record-command-line, -frecord-gcc-switches .. option:: -fsanitize-address-field-padding= @@ -810,20 +814,18 @@ Level of field padding for AddressSanitizer Enable linker dead stripping of globals in AddressSanitizer -.. option:: -fsanitize-address-use-odr-indicator, -fno-sanitize-address-use-odr-indicator - -Enable ODR indicator globals to avoid false ODR violation reports in partially sanitized programs at the cost of an increase in binary size - .. option:: -fsanitize-address-poison-custom-array-cookie, -fno-sanitize-address-poison-custom-array-cookie -Enable "poisoning" array cookies when allocating arrays with a custom operator new\[\] in Address Sanitizer, preventing accesses to the cookies from user code. An array cookie is a small implementation-defined header added to certain array allocations to record metadata such as the length of the array. Accesses to array cookies from user code are technically allowed by the standard but are more likely to be the result of an out-of-bounds array access. - -An operator new\[\] is "custom" if it is not one of the allocation functions provided by the C++ standard library. Array cookies from non-custom allocation functions are always poisoned. +Enable poisoning array cookies when using custom operator new\[\] in AddressSanitizer .. option:: -fsanitize-address-use-after-scope, -fno-sanitize-address-use-after-scope Enable use-after-scope detection in AddressSanitizer +.. option:: -fsanitize-address-use-odr-indicator, -fno-sanitize-address-use-odr-indicator + +Enable ODR indicator globals to avoid false ODR violation reports in partially sanitized programs at the cost of an increase in binary size + .. option:: -fsanitize-blacklist= Path to blacklist file for sanitizers @@ -840,6 +842,10 @@ Generalize pointers in CFI indirect call type signature checks Specify the type of coverage instrumentation for Sanitizers +.. option:: -fsanitize-hwaddress-abi= + +Select the HWAddressSanitizer ABI to target (interceptor or platform, default interceptor) + .. option:: -fsanitize-link-c++-runtime .. option:: -fsanitize-memory-track-origins, -fno-sanitize-memory-track-origins @@ -1072,6 +1078,10 @@ Set directory to include search path with prefix Add directory to SYSTEM include search path, absolute paths are relative to -isysroot +.. option:: --libomptarget-nvptx-path= + +Path to libomptarget-nvptx libraries + .. option:: --ptxas-path= Path to ptxas (used for compiling CUDA code) @@ -1283,6 +1293,8 @@ Enable C++ static destructor registration (the default) Instrument control-flow architecture protection. Options: return, branch, full, none. +.. option:: -fcf-runtime-abi= + .. option:: -fchar8\_t, -fno-char8\_t Enable C++ builtin type char8\_t @@ -1343,6 +1355,10 @@ Emit macro debug information remap file source paths in debug info +.. option:: -fdebug-ranges-base-address, -fno-debug-ranges-base-address + +Use DWARF base address selection entries in debug\_ranges + .. option:: -fdebug-types-section, -fno-debug-types-section Place debug types in their own section (ELF Only) @@ -1651,6 +1667,8 @@ Synthesize retain and release calls for Objective-C pointers Use EH-safe code when synthesizing retains and releases in -fobjc-arc +.. option:: -fobjc-convert-messages-to-runtime-calls, -fno-objc-convert-messages-to-runtime-calls + .. option:: -fobjc-exceptions, -fno-objc-exceptions Enable Objective-C exceptions @@ -1737,6 +1755,14 @@ Load the named plugin (dynamic shared object) .. option:: -fprofile-dir= +.. option:: -fprofile-exclude-files= + +Instrument only functions from files where names don't match all the regexes separated by a semi-colon + +.. option:: -fprofile-filter-files= + +Instrument only functions from files where names match any regex separated by a semi-colon + .. option:: -fprofile-generate, -fno-profile-generate Generate instrumented code to collect execution counts into default.profraw (overridden by LLVM\_PROFILE\_FILE env var) @@ -1765,6 +1791,10 @@ Generate instrumented code to collect execution counts into (overridden b Use instrumentation data for profile-guided optimization +.. option:: -fprofile-remapping-file=, -fprofile-remapping-file + +Use the remappings described in to match the profile data against names in the program + .. option:: -fprofile-sample-accurate, -fauto-profile-accurate, -fno-profile-sample-accurate Specifies that the sample profile is accurate. If the sample @@ -1876,19 +1906,23 @@ Enable the superword-level parallelism vectorization passes Provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF +.. option:: -fsplit-lto-unit, -fno-split-lto-unit + +Enables splitting of the LTO unit. + .. option:: -fsplit-stack .. option:: -fstack-protector, -fno-stack-protector -Enable stack protectors for functions potentially vulnerable to stack smashing +Enable stack protectors for some functions vulnerable to stack smashing. This uses a loose heuristic which considers functions vulnerable if they contain a char (or 8bit integer) array or constant sized calls to alloca, which are of greater size than ssp-buffer-size (default: 8 bytes). All variable sized calls to alloca are considered vulnerable .. option:: -fstack-protector-all -Force the usage of stack protectors for all functions +Enable stack protectors for all functions .. option:: -fstack-protector-strong -Use a strong heuristic to apply stack protectors to functions +Enable stack protectors for some functions vulnerable to stack smashing. Compared to -fstack-protector, this uses a stronger heuristic that includes functions containing arrays of any size (and any type), as well as any calls to alloca or the taking of an address from a local variable .. option:: -fstack-size-section, -fno-stack-size-section @@ -1962,6 +1996,10 @@ Specify the function to be called on overflow Process trigraph sequences +.. option:: -ftrivial-auto-var-init= + +Initialize trivial automatic stack variables: uninitialized (default) \| pattern + .. option:: -funique-section-names, -fno-unique-section-names Use unique names for text and data sections (ELF Only) @@ -2000,6 +2038,10 @@ Enable the loop vectorization passes .. option:: -fverbose-asm, -fno-verbose-asm +.. option:: -fvisibility-global-new-delete-hidden + +Give global C++ operator new and delete declarations hidden visibility + .. option:: -fvisibility-inlines-hidden Give inline C++ member functions hidden visibility by default @@ -2162,7 +2204,7 @@ Link stack frames through backchain on System Z .. option:: -mconsole -.. option:: -mcpu=, -mv5 (equivalent to -mcpu=hexagonv5), -mv55 (equivalent to -mcpu=hexagonv55), -mv60 (equivalent to -mcpu=hexagonv60), -mv62 (equivalent to -mcpu=hexagonv62), -mv65 (equivalent to -mcpu=hexagonv65) +.. option:: -mcpu=, -mv5 (equivalent to -mcpu=hexagonv5), -mv55 (equivalent to -mcpu=hexagonv55), -mv60 (equivalent to -mcpu=hexagonv60), -mv62 (equivalent to -mcpu=hexagonv62), -mv65 (equivalent to -mcpu=hexagonv65), -mv66 (equivalent to -mcpu=hexagonv66) .. option:: -mcrc, -mno-crc @@ -2196,6 +2238,8 @@ Enable merging of globals .. option:: -mhwdiv=, --mhwdiv , --mhwdiv= +.. option:: -mhwmult= + .. option:: -miamcu, -mno-iamcu Use Intel MCU ABI @@ -2272,6 +2316,8 @@ Select return address signing scope Use software floating point +.. option:: -mspeculative-load-hardening, -mno-speculative-load-hardening + .. option:: -mstack-alignment= Set the stack alignment @@ -2296,6 +2342,10 @@ The thread model to use, e.g. posix, single (posix by default) .. option:: -mthumb, -mno-thumb +.. option:: -mtls-direct-seg-refs, -mno-tls-direct-seg-refs + +Enable direct TLS access through segment registers (default) + .. option:: -mtune= .. option:: -mtvos-version-min=, -mappletvos-version-min= @@ -2314,50 +2364,6 @@ The thread model to use, e.g. posix, single (posix by default) AARCH64 ------- -.. option:: -ffixed-x1 - -Reserve the x1 register (AArch64 only) - -.. option:: -ffixed-x2 - -Reserve the x2 register (AArch64 only) - -.. option:: -ffixed-x3 - -Reserve the x3 register (AArch64 only) - -.. option:: -ffixed-x4 - -Reserve the x4 register (AArch64 only) - -.. option:: -ffixed-x5 - -Reserve the x5 register (AArch64 only) - -.. option:: -ffixed-x6 - -Reserve the x6 register (AArch64 only) - -.. option:: -ffixed-x7 - -Reserve the x7 register (AArch64 only) - -.. option:: -ffixed-x18 - -Reserve the x18 register (AArch64 only) - -.. option:: -ffixed-x20 - -Reserve the x20 register (AArch64 only) - -.. option:: -fcall-saved-x8 - -Make the x8 register call-saved (AArch64 only) - -.. option:: -fcall-saved-x9 - -Make the x9 register call-saved (AArch64 only) - .. option:: -fcall-saved-x10 Make the x10 register call-saved (AArch64 only) @@ -2386,6 +2392,50 @@ Make the x15 register call-saved (AArch64 only) Make the x18 register call-saved (AArch64 only) +.. option:: -fcall-saved-x8 + +Make the x8 register call-saved (AArch64 only) + +.. option:: -fcall-saved-x9 + +Make the x9 register call-saved (AArch64 only) + +.. option:: -ffixed-x1 + +Reserve the 1 register (AArch64 only) + +.. option:: -ffixed-x18 + +Reserve the 18 register (AArch64 only) + +.. option:: -ffixed-x2 + +Reserve the 2 register (AArch64 only) + +.. option:: -ffixed-x20 + +Reserve the 20 register (AArch64 only) + +.. option:: -ffixed-x3 + +Reserve the 3 register (AArch64 only) + +.. option:: -ffixed-x4 + +Reserve the 4 register (AArch64 only) + +.. option:: -ffixed-x5 + +Reserve the 5 register (AArch64 only) + +.. option:: -ffixed-x6 + +Reserve the 6 register (AArch64 only) + +.. option:: -ffixed-x7 + +Reserve the 7 register (AArch64 only) + .. option:: -mfix-cortex-a53-835769, -mno-fix-cortex-a53-835769 Workaround Cortex-A53 erratum 835769 (AArch64 only) @@ -2396,6 +2446,14 @@ Generate code which only uses the general purpose registers (AArch64 only) AMDGPU ------ +.. option:: -mcode-object-v3, -mno-code-object-v3 + +Enable code object v3 (AMDGPU only) + +.. option:: -msram-ecc, -mno-sram-ecc + +Enable SRAM ECC (AMDGPU only) + .. option:: -mxnack, -mno-xnack Enable XNACK (AMDGPU only) @@ -2594,6 +2652,8 @@ WebAssembly .. option:: -msimd128, -mno-simd128 +.. option:: -munimplemented-simd128, -mno-unimplemented-simd128 + X86 --- .. option:: -m3dnow, -mno-3dnow @@ -2811,6 +2871,10 @@ ___________ .. option:: -ggdb3 +.. option:: -gline-directives-only + +Emit debug line info directives only + .. option:: -gline-tables-only, -g1, -gmlt Emit debug line number tables only @@ -2841,10 +2905,16 @@ Embed source text in DWARF debug sections .. option:: -gpubnames, -gno-pubnames -.. option:: -grecord-command-line, -grecord-gcc-switches, -gno-record-command-line, -gno-record-gcc-switches +.. option:: -grecord-command-line, -gno-record-command-line, -grecord-gcc-switches .. option:: -gsplit-dwarf +.. program:: clang1 +.. option:: -gsplit-dwarf= +.. program:: clang + +Set DWARF fission mode to either 'split' or 'single' + .. option:: -gstrict-dwarf, -gno-strict-dwarf .. option:: -gz diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 1fe1dd39948a..b792db2852a8 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -103,13 +103,6 @@ def ObjCInstanceMethod : SubsetSubjectisInstanceMethod()}], "Objective-C instance methods">; -def ObjCInterfaceDeclInitMethod : SubsetSubjectgetMethodFamily() == OMF_init && - (isa(S->getDeclContext()) || - (isa(S->getDeclContext()) && - cast(S->getDeclContext())->IsClassExtension()))}], - "init methods of interface or class extension declarations">; - def Struct : SubsetSubjectisUnion()}], "structs">; @@ -329,6 +322,7 @@ def TargetMSP430 : TargetArch<["msp430"]>; def TargetRISCV : TargetArch<["riscv32", "riscv64"]>; def TargetX86 : TargetArch<["x86"]>; def TargetAnyX86 : TargetArch<["x86", "x86_64"]>; +def TargetWebAssembly : TargetArch<["wasm32", "wasm64"]>; def TargetWindows : TargetArch<["x86", "x86_64", "arm", "thumb", "aarch64"]> { let OSes = ["Win32"]; } @@ -1500,6 +1494,22 @@ def AMDGPUNumVGPR : InheritableAttr { let Subjects = SubjectList<[Function], ErrorDiag, "kernel functions">; } +def WebAssemblyImportModule : InheritableAttr, + TargetSpecificAttr { + let Spellings = [Clang<"import_module">]; + let Args = [StringArgument<"ImportModule">]; + let Documentation = [WebAssemblyImportModuleDocs]; + let Subjects = SubjectList<[Function], ErrorDiag>; +} + +def WebAssemblyImportName : InheritableAttr, + TargetSpecificAttr { + let Spellings = [Clang<"import_name">]; + let Args = [StringArgument<"ImportName">]; + let Documentation = [WebAssemblyImportNameDocs]; + let Subjects = SubjectList<[Function], ErrorDiag>; +} + def NoSplitStack : InheritableAttr { let Spellings = [GCC<"no_split_stack">]; let Subjects = SubjectList<[Function], ErrorDiag>; @@ -1745,7 +1755,7 @@ def ObjCExplicitProtocolImpl : InheritableAttr { def ObjCDesignatedInitializer : Attr { let Spellings = [Clang<"objc_designated_initializer">]; - let Subjects = SubjectList<[ObjCInterfaceDeclInitMethod], ErrorDiag>; + let Subjects = SubjectList<[ObjCMethod], ErrorDiag>; let Documentation = [Undocumented]; } diff --git a/include/clang/Basic/AttrDocs.td b/include/clang/Basic/AttrDocs.td index 5773a92c9c15..94c8343d2368 100644 --- a/include/clang/Basic/AttrDocs.td +++ b/include/clang/Basic/AttrDocs.td @@ -3652,7 +3652,40 @@ definition ( For more information see `gcc documentation `_ or `msvc documentation `_. -}]; +}]; } + +def WebAssemblyImportModuleDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +Clang supports the ``__attribute__((import_module()))`` +attribute for the WebAssembly target. This attribute may be attached to a +function declaration, where it modifies how the symbol is to be imported +within the WebAssembly linking environment. + +WebAssembly imports use a two-level namespace scheme, consisting of a module +name, which typically identifies a module from which to import, and a field +name, which typically identifies a field from that module to import. By +default, module names for C/C++ symbols are assigned automatically by the +linker. This attribute can be used to override the default behavior, and +reuqest a specific module name be used instead. + }]; +} + +def WebAssemblyImportNameDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +Clang supports the ``__attribute__((import_name()))`` +attribute for the WebAssembly target. This attribute may be attached to a +function declaration, where it modifies how the symbol is to be imported +within the WebAssembly linking environment. + +WebAssembly imports use a two-level namespace scheme, consisting of a module +name, which typically identifies a module from which to import, and a field +name, which typically identifies a field from that module to import. By +default, field names for C/C++ symbols are the same as their C/C++ symbol +names. This attribute can be used to override the default behavior, and +reuqest a specific field name be used instead. + }]; } def ArtificialDocs : Documentation { diff --git a/include/clang/Basic/BuiltinsAArch64.def b/include/clang/Basic/BuiltinsAArch64.def index 690d547f7f3e..054662e68831 100644 --- a/include/clang/Basic/BuiltinsAArch64.def +++ b/include/clang/Basic/BuiltinsAArch64.def @@ -204,8 +204,8 @@ TARGET_HEADER_BUILTIN(_InterlockedDecrement64_rel, "LLiLLiD*", "nh", "intrin.h", TARGET_HEADER_BUILTIN(_ReadWriteBarrier, "v", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(__getReg, "ULLii", "nh", "intrin.h", ALL_MS_LANGUAGES, "") -TARGET_HEADER_BUILTIN(_ReadStatusReg, "ii", "nh", "intrin.h", ALL_MS_LANGUAGES, "") -TARGET_HEADER_BUILTIN(_WriteStatusReg, "vii", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_ReadStatusReg, "LLii", "nh", "intrin.h", ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(_WriteStatusReg, "viLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_AddressOfReturnAddress, "v*", "nh", "intrin.h", ALL_MS_LANGUAGES, "") #undef BUILTIN diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index b71f65d146ca..7ef57b02fe1c 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -3460,6 +3460,9 @@ def warn_objc_secondary_init_missing_init_call : Warning< def warn_objc_implementation_missing_designated_init_override : Warning< "method override for the designated initializer of the superclass %objcinstance0 not found">, InGroup; +def err_designated_init_attr_non_init : Error< + "'objc_designated_initializer' attribute only applies to init methods " + "of interface or class extension declarations">; // objc_bridge attribute diagnostics. def err_objc_attr_not_id : Error< diff --git a/include/clang/Basic/OpenCLOptions.h b/include/clang/Basic/OpenCLOptions.h index cc4e9922dca0..c76fa88092b9 100644 --- a/include/clang/Basic/OpenCLOptions.h +++ b/include/clang/Basic/OpenCLOptions.h @@ -15,6 +15,7 @@ #ifndef LLVM_CLANG_BASIC_OPENCLOPTIONS_H #define LLVM_CLANG_BASIC_OPENCLOPTIONS_H +#include "clang/Basic/LangOptions.h" #include "llvm/ADT/StringMap.h" namespace clang { @@ -42,25 +43,29 @@ class OpenCLOptions { // Is supported as either an extension or an (optional) core feature for // OpenCL version \p CLVer. - bool isSupported(llvm::StringRef Ext, unsigned CLVer) const { + bool isSupported(llvm::StringRef Ext, LangOptions LO) const { + // In C++ mode all extensions should work at least as in v2.0. + auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion; auto I = OptMap.find(Ext)->getValue(); return I.Supported && I.Avail <= CLVer; } // Is supported (optional) OpenCL core features for OpenCL version \p CLVer. // For supported extension, return false. - bool isSupportedCore(llvm::StringRef Ext, unsigned CLVer) const { + bool isSupportedCore(llvm::StringRef Ext, LangOptions LO) const { + // In C++ mode all extensions should work at least as in v2.0. + auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion; auto I = OptMap.find(Ext)->getValue(); - return I.Supported && I.Avail <= CLVer && - I.Core != ~0U && CLVer >= I.Core; + return I.Supported && I.Avail <= CLVer && I.Core != ~0U && CLVer >= I.Core; } // Is supported OpenCL extension for OpenCL version \p CLVer. // For supported (optional) core feature, return false. - bool isSupportedExtension(llvm::StringRef Ext, unsigned CLVer) const { + bool isSupportedExtension(llvm::StringRef Ext, LangOptions LO) const { + // In C++ mode all extensions should work at least as in v2.0. + auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion; auto I = OptMap.find(Ext)->getValue(); - return I.Supported && I.Avail <= CLVer && - (I.Core == ~0U || CLVer < I.Core); + return I.Supported && I.Avail <= CLVer && (I.Core == ~0U || CLVer < I.Core); } void enable(llvm::StringRef Ext, bool V = true) { @@ -122,10 +127,10 @@ class OpenCLOptions { I->second.Enabled = false; } - void enableSupportedCore(unsigned CLVer) { - for (llvm::StringMap::iterator I = OptMap.begin(), - E = OptMap.end(); I != E; ++I) - if (isSupportedCore(I->getKey(), CLVer)) + void enableSupportedCore(LangOptions LO) { + for (llvm::StringMap::iterator I = OptMap.begin(), E = OptMap.end(); + I != E; ++I) + if (isSupportedCore(I->getKey(), LO)) I->second.Enabled = true; } @@ -133,6 +138,6 @@ class OpenCLOptions { friend class ASTReader; }; -} // end namespace clang +} // end namespace clang #endif diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index d8155a95775c..d02d9744d78d 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -552,9 +552,9 @@ def cuda_compile_host_device : Flag<["--"], "cuda-compile-host-device">, HelpText<"Compile CUDA code for both host and device (default). Has no " "effect on non-CUDA compilations.">; def cuda_include_ptx_EQ : Joined<["--"], "cuda-include-ptx=">, Flags<[DriverOption]>, - HelpText<"Include PTX for the follwing GPU architecture (e.g. sm_35) or 'all'. May be specified more than once.">; + HelpText<"Include PTX for the following GPU architecture (e.g. sm_35) or 'all'. May be specified more than once.">; def no_cuda_include_ptx_EQ : Joined<["--"], "no-cuda-include-ptx=">, Flags<[DriverOption]>, - HelpText<"Do not include PTX for the follwing GPU architecture (e.g. sm_35) or 'all'. May be specified more than once.">; + HelpText<"Do not include PTX for the following GPU architecture (e.g. sm_35) or 'all'. May be specified more than once.">; def cuda_gpu_arch_EQ : Joined<["--"], "cuda-gpu-arch=">, Flags<[DriverOption]>, HelpText<"CUDA GPU architecture (e.g. sm_35). May be specified more than once.">; def hip_link : Flag<["--"], "hip-link">, diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 438ff0e2ed45..46e4431913e7 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -360,11 +360,6 @@ class Parser : public CodeCompletionHandler { /// just a regular sub-expression. SourceLocation ExprStatementTokLoc; - /// Tests whether an expression value is discarded based on token lookahead. - /// It will return true if the lexer is currently processing the }) - /// terminating a GNU statement expression and false otherwise. - bool isExprValueDiscarded(); - public: Parser(Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies); ~Parser() override; diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index e5b7465820a9..ced5773f0c07 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -1369,7 +1369,6 @@ class Sema { void PopCompoundScope(); sema::CompoundScopeInfo &getCurCompoundScope() const; - bool isCurCompoundStmtAStmtExpr() const; bool hasAnyUnrecoverableErrorsInThisFunction() const; @@ -3690,17 +3689,16 @@ class Sema { return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation()); } FullExprArg MakeFullExpr(Expr *Arg, SourceLocation CC) { - return FullExprArg( - ActOnFinishFullExpr(Arg, CC, /*DiscardedValue*/ false).get()); + return FullExprArg(ActOnFinishFullExpr(Arg, CC).get()); } FullExprArg MakeFullDiscardedValueExpr(Expr *Arg) { ExprResult FE = - ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(), - /*DiscardedValue*/ true); + ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(), + /*DiscardedValue*/ true); return FullExprArg(FE.get()); } - StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue = true); + StmtResult ActOnExprStmt(ExprResult Arg); StmtResult ActOnExprStmtError(); StmtResult ActOnNullStmt(SourceLocation SemiLoc, @@ -5346,12 +5344,13 @@ class Sema { CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference); - ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue) { - return ActOnFinishFullExpr( - Expr, Expr ? Expr->getExprLoc() : SourceLocation(), DiscardedValue); + ExprResult ActOnFinishFullExpr(Expr *Expr) { + return ActOnFinishFullExpr(Expr, Expr ? Expr->getExprLoc() + : SourceLocation()); } ExprResult ActOnFinishFullExpr(Expr *Expr, SourceLocation CC, - bool DiscardedValue, bool IsConstexpr = false); + bool DiscardedValue = false, + bool IsConstexpr = false); StmtResult ActOnFinishFullStmt(Stmt *Stmt); // Marks SS invalid if it represents an incomplete type. diff --git a/lib/Basic/Targets/PPC.h b/lib/Basic/Targets/PPC.h index 058970a0e098..cbe7a9a2fa85 100644 --- a/lib/Basic/Targets/PPC.h +++ b/lib/Basic/Targets/PPC.h @@ -331,9 +331,15 @@ class LLVM_LIBRARY_VISIBILITY PPC32TargetInfo : public PPCTargetInfo { break; } - if (getTriple().isOSFreeBSD()) { + switch (getTriple().getOS()) { + case llvm::Triple::FreeBSD: + case llvm::Triple::NetBSD: + case llvm::Triple::OpenBSD: LongDoubleWidth = LongDoubleAlign = 64; LongDoubleFormat = &llvm::APFloat::IEEEdouble(); + break; + default: + break; } // PPC32 supports atomics up to 4 bytes. diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index a718f2f19aa6..ccc657493b28 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -7052,19 +7052,16 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID, llvm::Value *Metadata = llvm::MetadataAsValue::get(Context, RegName); llvm::Type *RegisterType = Int64Ty; - llvm::Type *ValueType = Int32Ty; llvm::Type *Types[] = { RegisterType }; if (BuiltinID == AArch64::BI_ReadStatusReg) { llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::read_register, Types); - llvm::Value *Call = Builder.CreateCall(F, Metadata); - return Builder.CreateTrunc(Call, ValueType); + return Builder.CreateCall(F, Metadata); } llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::write_register, Types); llvm::Value *ArgValue = EmitScalarExpr(E->getArg(1)); - ArgValue = Builder.CreateZExt(ArgValue, RegisterType); return Builder.CreateCall(F, { Metadata, ArgValue }); } diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 5959d889b455..b98657ffd800 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -1631,11 +1631,15 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { ? LangOptions::TrivialAutoVarInitKind::Uninitialized : getContext().getLangOpts().getTrivialAutoVarInit())); - auto initializeWhatIsTechnicallyUninitialized = [&]() { + auto initializeWhatIsTechnicallyUninitialized = [&](Address Loc) { if (trivialAutoVarInit == LangOptions::TrivialAutoVarInitKind::Uninitialized) return; + // Only initialize a __block's storage: we always initialize the header. + if (emission.IsEscapingByRef) + Loc = emitBlockByrefAddress(Loc, &D, /*follow=*/false); + CharUnits Size = getContext().getTypeSizeInChars(type); if (!Size.isZero()) { switch (trivialAutoVarInit) { @@ -1713,7 +1717,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { }; if (isTrivialInitializer(Init)) { - initializeWhatIsTechnicallyUninitialized(); + initializeWhatIsTechnicallyUninitialized(Loc); return; } @@ -1727,7 +1731,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { } if (!constant) { - initializeWhatIsTechnicallyUninitialized(); + initializeWhatIsTechnicallyUninitialized(Loc); LValue lv = MakeAddrLValue(Loc, type); lv.setNonGC(true); return EmitExprAsInit(Init, &D, lv, capturedByInit); diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 244738042cef..2ac59fb4de25 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -3762,13 +3762,15 @@ static bool isVarDeclStrongDefinition(const ASTContext &Context, } } - // Microsoft's link.exe doesn't support alignments greater than 32 for common - // symbols, so symbols with greater alignment requirements cannot be common. + // Microsoft's link.exe doesn't support alignments greater than 32 bytes for + // common symbols, so symbols with greater alignment requirements cannot be + // common. // Other COFF linkers (ld.bfd and LLD) support arbitrary power-of-two // alignments for common symbols via the aligncomm directive, so this // restriction only applies to MSVC environments. if (Context.getTargetInfo().getTriple().isKnownWindowsMSVCEnvironment() && - Context.getTypeAlignIfKnown(D->getType()) > 32) + Context.getTypeAlignIfKnown(D->getType()) > + Context.toBits(CharUnits::fromQuantity(32))) return true; return false; diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index f5a770ed9d84..94fccb15ff6e 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -761,6 +761,22 @@ class WebAssemblyTargetCodeGenInfo final : public TargetCodeGenInfo { void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) const override { + TargetCodeGenInfo::setTargetAttributes(D, GV, CGM); + if (const auto *FD = dyn_cast_or_null(D)) { + if (const auto *Attr = FD->getAttr()) { + llvm::Function *Fn = cast(GV); + llvm::AttrBuilder B; + B.addAttribute("wasm-import-module", Attr->getImportModule()); + Fn->addAttributes(llvm::AttributeList::FunctionIndex, B); + } + if (const auto *Attr = FD->getAttr()) { + llvm::Function *Fn = cast(GV); + llvm::AttrBuilder B; + B.addAttribute("wasm-import-name", Attr->getImportName()); + Fn->addAttributes(llvm::AttributeList::FunctionIndex, B); + } + } + if (auto *FD = dyn_cast_or_null(D)) { llvm::Function *Fn = cast(GV); if (!FD->doesThisDeclarationHaveABody() && !FD->hasPrototype()) diff --git a/lib/Driver/ToolChains/MSVC.cpp b/lib/Driver/ToolChains/MSVC.cpp index 7e34b0df5c8c..a164fd68e22e 100644 --- a/lib/Driver/ToolChains/MSVC.cpp +++ b/lib/Driver/ToolChains/MSVC.cpp @@ -1408,10 +1408,10 @@ static void TranslateOptArg(Arg *A, llvm::opt::DerivedArgList &DAL, DAL.AddFlagArg( A, Opts.getOption(options::OPT_fno_omit_frame_pointer)); } else { - // Don't warn about /Oy- in 64-bit builds (where + // Don't warn about /Oy- in x86-64 builds (where // SupportsForcingFramePointer is false). The flag having no effect // there is a compiler-internal optimization, and people shouldn't have - // to special-case their build files for 64-bit clang-cl. + // to special-case their build files for x86-64 clang-cl. A->claim(); } break; @@ -1442,8 +1442,8 @@ MSVCToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args, DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs()); const OptTable &Opts = getDriver().getOpts(); - // /Oy and /Oy- only has an effect under X86-32. - bool SupportsForcingFramePointer = getArch() == llvm::Triple::x86; + // /Oy and /Oy- don't have an effect on X86-64 + bool SupportsForcingFramePointer = getArch() != llvm::Triple::x86_64; // The -O[12xd] flag actually expands to several flags. We must desugar the // flags so that options embedded can be negated. For example, the '-O2' flag diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 66807b097d40..4cde22ce9aa4 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -1059,10 +1059,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI, // OpenCL definitions. if (LangOpts.OpenCL) { -#define OPENCLEXT(Ext) \ - if (TI.getSupportedOpenCLOpts().isSupported(#Ext, \ - LangOpts.OpenCLVersion)) \ - Builder.defineMacro(#Ext); +#define OPENCLEXT(Ext) \ + if (TI.getSupportedOpenCLOpts().isSupported(#Ext, LangOpts)) \ + Builder.defineMacro(#Ext); #include "clang/Basic/OpenCLExtensions.def" auto Arch = TI.getTriple().getArch(); diff --git a/lib/Headers/intrin.h b/lib/Headers/intrin.h index c86f41faeb88..966258bab4b3 100644 --- a/lib/Headers/intrin.h +++ b/lib/Headers/intrin.h @@ -564,8 +564,8 @@ __nop(void) { #if defined(__aarch64__) unsigned __int64 __getReg(int); long _InterlockedAdd(long volatile *Addend, long Value); -int _ReadStatusReg(int); -void _WriteStatusReg(int, int); +__int64 _ReadStatusReg(int); +void _WriteStatusReg(int, __int64); static inline unsigned short _byteswap_ushort (unsigned short val) { return __builtin_bswap16(val); diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index bd55f7179399..c8d7bda3d6e9 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -2741,7 +2741,7 @@ StmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) { // Otherwise, eat the semicolon. ExpectAndConsumeSemi(diag::err_expected_semi_after_expr); - return Actions.ActOnExprStmt(Res, isExprValueDiscarded()); + return Actions.ActOnExprStmt(Res); } ExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) { diff --git a/lib/Parse/ParseOpenMP.cpp b/lib/Parse/ParseOpenMP.cpp index dd2a8aae9f2f..17c3fa3cf2aa 100644 --- a/lib/Parse/ParseOpenMP.cpp +++ b/lib/Parse/ParseOpenMP.cpp @@ -314,7 +314,7 @@ Parser::ParseOpenMPDeclareReductionDirective(AccessSpecifier AS) { Actions.ActOnOpenMPDeclareReductionCombinerStart(getCurScope(), D); ExprResult CombinerResult = Actions.ActOnFinishFullExpr(ParseAssignmentExpression().get(), - D->getLocation(), /*DiscardedValue*/ false); + D->getLocation(), /*DiscardedValue=*/true); Actions.ActOnOpenMPDeclareReductionCombinerEnd(D, CombinerResult.get()); if (CombinerResult.isInvalid() && Tok.isNot(tok::r_paren) && @@ -356,7 +356,7 @@ Parser::ParseOpenMPDeclareReductionDirective(AccessSpecifier AS) { if (Actions.getLangOpts().CPlusPlus) { InitializerResult = Actions.ActOnFinishFullExpr( ParseAssignmentExpression().get(), D->getLocation(), - /*DiscardedValue*/ false); + /*DiscardedValue=*/true); } else { ConsumeToken(); ParseOpenMPReductionInitializerForDecl(OmpPrivParm); @@ -364,7 +364,7 @@ Parser::ParseOpenMPDeclareReductionDirective(AccessSpecifier AS) { } else { InitializerResult = Actions.ActOnFinishFullExpr( ParseAssignmentExpression().get(), D->getLocation(), - /*DiscardedValue*/ false); + /*DiscardedValue=*/true); } Actions.ActOnOpenMPDeclareReductionInitializerEnd( D, InitializerResult.get(), OmpPrivParm); @@ -1455,7 +1455,7 @@ ExprResult Parser::ParseOpenMPParensExpr(StringRef ClauseName, ExprResult LHS(ParseCastExpression( /*isUnaryExpression=*/false, /*isAddressOfOperand=*/false, NotTypeCast)); ExprResult Val(ParseRHSOfBinaryExpression(LHS, prec::Conditional)); - Val = Actions.ActOnFinishFullExpr(Val.get(), ELoc, /*DiscardedValue*/ false); + Val = Actions.ActOnFinishFullExpr(Val.get(), ELoc); // Parse ')'. RLoc = Tok.getLocation(); @@ -1711,8 +1711,7 @@ OMPClause *Parser::ParseOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind, SourceLocation ELoc = Tok.getLocation(); ExprResult LHS(ParseCastExpression(false, false, NotTypeCast)); Val = ParseRHSOfBinaryExpression(LHS, prec::Conditional); - Val = - Actions.ActOnFinishFullExpr(Val.get(), ELoc, /*DiscardedValue*/ false); + Val = Actions.ActOnFinishFullExpr(Val.get(), ELoc); } // Parse ')'. @@ -1997,8 +1996,7 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind, Data.ColonLoc = Tok.getLocation(); SourceLocation ELoc = ConsumeToken(); ExprResult Tail = ParseAssignmentExpression(); - Tail = - Actions.ActOnFinishFullExpr(Tail.get(), ELoc, /*DiscardedValue*/ false); + Tail = Actions.ActOnFinishFullExpr(Tail.get(), ELoc); if (Tail.isUsable()) Data.TailExpr = Tail.get(); else diff --git a/lib/Parse/ParsePragma.cpp b/lib/Parse/ParsePragma.cpp index 380eb64997a7..7e9b1011e81a 100644 --- a/lib/Parse/ParsePragma.cpp +++ b/lib/Parse/ParsePragma.cpp @@ -693,13 +693,12 @@ void Parser::HandlePragmaOpenCLExtension() { if (Name == "all") { if (State == Disable) { Opt.disableAll(); - Opt.enableSupportedCore(getLangOpts().OpenCLVersion); + Opt.enableSupportedCore(getLangOpts()); } else { PP.Diag(NameLoc, diag::warn_pragma_expected_predicate) << 1; } } else if (State == Begin) { - if (!Opt.isKnown(Name) || - !Opt.isSupported(Name, getLangOpts().OpenCLVersion)) { + if (!Opt.isKnown(Name) || !Opt.isSupported(Name, getLangOpts())) { Opt.support(Name); } Actions.setCurrentOpenCLExtension(Name); @@ -709,9 +708,9 @@ void Parser::HandlePragmaOpenCLExtension() { Actions.setCurrentOpenCLExtension(""); } else if (!Opt.isKnown(Name)) PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << Ident; - else if (Opt.isSupportedExtension(Name, getLangOpts().OpenCLVersion)) + else if (Opt.isSupportedExtension(Name, getLangOpts())) Opt.enable(Name, State == Enable); - else if (Opt.isSupportedCore(Name, getLangOpts().OpenCLVersion)) + else if (Opt.isSupportedCore(Name, getLangOpts())) PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << Ident; else PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << Ident; diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 2974e6a245b0..313793c3e8fb 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -439,7 +439,7 @@ StmtResult Parser::ParseExprStatement() { // Otherwise, eat the semicolon. ExpectAndConsumeSemi(diag::err_expected_semi_after_expr); - return Actions.ActOnExprStmt(Expr, isExprValueDiscarded()); + return Actions.ActOnExprStmt(Expr); } /// ParseSEHTryBlockCommon @@ -958,16 +958,6 @@ bool Parser::ConsumeNullStmt(StmtVector &Stmts) { return true; } -bool Parser::isExprValueDiscarded() { - if (Actions.isCurCompoundStmtAStmtExpr()) { - // Look to see if the next two tokens close the statement expression; - // if so, this expression statement is the last statement in a - // statment expression. - return Tok.isNot(tok::r_brace) || NextToken().isNot(tok::r_paren); - } - return true; -} - /// ParseCompoundStatementBody - Parse a sequence of statements and invoke the /// ActOnCompoundStmt action. This expects the '{' to be the current token, and /// consume the '}' at the end of the block. It does not manipulate the scope @@ -1072,7 +1062,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { // Eat the semicolon at the end of stmt and convert the expr into a // statement. ExpectAndConsumeSemi(diag::err_expected_semi_after_expr); - R = Actions.ActOnExprStmt(Res, isExprValueDiscarded()); + R = Actions.ActOnExprStmt(Res); } } @@ -1708,16 +1698,8 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) { if (!Value.isInvalid()) { if (ForEach) FirstPart = Actions.ActOnForEachLValueExpr(Value.get()); - else { - // We already know this is not an init-statement within a for loop, so - // if we are parsing a C++11 range-based for loop, we should treat this - // expression statement as being a discarded value expression because - // we will err below. This way we do not warn on an unused expression - // that was an error in the first place, like with: for (expr : expr); - bool IsRangeBasedFor = - getLangOpts().CPlusPlus11 && !ForEach && Tok.is(tok::colon); - FirstPart = Actions.ActOnExprStmt(Value, !IsRangeBasedFor); - } + else + FirstPart = Actions.ActOnExprStmt(Value); } if (Tok.is(tok::semi)) { diff --git a/lib/Parse/ParseStmtAsm.cpp b/lib/Parse/ParseStmtAsm.cpp index 9b96c5150e56..3f5af7d44f36 100644 --- a/lib/Parse/ParseStmtAsm.cpp +++ b/lib/Parse/ParseStmtAsm.cpp @@ -637,7 +637,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { // Filter out "fpsw" and "mxcsr". They aren't valid GCC asm clobber // constraints. Clang always adds fpsr to the clobber list anyway. llvm::erase_if(Clobbers, [](const std::string &C) { - return C == "fpsw" || C == "mxcsr"; + return C == "fpsr" || C == "mxcsr"; }); // Build the vector of clobber StringRefs. diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 9fa39968625a..9d33ec519092 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -256,11 +256,12 @@ void Sema::Initialize() { // Initialize predefined OpenCL types and supported extensions and (optional) // core features. if (getLangOpts().OpenCL) { - getOpenCLOptions().addSupport(Context.getTargetInfo().getSupportedOpenCLOpts()); - getOpenCLOptions().enableSupportedCore(getLangOpts().OpenCLVersion); + getOpenCLOptions().addSupport( + Context.getTargetInfo().getSupportedOpenCLOpts()); + getOpenCLOptions().enableSupportedCore(getLangOpts()); addImplicitTypedef("sampler_t", Context.OCLSamplerTy); addImplicitTypedef("event_t", Context.OCLEventTy); - if (getLangOpts().OpenCLVersion >= 200) { + if (getLangOpts().OpenCLCPlusPlus || getLangOpts().OpenCLVersion >= 200) { addImplicitTypedef("clk_event_t", Context.OCLClkEventTy); addImplicitTypedef("queue_t", Context.OCLQueueTy); addImplicitTypedef("reserve_id_t", Context.OCLReserveIDTy); diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 8dc1fdb76988..b2c727b5c483 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -10622,16 +10622,16 @@ static void AnalyzeCompoundAssignment(Sema &S, BinaryOperator *E) { // The below checks assume source is floating point. if (!ResultBT || !RBT || !RBT->isFloatingPoint()) return; - // If source is floating point but target is not. - if (!ResultBT->isFloatingPoint()) - return DiagnoseFloatingImpCast(S, E, E->getRHS()->getType(), - E->getExprLoc()); - - // If both source and target are floating points. - // Builtin FP kinds are ordered by increasing FP rank. - if (ResultBT->getKind() < RBT->getKind() && - // We don't want to warn for system macro. - !S.SourceMgr.isInSystemMacro(E->getOperatorLoc())) + // If source is floating point but target is an integer. + if (ResultBT->isInteger()) + DiagnoseImpCast(S, E, E->getRHS()->getType(), E->getLHS()->getType(), + E->getExprLoc(), diag::warn_impcast_float_integer); + // If both source and target are floating points. Builtin FP kinds are ordered + // by increasing FP rank. FIXME: except _Float16, we currently emit a bogus + // warning. + else if (ResultBT->isFloatingPoint() && ResultBT->getKind() < RBT->getKind() && + // We don't want to warn for system macro. + !S.SourceMgr.isInSystemMacro(E->getOperatorLoc())) // warn about dropping FP rank. DiagnoseImpCast(S, E->getRHS(), E->getLHS()->getType(), E->getOperatorLoc(), diag::warn_impcast_float_result_precision); diff --git a/lib/Sema/SemaCoroutine.cpp b/lib/Sema/SemaCoroutine.cpp index 181efa6d3dd0..e282bb62f032 100644 --- a/lib/Sema/SemaCoroutine.cpp +++ b/lib/Sema/SemaCoroutine.cpp @@ -646,7 +646,7 @@ bool Sema::ActOnCoroutineBodyStart(Scope *SC, SourceLocation KWLoc, return StmtError(); Suspend = BuildResolvedCoawaitExpr(Loc, Suspend.get(), /*IsImplicit*/ true); - Suspend = ActOnFinishFullExpr(Suspend.get(), /*DiscardedValue*/ false); + Suspend = ActOnFinishFullExpr(Suspend.get()); if (Suspend.isInvalid()) { Diag(Loc, diag::note_coroutine_promise_suspend_implicitly_required) << ((Name == "initial_suspend") ? 0 : 1); @@ -867,7 +867,7 @@ StmtResult Sema::BuildCoreturnStmt(SourceLocation Loc, Expr *E, if (PC.isInvalid()) return StmtError(); - Expr *PCE = ActOnFinishFullExpr(PC.get(), /*DiscardedValue*/ false).get(); + Expr *PCE = ActOnFinishFullExpr(PC.get()).get(); Stmt *Res = new (Context) CoreturnStmt(Loc, E, PCE, IsImplicit); return Res; @@ -1236,7 +1236,7 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() { ExprResult NewExpr = S.ActOnCallExpr(S.getCurScope(), NewRef.get(), Loc, NewArgs, Loc); - NewExpr = S.ActOnFinishFullExpr(NewExpr.get(), /*DiscardedValue*/ false); + NewExpr = S.ActOnFinishFullExpr(NewExpr.get()); if (NewExpr.isInvalid()) return false; @@ -1262,8 +1262,7 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() { ExprResult DeleteExpr = S.ActOnCallExpr(S.getCurScope(), DeleteRef.get(), Loc, DeleteArgs, Loc); - DeleteExpr = - S.ActOnFinishFullExpr(DeleteExpr.get(), /*DiscardedValue*/ false); + DeleteExpr = S.ActOnFinishFullExpr(DeleteExpr.get()); if (DeleteExpr.isInvalid()) return false; @@ -1348,8 +1347,7 @@ bool CoroutineStmtBuilder::makeOnException() { ExprResult UnhandledException = buildPromiseCall(S, Fn.CoroutinePromise, Loc, "unhandled_exception", None); - UnhandledException = S.ActOnFinishFullExpr(UnhandledException.get(), Loc, - /*DiscardedValue*/ false); + UnhandledException = S.ActOnFinishFullExpr(UnhandledException.get(), Loc); if (UnhandledException.isInvalid()) return false; @@ -1402,8 +1400,7 @@ bool CoroutineStmtBuilder::makeGroDeclAndReturnStmt() { "get_return_object type must no longer be dependent"); if (FnRetType->isVoidType()) { - ExprResult Res = - S.ActOnFinishFullExpr(this->ReturnValue, Loc, /*DiscardedValue*/ false); + ExprResult Res = S.ActOnFinishFullExpr(this->ReturnValue, Loc); if (Res.isInvalid()) return false; @@ -1435,7 +1432,7 @@ bool CoroutineStmtBuilder::makeGroDeclAndReturnStmt() { if (Res.isInvalid()) return false; - Res = S.ActOnFinishFullExpr(Res.get(), /*DiscardedValue*/ false); + Res = S.ActOnFinishFullExpr(Res.get()); if (Res.isInvalid()) return false; diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 23c99d45a78d..7ddf2e88b787 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -11200,9 +11200,9 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { // struct T { S a, b; } t = { Temp(), Temp() } // // we should destroy the first Temp before constructing the second. - ExprResult Result = - ActOnFinishFullExpr(Init, VDecl->getLocation(), - /*DiscardedValue*/ false, VDecl->isConstexpr()); + ExprResult Result = ActOnFinishFullExpr(Init, VDecl->getLocation(), + false, + VDecl->isConstexpr()); if (Result.isInvalid()) { VDecl->setInvalidDecl(); return; diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 139ac8aab433..c4c3598ee7f3 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -5116,11 +5116,22 @@ static void handleObjCBridgeRelatedAttr(Sema &S, Decl *D, static void handleObjCDesignatedInitializer(Sema &S, Decl *D, const ParsedAttr &AL) { + DeclContext *Ctx = D->getDeclContext(); + + // This attribute can only be applied to methods in interfaces or class + // extensions. + if (!isa(Ctx) && + !(isa(Ctx) && + cast(Ctx)->IsClassExtension())) { + S.Diag(D->getLocation(), diag::err_designated_init_attr_non_init); + return; + } + ObjCInterfaceDecl *IFace; - if (auto *CatDecl = dyn_cast(D->getDeclContext())) + if (auto *CatDecl = dyn_cast(Ctx)) IFace = CatDecl->getClassInterface(); else - IFace = cast(D->getDeclContext()); + IFace = cast(Ctx); if (!IFace) return; @@ -5577,6 +5588,51 @@ static void handleAVRSignalAttr(Sema &S, Decl *D, const ParsedAttr &AL) { handleSimpleAttribute(S, D, AL); } +static void handleWebAssemblyImportModuleAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + if (!isFunctionOrMethod(D)) { + S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type) + << "'import_module'" << ExpectedFunction; + return; + } + + auto *FD = cast(D); + if (FD->isThisDeclarationADefinition()) { + S.Diag(D->getLocation(), diag::err_alias_is_definition) << FD << 0; + return; + } + + StringRef Str; + SourceLocation ArgLoc; + if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &ArgLoc)) + return; + + FD->addAttr(::new (S.Context) WebAssemblyImportModuleAttr( + AL.getRange(), S.Context, Str, + AL.getAttributeSpellingListIndex())); +} + +static void handleWebAssemblyImportNameAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + if (!isFunctionOrMethod(D)) { + S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type) + << "'import_name'" << ExpectedFunction; + return; + } + + auto *FD = cast(D); + if (FD->isThisDeclarationADefinition()) { + S.Diag(D->getLocation(), diag::err_alias_is_definition) << FD << 0; + return; + } + + StringRef Str; + SourceLocation ArgLoc; + if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &ArgLoc)) + return; + + FD->addAttr(::new (S.Context) WebAssemblyImportNameAttr( + AL.getRange(), S.Context, Str, + AL.getAttributeSpellingListIndex())); +} static void handleRISCVInterruptAttr(Sema &S, Decl *D, const ParsedAttr &AL) { @@ -6330,6 +6386,12 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, case ParsedAttr::AT_AVRSignal: handleAVRSignalAttr(S, D, AL); break; + case ParsedAttr::AT_WebAssemblyImportModule: + handleWebAssemblyImportModuleAttr(S, D, AL); + break; + case ParsedAttr::AT_WebAssemblyImportName: + handleWebAssemblyImportNameAttr(S, D, AL); + break; case ParsedAttr::AT_IBAction: handleSimpleAttribute(S, D, AL); break; @@ -7016,6 +7078,17 @@ void Sema::ProcessDeclAttributeList(Scope *S, Decl *D, } } } + + // Do this check after processing D's attributes because the attribute + // objc_method_family can change whether the given method is in the init + // family, and it can be applied after objc_designated_initializer. This is a + // bit of a hack, but we need it to be compatible with versions of clang that + // processed the attribute list in the wrong order. + if (D->hasAttr() && + cast(D)->getMethodFamily() != OMF_init) { + Diag(D->getLocation(), diag::err_designated_init_attr_non_init); + D->dropAttr(); + } } // Helper for delayed processing TransparentUnion attribute. diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 8b3556f715bf..950a63aa451b 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1205,7 +1205,7 @@ static bool checkTupleLikeDecomposition(Sema &S, E = Seq.Perform(S, Entity, Kind, Init); if (E.isInvalid()) return true; - E = S.ActOnFinishFullExpr(E.get(), Loc, /*DiscardedValue*/ false); + E = S.ActOnFinishFullExpr(E.get(), Loc); if (E.isInvalid()) return true; RefVD->setInit(E.get()); @@ -3686,7 +3686,7 @@ void Sema::ActOnFinishCXXInClassMemberInitializer(Decl *D, // C++11 [class.base.init]p7: // The initialization of each base and member constitutes a // full-expression. - Init = ActOnFinishFullExpr(Init.get(), InitLoc, /*DiscardedValue*/ false); + Init = ActOnFinishFullExpr(Init.get(), InitLoc); if (Init.isInvalid()) { FD->setInvalidDecl(); return; @@ -4044,8 +4044,7 @@ Sema::BuildMemberInitializer(ValueDecl *Member, Expr *Init, // C++11 [class.base.init]p7: // The initialization of each base and member constitutes a // full-expression. - MemberInit = ActOnFinishFullExpr(MemberInit.get(), InitRange.getBegin(), - /*DiscardedValue*/ false); + MemberInit = ActOnFinishFullExpr(MemberInit.get(), InitRange.getBegin()); if (MemberInit.isInvalid()) return true; @@ -4100,8 +4099,8 @@ Sema::BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, // C++11 [class.base.init]p7: // The initialization of each base and member constitutes a // full-expression. - DelegationInit = ActOnFinishFullExpr( - DelegationInit.get(), InitRange.getBegin(), /*DiscardedValue*/ false); + DelegationInit = ActOnFinishFullExpr(DelegationInit.get(), + InitRange.getBegin()); if (DelegationInit.isInvalid()) return true; @@ -4230,8 +4229,7 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, // C++11 [class.base.init]p7: // The initialization of each base and member constitutes a // full-expression. - BaseInit = ActOnFinishFullExpr(BaseInit.get(), InitRange.getBegin(), - /*DiscardedValue*/ false); + BaseInit = ActOnFinishFullExpr(BaseInit.get(), InitRange.getBegin()); if (BaseInit.isInvalid()) return true; diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 2bcd47abe356..db0c62630a9e 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -4723,9 +4723,8 @@ bool Sema::CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, if (Result.isInvalid()) return true; - Result = - ActOnFinishFullExpr(Result.getAs(), Param->getOuterLocStart(), - /*DiscardedValue*/ false); + Result = ActOnFinishFullExpr(Result.getAs(), + Param->getOuterLocStart()); if (Result.isInvalid()) return true; diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 8c89a3cee3db..cce7a216548f 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -7815,8 +7815,6 @@ ExprResult Sema::ActOnFinishFullExpr(Expr *FE, SourceLocation CC, FullExpr = IgnoredValueConversions(FullExpr.get()); if (FullExpr.isInvalid()) return ExprError(); - - DiagnoseUnusedExprResult(FullExpr.get()); } FullExpr = CorrectDelayedTyposInExpr(FullExpr.get()); diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index af233b96d69b..4e002a853dc2 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -1724,7 +1724,7 @@ ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation, /*NRVO=*/false), CurrentLocation, Src); if (!Init.isInvalid()) - Init = ActOnFinishFullExpr(Init.get(), /*DiscardedValue*/ false); + Init = ActOnFinishFullExpr(Init.get()); if (Init.isInvalid()) return ExprError(); diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 36048a38b999..aedec746af9e 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -5367,7 +5367,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, LastIteration.get(), UB.get()); EUB = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, UB.get(), CondOp.get()); - EUB = SemaRef.ActOnFinishFullExpr(EUB.get(), /*DiscardedValue*/ false); + EUB = SemaRef.ActOnFinishFullExpr(EUB.get()); // If we have a combined directive that combines 'distribute', 'for' or // 'simd' we need to be able to access the bounds of the schedule of the @@ -5396,8 +5396,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, LastIteration.get(), CombUB.get()); CombEUB = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, CombUB.get(), CombCondOp.get()); - CombEUB = - SemaRef.ActOnFinishFullExpr(CombEUB.get(), /*DiscardedValue*/ false); + CombEUB = SemaRef.ActOnFinishFullExpr(CombEUB.get()); const CapturedDecl *CD = cast(AStmt)->getCapturedDecl(); // We expect to have at least 2 more parameters than the 'parallel' @@ -5431,7 +5430,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, ? LB.get() : SemaRef.ActOnIntegerConstant(SourceLocation(), 0).get(); Init = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, IV.get(), RHS); - Init = SemaRef.ActOnFinishFullExpr(Init.get(), /*DiscardedValue*/ false); + Init = SemaRef.ActOnFinishFullExpr(Init.get()); if (isOpenMPLoopBoundSharingDirective(DKind)) { Expr *CombRHS = @@ -5442,8 +5441,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, : SemaRef.ActOnIntegerConstant(SourceLocation(), 0).get(); CombInit = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, IV.get(), CombRHS); - CombInit = - SemaRef.ActOnFinishFullExpr(CombInit.get(), /*DiscardedValue*/ false); + CombInit = SemaRef.ActOnFinishFullExpr(CombInit.get()); } } @@ -5475,7 +5473,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, if (!Inc.isUsable()) return 0; Inc = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, IV.get(), Inc.get()); - Inc = SemaRef.ActOnFinishFullExpr(Inc.get(), /*DiscardedValue*/ false); + Inc = SemaRef.ActOnFinishFullExpr(Inc.get()); if (!Inc.isUsable()) return 0; @@ -5493,8 +5491,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, // LB = LB + ST NextLB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, LB.get(), NextLB.get()); - NextLB = - SemaRef.ActOnFinishFullExpr(NextLB.get(), /*DiscardedValue*/ false); + NextLB = SemaRef.ActOnFinishFullExpr(NextLB.get()); if (!NextLB.isUsable()) return 0; // UB + ST @@ -5504,8 +5501,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, // UB = UB + ST NextUB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, UB.get(), NextUB.get()); - NextUB = - SemaRef.ActOnFinishFullExpr(NextUB.get(), /*DiscardedValue*/ false); + NextUB = SemaRef.ActOnFinishFullExpr(NextUB.get()); if (!NextUB.isUsable()) return 0; if (isOpenMPLoopBoundSharingDirective(DKind)) { @@ -5516,8 +5512,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, // LB = LB + ST CombNextLB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, CombLB.get(), CombNextLB.get()); - CombNextLB = SemaRef.ActOnFinishFullExpr(CombNextLB.get(), - /*DiscardedValue*/ false); + CombNextLB = SemaRef.ActOnFinishFullExpr(CombNextLB.get()); if (!CombNextLB.isUsable()) return 0; // UB + ST @@ -5528,8 +5523,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, // UB = UB + ST CombNextUB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Assign, CombUB.get(), CombNextUB.get()); - CombNextUB = SemaRef.ActOnFinishFullExpr(CombNextUB.get(), - /*DiscardedValue*/ false); + CombNextUB = SemaRef.ActOnFinishFullExpr(CombNextUB.get()); if (!CombNextUB.isUsable()) return 0; } @@ -5550,8 +5544,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, assert(DistInc.isUsable() && "distribute inc expr was not built"); DistInc = SemaRef.BuildBinOp(CurScope, DistIncLoc, BO_Assign, IV.get(), DistInc.get()); - DistInc = - SemaRef.ActOnFinishFullExpr(DistInc.get(), /*DiscardedValue*/ false); + DistInc = SemaRef.ActOnFinishFullExpr(DistInc.get()); assert(DistInc.isUsable() && "distribute inc expr was not built"); // Build expression: UB = min(UB, prevUB) for #for in composite or combined @@ -5563,8 +5556,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, DistEUBLoc, DistEUBLoc, IsUBGreater.get(), PrevUB.get(), UB.get()); PrevEUB = SemaRef.BuildBinOp(CurScope, DistIncLoc, BO_Assign, UB.get(), CondOp.get()); - PrevEUB = - SemaRef.ActOnFinishFullExpr(PrevEUB.get(), /*DiscardedValue*/ false); + PrevEUB = SemaRef.ActOnFinishFullExpr(PrevEUB.get()); // Build IV <= PrevUB to be used in parallel for is in combination with // a distribute directive with schedule(static, 1) @@ -5680,10 +5672,8 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, Built.IterationVarRef = IV.get(); Built.LastIteration = LastIteration.get(); Built.NumIterations = NumIterations.get(); - Built.CalcLastIteration = SemaRef - .ActOnFinishFullExpr(CalcLastIteration.get(), - /*DiscardedValue*/ false) - .get(); + Built.CalcLastIteration = + SemaRef.ActOnFinishFullExpr(CalcLastIteration.get()).get(); Built.PreCond = PreCond.get(); Built.PreInits = buildPreInits(C, Captures); Built.Cond = Cond.get(); @@ -10358,8 +10348,8 @@ OMPClause *Sema::ActOnOpenMPLastprivateClause(ArrayRef VarList, PseudoDstExpr, PseudoSrcExpr); if (AssignmentOp.isInvalid()) continue; - AssignmentOp = - ActOnFinishFullExpr(AssignmentOp.get(), ELoc, /*DiscardedValue*/ false); + AssignmentOp = ActOnFinishFullExpr(AssignmentOp.get(), ELoc, + /*DiscardedValue=*/true); if (AssignmentOp.isInvalid()) continue; @@ -11357,8 +11347,7 @@ static bool actOnOMPReductionKindClause( BO_Assign, LHSDRE, ConditionalOp); } if (ReductionOp.isUsable()) - ReductionOp = S.ActOnFinishFullExpr(ReductionOp.get(), - /*DiscardedValue*/ false); + ReductionOp = S.ActOnFinishFullExpr(ReductionOp.get()); } if (!ReductionOp.isUsable()) continue; @@ -11688,7 +11677,7 @@ OMPClause *Sema::ActOnOpenMPLinearClause( buildDeclRefExpr(*this, SaveVar, StepExpr->getType(), StepLoc); ExprResult CalcStep = BuildBinOp(CurScope, StepLoc, BO_Assign, SaveRef.get(), StepExpr); - CalcStep = ActOnFinishFullExpr(CalcStep.get(), /*DiscardedValue*/ false); + CalcStep = ActOnFinishFullExpr(CalcStep.get()); // Warn about zero linear step (it would be probably better specified as // making corresponding variables 'const'). @@ -11776,7 +11765,7 @@ static bool FinishOpenMPLinearClause(OMPLinearClause &Clause, DeclRefExpr *IV, else Update = *CurPrivate; Update = SemaRef.ActOnFinishFullExpr(Update.get(), DE->getBeginLoc(), - /*DiscardedValue*/ false); + /*DiscardedValue=*/true); // Build final: Var = InitExpr + NumIterations * Step ExprResult Final; @@ -11787,7 +11776,7 @@ static bool FinishOpenMPLinearClause(OMPLinearClause &Clause, DeclRefExpr *IV, else Final = *CurPrivate; Final = SemaRef.ActOnFinishFullExpr(Final.get(), DE->getBeginLoc(), - /*DiscardedValue*/ false); + /*DiscardedValue=*/true); if (!Update.isUsable() || !Final.isUsable()) { Updates.push_back(nullptr); @@ -11955,7 +11944,7 @@ OMPClause *Sema::ActOnOpenMPCopyinClause(ArrayRef VarList, if (AssignmentOp.isInvalid()) continue; AssignmentOp = ActOnFinishFullExpr(AssignmentOp.get(), DE->getExprLoc(), - /*DiscardedValue*/ false); + /*DiscardedValue=*/true); if (AssignmentOp.isInvalid()) continue; @@ -12063,8 +12052,8 @@ OMPClause *Sema::ActOnOpenMPCopyprivateClause(ArrayRef VarList, DSAStack->getCurScope(), ELoc, BO_Assign, PseudoDstExpr, PseudoSrcExpr); if (AssignmentOp.isInvalid()) continue; - AssignmentOp = - ActOnFinishFullExpr(AssignmentOp.get(), ELoc, /*DiscardedValue*/ false); + AssignmentOp = ActOnFinishFullExpr(AssignmentOp.get(), ELoc, + /*DiscardedValue=*/true); if (AssignmentOp.isInvalid()) continue; diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 9e30c9a396c0..dacf8d0cf4e7 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -42,11 +42,12 @@ using namespace clang; using namespace sema; -StmtResult Sema::ActOnExprStmt(ExprResult FE, bool DiscardedValue) { +StmtResult Sema::ActOnExprStmt(ExprResult FE) { if (FE.isInvalid()) return StmtError(); - FE = ActOnFinishFullExpr(FE.get(), FE.get()->getExprLoc(), DiscardedValue); + FE = ActOnFinishFullExpr(FE.get(), FE.get()->getExprLoc(), + /*DiscardedValue*/ true); if (FE.isInvalid()) return StmtError(); @@ -347,10 +348,6 @@ sema::CompoundScopeInfo &Sema::getCurCompoundScope() const { return getCurFunction()->CompoundScopes.back(); } -bool Sema::isCurCompoundStmtAStmtExpr() const { - return getCurCompoundScope().IsStmtExpr; -} - StmtResult Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef Elts, bool isStmtExpr) { const unsigned NumElts = Elts.size(); @@ -373,6 +370,14 @@ StmtResult Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, Diag(D->getLocation(), diag::ext_mixed_decls_code); } } + // Warn about unused expressions in statements. + for (unsigned i = 0; i != NumElts; ++i) { + // Ignore statements that are last in a statement expression. + if (isStmtExpr && i == NumElts - 1) + continue; + + DiagnoseUnusedExprResult(Elts[i]); + } // Check for suspicious empty body (null statement) in `for' and `while' // statements. Don't do anything for template instantiations, this just adds @@ -464,12 +469,15 @@ Sema::ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHSVal, /// ActOnCaseStmtBody - This installs a statement as the body of a case. void Sema::ActOnCaseStmtBody(Stmt *S, Stmt *SubStmt) { + DiagnoseUnusedExprResult(SubStmt); cast(S)->setSubStmt(SubStmt); } StmtResult Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope) { + DiagnoseUnusedExprResult(SubStmt); + if (getCurFunction()->SwitchStack.empty()) { Diag(DefaultLoc, diag::err_default_not_in_switch); return SubStmt; @@ -563,6 +571,9 @@ StmtResult Sema::BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr, if (IsConstexpr || isa(Cond.get().second)) setFunctionHasBranchProtectedScope(); + DiagnoseUnusedExprResult(thenStmt); + DiagnoseUnusedExprResult(elseStmt); + return IfStmt::Create(Context, IfLoc, IsConstexpr, InitStmt, Cond.get().first, Cond.get().second, thenStmt, ElseLoc, elseStmt); } @@ -1290,6 +1301,8 @@ StmtResult Sema::ActOnWhileStmt(SourceLocation WhileLoc, ConditionResult Cond, !Diags.isIgnored(diag::warn_comma_operator, CondVal.second->getExprLoc())) CommaVisitor(*this).Visit(CondVal.second); + DiagnoseUnusedExprResult(Body); + if (isa(Body)) getCurCompoundScope().setHasEmptyLoopBodies(); @@ -1309,7 +1322,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, return StmtError(); Cond = CondResult.get(); - CondResult = ActOnFinishFullExpr(Cond, DoLoc, /*DiscardedValue*/ false); + CondResult = ActOnFinishFullExpr(Cond, DoLoc); if (CondResult.isInvalid()) return StmtError(); Cond = CondResult.get(); @@ -1319,6 +1332,8 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, !Diags.isIgnored(diag::warn_comma_operator, Cond->getExprLoc())) CommaVisitor(*this).Visit(Cond); + DiagnoseUnusedExprResult(Body); + return new (Context) DoStmt(Body, Cond, DoLoc, WhileLoc, CondRParen); } @@ -1763,6 +1778,11 @@ StmtResult Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, CommaVisitor(*this).Visit(Second.get().second); Expr *Third = third.release().getAs(); + + DiagnoseUnusedExprResult(First); + DiagnoseUnusedExprResult(Third); + DiagnoseUnusedExprResult(Body); + if (isa(Body)) getCurCompoundScope().setHasEmptyLoopBodies(); @@ -1782,7 +1802,7 @@ StmtResult Sema::ActOnForEachLValueExpr(Expr *E) { if (result.isInvalid()) return StmtError(); E = result.get(); - ExprResult FullExpr = ActOnFinishFullExpr(E, /*DiscardedValue*/ false); + ExprResult FullExpr = ActOnFinishFullExpr(E); if (FullExpr.isInvalid()) return StmtError(); return StmtResult(static_cast(FullExpr.get())); @@ -1936,8 +1956,7 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc, if (CollectionExprResult.isInvalid()) return StmtError(); - CollectionExprResult = - ActOnFinishFullExpr(CollectionExprResult.get(), /*DiscardedValue*/ false); + CollectionExprResult = ActOnFinishFullExpr(CollectionExprResult.get()); if (CollectionExprResult.isInvalid()) return StmtError(); @@ -2574,8 +2593,7 @@ StmtResult Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, if (!NotEqExpr.isInvalid()) NotEqExpr = CheckBooleanCondition(ColonLoc, NotEqExpr.get()); if (!NotEqExpr.isInvalid()) - NotEqExpr = - ActOnFinishFullExpr(NotEqExpr.get(), /*DiscardedValue*/ false); + NotEqExpr = ActOnFinishFullExpr(NotEqExpr.get()); if (NotEqExpr.isInvalid()) { Diag(RangeLoc, diag::note_for_range_invalid_iterator) << RangeLoc << 0 << BeginRangeRef.get()->getType(); @@ -2598,7 +2616,7 @@ StmtResult Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, // co_await during the initial parse. IncrExpr = ActOnCoawaitExpr(S, CoawaitLoc, IncrExpr.get()); if (!IncrExpr.isInvalid()) - IncrExpr = ActOnFinishFullExpr(IncrExpr.get(), /*DiscardedValue*/ false); + IncrExpr = ActOnFinishFullExpr(IncrExpr.get()); if (IncrExpr.isInvalid()) { Diag(RangeLoc, diag::note_for_range_invalid_iterator) << RangeLoc << 2 << BeginRangeRef.get()->getType() ; @@ -2853,7 +2871,7 @@ Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, return StmtError(); } - ExprResult ExprRes = ActOnFinishFullExpr(E, /*DiscardedValue*/ false); + ExprResult ExprRes = ActOnFinishFullExpr(E); if (ExprRes.isInvalid()) return StmtError(); E = ExprRes.get(); @@ -3203,8 +3221,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { ExpressionEvaluationContext::DiscardedStatement && (HasDeducedReturnType || CurCap->HasImplicitReturnType)) { if (RetValExp) { - ExprResult ER = - ActOnFinishFullExpr(RetValExp, ReturnLoc, /*DiscardedValue*/ false); + ExprResult ER = ActOnFinishFullExpr(RetValExp, ReturnLoc); if (ER.isInvalid()) return StmtError(); RetValExp = ER.get(); @@ -3331,8 +3348,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { } if (RetValExp) { - ExprResult ER = - ActOnFinishFullExpr(RetValExp, ReturnLoc, /*DiscardedValue*/ false); + ExprResult ER = ActOnFinishFullExpr(RetValExp, ReturnLoc); if (ER.isInvalid()) return StmtError(); RetValExp = ER.get(); @@ -3562,8 +3578,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { ExpressionEvaluationContext::DiscardedStatement && FnRetType->getContainedAutoType()) { if (RetValExp) { - ExprResult ER = - ActOnFinishFullExpr(RetValExp, ReturnLoc, /*DiscardedValue*/ false); + ExprResult ER = ActOnFinishFullExpr(RetValExp, ReturnLoc); if (ER.isInvalid()) return StmtError(); RetValExp = ER.get(); @@ -3657,8 +3672,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { } if (RetValExp) { - ExprResult ER = - ActOnFinishFullExpr(RetValExp, ReturnLoc, /*DiscardedValue*/ false); + ExprResult ER = ActOnFinishFullExpr(RetValExp, ReturnLoc); if (ER.isInvalid()) return StmtError(); RetValExp = ER.get(); @@ -3737,8 +3751,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { } if (RetValExp) { - ExprResult ER = - ActOnFinishFullExpr(RetValExp, ReturnLoc, /*DiscardedValue*/ false); + ExprResult ER = ActOnFinishFullExpr(RetValExp, ReturnLoc); if (ER.isInvalid()) return StmtError(); RetValExp = ER.get(); @@ -3791,7 +3804,7 @@ StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw) { if (Result.isInvalid()) return StmtError(); - Result = ActOnFinishFullExpr(Result.get(), /*DiscardedValue*/ false); + Result = ActOnFinishFullExpr(Result.get()); if (Result.isInvalid()) return StmtError(); Throw = Result.get(); @@ -3863,7 +3876,7 @@ Sema::ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand) { } // The operand to @synchronized is a full-expression. - return ActOnFinishFullExpr(operand, /*DiscardedValue*/ false); + return ActOnFinishFullExpr(operand); } StmtResult diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index df14768cbe81..9de4e8d654f9 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -328,7 +328,7 @@ class TreeTransform { /// other mechanism. /// /// \returns the transformed statement. - StmtResult TransformStmt(Stmt *S, bool DiscardedValue = false); + StmtResult TransformStmt(Stmt *S); /// Transform the given statement. /// @@ -3269,8 +3269,8 @@ class TreeTransform { bool DeducibleTSTContext); }; -template -StmtResult TreeTransform::TransformStmt(Stmt *S, bool DiscardedValue) { +template +StmtResult TreeTransform::TransformStmt(Stmt *S) { if (!S) return S; @@ -3294,7 +3294,7 @@ StmtResult TreeTransform::TransformStmt(Stmt *S, bool DiscardedValue) { if (E.isInvalid()) return StmtError(); - return getSema().ActOnExprStmt(E, DiscardedValue); + return getSema().ActOnExprStmt(E); } } @@ -4715,8 +4715,7 @@ TreeTransform::TransformVariableArrayType(TypeLocBuilder &TLB, } if (SizeResult.isInvalid()) return QualType(); - SizeResult = - SemaRef.ActOnFinishFullExpr(SizeResult.get(), /*DiscardedValue*/ false); + SizeResult = SemaRef.ActOnFinishFullExpr(SizeResult.get()); if (SizeResult.isInvalid()) return QualType(); @@ -6521,9 +6520,7 @@ TreeTransform::TransformCompoundStmt(CompoundStmt *S, bool SubStmtChanged = false; SmallVector Statements; for (auto *B : S->body()) { - StmtResult Result = - getDerived().TransformStmt(B, !IsStmtExpr || B != S->body_back()); - + StmtResult Result = getDerived().TransformStmt(B); if (Result.isInvalid()) { // Immediately fail if this was a DeclStmt, since it's very // likely that this will cause problems for future statements. diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index da94b6eb21e9..ea695c4736a3 100644 --- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -154,6 +154,32 @@ const Expr *bugreporter::getDerefExpr(const Stmt *S) { return E; } +/// Comparing internal representations of symbolic values (via +/// SVal::operator==()) is a valid way to check if the value was updated, +/// unless it's a LazyCompoundVal that may have a different internal +/// representation every time it is loaded from the state. In this function we +/// do an approximate comparison for lazy compound values, checking that they +/// are the immediate snapshots of the tracked region's bindings within the +/// node's respective states but not really checking that these snapshots +/// actually contain the same set of bindings. +bool hasVisibleUpdate(const ExplodedNode *LeftNode, SVal LeftVal, + const ExplodedNode *RightNode, SVal RightVal) { + if (LeftVal == RightVal) + return true; + + const auto LLCV = LeftVal.getAs(); + if (!LLCV) + return false; + + const auto RLCV = RightVal.getAs(); + if (!RLCV) + return false; + + return LLCV->getRegion() == RLCV->getRegion() && + LLCV->getStore() == LeftNode->getState()->getStore() && + RLCV->getStore() == RightNode->getState()->getStore(); +} + //===----------------------------------------------------------------------===// // Definitions for bug reporter visitors. //===----------------------------------------------------------------------===// @@ -1188,7 +1214,7 @@ FindLastStoreBRVisitor::VisitNode(const ExplodedNode *Succ, if (Succ->getState()->getSVal(R) != V) return nullptr; - if (Pred->getState()->getSVal(R) == V) { + if (hasVisibleUpdate(Pred, Pred->getState()->getSVal(R), Succ, V)) { Optional PS = Succ->getLocationAs(); if (!PS || PS->getLocationValue() != R) return nullptr; @@ -1209,6 +1235,7 @@ FindLastStoreBRVisitor::VisitNode(const ExplodedNode *Succ, // UndefinedVal.) if (Optional CE = Succ->getLocationAs()) { if (const auto *VR = dyn_cast(R)) { + const auto *Param = cast(VR->getDecl()); ProgramStateManager &StateMgr = BRC.getStateManager(); diff --git a/test/Analysis/PR40625.cpp b/test/Analysis/PR40625.cpp new file mode 100644 index 000000000000..6cc27d39b6c0 --- /dev/null +++ b/test/Analysis/PR40625.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,alpha.core.CallAndMessageUnInitRefArg %s -verify + +void f(const int *end); + +void g(const int (&arrr)[10]) { + f(arrr+sizeof(arrr)); // expected-warning{{1st function call argument is a pointer to uninitialized value}} + // FIXME: This is a false positive that should be fixed. Until then this + // tests the crash fix in FindLastStoreBRVisitor (beside + // uninit-vals.m). +} + +void h() { + int arr[10]; + + g(arr); +} diff --git a/test/Analysis/uninit-vals.m b/test/Analysis/uninit-vals.m index f97af1a6633c..33352122ca5a 100644 --- a/test/Analysis/uninit-vals.m +++ b/test/Analysis/uninit-vals.m @@ -394,11 +394,11 @@ void testSmallStructBitfieldsFirstUnnamed() { struct { int : 4; int y : 4; - } a, b, c; + } a, b, c; // expected-note{{'c' initialized here}} a.y = 2; - b = a; // expected-note{{Value assigned to 'c'}} + b = a; clang_analyzer_eval(b.y == 2); // expected-warning{{TRUE}} // expected-note@-1{{TRUE}} @@ -411,11 +411,11 @@ void testSmallStructBitfieldsSecondUnnamed() { struct { int x : 4; int : 4; - } a, b, c; + } a, b, c; // expected-note{{'c' initialized here}} a.x = 1; - b = a; // expected-note{{Value assigned to 'c'}} + b = a; clang_analyzer_eval(b.x == 1); // expected-warning{{TRUE}} // expected-note@-1{{TRUE}} diff --git a/test/CXX/stmt.stmt/stmt.select/p3.cpp b/test/CXX/stmt.stmt/stmt.select/p3.cpp index 4804cc559d00..7a6a408ec955 100644 --- a/test/CXX/stmt.stmt/stmt.select/p3.cpp +++ b/test/CXX/stmt.stmt/stmt.select/p3.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s -// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -std=c++1z -Wc++14-compat -verify %s -DCPP17 +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++1z -Wc++14-compat -verify %s -DCPP17 int f(); @@ -71,6 +71,7 @@ void whileInitStatement() { // last loop above. It would be nice to remove this. void whileInitStatement2() { while (; false) {} // expected-error {{expected expression}} - // expected-error@-1 {{expected ';' after expression}} - // expected-error@-2 {{expected expression}} + // expected-warning@-1 {{expression result unused}} + // expected-error@-2 {{expected ';' after expression}} + // expected-error@-3 {{expected expression}} } diff --git a/test/CodeCompletion/pragma-macro-token-caching.c b/test/CodeCompletion/pragma-macro-token-caching.c index 59b6621b56ad..432706e85ceb 100644 --- a/test/CodeCompletion/pragma-macro-token-caching.c +++ b/test/CodeCompletion/pragma-macro-token-caching.c @@ -12,7 +12,7 @@ void completeParam(int param) { void completeParamPragmaError(int param) { Outer(__extension__({ _Pragma(2) })); // expected-error {{_Pragma takes a parenthesized string literal}} - param; // expected-warning {{expression result unused}} + param; } // RUN: %clang_cc1 -fsyntax-only -verify -code-completion-at=%s:16:1 %s | FileCheck %s diff --git a/test/CodeGen/arm64-microsoft-status-reg.cpp b/test/CodeGen/arm64-microsoft-status-reg.cpp index eb59bae50f0a..524b5af120c5 100644 --- a/test/CodeGen/arm64-microsoft-status-reg.cpp +++ b/test/CodeGen/arm64-microsoft-status-reg.cpp @@ -23,88 +23,112 @@ #define ARM64_TPIDRRO_EL0 ARM64_SYSREG(3,3,13, 0,3) // Thread ID Register, User Read Only [CP15_TPIDRURO] #define ARM64_TPIDR_EL1 ARM64_SYSREG(3,0,13, 0,4) // Thread ID Register, Privileged Only [CP15_TPIDRPRW] -void check_ReadWriteStatusReg(int v) { - int ret; +// From intrin.h +__int64 _ReadStatusReg(int); +void _WriteStatusReg(int, __int64); + +void check_ReadWriteStatusReg(__int64 v) { + __int64 ret; ret = _ReadStatusReg(ARM64_CNTVCT); -// CHECK-ASM: mrs x8, CNTVCT_EL0 -// CHECK-IR: call i64 @llvm.read_register.i64(metadata ![[MD2:.*]]) +// CHECK-ASM: mrs x0, CNTVCT_EL0 +// CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD2:.*]]) +// CHECK-IR-NEXT: store i64 %[[VAR]] ret = _ReadStatusReg(ARM64_PMCCNTR_EL0); -// CHECK-ASM: mrs x8, PMCCNTR_EL0 -// CHECK-IR: call i64 @llvm.read_register.i64(metadata ![[MD3:.*]]) +// CHECK-ASM: mrs x0, PMCCNTR_EL0 +// CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD3:.*]]) +// CHECK-IR-NEXT: store i64 %[[VAR]] ret = _ReadStatusReg(ARM64_PMSELR_EL0); -// CHECK-ASM: mrs x8, PMSELR_EL0 -// CHECK-IR: call i64 @llvm.read_register.i64(metadata ![[MD4:.*]]) +// CHECK-ASM: mrs x0, PMSELR_EL0 +// CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD4:.*]]) +// CHECK-IR-NEXT: store i64 %[[VAR]] ret = _ReadStatusReg(ARM64_PMXEVCNTR_EL0); -// CHECK-ASM: mrs x8, PMXEVCNTR_EL0 -// CHECK-IR: call i64 @llvm.read_register.i64(metadata ![[MD5:.*]]) +// CHECK-ASM: mrs x0, PMXEVCNTR_EL0 +// CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD5:.*]]) +// CHECK-IR-NEXT: store i64 %[[VAR]] ret = _ReadStatusReg(ARM64_PMXEVCNTRn_EL0(0)); -// CHECK-ASM: mrs x8, PMEVCNTR0_EL0 -// CHECK-IR: call i64 @llvm.read_register.i64(metadata ![[MD6:.*]]) +// CHECK-ASM: mrs x0, PMEVCNTR0_EL0 +// CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD6:.*]]) +// CHECK-IR-NEXT: store i64 %[[VAR]] ret = _ReadStatusReg(ARM64_PMXEVCNTRn_EL0(1)); -// CHECK-ASM: mrs x8, PMEVCNTR1_EL0 -// CHECK-IR: call i64 @llvm.read_register.i64(metadata ![[MD7:.*]]) +// CHECK-ASM: mrs x0, PMEVCNTR1_EL0 +// CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD7:.*]]) +// CHECK-IR-NEXT: store i64 %[[VAR]] ret = _ReadStatusReg(ARM64_PMXEVCNTRn_EL0(30)); -// CHECK-ASM: mrs x8, PMEVCNTR30_EL0 -// CHECK-IR: call i64 @llvm.read_register.i64(metadata ![[MD8:.*]]) +// CHECK-ASM: mrs x0, PMEVCNTR30_EL0 +// CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD8:.*]]) +// CHECK-IR-NEXT: store i64 %[[VAR]] ret = _ReadStatusReg(ARM64_TPIDR_EL0); -// CHECK-ASM: mrs x8, TPIDR_EL0 -// CHECK-IR: call i64 @llvm.read_register.i64(metadata ![[MD9:.*]]) +// CHECK-ASM: mrs x0, TPIDR_EL0 +// CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD9:.*]]) +// CHECK-IR-NEXT: store i64 %[[VAR]] ret = _ReadStatusReg(ARM64_TPIDRRO_EL0); -// CHECK-ASM: mrs x8, TPIDRRO_EL0 -// CHECK-IR: call i64 @llvm.read_register.i64(metadata ![[MD10:.*]]) +// CHECK-ASM: mrs x0, TPIDRRO_EL0 +// CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD10:.*]]) +// CHECK-IR-NEXT: store i64 %[[VAR]] ret = _ReadStatusReg(ARM64_TPIDR_EL1); -// CHECK-ASM: mrs x8, TPIDR_EL1 -// CHECK-IR: call i64 @llvm.read_register.i64(metadata ![[MD11:.*]]) +// CHECK-ASM: mrs x0, TPIDR_EL1 +// CHECK-IR: %[[VAR:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD11:.*]]) +// CHECK-IR-NEXT: store i64 %[[VAR]] _WriteStatusReg(ARM64_CNTVCT, v); -// CHECK-ASM: msr S3_3_C14_C0_2, x8 -// CHECK-IR: call void @llvm.write_register.i64(metadata ![[MD2:.*]], i64 {{%.*}}) +// CHECK-ASM: msr S3_3_C14_C0_2, x0 +// CHECK-IR: %[[VAR:.*]] = load i64, +// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD2:.*]], i64 %[[VAR]]) _WriteStatusReg(ARM64_PMCCNTR_EL0, v); -// CHECK-ASM: msr PMCCNTR_EL0, x8 -// CHECK-IR: call void @llvm.write_register.i64(metadata ![[MD3:.*]], i64 {{%.*}}) +// CHECK-ASM: msr PMCCNTR_EL0, x0 +// CHECK-IR: %[[VAR:.*]] = load i64, +// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD3:.*]], i64 %[[VAR]]) _WriteStatusReg(ARM64_PMSELR_EL0, v); -// CHECK-ASM: msr PMSELR_EL0, x8 -// CHECK-IR: call void @llvm.write_register.i64(metadata ![[MD4:.*]], i64 {{%.*}}) +// CHECK-ASM: msr PMSELR_EL0, x0 +// CHECK-IR: %[[VAR:.*]] = load i64, +// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD4:.*]], i64 %[[VAR]]) _WriteStatusReg(ARM64_PMXEVCNTR_EL0, v); -// CHECK-ASM: msr PMXEVCNTR_EL0, x8 -// CHECK-IR: call void @llvm.write_register.i64(metadata ![[MD5:.*]], i64 {{%.*}}) +// CHECK-ASM: msr PMXEVCNTR_EL0, x0 +// CHECK-IR: %[[VAR:.*]] = load i64, +// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD5:.*]], i64 %[[VAR]]) _WriteStatusReg(ARM64_PMXEVCNTRn_EL0(0), v); -// CHECK-ASM: msr PMEVCNTR0_EL0, x8 -// CHECK-IR: call void @llvm.write_register.i64(metadata ![[MD6:.*]], i64 {{%.*}}) +// CHECK-ASM: msr PMEVCNTR0_EL0, x0 +// CHECK-IR: %[[VAR:.*]] = load i64, +// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD6:.*]], i64 %[[VAR]]) _WriteStatusReg(ARM64_PMXEVCNTRn_EL0(1), v); -// CHECK-ASM: msr PMEVCNTR1_EL0, x8 -// CHECK-IR: call void @llvm.write_register.i64(metadata ![[MD7:.*]], i64 {{%.*}}) +// CHECK-ASM: msr PMEVCNTR1_EL0, x0 +// CHECK-IR: %[[VAR:.*]] = load i64, +// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD7:.*]], i64 %[[VAR]]) _WriteStatusReg(ARM64_PMXEVCNTRn_EL0(30), v); -// CHECK-ASM: msr PMEVCNTR30_EL0, x8 -// CHECK-IR: call void @llvm.write_register.i64(metadata ![[MD8:.*]], i64 {{%.*}}) +// CHECK-ASM: msr PMEVCNTR30_EL0, x0 +// CHECK-IR: %[[VAR:.*]] = load i64, +// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD8:.*]], i64 %[[VAR]]) _WriteStatusReg(ARM64_TPIDR_EL0, v); -// CHECK-ASM: msr TPIDR_EL0, x8 -// CHECK-IR: call void @llvm.write_register.i64(metadata ![[MD9:.*]], i64 {{%.*}}) +// CHECK-ASM: msr TPIDR_EL0, x0 +// CHECK-IR: %[[VAR:.*]] = load i64, +// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD9:.*]], i64 %[[VAR]]) _WriteStatusReg(ARM64_TPIDRRO_EL0, v); -// CHECK-ASM: msr TPIDRRO_EL0, x8 -// CHECK-IR: call void @llvm.write_register.i64(metadata ![[MD10:.*]], i64 {{%.*}}) +// CHECK-ASM: msr TPIDRRO_EL0, x0 +// CHECK-IR: %[[VAR:.*]] = load i64, +// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD10:.*]], i64 %[[VAR]]) _WriteStatusReg(ARM64_TPIDR_EL1, v); -// CHECK-ASM: msr TPIDR_EL1, x8 -// CHECK-IR: call void @llvm.write_register.i64(metadata ![[MD11:.*]], i64 {{%.*}}) +// CHECK-ASM: msr TPIDR_EL1, x0 +// CHECK-IR: %[[VAR:.*]] = load i64, +// CHECK-IR-NEXT: call void @llvm.write_register.i64(metadata ![[MD11:.*]], i64 %[[VAR]]) } // CHECK-IR: ![[MD2]] = !{!"3:3:14:0:2"} diff --git a/test/CodeGen/microsoft-no-common-align.c b/test/CodeGen/microsoft-no-common-align.c index fc46946c00ed..a7a27a062704 100644 --- a/test/CodeGen/microsoft-no-common-align.c +++ b/test/CodeGen/microsoft-no-common-align.c @@ -6,3 +6,6 @@ TooLargeAlignment TooBig; // CHECK: @TooBig = dso_local global <16 x float> zeroinitializer, align 64 NormalAlignment JustRight; // CHECK: @JustRight = common dso_local global <1 x float> zeroinitializer, align 4 + +TooLargeAlignment *IsAPointer; +// CHECK: @IsAPointer = common dso_local global <16 x float>* null, align 8 diff --git a/test/CodeGen/powerpc_types.c b/test/CodeGen/powerpc_types.c index b7d0f5de4985..86eb7f835680 100644 --- a/test/CodeGen/powerpc_types.c +++ b/test/CodeGen/powerpc_types.c @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -triple powerpc-unknown-freebsd -emit-llvm -o - %s| FileCheck -check-prefix=SVR4-CHECK %s +// RUN: %clang_cc1 -triple powerpc-unknown-netbsd -emit-llvm -o - %s| FileCheck -check-prefix=SVR4-CHECK %s +// RUN: %clang_cc1 -triple powerpc-unknown-openbsd -emit-llvm -o - %s| FileCheck -check-prefix=SVR4-CHECK %s #include diff --git a/test/CodeGen/wasm-import-module.c b/test/CodeGen/wasm-import-module.c new file mode 100644 index 000000000000..866a3a459949 --- /dev/null +++ b/test/CodeGen/wasm-import-module.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple wasm32-unknown-unknown-wasm -emit-llvm -o - %s | FileCheck %s + +void __attribute__((import_module("bar"))) foo(void); + +void call(void) { + foo(); +} + +// CHECK: declare void @foo() [[A:#[0-9]+]] + +// CHECK: attributes [[A]] = {{{.*}} "wasm-import-module"="bar" {{.*}}} diff --git a/test/CodeGen/wasm-import-name.c b/test/CodeGen/wasm-import-name.c new file mode 100644 index 000000000000..7c3b094b9e43 --- /dev/null +++ b/test/CodeGen/wasm-import-name.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple wasm32-unknown-unknown-wasm -emit-llvm -o - %s | FileCheck %s + +void __attribute__((import_name("bar"))) foo(void); + +void call(void) { + foo(); +} + +// CHECK: declare void @foo() [[A:#[0-9]+]] + +// CHECK: attributes [[A]] = {{{.*}} "wasm-import-name"="bar" {{.*}}} diff --git a/test/CodeGenCXX/trivial-auto-var-init.cpp b/test/CodeGenCXX/trivial-auto-var-init.cpp index b795c0755bd4..37ff770abf57 100644 --- a/test/CodeGenCXX/trivial-auto-var-init.cpp +++ b/test/CodeGenCXX/trivial-auto-var-init.cpp @@ -30,6 +30,32 @@ void test_block() { used(block); } +// Using the variable being initialized is typically UB in C, but for blocks we +// can be nice: they imply extra book-keeping and we can do the auto-init before +// any of said book-keeping. +// +// UNINIT-LABEL: test_block_self_init( +// ZERO-LABEL: test_block_self_init( +// ZERO: %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>, align 8 +// ZERO: %captured1 = getelementptr inbounds %struct.__block_byref_captured, %struct.__block_byref_captured* %captured, i32 0, i32 4 +// ZERO-NEXT: store %struct.XYZ* null, %struct.XYZ** %captured1, align 8 +// ZERO: %call = call %struct.XYZ* @create( +// PATTERN-LABEL: test_block_self_init( +// PATTERN: %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }>, align 8 +// PATTERN: %captured1 = getelementptr inbounds %struct.__block_byref_captured, %struct.__block_byref_captured* %captured, i32 0, i32 4 +// PATTERN-NEXT: store %struct.XYZ* inttoptr (i64 -6148914691236517206 to %struct.XYZ*), %struct.XYZ** %captured1, align 8 +// PATTERN: %call = call %struct.XYZ* @create( +void test_block_self_init() { + using Block = void (^)(); + typedef struct XYZ { + Block block; + } * xyz_t; + extern xyz_t create(Block block); + __block xyz_t captured = create(^() { + (void)captured; + }); +} + // This type of code is currently not handled by zero / pattern initialization. // The test will break when that is fixed. // UNINIT-LABEL: test_goto_unreachable_value( diff --git a/test/Driver/cl-options.c b/test/Driver/cl-options.c index f5171d5c040c..d8db081ac8a6 100644 --- a/test/Driver/cl-options.c +++ b/test/Driver/cl-options.c @@ -178,6 +178,10 @@ // Oy_2: -momit-leaf-frame-pointer // Oy_2: -O2 +// RUN: %clang_cl --target=aarch64-pc-windows-msvc -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_aarch64 %s +// Oy_aarch64: -mdisable-fp-elim +// Oy_aarch64: -O2 + // RUN: %clang_cl --target=i686-pc-win32 -Werror /O2 /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2O2 %s // O2O2: "-O2" diff --git a/test/Misc/pragma-attribute-supported-attributes-list.test b/test/Misc/pragma-attribute-supported-attributes-list.test index 9a6bcca1bd36..5ae4a7ca7bbe 100644 --- a/test/Misc/pragma-attribute-supported-attributes-list.test +++ b/test/Misc/pragma-attribute-supported-attributes-list.test @@ -94,6 +94,7 @@ // CHECK-NEXT: ObjCBridge (SubjectMatchRule_record, SubjectMatchRule_type_alias) // CHECK-NEXT: ObjCBridgeMutable (SubjectMatchRule_record) // CHECK-NEXT: ObjCBridgeRelated (SubjectMatchRule_record) +// CHECK-NEXT: ObjCDesignatedInitializer (SubjectMatchRule_objc_method) // CHECK-NEXT: ObjCException (SubjectMatchRule_objc_interface) // CHECK-NEXT: ObjCExplicitProtocolImpl (SubjectMatchRule_objc_protocol) // CHECK-NEXT: ObjCExternallyRetained (SubjectMatchRule_variable_not_is_parameter, SubjectMatchRule_function, SubjectMatchRule_block, SubjectMatchRule_objc_method) @@ -136,6 +137,8 @@ // CHECK-NEXT: WarnUnusedResult (SubjectMatchRule_objc_method, SubjectMatchRule_enum, SubjectMatchRule_record, SubjectMatchRule_hasType_functionType) // CHECK-NEXT: Weak (SubjectMatchRule_variable, SubjectMatchRule_function, SubjectMatchRule_record) // CHECK-NEXT: WeakRef (SubjectMatchRule_variable, SubjectMatchRule_function) +// CHECK-NEXT: WebAssemblyImportModule (SubjectMatchRule_function) +// CHECK-NEXT: WebAssemblyImportName (SubjectMatchRule_function) // CHECK-NEXT: WorkGroupSizeHint (SubjectMatchRule_function) // CHECK-NEXT: XRayInstrument (SubjectMatchRule_function, SubjectMatchRule_objc_method) // CHECK-NEXT: XRayLogArgs (SubjectMatchRule_function, SubjectMatchRule_objc_method) diff --git a/test/Parser/cxx1z-init-statement.cpp b/test/Parser/cxx1z-init-statement.cpp index ade60dc762d5..3d119ef8e709 100644 --- a/test/Parser/cxx1z-init-statement.cpp +++ b/test/Parser/cxx1z-init-statement.cpp @@ -13,9 +13,9 @@ int f() { if (T(n) = 0; n) {} // init-statement expressions - if (T{f()}; f()) {} // expected-warning {{expression result unused}} - if (T{f()}, g, h; f()) {} // expected-warning 2{{unused}} expected-warning {{expression result unused}} - if (T(f()), g, h + 1; f()) {} // expected-warning 2{{unused}} expected-warning {{expression result unused}} + if (T{f()}; f()) {} + if (T{f()}, g, h; f()) {} // expected-warning 2{{unused}} + if (T(f()), g, h + 1; f()) {} // expected-warning 2{{unused}} // condition declarations if (T(n){g}) {} @@ -35,7 +35,7 @@ int f() { // Likewise for 'switch' switch (int n; n) {} - switch (g; int g = 5) {} // expected-warning {{expression result unused}} + switch (g; int g = 5) {} if (int a, b; int c = a) { // expected-note 6{{previous}} int a; // expected-error {{redefinition}} diff --git a/test/Parser/switch-recovery.cpp b/test/Parser/switch-recovery.cpp index eacd017ab236..a3a0178cd10b 100644 --- a/test/Parser/switch-recovery.cpp +++ b/test/Parser/switch-recovery.cpp @@ -105,7 +105,7 @@ void test9(int x) { // expected-note {{'x' declared here}} expected-error {{expected expression}} 8:: x; // expected-error {{expected ';' after expression}} \ expected-error {{no member named 'x' in the global namespace; did you mean simply 'x'?}} \ - expected-warning {{expression result unused}} + expected-warning 2 {{expression result unused}} 9:: :y; // expected-error {{expected ';' after expression}} \ expected-error {{expected unqualified-id}} \ expected-warning {{expression result unused}} diff --git a/test/SemaCXX/cxx1z-init-statement.cpp b/test/SemaCXX/cxx1z-init-statement.cpp index eea2589ab7c6..d37acd08ce77 100644 --- a/test/SemaCXX/cxx1z-init-statement.cpp +++ b/test/SemaCXX/cxx1z-init-statement.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -std=c++1z -Wno-unused-value -verify %s -// RUN: %clang_cc1 -std=c++17 -Wno-unused-value -verify %s +// RUN: %clang_cc1 -std=c++1z -verify %s +// RUN: %clang_cc1 -std=c++17 -verify %s void testIf() { int x = 0; @@ -12,7 +12,7 @@ void testIf() { int x = 0; // expected-error {{redefinition of 'x'}} if (x; int a = 0) ++a; - if (x, +x; int a = 0) // expected-note 2 {{previous definition is here}} + if (x, +x; int a = 0) // expected-note 2 {{previous definition is here}} expected-warning {{unused}} int a = 0; // expected-error {{redefinition of 'a'}} else int a = 0; // expected-error {{redefinition of 'a'}} @@ -48,7 +48,7 @@ void testSwitch() { ++a; } - switch (x, +x; int a = 0) { // expected-note {{previous definition is here}} + switch (x, +x; int a = 0) { // expected-note {{previous definition is here}} expected-warning {{unused}} case 0: int a = 0; // expected-error {{redefinition of 'a'}} // expected-note {{previous definition is here}} case 1: diff --git a/test/SemaCXX/for-range-examples.cpp b/test/SemaCXX/for-range-examples.cpp index 5424b7a8ee79..477789b56c14 100644 --- a/test/SemaCXX/for-range-examples.cpp +++ b/test/SemaCXX/for-range-examples.cpp @@ -244,7 +244,7 @@ void foo () { int b = 1, a[b]; a[0] = 0; - [&] { for (int c : a) 0; } (); // expected-warning {{expression result unused}} + [&] { for (int c : a) 0; } (); } diff --git a/test/SemaCXX/warn-float-conversion.cpp b/test/SemaCXX/warn-float-conversion.cpp index 7dec4844b062..fad1ff147e49 100644 --- a/test/SemaCXX/warn-float-conversion.cpp +++ b/test/SemaCXX/warn-float-conversion.cpp @@ -44,17 +44,17 @@ void Convert(float f, double d, long double ld) { void CompoundAssignment() { int x = 3; - x += 1.234; //expected-warning{{conversion}} - x -= -0.0; //expected-warning{{conversion}} - x *= 1.1f; //expected-warning{{conversion}} - x /= -2.2f; //expected-warning{{conversion}} + x += 1.234; // expected-warning {{implicit conversion turns floating-point number into integer: 'double' to 'int'}} + x -= -0.0; // expected-warning {{implicit conversion turns floating-point number into integer: 'double' to 'int'}} + x *= 1.1f; // expected-warning {{implicit conversion turns floating-point number into integer: 'float' to 'int'}} + x /= -2.2f; // expected-warning {{implicit conversion turns floating-point number into integer: 'float' to 'int'}} - int y = x += 1.4f; //expected-warning{{conversion}} + int y = x += 1.4f; // expected-warning {{implicit conversion turns floating-point number into integer: 'float' to 'int'}} float z = 1.1f; double w = -2.2; - y += z + w; //expected-warning{{conversion}} + y += z + w; // expected-warning {{implicit conversion turns floating-point number into integer: 'double' to 'int'}} } # 1 "foo.h" 3 diff --git a/test/SemaCXX/warn-unused-result.cpp b/test/SemaCXX/warn-unused-result.cpp index f1de4618a741..88f5ab1e85c0 100644 --- a/test/SemaCXX/warn-unused-result.cpp +++ b/test/SemaCXX/warn-unused-result.cpp @@ -33,36 +33,6 @@ void test() { const S &s4 = g1(); } -void testSubstmts(int i) { - switch (i) { - case 0: - f(); // expected-warning {{ignoring return value}} - default: - f(); // expected-warning {{ignoring return value}} - } - - if (i) - f(); // expected-warning {{ignoring return value}} - else - f(); // expected-warning {{ignoring return value}} - - while (i) - f(); // expected-warning {{ignoring return value}} - - do - f(); // expected-warning {{ignoring return value}} - while (i); - - for (f(); // expected-warning {{ignoring return value}} - ; - f() // expected-warning {{ignoring return value}} - ) - f(); // expected-warning {{ignoring return value}} - - f(), // expected-warning {{ignoring return value}} - (void)f(); -} - struct X { int foo() __attribute__((warn_unused_result)); }; @@ -236,13 +206,3 @@ void f() { (void)++p; } } // namespace - -namespace PR39837 { -[[clang::warn_unused_result]] int f(int); - -void g() { - int a[2]; - for (int b : a) - f(b); // expected-warning {{ignoring return value}} -} -} // namespace PR39837 diff --git a/test/SemaObjC/attr-designated-init.m b/test/SemaObjC/attr-designated-init.m index 05085884784b..3558916dbe54 100644 --- a/test/SemaObjC/attr-designated-init.m +++ b/test/SemaObjC/attr-designated-init.m @@ -3,7 +3,7 @@ #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) #define NS_UNAVAILABLE __attribute__((unavailable)) -void fnfoo(void) NS_DESIGNATED_INITIALIZER; // expected-error {{only applies to init methods of interface or class extension declarations}} +void fnfoo(void) NS_DESIGNATED_INITIALIZER; // expected-error {{'objc_designated_initializer' attribute only applies to Objective-C methods}} @protocol P1 -(id)init NS_DESIGNATED_INITIALIZER; // expected-error {{only applies to init methods of interface or class extension declarations}} @@ -428,3 +428,16 @@ __attribute__((objc_root_class)) @interface CategoryForMissingInterface(Cat) // expected-error{{cannot find interface declaration}} - (instancetype)init NS_DESIGNATED_INITIALIZER; // expected-error{{only applies to init methods of interface or class extension declarations}} @end + +@interface TwoAttrs +-(instancetype)foo + __attribute__((objc_designated_initializer)) + __attribute__((objc_method_family(init))); +-(instancetype)bar + __attribute__((objc_method_family(init))) + __attribute__((objc_designated_initializer)); +-(instancetype)baz + __attribute__((objc_designated_initializer, objc_method_family(init))); +-(instancetype)quux + __attribute__((objc_method_family(init), objc_designated_initializer)); +@end diff --git a/test/SemaObjC/conversion.m b/test/SemaObjC/conversion.m index 88a1a44b2177..743f7440e2e4 100644 --- a/test/SemaObjC/conversion.m +++ b/test/SemaObjC/conversion.m @@ -14,4 +14,11 @@ void radar14415662(RDar14415662 *f, char x, int y) { x = y; // expected-warning {{implicit conversion loses integer precision: 'int' to 'char'}} } +__attribute__((objc_root_class)) @interface DoubleProp +@property double d; +@end +void use_double_prop(DoubleProp *dp) { + double local = 42; + dp.d += local; // no warning +} diff --git a/test/SemaOpenCL/extension-version.cl b/test/SemaOpenCL/extension-version.cl index a587f1db99af..d976cfb3a435 100644 --- a/test/SemaOpenCL/extension-version.cl +++ b/test/SemaOpenCL/extension-version.cl @@ -2,12 +2,14 @@ // RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown // RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown // RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown +// RUN: %clang_cc1 -x cl -cl-std=c++ %s -verify -triple spir-unknown-unknown // RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES // RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES // RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES // RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES +// RUN: %clang_cc1 -x cl -cl-std=c++ %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -#if __OPENCL_C_VERSION__ >= 200 && ! defined TEST_CORE_FEATURES +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) && !defined(TEST_CORE_FEATURES) // expected-no-diagnostics #endif @@ -47,44 +49,44 @@ #ifndef cl_khr_byte_addressable_store #error "Missing cl_khr_byte_addressable_store define" #endif -#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable -#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES +#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES // expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}} #endif #ifndef cl_khr_global_int32_base_atomics #error "Missing cl_khr_global_int32_base_atomics define" #endif -#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable -#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES +#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES // expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}} #endif #ifndef cl_khr_global_int32_extended_atomics #error "Missing cl_khr_global_int32_extended_atomics define" #endif -#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable -#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES +#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES // expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} #endif #ifndef cl_khr_local_int32_base_atomics #error "Missing cl_khr_local_int32_base_atomics define" #endif -#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable -#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES +#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics : enable +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES // expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}} #endif #ifndef cl_khr_local_int32_extended_atomics #error "Missing cl_khr_local_int32_extended_atomics define" #endif -#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable -#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES +#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics : enable +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES // expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} #endif -#if (__OPENCL_C_VERSION__ < 110) +#if (defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ < 110) // Deprecated abvoe 1.0 #ifndef cl_khr_select_fprounding_mode #error "Missing cl_khr_select_fp_rounding_mode define" @@ -97,8 +99,8 @@ #ifndef cl_khr_fp64 #error "Missing cl_khr_fp64 define" #endif -#pragma OPENCL EXTENSION cl_khr_fp64: enable -#if (__OPENCL_C_VERSION__ >= 120) && defined TEST_CORE_FEATURES +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) && defined TEST_CORE_FEATURES // expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}} #endif @@ -106,131 +108,129 @@ #ifndef cl_khr_3d_image_writes #error "Missing cl_khr_3d_image_writes define" #endif -#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable -#if (__OPENCL_C_VERSION__ >= 200) && defined TEST_CORE_FEATURES +#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) && defined TEST_CORE_FEATURES // expected-warning@-2{{OpenCL extension 'cl_khr_3d_image_writes' is core feature or supported optional core feature - ignoring}} #endif - - -#if (__OPENCL_C_VERSION__ >= 110) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) #ifndef cl_khr_gl_event #error "Missing cl_khr_gl_event define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_event' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_gl_event: enable +#pragma OPENCL EXTENSION cl_khr_gl_event : enable -#if (__OPENCL_C_VERSION__ >= 110) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) #ifndef cl_khr_d3d10_sharing #error "Missing cl_khr_d3d10_sharing define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d10_sharing' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_d3d10_sharing: enable +#pragma OPENCL EXTENSION cl_khr_d3d10_sharing : enable -#if (__OPENCL_C_VERSION__ >= 110) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110) #ifndef cles_khr_int64 #error "Missing cles_khr_int64 define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cles_khr_int64' - ignoring}} #endif -#pragma OPENCL EXTENSION cles_khr_int64: enable +#pragma OPENCL EXTENSION cles_khr_int64 : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_khr_context_abort #error "Missing cl_context_abort define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_context_abort' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_context_abort: enable +#pragma OPENCL EXTENSION cl_khr_context_abort : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_khr_d3d11_sharing #error "Missing cl_khr_d3d11_sharing define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d11_sharing' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_d3d11_sharing: enable +#pragma OPENCL EXTENSION cl_khr_d3d11_sharing : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_khr_dx9_media_sharing #error "Missing cl_khr_dx9_media_sharing define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_dx9_media_sharing' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_dx9_media_sharing: enable +#pragma OPENCL EXTENSION cl_khr_dx9_media_sharing : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_khr_image2d_from_buffer #error "Missing cl_khr_image2d_from_buffer define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_image2d_from_buffer' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_image2d_from_buffer: enable +#pragma OPENCL EXTENSION cl_khr_image2d_from_buffer : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_khr_initialize_memory #error "Missing cl_khr_initialize_memory define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_initialize_memory' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_initialize_memory: enable +#pragma OPENCL EXTENSION cl_khr_initialize_memory : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_khr_gl_depth_images #error "Missing cl_khr_gl_depth_images define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_depth_images' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_gl_depth_images: enable +#pragma OPENCL EXTENSION cl_khr_gl_depth_images : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_khr_gl_msaa_sharing #error "Missing cl_khr_gl_msaa_sharing define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable +#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_khr_spir #error "Missing cl_khr_spir define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_spir' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_spir: enable +#pragma OPENCL EXTENSION cl_khr_spir : enable -#if (__OPENCL_C_VERSION__ >= 200) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) #ifndef cl_khr_egl_event #error "Missing cl_khr_egl_event define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_egl_event' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_egl_event: enable +#pragma OPENCL EXTENSION cl_khr_egl_event : enable -#if (__OPENCL_C_VERSION__ >= 200) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) #ifndef cl_khr_egl_image #error "Missing cl_khr_egl_image define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_egl_image' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_egl_image: enable +#pragma OPENCL EXTENSION cl_khr_egl_image : enable -#if (__OPENCL_C_VERSION__ >= 200) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) #ifndef cl_khr_mipmap_image #error "Missing cl_khr_mipmap_image define" #endif @@ -240,18 +240,18 @@ #endif // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable +#pragma OPENCL EXTENSION cl_khr_mipmap_image : enable -#if (__OPENCL_C_VERSION__ >= 200) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) #ifndef cl_khr_srgb_image_writes #error "Missing cl_khr_srgb_image_writes define" #endif #else // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_srgb_image_writes: enable +#pragma OPENCL EXTENSION cl_khr_srgb_image_writes : enable -#if (__OPENCL_C_VERSION__ >= 200) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) #ifndef cl_khr_subgroups #error "Missing cl_khr_subgroups define" #endif @@ -261,9 +261,9 @@ #endif // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_subgroups: enable +#pragma OPENCL EXTENSION cl_khr_subgroups : enable -#if (__OPENCL_C_VERSION__ >= 200) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) #ifndef cl_khr_terminate_context #error "Missing cl_khr_terminate_context define" #endif @@ -280,9 +280,9 @@ #ifndef cl_amd_media_ops2 #error "Missing cl_amd_media_ops2 define" #endif -#pragma OPENCL EXTENSION cl_amd_media_ops2: enable +#pragma OPENCL EXTENSION cl_amd_media_ops2 : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_khr_depth_images #error "Missing cl_khr_depth_images define" #endif @@ -292,9 +292,9 @@ #endif // expected-warning@+2{{unsupported OpenCL extension 'cl_khr_depth_images' - ignoring}} #endif -#pragma OPENCL EXTENSION cl_khr_depth_images: enable +#pragma OPENCL EXTENSION cl_khr_depth_images : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_intel_subgroups #error "Missing cl_intel_subgroups define" #endif @@ -303,7 +303,7 @@ #endif #pragma OPENCL EXTENSION cl_intel_subgroups : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_intel_subgroups_short #error "Missing cl_intel_subgroups_short define" #endif @@ -312,7 +312,7 @@ #endif #pragma OPENCL EXTENSION cl_intel_subgroups_short : enable -#if (__OPENCL_C_VERSION__ >= 120) +#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120) #ifndef cl_intel_device_side_avc_motion_estimation #error "Missing cl_intel_device_side_avc_motion_estimation define" #endif diff --git a/test/SemaOpenCL/extensions.cl b/test/SemaOpenCL/extensions.cl index 5f95e32d4a54..e9dba69ecd7c 100644 --- a/test/SemaOpenCL/extensions.cl +++ b/test/SemaOpenCL/extensions.cl @@ -28,6 +28,7 @@ // enabled by default with -cl-std=CL2.0). // // RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=CL2.0 -finclude-default-header +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=c++ #ifdef _OPENCL_H_ // expected-no-diagnostics @@ -37,7 +38,11 @@ // expected-no-diagnostics #endif -#if __OPENCL_C_VERSION__ < 120 +#ifdef __OPENCL_CPP_VERSION__ +// expected-no-diagnostics +#endif + +#if (defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ < 120) void f1(double da) { // expected-error {{type 'double' requires cl_khr_fp64 extension}} double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}} (void) 1.0; // expected-warning {{double precision constant requires cl_khr_fp64}} @@ -89,7 +94,7 @@ void f2(void) { // expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}} #endif -#if __OPENCL_C_VERSION__ < 120 +#if (defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ < 120) void f3(void) { double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}} } From 8e85c80dd7085ea30105e29d4adc963119b30c09 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 15 Feb 2019 20:49:11 +0000 Subject: [PATCH 3/4] Vendor import of compiler-rt release_80 branch r354130: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_80@354130 --- .../sanitizer_interceptors_ioctl_netbsd.inc | 9 +++------ lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc | 5 ----- lib/sanitizer_common/sanitizer_platform_limits_netbsd.h | 4 ---- utils/generate_netbsd_ioctls.awk | 1 - 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc b/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc index 86cb44047606..bddc26d20019 100644 --- a/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc +++ b/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc @@ -25,7 +25,7 @@ struct ioctl_desc { const char *name; }; -const unsigned ioctl_table_max = 1202; +const unsigned ioctl_table_max = 1200; static ioctl_desc ioctl_table[ioctl_table_max]; static unsigned ioctl_table_size = 0; @@ -298,9 +298,6 @@ static void ioctl_table_fill() { _(IRFRAMETTY_GET_DEVICE, WRITE, sizeof(unsigned int)); _(IRFRAMETTY_GET_DONGLE, WRITE, sizeof(unsigned int)); _(IRFRAMETTY_SET_DONGLE, READ, sizeof(unsigned int)); - /* Entries from file: dev/isa/satlinkio.h */ - _(SATIORESET, NONE, 0); - _(SATIOGID, WRITE, struct_satlink_id_sz); /* Entries from file: dev/isa/isvio.h */ _(ISV_CMD, READWRITE, struct_isv_cmd_sz); /* Entries from file: dev/isa/wtreg.h */ @@ -649,8 +646,8 @@ static void ioctl_table_fill() { _(SPKRTUNE, NONE, 0); _(SPKRGETVOL, WRITE, sizeof(unsigned int)); _(SPKRSETVOL, READ, sizeof(unsigned int)); - /* Entries from file: dev/nvmm/nvmm_ioctl.h */ #if 0 /* WIP */ + /* Entries from file: dev/nvmm/nvmm_ioctl.h */ _(NVMM_IOC_CAPABILITY, WRITE, struct_nvmm_ioc_capability_sz); _(NVMM_IOC_MACHINE_CREATE, READWRITE, struct_nvmm_ioc_machine_create_sz); _(NVMM_IOC_MACHINE_DESTROY, READ, struct_nvmm_ioc_machine_destroy_sz); @@ -659,7 +656,7 @@ static void ioctl_table_fill() { _(NVMM_IOC_VCPU_DESTROY, READ, struct_nvmm_ioc_vcpu_destroy_sz); _(NVMM_IOC_VCPU_SETSTATE, READ, struct_nvmm_ioc_vcpu_setstate_sz); _(NVMM_IOC_VCPU_GETSTATE, READ, struct_nvmm_ioc_vcpu_getstate_sz); - _(NVMM_IOC_VCPU_INJECT, READWRITE, struct_nvmm_ioc_vcpu_inject_sz); + _(NVMM_IOC_VCPU_INJECT, READ, struct_nvmm_ioc_vcpu_inject_sz); _(NVMM_IOC_VCPU_RUN, READWRITE, struct_nvmm_ioc_vcpu_run_sz); _(NVMM_IOC_GPA_MAP, READ, struct_nvmm_ioc_gpa_map_sz); _(NVMM_IOC_GPA_UNMAP, READ, struct_nvmm_ioc_gpa_unmap_sz); diff --git a/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc b/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc index b23b430d9e5b..c112e044b1d8 100644 --- a/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc +++ b/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc @@ -122,7 +122,6 @@ #include #include #include -#include #include #include #include @@ -639,7 +638,6 @@ unsigned struct_rf_recon_req_sz = sizeof(rf_recon_req); unsigned struct_rio_conf_sz = sizeof(rio_conf); unsigned struct_rio_interface_sz = sizeof(rio_interface); unsigned struct_rio_stats_sz = sizeof(rio_stats); -unsigned struct_satlink_id_sz = sizeof(satlink_id); unsigned struct_scan_io_sz = sizeof(scan_io); unsigned struct_scbusaccel_args_sz = sizeof(scbusaccel_args); unsigned struct_scbusiodetach_args_sz = sizeof(scbusiodetach_args); @@ -1105,9 +1103,6 @@ unsigned IOCTL_IRDA_GET_TURNAROUNDMASK = IRDA_GET_TURNAROUNDMASK; unsigned IOCTL_IRFRAMETTY_GET_DEVICE = IRFRAMETTY_GET_DEVICE; unsigned IOCTL_IRFRAMETTY_GET_DONGLE = IRFRAMETTY_GET_DONGLE; unsigned IOCTL_IRFRAMETTY_SET_DONGLE = IRFRAMETTY_SET_DONGLE; -unsigned IOCTL_SATIORESET = SATIORESET; -unsigned IOCTL_SATIOGID = SATIOGID; -unsigned IOCTL_SATIOSBUFSIZE = SATIOSBUFSIZE; unsigned IOCTL_ISV_CMD = ISV_CMD; unsigned IOCTL_WTQICMD = WTQICMD; unsigned IOCTL_ISCSI_GET_VERSION = ISCSI_GET_VERSION; diff --git a/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h b/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h index 0c0c8a837b8b..594cfa6c0d47 100644 --- a/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h +++ b/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h @@ -803,7 +803,6 @@ extern unsigned struct_rf_recon_req_sz; extern unsigned struct_rio_conf_sz; extern unsigned struct_rio_interface_sz; extern unsigned struct_rio_stats_sz; -extern unsigned struct_satlink_id_sz; extern unsigned struct_scan_io_sz; extern unsigned struct_scbusaccel_args_sz; extern unsigned struct_scbusiodetach_args_sz; @@ -1266,9 +1265,6 @@ extern unsigned IOCTL_IRDA_GET_TURNAROUNDMASK; extern unsigned IOCTL_IRFRAMETTY_GET_DEVICE; extern unsigned IOCTL_IRFRAMETTY_GET_DONGLE; extern unsigned IOCTL_IRFRAMETTY_SET_DONGLE; -extern unsigned IOCTL_SATIORESET; -extern unsigned IOCTL_SATIOGID; -extern unsigned IOCTL_SATIOSBUFSIZE; extern unsigned IOCTL_ISV_CMD; extern unsigned IOCTL_WTQICMD; extern unsigned IOCTL_ISCSI_GET_VERSION; diff --git a/utils/generate_netbsd_ioctls.awk b/utils/generate_netbsd_ioctls.awk index 82b199214377..38fe88fb0cde 100755 --- a/utils/generate_netbsd_ioctls.awk +++ b/utils/generate_netbsd_ioctls.awk @@ -152,7 +152,6 @@ FNR == 1 { $0 ~ /JOY_GET_X_OFFSET/ || $0 ~ /CHIOGPICKER/ || $0 ~ /SLIOCGUNIT/ || - $0 ~ /SATIOSBUFSIZE/ || $0 ~ /TUNSLMODE/ || $0 ~ /CBQ_IF_ATTACH/ || $0 ~ /CDNR_IF_ATTACH/ || From 38e89f16767351c482670d10ce0a76f85fd327fb Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 15 Feb 2019 20:49:22 +0000 Subject: [PATCH 4/4] Vendor import of lld release_80 branch r354130: https://llvm.org/svn/llvm-project/lld/branches/release_80@354130 --- COFF/PDB.cpp | 18 ++- ELF/Driver.cpp | 2 +- ELF/ScriptParser.cpp | 3 +- docs/ReleaseNotes.rst | 60 +++++++-- docs/index.rst | 1 + docs/missingkeyfunction.rst | 4 +- test/COFF/pdb-relative-source-lines.test | 60 ++++----- test/ELF/emulation-mips.s | 3 + test/ELF/emulation-ppc.s | 37 ++++++ test/wasm/data-layout.ll | 6 +- test/wasm/import-module.ll | 21 ++++ test/wasm/import-names.ll | 27 ++++ test/wasm/init-fini.ll | 88 ++++++------- test/wasm/locals-duplicate.test | 152 +++++++++++------------ test/wasm/lto/relocatable-undefined.ll | 36 ++++++ test/wasm/weak-alias.ll | 28 ++--- wasm/Driver.cpp | 4 +- wasm/InputChunks.cpp | 6 +- wasm/InputFiles.cpp | 11 +- wasm/LTO.cpp | 5 +- wasm/LTO.h | 1 + wasm/MarkLive.cpp | 2 +- wasm/SymbolTable.cpp | 14 ++- wasm/SymbolTable.h | 10 +- wasm/Symbols.h | 19 ++- wasm/Writer.cpp | 108 +++++++++------- wasm/Writer.h | 2 + 27 files changed, 473 insertions(+), 255 deletions(-) create mode 100644 test/wasm/import-module.ll create mode 100644 test/wasm/import-names.ll create mode 100644 test/wasm/lto/relocatable-undefined.ll diff --git a/COFF/PDB.cpp b/COFF/PDB.cpp index 7862b6ce4cc5..7757b89e2b36 100644 --- a/COFF/PDB.cpp +++ b/COFF/PDB.cpp @@ -288,18 +288,24 @@ static void pdbMakeAbsolute(SmallVectorImpl &FileName) { // It's not absolute in any path syntax. Relative paths necessarily refer to // the local file system, so we can make it native without ending up with a // nonsensical path. - sys::path::native(FileName); if (Config->PDBSourcePath.empty()) { + sys::path::native(FileName); sys::fs::make_absolute(FileName); return; } - // Only apply native and dot removal to the relative file path. We want to - // leave the path the user specified untouched since we assume they specified - // it for a reason. - sys::path::remove_dots(FileName, /*remove_dot_dots=*/true); + // Try to guess whether /PDBSOURCEPATH is a unix path or a windows path. + // Since PDB's are more of a Windows thing, we make this conservative and only + // decide that it's a unix path if we're fairly certain. Specifically, if + // it starts with a forward slash. SmallString<128> AbsoluteFileName = Config->PDBSourcePath; - sys::path::append(AbsoluteFileName, FileName); + sys::path::Style GuessedStyle = AbsoluteFileName.startswith("/") + ? sys::path::Style::posix + : sys::path::Style::windows; + sys::path::append(AbsoluteFileName, GuessedStyle, FileName); + sys::path::native(AbsoluteFileName, GuessedStyle); + sys::path::remove_dots(AbsoluteFileName, true, GuessedStyle); + FileName = std::move(AbsoluteFileName); } diff --git a/ELF/Driver.cpp b/ELF/Driver.cpp index 2e2036310fb2..bce9d944a4a6 100644 --- a/ELF/Driver.cpp +++ b/ELF/Driver.cpp @@ -130,7 +130,7 @@ static std::tuple parseEmulation(StringRef Emul) { .Cases("elf32btsmip", "elf32btsmipn32", {ELF32BEKind, EM_MIPS}) .Cases("elf32ltsmip", "elf32ltsmipn32", {ELF32LEKind, EM_MIPS}) .Case("elf32lriscv", {ELF32LEKind, EM_RISCV}) - .Case("elf32ppc", {ELF32BEKind, EM_PPC}) + .Cases("elf32ppc", "elf32ppclinux", {ELF32BEKind, EM_PPC}) .Case("elf64btsmip", {ELF64BEKind, EM_MIPS}) .Case("elf64ltsmip", {ELF64LEKind, EM_MIPS}) .Case("elf64lriscv", {ELF64LEKind, EM_RISCV}) diff --git a/ELF/ScriptParser.cpp b/ELF/ScriptParser.cpp index 7cce94659c9e..7dbe1641622b 100644 --- a/ELF/ScriptParser.cpp +++ b/ELF/ScriptParser.cpp @@ -392,10 +392,11 @@ static std::pair parseBfdName(StringRef S) { .Case("elf32-x86-64", {ELF32LEKind, EM_X86_64}) .Case("elf64-aarch64", {ELF64LEKind, EM_AARCH64}) .Case("elf64-littleaarch64", {ELF64LEKind, EM_AARCH64}) + .Case("elf32-powerpc", {ELF32BEKind, EM_PPC}) .Case("elf64-powerpc", {ELF64BEKind, EM_PPC64}) .Case("elf64-powerpcle", {ELF64LEKind, EM_PPC64}) .Case("elf64-x86-64", {ELF64LEKind, EM_X86_64}) - .Case("elf32-tradbigmips", {ELF32BEKind, EM_MIPS}) + .Cases("elf32-tradbigmips", "elf32-bigmips", {ELF32BEKind, EM_MIPS}) .Case("elf32-ntradbigmips", {ELF32BEKind, EM_MIPS}) .Case("elf32-tradlittlemips", {ELF32LEKind, EM_MIPS}) .Case("elf32-ntradlittlemips", {ELF32LEKind, EM_MIPS}) diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index c02cc586c795..0bebfb3fb1ce 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -13,10 +13,12 @@ lld 8.0.0 Release Notes Introduction ============ -This document contains the release notes for the lld linker, release 8.0.0. -Here we describe the status of lld, including major improvements -from the previous release. All lld releases may be downloaded -from the `LLVM releases web site `_. +lld is a high-performance linker that supports ELF (Unix), COFF (Windows), +Mach-O (macOS), MinGW and WebAssembly. lld is command-line-compatible with +GNU linkers and Microsoft link.exe and is significantly faster than the +system default linkers. + +nlld 8.0.0 has lots of feature improvements and bug fixes. Non-comprehensive list of changes in this release ================================================= @@ -33,27 +35,66 @@ ELF Improvements non-superpages to a superpage if they are aligned to the superpage size. (`r342746 `_) +* lld now attempts to place a ``.note`` segment in the first page of a + generated file, so that you can find some important information + (``.note.gnu.build-id`` in particular) in a core file even if a core + file is truncated by ulimit. + (`r349524 `_) + +* lld now reports an error if ``_GLOBAL_OFFSET_TABLE_`` symbol is + defined by an input object file, as the symbol is supposed to be + synthesized by the linker. + (`r347854 `_) + * lld/Hexagon can now link Linux kernel and musl libc for Qualcomm Hexagon ISA. * Initial MSP430 ISA support has landed. -* The following flags have been added: ``-z interpose``, ``-z global`` - * lld now uses the ``sigrie`` instruction as a trap instruction for MIPS targets. +* lld now creates a TLS segment for AArch64 with a slightly larger + alignment requirement, so that the loader makes a few bytes room + before each TLS segment at runtime. The aim of this change is to + make room to accomodate nonstandard Android TLS slots while keeping + the compatibility with the standard AArch64 ABI. + (`r350681 `_) + +* The following flags have been added: ``--call-graph-profile``, + ``--no-call-graph-profile``, ``--warn-ifunc-textrel``, + ``-z interpose``, ``-z global``, ``-z nodefaultlib`` + COFF Improvements ----------------- * PDB GUID is set to hash of PDB contents instead to a random byte sequence for build reproducibility. +* ``/pdbsourcepath:`` is now also used to make ``"cwd"``, ``"exe"``, ``"pdb"`` + in the env block of PDB outputs absolute if they are relative, and to make + paths to obj files referenced in PDB outputs absolute if they are relative. + Together with the previous item, this makes it possible to generate + executables and PDBs that are fully deterministic and independent of the + absolute path to the build directory, so that different machines building + the same code in different directories can produce exactly the same output. + * The following flags have been added: ``/force:multiple`` * lld now can link against import libraries produced by GNU tools. -* lld can create thunks for ARM, to allow linking images over 16 MB. +* lld can create thunks for ARM and ARM64, to allow linking larger images + (over 16 MB for ARM and over 128 MB for ARM64) + +* Several speed and memory usage improvements. + +* lld now creates debug info for typedefs. + +* lld can now link obj files produced by ``cl.exe /Z7 /Yc``. + +* lld now understands ``%_PDB%`` and ``%_EXT%`` in ``/pdbaltpath:``. + +* Undefined symbols are now printed in demangled form in addition to raw form. MinGW Improvements ------------------ @@ -76,11 +117,6 @@ MinGW Improvements Previously, the ``--build-id`` option did not actually generate a build id unless ``--pdb`` was specified. -MachO Improvements ------------------- - -* Item 1. - WebAssembly Improvements ------------------------ diff --git a/docs/index.rst b/docs/index.rst index da1c894f3d83..2564e9b6310f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -173,4 +173,5 @@ document soon. AtomLLD WebAssembly windows_support + missingkeyfunction ReleaseNotes diff --git a/docs/missingkeyfunction.rst b/docs/missingkeyfunction.rst index 410c749c3b03..54ad3251f794 100644 --- a/docs/missingkeyfunction.rst +++ b/docs/missingkeyfunction.rst @@ -1,5 +1,5 @@ -Missing Key Method -================== +Missing Key Function +==================== If your build failed with a linker error something like this:: diff --git a/test/COFF/pdb-relative-source-lines.test b/test/COFF/pdb-relative-source-lines.test index 865d7a6d8a0a..547056785962 100644 --- a/test/COFF/pdb-relative-source-lines.test +++ b/test/COFF/pdb-relative-source-lines.test @@ -37,26 +37,26 @@ RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=line RUN: ./lld-link -debug "-pdbsourcepath:/usr/src" -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck --check-prefix=POSIX %s -CHECK-LABEL: - Module: 'c:\src{{[\\/]}}pdb_lines_1_relative.obj' -CHECK-NEXT: ObjFile: 'c:\src{{[\\/]}}pdb_lines_1_relative.obj' +CHECK-LABEL: - Module: 'c:\src\pdb_lines_1_relative.obj' +CHECK-NEXT: ObjFile: 'c:\src\pdb_lines_1_relative.obj' CHECK: SourceFiles: -CHECK-NEXT: - 'c:\src{{[\\/]}}pdb_lines_1.c' -CHECK-NEXT: - 'c:\src{{[\\/]}}foo.h' +CHECK-NEXT: - 'c:\src\pdb_lines_1.c' +CHECK-NEXT: - 'c:\src\foo.h' CHECK: Subsections: -CHECK: - FileName: 'c:\src{{[\\/]}}pdb_lines_1.c' -CHECK: - FileName: 'c:\src{{[\\/]}}foo.h' +CHECK: - FileName: 'c:\src\pdb_lines_1.c' +CHECK: - FileName: 'c:\src\foo.h' CHECK: - !FileChecksums -CHECK: - FileName: 'c:\src{{[\\/]}}pdb_lines_1.c' -CHECK: - FileName: 'c:\src{{[\\/]}}foo.h' +CHECK: - FileName: 'c:\src\pdb_lines_1.c' +CHECK: - FileName: 'c:\src\foo.h' -CHECK-LABEL: - Module: 'c:\src{{[\\/]}}pdb_lines_2_relative.obj' -CHECK-NEXT: ObjFile: 'c:\src{{[\\/]}}pdb_lines_2_relative.obj' +CHECK-LABEL: - Module: 'c:\src\pdb_lines_2_relative.obj' +CHECK-NEXT: ObjFile: 'c:\src\pdb_lines_2_relative.obj' CHECK: SourceFiles: -CHECK-NEXT: - 'c:\src{{[\\/]}}pdb_lines_2.c' +CHECK-NEXT: - 'c:\src\pdb_lines_2.c' CHECK: Subsections: -CHECK: - FileName: 'c:\src{{[\\/]}}pdb_lines_2.c' +CHECK: - FileName: 'c:\src\pdb_lines_2.c' CHECK: - !FileChecksums -CHECK: - FileName: 'c:\src{{[\\/]}}pdb_lines_2.c' +CHECK: - FileName: 'c:\src\pdb_lines_2.c' CHECK-LABEL: - Kind: S_ENVBLOCK CHECK-NEXT: EnvBlockSym: @@ -64,33 +64,33 @@ CHECK-NEXT: Entries: CHECK-NEXT: - cwd CHECK-NEXT: - 'c:\src' CHECK-NEXT: - exe -CHECK-NEXT: - 'c:\src{{[\\/]}}lld-link' +CHECK-NEXT: - 'c:\src\lld-link' CHECK-NEXT: - pdb -CHECK-NEXT: - 'c:\src{{[\\/]}}out.pdb' +CHECK-NEXT: - 'c:\src\out.pdb' CHECK-NEXT: - cmd CHECK-NEXT: - '-debug -pdbsourcepath:c:\src -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj' -POSIX-LABEL: - Module: '/usr/src{{[\\/]}}pdb_lines_1_relative.obj' -POSIX-NEXT: ObjFile: '/usr/src{{[\\/]}}pdb_lines_1_relative.obj' +POSIX-LABEL: - Module: '/usr/src/pdb_lines_1_relative.obj' +POSIX-NEXT: ObjFile: '/usr/src/pdb_lines_1_relative.obj' POSIX: SourceFiles: -POSIX-NEXT: - '/usr/src{{[\\/]}}pdb_lines_1.c' -POSIX-NEXT: - '/usr/src{{[\\/]}}foo.h' +POSIX-NEXT: - '/usr/src/pdb_lines_1.c' +POSIX-NEXT: - '/usr/src/foo.h' POSIX: Subsections: -POSIX: - FileName: '/usr/src{{[\\/]}}pdb_lines_1.c' -POSIX: - FileName: '/usr/src{{[\\/]}}foo.h' +POSIX: - FileName: '/usr/src/pdb_lines_1.c' +POSIX: - FileName: '/usr/src/foo.h' POSIX: - !FileChecksums -POSIX: - FileName: '/usr/src{{[\\/]}}pdb_lines_1.c' -POSIX: - FileName: '/usr/src{{[\\/]}}foo.h' +POSIX: - FileName: '/usr/src/pdb_lines_1.c' +POSIX: - FileName: '/usr/src/foo.h' -POSIX-LABEL: - Module: '/usr/src{{[\\/]}}pdb_lines_2_relative.obj' -POSIX-NEXT: ObjFile: '/usr/src{{[\\/]}}pdb_lines_2_relative.obj' +POSIX-LABEL: - Module: '/usr/src/pdb_lines_2_relative.obj' +POSIX-NEXT: ObjFile: '/usr/src/pdb_lines_2_relative.obj' POSIX: SourceFiles: -POSIX-NEXT: - '/usr/src{{[\\/]}}pdb_lines_2.c' +POSIX-NEXT: - '/usr/src/pdb_lines_2.c' POSIX: Subsections: -POSIX: - FileName: '/usr/src{{[\\/]}}pdb_lines_2.c' +POSIX: - FileName: '/usr/src/pdb_lines_2.c' POSIX: - !FileChecksums -POSIX: - FileName: '/usr/src{{[\\/]}}pdb_lines_2.c' +POSIX: - FileName: '/usr/src/pdb_lines_2.c' POSIX-LABEL: - Kind: S_ENVBLOCK POSIX-NEXT: EnvBlockSym: @@ -98,8 +98,8 @@ POSIX-NEXT: Entries: POSIX-NEXT: - cwd POSIX-NEXT: - '/usr/src' POSIX-NEXT: - exe -POSIX-NEXT: - '/usr/src{{[\\/]}}lld-link' +POSIX-NEXT: - '/usr/src/lld-link' POSIX-NEXT: - pdb -POSIX-NEXT: - '/usr/src{{[\\/]}}out.pdb' +POSIX-NEXT: - '/usr/src/out.pdb' POSIX-NEXT: - cmd POSIX-NEXT: - '-debug -pdbsourcepath:/usr/src -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj' diff --git a/test/ELF/emulation-mips.s b/test/ELF/emulation-mips.s index 42d0dd973eb3..6d7a1198b761 100644 --- a/test/ELF/emulation-mips.s +++ b/test/ELF/emulation-mips.s @@ -7,6 +7,9 @@ # RUN: echo 'OUTPUT_FORMAT(elf32-tradbigmips)' > %tmips.script # RUN: ld.lld %tmips.script -e _start %tmips -o %t4mips # RUN: llvm-readobj -file-headers %t4mips | FileCheck --check-prefix=MIPS %s +# RUN: echo 'OUTPUT_FORMAT(elf32-bigmips)' > %tmips2.script +# RUN: ld.lld %tmips2.script -e _start %tmips -o %t5mips +# RUN: llvm-readobj -file-headers %t5mips | FileCheck --check-prefix=MIPS %s # MIPS: ElfHeader { # MIPS-NEXT: Ident { # MIPS-NEXT: Magic: (7F 45 4C 46) diff --git a/test/ELF/emulation-ppc.s b/test/ELF/emulation-ppc.s index 843e77604779..4c8beb10159e 100644 --- a/test/ELF/emulation-ppc.s +++ b/test/ELF/emulation-ppc.s @@ -103,5 +103,42 @@ # PPC64LE-NEXT: StringTableSectionIndex: # PPC64LE-NEXT: } +# RUN: llvm-mc -filetype=obj -triple=powerpc-unknown-linux %s -o %tppc32 +# RUN: ld.lld -m elf32ppc %tppc32 -o %t2ppc32 +# RUN: llvm-readobj -file-headers %t2ppc32 | FileCheck --check-prefix=PPC32 %s +# RUN: ld.lld %tppc32 -o %t3ppc32 +# RUN: llvm-readobj -file-headers %t3ppc32 | FileCheck --check-prefix=PPC32 %s +# RUN: echo 'OUTPUT_FORMAT(elf32-powerpc)' > %tppc32.script +# RUN: ld.lld %tppc32.script %tppc32 -o %t4ppc32 +# RUN: llvm-readobj -file-headers %t4ppc32 | FileCheck --check-prefix=PPC32 %s +# RUN: ld.lld -m elf32ppclinux %tppc32 -o %t5ppc32 +# RUN: llvm-readobj -file-headers %t5ppc32 | FileCheck --check-prefix=PPC32 %s + +# PPC32: ElfHeader { +# PPC32-NEXT: Ident { +# PPC32-NEXT: Magic: (7F 45 4C 46) +# PPC32-NEXT: Class: 32-bit (0x1) +# PPC32-NEXT: DataEncoding: BigEndian (0x2) +# PPC32-NEXT: FileVersion: 1 +# PPC32-NEXT: OS/ABI: SystemV (0x0) +# PPC32-NEXT: ABIVersion: 0 +# PPC32-NEXT: Unused: (00 00 00 00 00 00 00) +# PPC32-NEXT: } +# PPC32-NEXT: Type: Executable (0x2) +# PPC32-NEXT: Machine: EM_PPC (0x14) +# PPC32-NEXT: Version: 1 +# PPC32-NEXT: Entry: +# PPC32-NEXT: ProgramHeaderOffset: 0x34 +# PPC32-NEXT: SectionHeaderOffset: +# PPC32-NEXT: Flags [ (0x0) +# PPC32-NEXT: ] +# PPC32-NEXT: HeaderSize: 52 +# PPC32-NEXT: ProgramHeaderEntrySize: 32 +# PPC32-NEXT: ProgramHeaderCount: +# PPC32-NEXT: SectionHeaderEntrySize: 40 +# PPC32-NEXT: SectionHeaderCount: +# PPC32-NEXT: StringTableSectionIndex: +# PPC32-NEXT: } + .globl _start _start: diff --git a/test/wasm/data-layout.ll b/test/wasm/data-layout.ll index b01c13ac9b82..7c215efb0d8f 100644 --- a/test/wasm/data-layout.ll +++ b/test/wasm/data-layout.ll @@ -85,10 +85,10 @@ target triple = "wasm32-unknown-unknown" ; RELOC: - Type: DATA ; RELOC-NEXT: Relocations: ; RELOC-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 -; RELOC-NEXT: Index: 6 +; RELOC-NEXT: Index: 3 ; RELOC-NEXT: Offset: 0x00000018 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 -; RELOC-NEXT: Index: 3 +; RELOC-NEXT: Index: 4 ; RELOC-NEXT: Offset: 0x0000002E ; RELOC-NEXT: Addend: 4 ; RELOC-NEXT: Segments: @@ -148,7 +148,7 @@ target triple = "wasm32-unknown-unknown" ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Segment: 2 ; RELOC-NEXT: Size: 4 -; RELOC: - Index: 6 +; RELOC-NEXT: - Index: 3 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: hello_str ; RELOC-NEXT: Flags: [ ] diff --git a/test/wasm/import-module.ll b/test/wasm/import-module.ll new file mode 100644 index 000000000000..9a473194ce2c --- /dev/null +++ b/test/wasm/import-module.ll @@ -0,0 +1,21 @@ +; RUN: llc -filetype=obj %s -o %t.o +; RUN: wasm-ld --allow-undefined -o %t.wasm %t.o +; RUN: obj2yaml %t.wasm | FileCheck %s + +target triple = "wasm32-unknown-unknown-wasm" + +define void @_start() { + call void @foo(); + ret void +} + +declare void @foo() #0 + +attributes #0 = { "wasm-import-module"="bar" } + +; CHECK: - Type: IMPORT +; CHECK-NEXT: Imports: +; CHECK-NEXT: - Module: bar +; CHECK-NEXT: Field: foo +; CHECK-NEXT: Kind: FUNCTION +; CHECK-NEXT: SigIndex: 0 diff --git a/test/wasm/import-names.ll b/test/wasm/import-names.ll new file mode 100644 index 000000000000..a3953d335619 --- /dev/null +++ b/test/wasm/import-names.ll @@ -0,0 +1,27 @@ +; RUN: llc -filetype=obj %s -o %t.o +; RUN: wasm-ld --allow-undefined -o %t.wasm %t.o +; RUN: obj2yaml %t.wasm | FileCheck %s + +target triple = "wasm32-unknown-unknown" + +declare void @f0() #0 + +define void @_start() { + call void @f0() + ret void +} + +attributes #0 = { "wasm-import-module"="somewhere" "wasm-import-name"="something" } + +; CHECK: - Type: IMPORT +; CHECK-NEXT: Imports: +; CHECK-NEXT: - Module: somewhere +; CHECK-NEXT: Field: something +; CHECK-NEXT: Kind: FUNCTION +; CHECK-NEXT: SigIndex: 0 + +; CHECK: - Type: CUSTOM +; CHECK-NEXT: Name: name +; CHECK-NEXT: FunctionNames: +; CHECK-NEXT: - Index: 0 +; CHECK-NEXT: Name: f0 diff --git a/test/wasm/init-fini.ll b/test/wasm/init-fini.ll index 9a7f5357ef01..b17020b177c7 100644 --- a/test/wasm/init-fini.ll +++ b/test/wasm/init-fini.ll @@ -163,64 +163,64 @@ entry: ; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ] ; RELOC-NEXT: Function: 7 ; RELOC-NEXT: - Index: 6 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: .Lcall_dtors.101 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Function: 8 -; RELOC-NEXT: - Index: 7 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: .Lregister_call_dtors.101 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Function: 9 -; RELOC-NEXT: - Index: 8 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: __dso_handle ; RELOC-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN, UNDEFINED ] -; RELOC-NEXT: - Index: 9 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: .Lcall_dtors.1001 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Function: 10 -; RELOC-NEXT: - Index: 10 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: .Lregister_call_dtors.1001 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Function: 11 -; RELOC-NEXT: - Index: 11 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: .Lcall_dtors.4000 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Function: 12 -; RELOC-NEXT: - Index: 12 +; RELOC-NEXT: - Index: 7 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: externDtor ; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN, UNDEFINED ] ; RELOC-NEXT: Function: 0 -; RELOC-NEXT: - Index: 13 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: .Lregister_call_dtors.4000 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Function: 13 -; RELOC-NEXT: - Index: 14 +; RELOC-NEXT: - Index: 8 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: externCtor ; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN, UNDEFINED ] ; RELOC-NEXT: Function: 1 -; RELOC-NEXT: - Index: 15 +; RELOC-NEXT: - Index: 9 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: myctor ; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ] ; RELOC-NEXT: Function: 14 -; RELOC-NEXT: - Index: 16 +; RELOC-NEXT: - Index: 10 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: mydtor ; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ] ; RELOC-NEXT: Function: 15 -; RELOC-NEXT: - Index: 17 +; RELOC-NEXT: - Index: 11 ; RELOC-NEXT: Kind: GLOBAL ; RELOC-NEXT: Name: __stack_pointer ; RELOC-NEXT: Flags: [ UNDEFINED ] ; RELOC-NEXT: Global: 0 +; RELOC-NEXT: - Index: 12 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: .Lcall_dtors.101 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Function: 8 +; RELOC-NEXT: - Index: 13 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: .Lregister_call_dtors.101 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Function: 9 +; RELOC-NEXT: - Index: 14 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: .Lcall_dtors.1001 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Function: 10 +; RELOC-NEXT: - Index: 15 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: .Lregister_call_dtors.1001 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Function: 11 +; RELOC-NEXT: - Index: 16 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: .Lcall_dtors.4000 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Function: 12 +; RELOC-NEXT: - Index: 17 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: .Lregister_call_dtors.4000 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Function: 13 ; RELOC-NEXT: - Index: 18 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: .Lcall_dtors.101 @@ -251,36 +251,36 @@ entry: ; RELOC-NEXT: Name: .Lregister_call_dtors.2002 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] ; RELOC-NEXT: Function: 21 -; RELOC-NEXT: InitFunctions: +; RELOC-NEXT: InitFunctions: ; RELOC-NEXT: - Priority: 101 ; RELOC-NEXT: Symbol: 0 ; RELOC-NEXT: - Priority: 101 ; RELOC-NEXT: Symbol: 1 ; RELOC-NEXT: - Priority: 101 -; RELOC-NEXT: Symbol: 7 +; RELOC-NEXT: Symbol: 13 ; RELOC-NEXT: - Priority: 101 -; RELOC-NEXT: Symbol: 15 +; RELOC-NEXT: Symbol: 9 ; RELOC-NEXT: - Priority: 101 ; RELOC-NEXT: Symbol: 19 ; RELOC-NEXT: - Priority: 202 -; RELOC-NEXT: Symbol: 15 +; RELOC-NEXT: Symbol: 9 ; RELOC-NEXT: - Priority: 202 ; RELOC-NEXT: Symbol: 21 ; RELOC-NEXT: - Priority: 1001 ; RELOC-NEXT: Symbol: 0 ; RELOC-NEXT: - Priority: 1001 -; RELOC-NEXT: Symbol: 10 -; RELOC-NEXT: - Priority: 2002 ; RELOC-NEXT: Symbol: 15 ; RELOC-NEXT: - Priority: 2002 +; RELOC-NEXT: Symbol: 9 +; RELOC-NEXT: - Priority: 2002 ; RELOC-NEXT: Symbol: 23 ; RELOC-NEXT: - Priority: 4000 -; RELOC-NEXT: Symbol: 14 +; RELOC-NEXT: Symbol: 8 ; RELOC-NEXT: - Priority: 4000 -; RELOC-NEXT: Symbol: 13 +; RELOC-NEXT: Symbol: 17 ; RELOC-NEXT: - Type: CUSTOM ; RELOC-NEXT: Name: name -; RELOC-NEXT: FunctionNames: +; RELOC-NEXT: FunctionNames: ; RELOC-NEXT: - Index: 0 ; RELOC-NEXT: Name: externDtor ; RELOC-NEXT: - Index: 1 diff --git a/test/wasm/locals-duplicate.test b/test/wasm/locals-duplicate.test index 2d6bd0df5314..74383bf429f6 100644 --- a/test/wasm/locals-duplicate.test +++ b/test/wasm/locals-duplicate.test @@ -270,40 +270,40 @@ ; RELOC-NEXT: - Type: CODE ; RELOC-NEXT: Relocations: ; RELOC-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 4 +; RELOC-NEXT: Index: 18 ; RELOC-NEXT: Offset: 0x00000013 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 6 +; RELOC-NEXT: Index: 3 ; RELOC-NEXT: Offset: 0x0000001C ; RELOC-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 8 +; RELOC-NEXT: Index: 19 ; RELOC-NEXT: Offset: 0x00000025 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 0 +; RELOC-NEXT: Index: 16 ; RELOC-NEXT: Offset: 0x0000002E ; RELOC-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 1 +; RELOC-NEXT: Index: 0 ; RELOC-NEXT: Offset: 0x00000037 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 2 +; RELOC-NEXT: Index: 17 ; RELOC-NEXT: Offset: 0x00000040 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 16 +; RELOC-NEXT: Index: 10 ; RELOC-NEXT: Offset: 0x00000058 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 18 +; RELOC-NEXT: Index: 22 ; RELOC-NEXT: Offset: 0x00000061 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB -; RELOC-NEXT: Index: 20 +; RELOC-NEXT: Index: 23 ; RELOC-NEXT: Offset: 0x0000006A ; RELOC-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 12 +; RELOC-NEXT: Index: 8 ; RELOC-NEXT: Offset: 0x00000073 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 13 +; RELOC-NEXT: Index: 20 ; RELOC-NEXT: Offset: 0x0000007C ; RELOC-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 14 +; RELOC-NEXT: Index: 21 ; RELOC-NEXT: Offset: 0x00000085 ; RELOC-NEXT: Functions: ; RELOC-NEXT: - Index: 0 @@ -386,133 +386,133 @@ ; RELOC-NEXT: SymbolTable: ; RELOC-NEXT: - Index: 0 ; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: colliding_func1 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Function: 0 -; RELOC-NEXT: - Index: 1 -; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: colliding_func2 ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 1 -; RELOC-NEXT: - Index: 2 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: colliding_func3 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Function: 2 -; RELOC-NEXT: - Index: 3 +; RELOC-NEXT: - Index: 1 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_global1A ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 3 -; RELOC-NEXT: - Index: 4 -; RELOC-NEXT: Kind: DATA -; RELOC-NEXT: Name: colliding_global1 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Segment: 0 -; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 5 +; RELOC-NEXT: - Index: 2 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_global2A ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 4 -; RELOC-NEXT: - Index: 6 +; RELOC-NEXT: - Index: 3 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: colliding_global2 ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Segment: 1 ; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 7 +; RELOC-NEXT: - Index: 4 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_global3A ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 5 -; RELOC-NEXT: - Index: 8 -; RELOC-NEXT: Kind: DATA -; RELOC-NEXT: Name: colliding_global3 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Segment: 2 -; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 9 +; RELOC-NEXT: - Index: 5 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_func1A ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 6 -; RELOC-NEXT: - Index: 10 +; RELOC-NEXT: - Index: 6 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_func2A ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 7 -; RELOC-NEXT: - Index: 11 +; RELOC-NEXT: - Index: 7 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_func3A ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 8 -; RELOC-NEXT: - Index: 12 +; RELOC-NEXT: - Index: 8 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: colliding_func1 ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 9 -; RELOC-NEXT: - Index: 13 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: colliding_func2 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Function: 10 -; RELOC-NEXT: - Index: 14 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: colliding_func3 -; RELOC-NEXT: Flags: [ BINDING_LOCAL ] -; RELOC-NEXT: Function: 11 -; RELOC-NEXT: - Index: 15 +; RELOC-NEXT: - Index: 9 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_global1B ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 12 -; RELOC-NEXT: - Index: 16 +; RELOC-NEXT: - Index: 10 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: colliding_global1 ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Segment: 0 ; RELOC-NEXT: Offset: 4 ; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 17 +; RELOC-NEXT: - Index: 11 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: get_global2B ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 13 +; RELOC-NEXT: - Index: 12 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: get_global3B +; RELOC-NEXT: Flags: [ ] +; RELOC-NEXT: Function: 14 +; RELOC-NEXT: - Index: 13 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: get_func1B +; RELOC-NEXT: Flags: [ ] +; RELOC-NEXT: Function: 15 +; RELOC-NEXT: - Index: 14 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: get_func2B +; RELOC-NEXT: Flags: [ ] +; RELOC-NEXT: Function: 16 +; RELOC-NEXT: - Index: 15 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: get_func3B +; RELOC-NEXT: Flags: [ ] +; RELOC-NEXT: Function: 17 +; RELOC-NEXT: - Index: 16 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: colliding_func1 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Function: 0 +; RELOC-NEXT: - Index: 17 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: colliding_func3 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Function: 2 ; RELOC-NEXT: - Index: 18 ; RELOC-NEXT: Kind: DATA +; RELOC-NEXT: Name: colliding_global1 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Segment: 0 +; RELOC-NEXT: Size: 4 +; RELOC-NEXT: - Index: 19 +; RELOC-NEXT: Kind: DATA +; RELOC-NEXT: Name: colliding_global3 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Segment: 2 +; RELOC-NEXT: Size: 4 +; RELOC-NEXT: - Index: 20 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: colliding_func2 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Function: 10 +; RELOC-NEXT: - Index: 21 +; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: colliding_func3 +; RELOC-NEXT: Flags: [ BINDING_LOCAL ] +; RELOC-NEXT: Function: 11 +; RELOC-NEXT: - Index: 22 +; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: colliding_global2 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] ; RELOC-NEXT: Segment: 1 ; RELOC-NEXT: Offset: 4 ; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 19 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: get_global3B -; RELOC-NEXT: Flags: [ ] -; RELOC-NEXT: Function: 14 -; RELOC-NEXT: - Index: 20 +; RELOC-NEXT: - Index: 23 ; RELOC-NEXT: Kind: DATA ; RELOC-NEXT: Name: colliding_global3 ; RELOC-NEXT: Flags: [ BINDING_LOCAL ] ; RELOC-NEXT: Segment: 2 ; RELOC-NEXT: Offset: 4 ; RELOC-NEXT: Size: 4 -; RELOC-NEXT: - Index: 21 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: get_func1B -; RELOC-NEXT: Flags: [ ] -; RELOC-NEXT: Function: 15 -; RELOC-NEXT: - Index: 22 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: get_func2B -; RELOC-NEXT: Flags: [ ] -; RELOC-NEXT: Function: 16 -; RELOC-NEXT: - Index: 23 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: get_func3B -; RELOC-NEXT: Flags: [ ] -; RELOC-NEXT: Function: 17 ; RELOC-NEXT: SegmentInfo: ; RELOC-NEXT: - Index: 0 ; RELOC-NEXT: Name: .bss.colliding_global1 diff --git a/test/wasm/lto/relocatable-undefined.ll b/test/wasm/lto/relocatable-undefined.ll new file mode 100644 index 000000000000..b9780ee0309b --- /dev/null +++ b/test/wasm/lto/relocatable-undefined.ll @@ -0,0 +1,36 @@ +; RUN: llvm-as %s -o %t.o +; RUN: wasm-ld -r -o %t.wasm %t.o +; RUN: obj2yaml %t.wasm | FileCheck %s + +target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown" + +@missing_data = external global i32 +declare i32 @missing_func() local_unnamed_addr + +define i32 @foo() { +entry: + %0 = call i32 @missing_func() + %1 = load i32, i32* @missing_data, align 4 + ret i32 %1 +} + + +; CHECK: - Type: CUSTOM +; CHECK-NEXT: Name: linking +; CHECK-NEXT: Version: 2 +; CHECK-NEXT: SymbolTable: +; CHECK-NEXT: - Index: 0 +; CHECK-NEXT: Kind: FUNCTION +; CHECK-NEXT: Name: missing_func +; CHECK-NEXT: Flags: [ UNDEFINED ] +; CHECK-NEXT: Function: 0 +; CHECK-NEXT: - Index: 1 +; CHECK-NEXT: Kind: FUNCTION +; CHECK-NEXT: Name: foo +; CHECK-NEXT: Flags: [ ] +; CHECK-NEXT: Function: 1 +; CHECK-NEXT: - Index: 2 +; CHECK-NEXT: Kind: DATA +; CHECK-NEXT: Name: missing_data +; CHECK-NEXT: Flags: [ UNDEFINED ] diff --git a/test/wasm/weak-alias.ll b/test/wasm/weak-alias.ll index 0c856e1eafa0..a925c10ccda4 100644 --- a/test/wasm/weak-alias.ll +++ b/test/wasm/weak-alias.ll @@ -187,13 +187,13 @@ entry: ; RELOC-NEXT: - Type: CODE ; RELOC-NEXT: Relocations: ; RELOC-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB -; RELOC-NEXT: Index: 4 +; RELOC-NEXT: Index: 1 ; RELOC-NEXT: Offset: 0x00000004 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB -; RELOC-NEXT: Index: 1 +; RELOC-NEXT: Index: 2 ; RELOC-NEXT: Offset: 0x00000013 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB -; RELOC-NEXT: Index: 4 +; RELOC-NEXT: Index: 1 ; RELOC-NEXT: Offset: 0x0000001C ; RELOC-NEXT: - Type: R_WEBASSEMBLY_GLOBAL_INDEX_LEB ; RELOC-NEXT: Index: 6 @@ -202,10 +202,10 @@ entry: ; RELOC-NEXT: Index: 6 ; RELOC-NEXT: Offset: 0x00000032 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 4 +; RELOC-NEXT: Index: 1 ; RELOC-NEXT: Offset: 0x0000003A ; RELOC-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB -; RELOC-NEXT: Index: 4 +; RELOC-NEXT: Index: 1 ; RELOC-NEXT: Offset: 0x00000043 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_GLOBAL_INDEX_LEB ; RELOC-NEXT: Index: 6 @@ -217,10 +217,10 @@ entry: ; RELOC-NEXT: Index: 6 ; RELOC-NEXT: Offset: 0x00000068 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB -; RELOC-NEXT: Index: 1 +; RELOC-NEXT: Index: 2 ; RELOC-NEXT: Offset: 0x00000070 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB -; RELOC-NEXT: Index: 1 +; RELOC-NEXT: Index: 2 ; RELOC-NEXT: Offset: 0x00000079 ; RELOC-NEXT: - Type: R_WEBASSEMBLY_GLOBAL_INDEX_LEB ; RELOC-NEXT: Index: 6 @@ -259,24 +259,24 @@ entry: ; RELOC-NEXT: Function: 0 ; RELOC-NEXT: - Index: 1 ; RELOC-NEXT: Kind: FUNCTION +; RELOC-NEXT: Name: alias_fn +; RELOC-NEXT: Flags: [ BINDING_WEAK ] +; RELOC-NEXT: Function: 1 +; RELOC-NEXT: - Index: 2 +; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: direct_fn ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 1 -; RELOC-NEXT: - Index: 2 +; RELOC-NEXT: - Index: 3 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: call_direct ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 2 -; RELOC-NEXT: - Index: 3 +; RELOC-NEXT: - Index: 4 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: call_alias ; RELOC-NEXT: Flags: [ ] ; RELOC-NEXT: Function: 3 -; RELOC-NEXT: - Index: 4 -; RELOC-NEXT: Kind: FUNCTION -; RELOC-NEXT: Name: alias_fn -; RELOC-NEXT: Flags: [ BINDING_WEAK ] -; RELOC-NEXT: Function: 1 ; RELOC-NEXT: - Index: 5 ; RELOC-NEXT: Kind: FUNCTION ; RELOC-NEXT: Name: call_alias_ptr diff --git a/wasm/Driver.cpp b/wasm/Driver.cpp index fab4c0c4ed8b..ade15a19f66e 100644 --- a/wasm/Driver.cpp +++ b/wasm/Driver.cpp @@ -434,7 +434,9 @@ static Symbol *handleUndefined(StringRef Name) { static UndefinedGlobal * createUndefinedGlobal(StringRef Name, llvm::wasm::WasmGlobalType *Type) { auto *Sym = - cast(Symtab->addUndefinedGlobal(Name, 0, nullptr, Type)); + cast(Symtab->addUndefinedGlobal(Name, Name, + DefaultModule, 0, + nullptr, Type)); Config->AllowUndefinedSymbols.insert(Sym->getName()); Sym->IsUsedInRegularObj = true; return Sym; diff --git a/wasm/InputChunks.cpp b/wasm/InputChunks.cpp index 1145c670253c..f5884a1beea4 100644 --- a/wasm/InputChunks.cpp +++ b/wasm/InputChunks.cpp @@ -23,7 +23,7 @@ using namespace llvm::support::endian; using namespace lld; using namespace lld::wasm; -static StringRef ReloctTypeToString(uint8_t RelocType) { +static StringRef reloctTypeToString(uint8_t RelocType) { switch (RelocType) { #define WASM_RELOC(NAME, REL) \ case REL: \ @@ -77,7 +77,7 @@ void InputChunk::verifyRelocTargets() const { warn("expected LEB at relocation site be 5-byte padded"); uint32_t ExpectedValue = File->calcExpectedValue(Rel); if (ExpectedValue != ExistingValue) - warn("unexpected existing value for " + ReloctTypeToString(Rel.Type) + + warn("unexpected existing value for " + reloctTypeToString(Rel.Type) + ": existing=" + Twine(ExistingValue) + " expected=" + Twine(ExpectedValue)); } @@ -103,7 +103,7 @@ void InputChunk::writeTo(uint8_t *Buf) const { for (const WasmRelocation &Rel : Relocations) { uint8_t *Loc = Buf + Rel.Offset + Off; uint32_t Value = File->calcNewValue(Rel); - LLVM_DEBUG(dbgs() << "apply reloc: type=" << ReloctTypeToString(Rel.Type) + LLVM_DEBUG(dbgs() << "apply reloc: type=" << reloctTypeToString(Rel.Type) << " addend=" << Rel.Addend << " index=" << Rel.Index << " value=" << Value << " offset=" << Rel.Offset << "\n"); diff --git a/wasm/InputFiles.cpp b/wasm/InputFiles.cpp index e5da23db3773..1e5427216354 100644 --- a/wasm/InputFiles.cpp +++ b/wasm/InputFiles.cpp @@ -377,11 +377,15 @@ Symbol *ObjFile::createUndefined(const WasmSymbol &Sym) { switch (Sym.Info.Kind) { case WASM_SYMBOL_TYPE_FUNCTION: - return Symtab->addUndefinedFunction(Name, Flags, this, Sym.Signature); + return Symtab->addUndefinedFunction(Name, Sym.Info.ImportName, + Sym.Info.ImportModule, Flags, this, + Sym.Signature); case WASM_SYMBOL_TYPE_DATA: return Symtab->addUndefinedData(Name, Flags, this); case WASM_SYMBOL_TYPE_GLOBAL: - return Symtab->addUndefinedGlobal(Name, Flags, this, Sym.GlobalType); + return Symtab->addUndefinedGlobal(Name, Sym.Info.ImportName, + Sym.Info.ImportModule, Flags, this, + Sym.GlobalType); case WASM_SYMBOL_TYPE_SECTION: llvm_unreachable("section symbols cannot be undefined"); } @@ -445,7 +449,8 @@ static Symbol *createBitcodeSymbol(const lto::InputFile::Symbol &ObjSym, if (ObjSym.isUndefined()) { if (ObjSym.isExecutable()) - return Symtab->addUndefinedFunction(Name, Flags, &F, nullptr); + return Symtab->addUndefinedFunction(Name, Name, DefaultModule, Flags, &F, + nullptr); return Symtab->addUndefinedData(Name, Flags, &F); } diff --git a/wasm/LTO.cpp b/wasm/LTO.cpp index 96a947e29d41..e994691cceb2 100644 --- a/wasm/LTO.cpp +++ b/wasm/LTO.cpp @@ -79,8 +79,9 @@ BitcodeCompiler::~BitcodeCompiler() = default; static void undefine(Symbol *S) { if (auto F = dyn_cast(S)) - replaceSymbol(F, F->getName(), 0, F->getFile(), - F->Signature); + replaceSymbol(F, F->getName(), F->getName(), + DefaultModule, 0, + F->getFile(), F->Signature); else if (isa(S)) replaceSymbol(S, S->getName(), 0, S->getFile()); else diff --git a/wasm/LTO.h b/wasm/LTO.h index cf726de5643a..d771301f224d 100644 --- a/wasm/LTO.h +++ b/wasm/LTO.h @@ -23,6 +23,7 @@ #include "lld/Common/LLVM.h" #include "llvm/ADT/SmallString.h" +#include "Writer.h" #include #include diff --git a/wasm/MarkLive.cpp b/wasm/MarkLive.cpp index 3bbd1148f6ad..723ac4e3c6ba 100644 --- a/wasm/MarkLive.cpp +++ b/wasm/MarkLive.cpp @@ -85,7 +85,7 @@ void lld::wasm::markLive() { // equal to null pointer, only reachable via direct call). if (Reloc.Type == R_WEBASSEMBLY_TABLE_INDEX_SLEB || Reloc.Type == R_WEBASSEMBLY_TABLE_INDEX_I32) { - FunctionSymbol *FuncSym = cast(Sym); + auto *FuncSym = cast(Sym); if (FuncSym->hasTableIndex() && FuncSym->getTableIndex() == 0) continue; } diff --git a/wasm/SymbolTable.cpp b/wasm/SymbolTable.cpp index c7983196db36..65441d293b50 100644 --- a/wasm/SymbolTable.cpp +++ b/wasm/SymbolTable.cpp @@ -314,8 +314,9 @@ Symbol *SymbolTable::addDefinedEvent(StringRef Name, uint32_t Flags, return S; } -Symbol *SymbolTable::addUndefinedFunction(StringRef Name, uint32_t Flags, - InputFile *File, +Symbol *SymbolTable::addUndefinedFunction(StringRef Name, StringRef ImportName, + StringRef ImportModule, + uint32_t Flags, InputFile *File, const WasmSignature *Sig) { LLVM_DEBUG(dbgs() << "addUndefinedFunction: " << Name << " [" << (Sig ? toString(*Sig) : "none") << "]\n"); @@ -325,7 +326,8 @@ Symbol *SymbolTable::addUndefinedFunction(StringRef Name, uint32_t Flags, std::tie(S, WasInserted) = insert(Name, File); if (WasInserted) - replaceSymbol(S, Name, Flags, File, Sig); + replaceSymbol(S, Name, ImportName, ImportModule, Flags, + File, Sig); else if (auto *Lazy = dyn_cast(S)) Lazy->fetch(); else @@ -351,7 +353,8 @@ Symbol *SymbolTable::addUndefinedData(StringRef Name, uint32_t Flags, return S; } -Symbol *SymbolTable::addUndefinedGlobal(StringRef Name, uint32_t Flags, +Symbol *SymbolTable::addUndefinedGlobal(StringRef Name, StringRef ImportName, + StringRef ImportModule, uint32_t Flags, InputFile *File, const WasmGlobalType *Type) { LLVM_DEBUG(dbgs() << "addUndefinedGlobal: " << Name << "\n"); @@ -361,7 +364,8 @@ Symbol *SymbolTable::addUndefinedGlobal(StringRef Name, uint32_t Flags, std::tie(S, WasInserted) = insert(Name, File); if (WasInserted) - replaceSymbol(S, Name, Flags, File, Type); + replaceSymbol(S, Name, ImportName, ImportModule, Flags, + File, Type); else if (auto *Lazy = dyn_cast(S)) Lazy->fetch(); else if (S->isDefined()) diff --git a/wasm/SymbolTable.h b/wasm/SymbolTable.h index 5e38e30692ab..64678aee5005 100644 --- a/wasm/SymbolTable.h +++ b/wasm/SymbolTable.h @@ -59,11 +59,13 @@ class SymbolTable { Symbol *addDefinedEvent(StringRef Name, uint32_t Flags, InputFile *File, InputEvent *E); - Symbol *addUndefinedFunction(StringRef Name, uint32_t Flags, InputFile *File, - const WasmSignature *Signature); + Symbol *addUndefinedFunction(StringRef Name, StringRef ImportName, + StringRef ImportModule, uint32_t Flags, + InputFile *File, const WasmSignature *Signature); Symbol *addUndefinedData(StringRef Name, uint32_t Flags, InputFile *File); - Symbol *addUndefinedGlobal(StringRef Name, uint32_t Flags, InputFile *File, - const WasmGlobalType *Type); + Symbol *addUndefinedGlobal(StringRef Name, StringRef ImportName, + StringRef ImportModule, uint32_t Flags, + InputFile *File, const WasmGlobalType *Type); void addLazy(ArchiveFile *F, const llvm::object::Archive::Symbol *Sym); diff --git a/wasm/Symbols.h b/wasm/Symbols.h index 11ee66550cdc..a065338ac1e4 100644 --- a/wasm/Symbols.h +++ b/wasm/Symbols.h @@ -149,13 +149,19 @@ class DefinedFunction : public FunctionSymbol { class UndefinedFunction : public FunctionSymbol { public: - UndefinedFunction(StringRef Name, uint32_t Flags, InputFile *File = nullptr, + UndefinedFunction(StringRef Name, StringRef ImportName, + StringRef ImportModule, uint32_t Flags, + InputFile *File = nullptr, const WasmSignature *Type = nullptr) - : FunctionSymbol(Name, UndefinedFunctionKind, Flags, File, Type) {} + : FunctionSymbol(Name, UndefinedFunctionKind, Flags, File, Type), + ImportName(ImportName), ImportModule(ImportModule) {} static bool classof(const Symbol *S) { return S->kind() == UndefinedFunctionKind; } + + StringRef ImportName; + StringRef ImportModule; }; class SectionSymbol : public Symbol { @@ -261,13 +267,18 @@ class DefinedGlobal : public GlobalSymbol { class UndefinedGlobal : public GlobalSymbol { public: - UndefinedGlobal(StringRef Name, uint32_t Flags, InputFile *File = nullptr, + UndefinedGlobal(StringRef Name, StringRef ImportName, StringRef ImportModule, + uint32_t Flags, InputFile *File = nullptr, const WasmGlobalType *Type = nullptr) - : GlobalSymbol(Name, UndefinedGlobalKind, Flags, File, Type) {} + : GlobalSymbol(Name, UndefinedGlobalKind, Flags, File, Type), + ImportName(ImportName), ImportModule(ImportModule) {} static bool classof(const Symbol *S) { return S->kind() == UndefinedGlobalKind; } + + StringRef ImportName; + StringRef ImportModule; }; // Wasm events are features that suspend the current execution and transfer the diff --git a/wasm/Writer.cpp b/wasm/Writer.cpp index 819d4298fef2..902ca61ca19b 100644 --- a/wasm/Writer.cpp +++ b/wasm/Writer.cpp @@ -39,8 +39,9 @@ using namespace llvm::wasm; using namespace lld; using namespace lld::wasm; -static constexpr int kStackAlignment = 16; -static constexpr const char *kFunctionTableName = "__indirect_function_table"; +static constexpr int StackAlignment = 16; +static constexpr const char *FunctionTableName = "__indirect_function_table"; +const char *lld::wasm::DefaultModule = "env"; namespace { @@ -155,7 +156,7 @@ void Writer::createImportSection() { if (Config->ImportMemory) { WasmImport Import; - Import.Module = "env"; + Import.Module = DefaultModule; Import.Field = "memory"; Import.Kind = WASM_EXTERNAL_MEMORY; Import.Memory.Flags = 0; @@ -172,8 +173,8 @@ void Writer::createImportSection() { if (Config->ImportTable) { uint32_t TableSize = TableBase + IndirectFunctions.size(); WasmImport Import; - Import.Module = "env"; - Import.Field = kFunctionTableName; + Import.Module = DefaultModule; + Import.Field = FunctionTableName; Import.Kind = WASM_EXTERNAL_TABLE; Import.Table.ElemType = WASM_TYPE_FUNCREF; Import.Table.Limits = {0, TableSize, 0}; @@ -182,8 +183,17 @@ void Writer::createImportSection() { for (const Symbol *Sym : ImportedSymbols) { WasmImport Import; - Import.Module = "env"; - Import.Field = Sym->getName(); + if (auto *F = dyn_cast(Sym)) { + Import.Field = F->ImportName; + Import.Module = F->ImportModule; + } else if (auto *G = dyn_cast(Sym)) { + Import.Field = G->ImportName; + Import.Module = G->ImportModule; + } else { + Import.Field = Sym->getName(); + Import.Module = DefaultModule; + } + if (auto *FunctionSym = dyn_cast(Sym)) { Import.Kind = WASM_EXTERNAL_FUNCTION; Import.SigIndex = lookupType(*FunctionSym->Signature); @@ -441,6 +451,13 @@ static uint32_t getWasmFlags(const Symbol *Sym) { Flags |= WASM_SYMBOL_VISIBILITY_HIDDEN; if (Sym->isUndefined()) Flags |= WASM_SYMBOL_UNDEFINED; + if (auto *F = dyn_cast(Sym)) { + if (F->getName() != F->ImportName) + Flags |= WASM_SYMBOL_EXPLICIT_NAME; + } else if (auto *G = dyn_cast(Sym)) { + if (G->getName() != G->ImportName) + Flags |= WASM_SYMBOL_EXPLICIT_NAME; + } return Flags; } @@ -506,15 +523,18 @@ void Writer::createLinkingSection() { if (auto *F = dyn_cast(Sym)) { writeUleb128(Sub.OS, F->getFunctionIndex(), "index"); - if (Sym->isDefined()) + if (Sym->isDefined() || + (Flags & WASM_SYMBOL_EXPLICIT_NAME) != 0) writeStr(Sub.OS, Sym->getName(), "sym name"); } else if (auto *G = dyn_cast(Sym)) { writeUleb128(Sub.OS, G->getGlobalIndex(), "index"); - if (Sym->isDefined()) + if (Sym->isDefined() || + (Flags & WASM_SYMBOL_EXPLICIT_NAME) != 0) writeStr(Sub.OS, Sym->getName(), "sym name"); } else if (auto *E = dyn_cast(Sym)) { writeUleb128(Sub.OS, E->getEventIndex(), "index"); - if (Sym->isDefined()) + if (Sym->isDefined() || + (Flags & WASM_SYMBOL_EXPLICIT_NAME) != 0) writeStr(Sub.OS, Sym->getName(), "sym name"); } else if (isa(Sym)) { writeStr(Sub.OS, Sym->getName(), "sym name"); @@ -663,9 +683,9 @@ void Writer::layoutMemory() { auto PlaceStack = [&]() { if (Config->Relocatable || Config->Shared) return; - MemoryPtr = alignTo(MemoryPtr, kStackAlignment); - if (Config->ZStackSize != alignTo(Config->ZStackSize, kStackAlignment)) - error("stack size must be " + Twine(kStackAlignment) + "-byte aligned"); + MemoryPtr = alignTo(MemoryPtr, StackAlignment); + if (Config->ZStackSize != alignTo(Config->ZStackSize, StackAlignment)) + error("stack size must be " + Twine(StackAlignment) + "-byte aligned"); log("mem: stack size = " + Twine(Config->ZStackSize)); log("mem: stack base = " + Twine(MemoryPtr)); MemoryPtr += Config->ZStackSize; @@ -814,7 +834,7 @@ void Writer::calculateExports() { Exports.push_back(WasmExport{"memory", WASM_EXTERNAL_MEMORY, 0}); if (!Config->Relocatable && Config->ExportTable) - Exports.push_back(WasmExport{kFunctionTableName, WASM_EXTERNAL_TABLE, 0}); + Exports.push_back(WasmExport{FunctionTableName, WASM_EXTERNAL_TABLE, 0}); unsigned FakeGlobalIndex = NumImportedGlobals + InputGlobals.size(); @@ -858,40 +878,42 @@ void Writer::assignSymtab() { StringMap SectionSymbolIndices; unsigned SymbolIndex = SymtabEntries.size(); - for (ObjFile *File : Symtab->ObjectFiles) { - LLVM_DEBUG(dbgs() << "Symtab entries: " << File->getName() << "\n"); - for (Symbol *Sym : File->getSymbols()) { - if (Sym->getFile() != File) - continue; - if (auto *S = dyn_cast(Sym)) { - StringRef Name = S->getName(); - if (CustomSectionMapping.count(Name) == 0) - continue; + auto AddSymbol = [&](Symbol *Sym) { + if (auto *S = dyn_cast(Sym)) { + StringRef Name = S->getName(); + if (CustomSectionMapping.count(Name) == 0) + return; - auto SSI = SectionSymbolIndices.find(Name); - if (SSI != SectionSymbolIndices.end()) { - Sym->setOutputSymbolIndex(SSI->second); - continue; - } - - SectionSymbolIndices[Name] = SymbolIndex; - CustomSectionSymbols[Name] = cast(Sym); - - Sym->markLive(); + auto SSI = SectionSymbolIndices.find(Name); + if (SSI != SectionSymbolIndices.end()) { + Sym->setOutputSymbolIndex(SSI->second); + return; } - // (Since this is relocatable output, GC is not performed so symbols must - // be live.) - assert(Sym->isLive()); - Sym->setOutputSymbolIndex(SymbolIndex++); - SymtabEntries.emplace_back(Sym); - } - } + SectionSymbolIndices[Name] = SymbolIndex; + CustomSectionSymbols[Name] = cast(Sym); - // For the moment, relocatable output doesn't contain any synthetic functions, - // so no need to look through the Symtab for symbols not referenced by - // Symtab->ObjectFiles. + Sym->markLive(); + } + + // (Since this is relocatable output, GC is not performed so symbols must + // be live.) + assert(Sym->isLive()); + Sym->setOutputSymbolIndex(SymbolIndex++); + SymtabEntries.emplace_back(Sym); + }; + + for (Symbol *Sym : Symtab->getSymbols()) + if (!Sym->isLazy()) + AddSymbol(Sym); + + for (ObjFile *File : Symtab->ObjectFiles) { + LLVM_DEBUG(dbgs() << "Local symtab entries: " << File->getName() << "\n"); + for (Symbol *Sym : File->getSymbols()) + if (Sym->isLocal()) + AddSymbol(Sym); + } } uint32_t Writer::lookupType(const WasmSignature &Sig) { diff --git a/wasm/Writer.h b/wasm/Writer.h index a931ba9c29a8..e62f47064228 100644 --- a/wasm/Writer.h +++ b/wasm/Writer.h @@ -15,6 +15,8 @@ namespace wasm { void writeResult(); +extern const char *DefaultModule; + } // namespace wasm } // namespace lld