[PATCH] D107939: [clang][Arm

2021-08-11 Thread Sarah Purohit via Phabricator via cfe-commits
sarahpurohit created this revision.
sarahpurohit added a project: clang.
Herald added a subscriber: kristof.beyls.
sarahpurohit requested review of this revision.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107939

Files:
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/test/Driver/windows-macho.c


Index: clang/test/Driver/windows-macho.c
===
--- /dev/null
+++ clang/test/Driver/windows-macho.c
@@ -0,0 +1,11 @@
+// RUN: %clang -target armv7-pc-win32-macho -msoft-float -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-SOFTFLOAT
+// CHECK-SOFTFLOAT-NOT: error: unsupported option '-msoft-float' for target 
'thumbv7-pc-windows-macho'
+
+// RUN: %clang -target armv7-pc-win32-macho -mhard-float -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-HARDFLOAT
+// CHECK-HARDFLOAT: error: unsupported option '-mhard-float' for target 
'thumbv7-pc-windows-macho'
+
+// RUN: %clang -target armv7-pc-win32-macho -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-DEFAULT-SOFTFLOAT-ABI
+// CHECK-DEFAULT-SOFTFLOAT-ABI: "-mfloat-abi" "soft"
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp
===
--- clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -314,6 +314,11 @@
 
   // FIXME: this is invalid for WindowsCE
   case llvm::Triple::Win32:
+// It is incorrect to select hard float ABI on MachO platforms if the ABI 
is
+// "apcs-gnu".
+if (Triple.isOSBinFormatMachO() && !useAAPCSForMachO(Triple)) {
+  return FloatABI::Soft;
+}
 return FloatABI::Hard;
 
   case llvm::Triple::NetBSD:


Index: clang/test/Driver/windows-macho.c
===
--- /dev/null
+++ clang/test/Driver/windows-macho.c
@@ -0,0 +1,11 @@
+// RUN: %clang -target armv7-pc-win32-macho -msoft-float -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-SOFTFLOAT
+// CHECK-SOFTFLOAT-NOT: error: unsupported option '-msoft-float' for target 'thumbv7-pc-windows-macho'
+
+// RUN: %clang -target armv7-pc-win32-macho -mhard-float -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-HARDFLOAT
+// CHECK-HARDFLOAT: error: unsupported option '-mhard-float' for target 'thumbv7-pc-windows-macho'
+
+// RUN: %clang -target armv7-pc-win32-macho -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-DEFAULT-SOFTFLOAT-ABI
+// CHECK-DEFAULT-SOFTFLOAT-ABI: "-mfloat-abi" "soft"
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp
===
--- clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -314,6 +314,11 @@
 
   // FIXME: this is invalid for WindowsCE
   case llvm::Triple::Win32:
+// It is incorrect to select hard float ABI on MachO platforms if the ABI is
+// "apcs-gnu".
+if (Triple.isOSBinFormatMachO() && !useAAPCSForMachO(Triple)) {
+  return FloatABI::Soft;
+}
 return FloatABI::Hard;
 
   case llvm::Triple::NetBSD:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107939: [clang][Arm] Fix the default floating point ABI for 'armv7-pc-win32-macho'

2021-08-12 Thread Sarah Purohit via Phabricator via cfe-commits
sarahpurohit accepted this revision.
sarahpurohit added a comment.

I do not have commit access. Can someone pull this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107939

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107939: [clang][Arm] Fix the default floating point ABI for 'armv7-pc-win32-macho'

2021-08-12 Thread Sarah Purohit via Phabricator via cfe-commits
sarahpurohit updated this revision to Diff 366179.
sarahpurohit added a comment.

Resolved syntax error with braces. No functional change otherwise.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107939

Files:
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/test/Driver/windows-macho.c


Index: clang/test/Driver/windows-macho.c
===
--- /dev/null
+++ clang/test/Driver/windows-macho.c
@@ -0,0 +1,11 @@
+// RUN: %clang -target armv7-pc-win32-macho -msoft-float -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-SOFTFLOAT
+// CHECK-SOFTFLOAT-NOT: error: unsupported option '-msoft-float' for target 
'thumbv7-pc-windows-macho'
+
+// RUN: %clang -target armv7-pc-win32-macho -mhard-float -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-HARDFLOAT
+// CHECK-HARDFLOAT: error: unsupported option '-mhard-float' for target 
'thumbv7-pc-windows-macho'
+
+// RUN: %clang -target armv7-pc-win32-macho -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-DEFAULT-SOFTFLOAT-ABI
+// CHECK-DEFAULT-SOFTFLOAT-ABI: "-mfloat-abi" "soft"
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp
===
--- clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -314,6 +314,10 @@
 
   // FIXME: this is invalid for WindowsCE
   case llvm::Triple::Win32:
+// It is incorrect to select hard float ABI on MachO platforms if the ABI 
is
+// "apcs-gnu".
+if (Triple.isOSBinFormatMachO() && !useAAPCSForMachO(Triple))
+  return FloatABI::Soft;
 return FloatABI::Hard;
 
   case llvm::Triple::NetBSD:


Index: clang/test/Driver/windows-macho.c
===
--- /dev/null
+++ clang/test/Driver/windows-macho.c
@@ -0,0 +1,11 @@
+// RUN: %clang -target armv7-pc-win32-macho -msoft-float -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-SOFTFLOAT
+// CHECK-SOFTFLOAT-NOT: error: unsupported option '-msoft-float' for target 'thumbv7-pc-windows-macho'
+
+// RUN: %clang -target armv7-pc-win32-macho -mhard-float -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-HARDFLOAT
+// CHECK-HARDFLOAT: error: unsupported option '-mhard-float' for target 'thumbv7-pc-windows-macho'
+
+// RUN: %clang -target armv7-pc-win32-macho -### -c %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-DEFAULT-SOFTFLOAT-ABI
+// CHECK-DEFAULT-SOFTFLOAT-ABI: "-mfloat-abi" "soft"
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp
===
--- clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -314,6 +314,10 @@
 
   // FIXME: this is invalid for WindowsCE
   case llvm::Triple::Win32:
+// It is incorrect to select hard float ABI on MachO platforms if the ABI is
+// "apcs-gnu".
+if (Triple.isOSBinFormatMachO() && !useAAPCSForMachO(Triple))
+  return FloatABI::Soft;
 return FloatABI::Hard;
 
   case llvm::Triple::NetBSD:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits