[PATCH] D120809: [AArch64][SME] Don't infer -neon from +streaming-sve.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 2 05:36:49 PST 2022


sdesmalen created this revision.
sdesmalen added reviewers: c-rhodes, paulwalker-arm, rsandifo-arm.
Herald added subscribers: ctetreau, hiraditya, kristof.beyls, tschuett.
Herald added a project: All.
sdesmalen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In Streaming SVE mode full NEON is not available, even though this is
implied from armv8-a. LLVM previously inferred that NEON needed to be
disabled when setting +streaming-sve, but there is no need to infer
this from +streaming-sve, because we can explicitly disable NEON using
LLVM's attribute mechanism. This is specifically relevant because
+streaming-sve is not a user-facing feature, but rather an LLVM internal
feature.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120809

Files:
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
  llvm/test/MC/AArch64/SME/streaming-mode-neon-bf16.s
  llvm/test/MC/AArch64/SME/streaming-mode-neon-negative.s
  llvm/test/MC/AArch64/SME/streaming-mode-neon.s
  llvm/test/MC/AArch64/SME/streaming-sve-feature.s


Index: llvm/test/MC/AArch64/SME/streaming-sve-feature.s
===================================================================
--- llvm/test/MC/AArch64/SME/streaming-sve-feature.s
+++ llvm/test/MC/AArch64/SME/streaming-sve-feature.s
@@ -1,5 +1,5 @@
-// RUN: llvm-mc -triple=aarch64 -mattr=+streaming-sve,+neon < %s 2>&1 | FileCheck %s
-// RUN: not llvm-mc -triple=aarch64 -mattr=+streaming-sve < %s 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -mattr=+sme < %s 2>&1 | FileCheck %s
+// RUN: not llvm-mc -triple=aarch64 -mattr=-neon,+sme < %s 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
 
 // Verify NEON is disabled when targeting streaming mode, if it's not
 // explicitly requested.
Index: llvm/test/MC/AArch64/SME/streaming-mode-neon.s
===================================================================
--- llvm/test/MC/AArch64/SME/streaming-mode-neon.s
+++ llvm/test/MC/AArch64/SME/streaming-mode-neon.s
@@ -1,13 +1,15 @@
-// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve < %s \
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=-neon,+sme < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=-neon,+streaming-sve < %s \
 // RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
 // RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=-neon < %s 2>&1 \
 // RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
-// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+streaming-sve < %s \
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=-neon,+streaming-sve < %s \
 // RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-INST
 // Disassemble encoding and check the re-encoding (-show-encoding) matches.
-// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve < %s \
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=-neon,+streaming-sve < %s \
 // RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
-// RUN:        | llvm-mc -triple=aarch64 -mattr=+streaming-sve -disassemble -show-encoding \
+// RUN:        | llvm-mc -triple=aarch64 -mattr=-neon,+streaming-sve -disassemble -show-encoding \
 // RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
 
 // Scalar FP instructions
Index: llvm/test/MC/AArch64/SME/streaming-mode-neon-negative.s
===================================================================
--- llvm/test/MC/AArch64/SME/streaming-mode-neon-negative.s
+++ llvm/test/MC/AArch64/SME/streaming-mode-neon-negative.s
@@ -1,4 +1,4 @@
-// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve,+bf16 2>&1 < %s| FileCheck %s
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=-neon,+sme 2>&1 < %s| FileCheck %s
 
 // ------------------------------------------------------------------------- //
 // Check FABD is illegal in streaming mode
Index: llvm/test/MC/AArch64/SME/streaming-mode-neon-bf16.s
===================================================================
--- llvm/test/MC/AArch64/SME/streaming-mode-neon-bf16.s
+++ llvm/test/MC/AArch64/SME/streaming-mode-neon-bf16.s
@@ -1,16 +1,18 @@
-// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve,+bf16 < %s \
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=-neon,+sme < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=-neon,+streaming-sve,+bf16 < %s \
 // RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
 // RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=-neon < %s 2>&1 \
 // RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
-// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+streaming-sve,+bf16 < %s \
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=-neon,+streaming-sve,+bf16 < %s \
 // RUN:        | llvm-objdump --mattr=+bf16 -d - | FileCheck %s --check-prefix=CHECK-INST
 // Disassemble encoding and check the re-encoding (-show-encoding) matches.
-// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve,+bf16 < %s \
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=-neon,+streaming-sve,+bf16 < %s \
 // RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
-// RUN:        | llvm-mc -triple=aarch64 -mattr=+streaming-sve,+bf16 -disassemble -show-encoding \
+// RUN:        | llvm-mc -triple=aarch64 -mattr=-neon,+streaming-sve,+bf16 -disassemble -show-encoding \
 // RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
 
 bfcvt h5, s3
 // CHECK-INST: bfcvt h5, s3
 // CHECK-ENCODING: [0x65,0x40,0x63,0x1e]
-// CHECK-ERROR: instruction requires: bf16
+// CHECK-ERROR: instruction requires: bf16 neon or sme
Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
===================================================================
--- llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
+++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
@@ -57,16 +57,7 @@
       CPU = "apple-a12";
   }
 
-  // Most of the NEON instruction set isn't supported in streaming mode on SME
-  // targets, disable NEON unless explicitly requested.
-  bool RequestedNEON = FS.contains("neon");
-  bool RequestedStreamingSVE = FS.contains("streaming-sve");
-  MCSubtargetInfo *STI =
-      createAArch64MCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
-  if (RequestedStreamingSVE && !RequestedNEON &&
-      STI->hasFeature(AArch64::FeatureNEON))
-    STI->ToggleFeature(AArch64::FeatureNEON);
-  return STI;
+  return createAArch64MCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
 }
 
 void AArch64_MC::initLLVMToCVRegMapping(MCRegisterInfo *MRI) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120809.412385.patch
Type: text/x-patch
Size: 5682 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220302/29da62b8/attachment.bin>


More information about the llvm-commits mailing list