[PATCH] D98895: [X86][Draft] Disable long double type for -mno-x87 option

Andrew Savonichev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 18 13:45:50 PDT 2021


asavonic created this revision.
asavonic added a reviewer: andrew.w.kaylor.
Herald added a subscriber: pengfei.
asavonic requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98895

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/X86.cpp
  clang/lib/Basic/Targets/X86.h
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Sema/x86-no-x87.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98895.331672.patch
Type: text/x-patch
Size: 7553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210318/05e6a50a/attachment.bin>


More information about the cfe-commits mailing list