[PATCH] D82946: [Driver][ARM] Disable bf16 when hardware FP support is missing

Victor Campos via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 1 04:49:31 PDT 2020


vhscampos created this revision.
Herald added subscribers: cfe-commits, danielkiss, kristof.beyls.
Herald added a project: clang.
vhscampos abandoned this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82946

Files:
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/test/CodeGen/arm-bf16-softfloat.c


Index: clang/test/CodeGen/arm-bf16-softfloat.c
===================================================================
--- clang/test/CodeGen/arm-bf16-softfloat.c
+++ clang/test/CodeGen/arm-bf16-softfloat.c
@@ -1,4 +1,6 @@
-// RUN: not %clang -o %t.out -target arm-arm-eabi -march=armv8-a+bf16 -mfloat-abi=soft -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target arm-arm-none-eabi -march=armv8-a+bf16 -mfloat-abi=soft -c %s -o %t 2>&1 | FileCheck %s
+// RUN: not %clang -target arm-arm-none-eabi -march=armv8-a+bf16 -mfpu=none -c %s -o %t 2>&1 | FileCheck %s
+// RUN: not %clang -target arm-arm-none-eabi -march=armv8-a+bf16+nofp -c %s -o %t 2>&1 | FileCheck %s
 
 // CHECK: error: __bf16 is not supported on this target
 extern __bf16 var;
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -301,13 +301,14 @@
 
     // Disable all features relating to hardware FP, not already disabled by the
     // above call.
-    Features.insert(Features.end(),
-                    {"-dotprod", "-fp16fml", "-mve", "-mve.fp", "-fpregs"});
+    Features.insert(Features.end(), {"-dotprod", "-fp16fml", "-bf16", "-mve",
+                                     "-mve.fp", "-fpregs"});
   } else if (FPUID == llvm::ARM::FK_NONE ||
              checkFPDisabledInArchName(ArchName)) {
     // -mfpu=none or -march=armvX+nofp is *very* similar to -mfloat-abi=soft,
     // only that it should not disable MVE-I.
-    Features.insert(Features.end(), {"-dotprod", "-fp16fml", "-mve.fp"});
+    Features.insert(Features.end(),
+                    {"-dotprod", "-fp16fml", "-bf16", "-mve.fp"});
     if (!hasIntegerMVE(Features)) {
       Features.emplace_back("-fpregs");
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82946.274755.patch
Type: text/x-patch
Size: 1816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200701/a423c5f1/attachment.bin>


More information about the cfe-commits mailing list