[all-commits] [llvm/llvm-project] a8083d: [X86][clang] Disable long double type for -mno-x87...

Andrew Savonichev via All-commits all-commits at lists.llvm.org
Wed Nov 3 02:09:33 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a8083d42b1c346e21623a1d36d1f0cadd7801d83
      https://github.com/llvm/llvm-project/commit/a8083d42b1c346e21623a1d36d1f0cadd7801d83
  Author: Andrew Savonichev <andrew.savonichev at gmail.com>
  Date:   2021-11-03 (Wed, 03 Nov 2021)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Basic/TargetInfo.h
    M clang/lib/Basic/TargetInfo.cpp
    M clang/lib/Basic/Targets/X86.cpp
    M clang/lib/Basic/Targets/X86.h
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Sema/SemaDecl.cpp
    A clang/test/Sema/x86-no-x87.cpp
    A clang/test/Sema/x86_64-no-x87.cpp
    M clang/test/SemaSYCL/float128.cpp

  Log Message:
  -----------
  [X86][clang] Disable long double type for -mno-x87 option

This patch attempts to fix a compiler crash that occurs when long
double type is used with -mno-x87 compiler option.

The option disables x87 target feature, which in turn disables x87
registers, so CG cannot select them for x86_fp80 LLVM IR type. Long
double is lowered as x86_fp80 for some targets, so it leads to a
crash.

The option seems to contradict the SystemV ABI, which requires long
double to be represented as a 80-bit floating point, and it also
requires to use x87 registers.

To avoid that, `long double` type is disabled when -mno-x87 option is
set. In addition to that, `float` and `double` also use x87 registers
for return values on 32-bit x86, so they are disabled as well.

Differential Revision: https://reviews.llvm.org/D98895




More information about the All-commits mailing list