[PATCH] D107902: [AArch64][SME] Disable NEON on generic CPU for streaming mode

Cullen Rhodes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 13 01:16:40 PDT 2021


c-rhodes updated this revision to Diff 366212.
c-rhodes set the repository for this revision to rG LLVM Github Monorepo.
c-rhodes added a comment.

Clarify comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107902

Files:
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
  llvm/test/MC/AArch64/SME/feature-negative.s
  llvm/test/MC/AArch64/SME/feature.s


Index: llvm/test/MC/AArch64/SME/feature.s
===================================================================
--- llvm/test/MC/AArch64/SME/feature.s
+++ llvm/test/MC/AArch64/SME/feature.s
@@ -8,4 +8,11 @@
 
 // Verify +sme flags imply +bf16
 bfdot z0.s, z1.h, z2.h
-// CHECK-INST: bfdot z0.s, z1.h, z2.h
+// CHECK: bfdot z0.s, z1.h, z2.h
+
+// If no CPU is specified the default is generic which implies NEON. However,
+// in streaming-sve mode NEON is disabled by default, unless the user has
+// explicitly added the feature.
+.arch_extension simd
+add v0.8b, v1.8b, v2.8b
+// CHECK: add v0.8b, v1.8b, v2.8b
Index: llvm/test/MC/AArch64/SME/feature-negative.s
===================================================================
--- /dev/null
+++ llvm/test/MC/AArch64/SME/feature-negative.s
@@ -0,0 +1,5 @@
+// RUN: not llvm-mc -triple=aarch64 -mattr=+streaming-sve < %s 2>&1 | FileCheck %s
+
+// Verify NEON is disabled when targeting streaming mode.
+dup b0, v0.b[0]
+// CHECK: error: instruction requires: neon
Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
===================================================================
--- llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
+++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
@@ -57,7 +57,18 @@
       CPU = "apple-a12";
   }
 
-  return createAArch64MCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
+  // Most of the NEON instruction set isn't supported in streaming mode on SME
+  // targets, but if no CPU is specified the default is "generic", which
+  // implies NEON. If streaming mode is enabled and the CPU is generic, disable
+  // NEON, only if it isn't explicitly specified in the feature flags.
+  bool HasNEON = FS.contains("neon");
+  MCSubtargetInfo *STI =
+      createAArch64MCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
+  if (CPU.equals("generic") && !HasNEON &&
+      STI->hasFeature(AArch64::FeatureNEON) &&
+      STI->hasFeature(AArch64::FeatureStreamingSVE))
+    STI->ToggleFeature(AArch64::FeatureNEON);
+  return STI;
 }
 
 void AArch64_MC::initLLVMToCVRegMapping(MCRegisterInfo *MRI) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107902.366212.patch
Type: text/x-patch
Size: 2126 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210813/bc3b9b94/attachment.bin>


More information about the llvm-commits mailing list