[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
Tue May 25 05:40:47 PDT 2021


asavonic added inline comments.


================
Comment at: clang/test/Sema/x86-no-x87.c:2
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -target-feature -x87
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple i686-linux-gnu -target-feature -x87
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-windows-msvc -target-feature -x87 -DNOERROR
----------------
pengfei wrote:
> Should i686 expect no error like GCC?
GCC seems to fallback to soft-float for i686 if -mno-80387 is used:

  long double orig(long double x, long double y)
  {
    long double z = x + y;
    if (z < 0.0)
      return z;
    else
      return 0.0;
  }

i686-linux-gnu-gcc-8 -c -S -mno-80387 -O3:
	  call	__addxf3 at PLT
	  [...]
	  call	__ltxf2 at PLT
	  addl	$32, %esp
	  testl	%eax, %eax
	  js	.L3
	  xorl	%esi, %esi
	  xorl	%edi, %edi
	  xorl	%ebp, %ebp
  .L3:
	  addl	$12, %esp
	  movl	%esi, %eax
	  movl	%edi, %edx
	  movl	%ebp, %ecx
	  popl	%ebx
	  popl	%esi
	  popl	%edi
	  popl	%ebp
	  ret

This looks like a different ABI.
X87 instructions are not used, so no error is reported.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98895/new/

https://reviews.llvm.org/D98895



More information about the cfe-commits mailing list