[llvm] bc45acb - [SPARC][IAS] Add named V9 ASI tag constants for memory instructions
Brad Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 5 02:00:15 PDT 2023
Author: Koakuma
Date: 2023-09-05T04:59:58-04:00
New Revision: bc45acbddceea58cdd16c27fe71793ff2543e4f2
URL: https://github.com/llvm/llvm-project/commit/bc45acbddceea58cdd16c27fe71793ff2543e4f2
DIFF: https://github.com/llvm/llvm-project/commit/bc45acbddceea58cdd16c27fe71793ff2543e4f2.diff
LOG: [SPARC][IAS] Add named V9 ASI tag constants for memory instructions
This adds named ASI tag constants (such as #ASI_P and #ASI_P_L) for memory
accesses.
This patch adds 64-bit/V9 tag names, given that currently the majority of SPARC
software targets that arch.
Support for 32-bit/V8 tag names will be added in a future patch.
Reviewed By: barannikov88
Differential Revision: https://reviews.llvm.org/D157235
Added:
llvm/lib/Target/Sparc/SparcASITags.td
llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt
llvm/test/MC/Sparc/sparcv9-asi-names.s
Modified:
llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
llvm/lib/Target/Sparc/CMakeLists.txt
llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.cpp
llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp
llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h
llvm/lib/Target/Sparc/Sparc.td
llvm/test/MC/Disassembler/Sparc/sparc-mem.txt
llvm/test/MC/Sparc/sparc-atomic-instructions.s
llvm/test/MC/Sparc/sparc-cas-instructions.s
llvm/test/MC/Sparc/sparc-mem-asi-instructions.s
llvm/test/MC/Sparc/sparc-mem-instructions.s
llvm/test/MC/Sparc/sparcv9-instructions.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
index adeebf535be95f0..bdb9d0317942b8b 100644
--- a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
+++ b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
@@ -1113,17 +1113,33 @@ OperandMatchResultTy SparcAsmParser::parseASITag(OperandVector &Operands) {
SMLoc E = Parser.getTok().getEndLoc();
int64_t ASIVal = 0;
- if (getParser().parseAbsoluteExpression(ASIVal)) {
- Error(
- S,
- is64Bit()
- ? "malformed ASI tag, must be %asi or a constant integer expression"
- : "malformed ASI tag, must be a constant integer expression");
- return MatchOperand_ParseFail;
- }
+ if (is64Bit() && (getLexer().getKind() == AsmToken::Hash)) {
+ // For now we only support named tags for 64-bit/V9 systems.
+ // TODO: add support for 32-bit/V8 systems.
+ SMLoc TagStart = getLexer().peekTok(false).getLoc();
+ Parser.Lex(); // Eat the '#'.
+ auto ASIName = Parser.getTok().getString();
+ auto ASITag = SparcASITag::lookupASITagByName(ASIName);
+ if (!ASITag)
+ ASITag = SparcASITag::lookupASITagByAltName(ASIName);
+ Parser.Lex(); // Eat the identifier token.
- if (!isUInt<8>(ASIVal)) {
- Error(S, "invalid ASI number, must be between 0 and 255");
+ if (!ASITag) {
+ Error(TagStart, "unknown ASI tag");
+ return MatchOperand_ParseFail;
+ }
+
+ ASIVal = ASITag->Encoding;
+ } else if (!getParser().parseAbsoluteExpression(ASIVal)) {
+ if (!isUInt<8>(ASIVal)) {
+ Error(S, "invalid ASI number, must be between 0 and 255");
+ return MatchOperand_ParseFail;
+ }
+ } else {
+ Error(S, is64Bit()
+ ? "malformed ASI tag, must be %asi, a constant integer "
+ "expression, or a named tag"
+ : "malformed ASI tag, must be a constant integer expression");
return MatchOperand_ParseFail;
}
@@ -1239,8 +1255,8 @@ SparcAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
return MatchOperand_Success;
}
- Error(S,
- "malformed ASI tag, must be %asi or a constant integer expression");
+ Error(S, "malformed ASI tag, must be %asi, a constant integer "
+ "expression, or a named tag");
return MatchOperand_ParseFail;
}
diff --git a/llvm/lib/Target/Sparc/CMakeLists.txt b/llvm/lib/Target/Sparc/CMakeLists.txt
index 6195843a77ce69d..bf76ed9d671b978 100644
--- a/llvm/lib/Target/Sparc/CMakeLists.txt
+++ b/llvm/lib/Target/Sparc/CMakeLists.txt
@@ -10,6 +10,7 @@ tablegen(LLVM SparcGenDisassemblerTables.inc -gen-disassembler)
tablegen(LLVM SparcGenInstrInfo.inc -gen-instr-info)
tablegen(LLVM SparcGenMCCodeEmitter.inc -gen-emitter)
tablegen(LLVM SparcGenRegisterInfo.inc -gen-register-info)
+tablegen(LLVM SparcGenSearchableTables.inc -gen-searchable-tables)
tablegen(LLVM SparcGenSubtargetInfo.inc -gen-subtarget)
add_public_tablegen_target(SparcCommonTableGen)
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.cpp b/llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.cpp
index c3150f4a72d04b0..a0b1fa345cb9abf 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.cpp
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcInstPrinter.cpp
@@ -255,5 +255,9 @@ void SparcInstPrinter::printMembarTag(const MCInst *MI, int opNum,
void SparcInstPrinter::printASITag(const MCInst *MI, int opNum,
const MCSubtargetInfo &STI, raw_ostream &O) {
unsigned Imm = MI->getOperand(opNum).getImm();
- O << Imm;
+ auto ASITag = SparcASITag::lookupASITagByEncoding(Imm);
+ if (isV9(STI) && ASITag)
+ O << '#' << ASITag->Name;
+ else
+ O << Imm;
}
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp
index d6688c31334c28d..fb634ccb280dfe0 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp
@@ -21,6 +21,13 @@
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/ErrorHandling.h"
+namespace llvm {
+namespace SparcASITag {
+#define GET_ASITagsList_IMPL
+#include "SparcGenSearchableTables.inc"
+} // end namespace SparcASITag
+} // end namespace llvm
+
using namespace llvm;
#define GET_INSTRINFO_MC_DESC
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h
index 8e6a9ebdb2ddecf..fd76627aa06756d 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h
@@ -13,6 +13,7 @@
#ifndef LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCMCTARGETDESC_H
#define LLVM_LIB_TARGET_SPARC_MCTARGETDESC_SPARCMCTARGETDESC_H
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DataTypes.h"
#include <memory>
@@ -35,6 +36,18 @@ MCAsmBackend *createSparcAsmBackend(const Target &T, const MCSubtargetInfo &STI,
const MCTargetOptions &Options);
std::unique_ptr<MCObjectTargetWriter> createSparcELFObjectWriter(bool Is64Bit,
uint8_t OSABI);
+
+// Defines symbolic names for Sparc v9 ASI tag names.
+namespace SparcASITag {
+struct ASITag {
+ const char *Name;
+ const char *AltName;
+ unsigned Encoding;
+};
+
+#define GET_ASITagsList_DECL
+#include "SparcGenSearchableTables.inc"
+} // end namespace SparcASITag
} // End llvm namespace
// Defines symbolic names for Sparc registers. This defines a mapping from
diff --git a/llvm/lib/Target/Sparc/Sparc.td b/llvm/lib/Target/Sparc/Sparc.td
index 4cc713abe04628a..ed4f949401181ab 100644
--- a/llvm/lib/Target/Sparc/Sparc.td
+++ b/llvm/lib/Target/Sparc/Sparc.td
@@ -69,6 +69,7 @@ include "LeonFeatures.td"
// Register File, Calling Conv, Instruction Descriptions
//===----------------------------------------------------------------------===//
+include "SparcASITags.td"
include "SparcRegisterInfo.td"
include "SparcCallingConv.td"
include "SparcSchedule.td"
diff --git a/llvm/lib/Target/Sparc/SparcASITags.td b/llvm/lib/Target/Sparc/SparcASITags.td
new file mode 100644
index 000000000000000..115e41bfe033389
--- /dev/null
+++ b/llvm/lib/Target/Sparc/SparcASITags.td
@@ -0,0 +1,54 @@
+//===- SparcASITags.td -------------------------------------*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the symbolic operands permitted for various kinds of
+// SPARCv9 ASI.
+//
+//===----------------------------------------------------------------------===//
+
+include "llvm/TableGen/SearchableTable.td"
+
+class ASITag<string name, string alt_name, bits<8> op> {
+ string Name = name;
+ // A maximum of one alias is supported right now.
+ string AltName = alt_name;
+ bits<8> Encoding = op;
+}
+
+def ASITagsList : GenericTable {
+ let FilterClass = "ASITag";
+ let Fields = ["Name", "AltName", "Encoding"];
+
+ let PrimaryKey = [ "Encoding" ];
+ let PrimaryKeyName = "lookupASITagByEncoding";
+}
+
+def lookupASITagByName : SearchIndex {
+ let Table = ASITagsList;
+ let Key = [ "Name" ];
+}
+
+def lookupASITagByAltName : SearchIndex {
+ let Table = ASITagsList;
+ let Key = [ "AltName" ];
+}
+
+def : ASITag<"ASI_N", "ASI_NUCLEUS", 0x4>;
+def : ASITag<"ASI_N_L", "ASI_NUCLEUS_LITTLE", 0xC>;
+def : ASITag<"ASI_AIUP", "ASI_AS_IF_USER_PRIMARY", 0x10>;
+def : ASITag<"ASI_AIUS", "ASI_AS_IF_USER_SECONDARY", 0x11>;
+def : ASITag<"ASI_AIUP_L", "ASI_AS_IF_USER_PRIMARY_LITTLE", 0x18>;
+def : ASITag<"ASI_AIUS_L", "ASI_AS_IF_USER_SECONDARY_LITTLE", 0x19>;
+def : ASITag<"ASI_P", "ASI_PRIMARY", 0x80>;
+def : ASITag<"ASI_S", "ASI_SECONDARY", 0x81>;
+def : ASITag<"ASI_PNF", "ASI_PRIMARY_NOFAULT", 0x82>;
+def : ASITag<"ASI_SNF", "ASI_SECONDARY_NOFAULT", 0x83>;
+def : ASITag<"ASI_P_L", "ASI_PRIMARY_LITTLE", 0x88>;
+def : ASITag<"ASI_S_L", "ASI_SECONDARY_LITTLE", 0x89>;
+def : ASITag<"ASI_PNF_L", "ASI_PRIMARY_NOFAULT_LITTLE", 0x8A>;
+def : ASITag<"ASI_SNF_L", "ASI_SECONDARY_NOFAULT_LITTLE", 0x8B>;
diff --git a/llvm/test/MC/Disassembler/Sparc/sparc-mem.txt b/llvm/test/MC/Disassembler/Sparc/sparc-mem.txt
index 87474fa1879f146..edb110064e80e78 100644
--- a/llvm/test/MC/Disassembler/Sparc/sparc-mem.txt
+++ b/llvm/test/MC/Disassembler/Sparc/sparc-mem.txt
@@ -12,7 +12,7 @@
# CHECK: ldsb [%g1], %o4
0xd8 0x48 0x40 0x00
-# CHECK: ldsba [%i0+%l6] 131, %o2
+# CHECK: ldsba [%i0+%l6] #ASI_SNF, %o2
0xd4 0xce 0x10 0x76
# CHECK: ldsh [%i0+%l6], %o2
@@ -27,7 +27,7 @@
# CHECK: ldsh [%g1], %o4
0xd8 0x50 0x40 0x00
-# CHECK: ldsha [%i0+%l6] 131, %o2
+# CHECK: ldsha [%i0+%l6] #ASI_SNF, %o2
0xd4 0xd6 0x10 0x76
# CHECK: ldub [%i0+%l6], %o2
@@ -42,7 +42,7 @@
# CHECK: ldub [%g1], %o2
0xd4 0x08 0x40 0x00
-# CHECK: lduba [%i0+%l6] 131, %o2
+# CHECK: lduba [%i0+%l6] #ASI_SNF, %o2
0xd4 0x8e 0x10 0x76
# CHECK: lduh [%i0+%l6], %o2
@@ -57,7 +57,7 @@
# CHECK: lduh [%g1], %o2
0xd4 0x10 0x40 0x00
-# CHECK: lduha [%i0+%l6] 131, %o2
+# CHECK: lduha [%i0+%l6] #ASI_SNF, %o2
0xd4 0x96 0x10 0x76
# CHECK: ld [%i0+%l6], %o2
@@ -72,7 +72,7 @@
# CHECK: ld [%g1], %o2
0xd4 0x00 0x40 0x00
-# CHECK: lda [%i0+%l6] 131, %o2
+# CHECK: lda [%i0+%l6] #ASI_SNF, %o2
0xd4 0x86 0x10 0x76
# CHECK: ld [%i0+%l6], %f2
@@ -87,7 +87,7 @@
# CHECK: ld [%g1], %f2
0xc5 0x00 0x40 0x00
-# CHECK: lda [%i0+%l6] 131, %f2
+# CHECK: lda [%i0+%l6] #ASI_SNF, %f2
0xc5 0x86 0x10 0x76
# CHECK: ldd [%i0+%l6], %f2
@@ -102,7 +102,7 @@
# CHECK: ldd [%g1], %f2
0xc5 0x18 0x40 0x00
-# CHECK: ldda [%i0+%l6] 131, %f2
+# CHECK: ldda [%i0+%l6] #ASI_SNF, %f2
0xc5 0x9e 0x10 0x76
# CHECK: ldq [%i0+%l6], %f4
@@ -153,7 +153,7 @@
# CHECK: stb %o2, [%g1]
0xd4 0x28 0x40 0x00
-# CHECK: stba %o2, [%i0+%l6] 131
+# CHECK: stba %o2, [%i0+%l6] #ASI_SNF
0xd4 0xae 0x10 0x76
# CHECK: sth %o2, [%i0+%l6]
@@ -168,7 +168,7 @@
# CHECK: sth %o2, [%g1]
0xd4 0x30 0x40 0x00
-# CHECK: stha %o2, [%i0+%l6] 131
+# CHECK: stha %o2, [%i0+%l6] #ASI_SNF
0xd4 0xb6 0x10 0x76
# CHECK: st %o2, [%i0+%l6]
@@ -183,7 +183,7 @@
# CHECK: st %o2, [%g1]
0xd4 0x20 0x40 0x00
-# CHECK: sta %o2, [%i0+%l6] 131
+# CHECK: sta %o2, [%i0+%l6] #ASI_SNF
0xd4 0xa6 0x10 0x76
# CHECK: st %f2, [%i0+%l6]
@@ -198,7 +198,7 @@
# CHECK: st %f2, [%g1]
0xc5 0x20 0x40 0x00
-# CHECK: sta %f2, [%i0+%l6] 131
+# CHECK: sta %f2, [%i0+%l6] #ASI_SNF
0xc5 0xa6 0x10 0x76
# CHECK: std %f2, [%i0+%l6]
@@ -213,7 +213,7 @@
# CHECK: std %f2, [%g1]
0xc5 0x38 0x40 0x00
-# CHECK: stda %f2, [%i0+%l6] 131
+# CHECK: stda %f2, [%i0+%l6] #ASI_SNF
0xc5 0xbe 0x10 0x76
# CHECK: stq %f4, [%i0+%l6]
@@ -252,10 +252,10 @@
# CHECK: swap [%g1], %o2
0xd4 0x78 0x40 0x00
-# CHECK: swapa [%i0+%l6] 131, %o2
+# CHECK: swapa [%i0+%l6] #ASI_SNF, %o2
0xd4 0xfe 0x10 0x76
-# CHECK: swapa [%g1] 131, %o2
+# CHECK: swapa [%g1] #ASI_SNF, %o2
0xd4 0xf8 0x50 0x60
# CHECK: ldd [%i0+%l6], %o2
@@ -282,7 +282,7 @@
# CHECK: std %o2, [%g1]
0xd4 0x38 0x40 0x00
-# CHECK: stda %o2, [%i0+%l6] 131
+# CHECK: stda %o2, [%i0+%l6] #ASI_SNF
0xd4 0xbe 0x10 0x76
# CHECK: ldstub [%i0+%l6], %o2
@@ -297,10 +297,10 @@
# CHECK: ldstub [%g1], %o2
0xd4 0x68 0x40 0x00
-# CHECK: ldstuba [%i0+%l6] 131, %o2
+# CHECK: ldstuba [%i0+%l6] #ASI_SNF, %o2
0xd4 0xee 0x10 0x76
-# CHECK: ldstuba [%g1] 131, %o2
+# CHECK: ldstuba [%g1] #ASI_SNF, %o2
0xd4 0xe8 0x50 0x60
# CHECK: flush %g1+%g2
diff --git a/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt b/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt
new file mode 100644
index 000000000000000..9286814552cf5f6
--- /dev/null
+++ b/llvm/test/MC/Disassembler/Sparc/sparc-v9-asi.txt
@@ -0,0 +1,34 @@
+# RUN: llvm-mc --disassemble %s -triple=sparcv9-unknown-linux | FileCheck %s --check-prefix=V9
+
+## Disassembly prefers alternate mnemonic over explicit ASI tags
+## and short over long ASI tag names.
+# V9: casxa [%i0] #ASI_N, %l6, %o2
+0xd5 0xf6 0x00 0x96
+# V9: casxa [%i0] #ASI_N_L, %l6, %o2
+0xd5 0xf6 0x01 0x96
+# V9: casxa [%i0] #ASI_AIUP, %l6, %o2
+0xd5 0xf6 0x02 0x16
+# V9: casxa [%i0] #ASI_AIUS, %l6, %o2
+0xd5 0xf6 0x02 0x36
+# V9: casxa [%i0] #ASI_AIUP_L, %l6, %o2
+0xd5 0xf6 0x03 0x16
+# V9: casxa [%i0] #ASI_AIUS_L, %l6, %o2
+0xd5 0xf6 0x03 0x36
+## casx == casxa #ASI_P
+# V9: casx [%i0], %l6, %o2
+0xd5 0xf6 0x10 0x16
+# V9: casxa [%i0] #ASI_S, %l6, %o2
+0xd5 0xf6 0x10 0x36
+# V9: casxa [%i0] #ASI_PNF, %l6, %o2
+0xd5 0xf6 0x10 0x56
+# V9: casxa [%i0] #ASI_SNF, %l6, %o2
+0xd5 0xf6 0x10 0x76
+## casxl == casxa #ASI_L
+# V9: casxl [%i0], %l6, %o2
+0xd5 0xf6 0x11 0x16
+# V9: casxa [%i0] #ASI_S_L, %l6, %o2
+0xd5 0xf6 0x11 0x36
+# V9: casxa [%i0] #ASI_PNF_L, %l6, %o2
+0xd5 0xf6 0x11 0x56
+# V9: casxa [%i0] #ASI_SNF_L, %l6, %o2
+0xd5 0xf6 0x11 0x76
diff --git a/llvm/test/MC/Sparc/sparc-atomic-instructions.s b/llvm/test/MC/Sparc/sparc-atomic-instructions.s
index ce92bf82d3ec603..2ed53e7c4f68719 100644
--- a/llvm/test/MC/Sparc/sparc-atomic-instructions.s
+++ b/llvm/test/MC/Sparc/sparc-atomic-instructions.s
@@ -1,29 +1,38 @@
-! RUN: llvm-mc %s -arch=sparcv9 -show-encoding | FileCheck %s
-! RUN: llvm-mc %s -arch=sparc -show-encoding | FileCheck %s
+! RUN: llvm-mc %s -arch=sparcv9 -show-encoding | FileCheck %s --check-prefix=V9
+! RUN: llvm-mc %s -arch=sparc -show-encoding | FileCheck %s --check-prefix=V8
- ! CHECK: stbar ! encoding: [0x81,0x43,0xc0,0x00]
+ ! V8: stbar ! encoding: [0x81,0x43,0xc0,0x00]
+ ! V9: stbar ! encoding: [0x81,0x43,0xc0,0x00]
stbar
- ! CHECK: swap [%i0+%l6], %o2 ! encoding: [0xd4,0x7e,0x00,0x16]
+ ! V8: swap [%i0+%l6], %o2 ! encoding: [0xd4,0x7e,0x00,0x16]
+ ! V9: swap [%i0+%l6], %o2 ! encoding: [0xd4,0x7e,0x00,0x16]
swap [%i0+%l6], %o2
- ! CHECK: swap [%i0+32], %o2 ! encoding: [0xd4,0x7e,0x20,0x20]
+ ! V8: swap [%i0+32], %o2 ! encoding: [0xd4,0x7e,0x20,0x20]
+ ! V9: swap [%i0+32], %o2 ! encoding: [0xd4,0x7e,0x20,0x20]
swap [%i0+32], %o2
- ! CHECK: swapa [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xfe,0x10,0x76]
+ ! V8: swapa [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xfe,0x10,0x76]
+ ! V9: swapa [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0xfe,0x10,0x76]
swapa [%i0+%l6] 131, %o2
- ! CHECK: swapa [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xfe,0x10,0x76]
+ ! V8: swapa [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xfe,0x10,0x76]
+ ! V9: swapa [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0xfe,0x10,0x76]
swapa [%i0+%l6] (130+1), %o2
- ! CHECK: ldstub [%i0+40], %g1 ! encoding: [0xc2,0x6e,0x20,0x28]
+ ! V8: ldstub [%i0+40], %g1 ! encoding: [0xc2,0x6e,0x20,0x28]
+ ! V9: ldstub [%i0+40], %g1 ! encoding: [0xc2,0x6e,0x20,0x28]
ldstub [%i0+40], %g1
- ! CHECK: ldstub [%i0+%i2], %g1 ! encoding: [0xc2,0x6e,0x00,0x1a]
+ ! V8: ldstub [%i0+%i2], %g1 ! encoding: [0xc2,0x6e,0x00,0x1a]
+ ! V9: ldstub [%i0+%i2], %g1 ! encoding: [0xc2,0x6e,0x00,0x1a]
ldstub [%i0+%i2], %g1
- ! CHECK: ldstuba [%i0+%i2] 131, %g1 ! encoding: [0xc2,0xee,0x10,0x7a]
+ ! V8: ldstuba [%i0+%i2] 131, %g1 ! encoding: [0xc2,0xee,0x10,0x7a]
+ ! V9: ldstuba [%i0+%i2] #ASI_SNF, %g1 ! encoding: [0xc2,0xee,0x10,0x7a]
ldstuba [%i0+%i2] 131, %g1
- ! CHECK: ldstuba [%i0+%i2] 131, %g1 ! encoding: [0xc2,0xee,0x10,0x7a]
+ ! V8: ldstuba [%i0+%i2] 131, %g1 ! encoding: [0xc2,0xee,0x10,0x7a]
+ ! V9: ldstuba [%i0+%i2] #ASI_SNF, %g1 ! encoding: [0xc2,0xee,0x10,0x7a]
ldstuba [%i0+%i2] (130+1), %g1
diff --git a/llvm/test/MC/Sparc/sparc-cas-instructions.s b/llvm/test/MC/Sparc/sparc-cas-instructions.s
index 8d062932d9a6438..c0cf72dda208b11 100644
--- a/llvm/test/MC/Sparc/sparc-cas-instructions.s
+++ b/llvm/test/MC/Sparc/sparc-cas-instructions.s
@@ -28,12 +28,12 @@ casxl [%i0], %l6, %o2
casxa [%i0] %asi, %l6, %o2
! V8: error: instruction requires a CPU feature not currently enabled
-! V9: casxa [%i0] 128, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x16]
+! V9: casxa [%i0] #ASI_P, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x16]
! LEON: error: instruction requires a CPU feature not currently enabled
casxa [%i0] 0x80, %l6, %o2
! V8: error: instruction requires a CPU feature not currently enabled
-! V9: casxa [%i0] 128, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x16]
+! V9: casxa [%i0] #ASI_P, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x16]
! LEON: error: instruction requires a CPU feature not currently enabled
casxa [%i0] (0x40+0x40), %l6, %o2
@@ -43,11 +43,11 @@ casxa [%i0] (0x40+0x40), %l6, %o2
casa [%i0] %asi, %l6, %o2
! V8: error: instruction requires a CPU feature not currently enabled
-! V9: casa [%i0] 128, %l6, %o2 ! encoding: [0xd5,0xe6,0x10,0x16]
+! V9: casa [%i0] #ASI_P, %l6, %o2 ! encoding: [0xd5,0xe6,0x10,0x16]
! LEON: casa [%i0] 128, %l6, %o2 ! encoding: [0xd5,0xe6,0x10,0x16]
casa [%i0] 0x80, %l6, %o2
! V8: error: instruction requires a CPU feature not currently enabled
-! V9: casa [%i0] 128, %l6, %o2 ! encoding: [0xd5,0xe6,0x10,0x16]
+! V9: casa [%i0] #ASI_P, %l6, %o2 ! encoding: [0xd5,0xe6,0x10,0x16]
! LEON: casa [%i0] 128, %l6, %o2 ! encoding: [0xd5,0xe6,0x10,0x16]
casa [%i0] (0x40+0x40), %l6, %o2
diff --git a/llvm/test/MC/Sparc/sparc-mem-asi-instructions.s b/llvm/test/MC/Sparc/sparc-mem-asi-instructions.s
index 6bad7c4b7e7277b..f69e26fc3e6384b 100644
--- a/llvm/test/MC/Sparc/sparc-mem-asi-instructions.s
+++ b/llvm/test/MC/Sparc/sparc-mem-asi-instructions.s
@@ -3,19 +3,19 @@
! V8: error: malformed ASI tag, must be a constant integer expression
! V8-NEXT: lduba [%i0] asi, %o2
-! V9: error: malformed ASI tag, must be %asi or a constant integer expression
+! V9: error: malformed ASI tag, must be %asi, a constant integer expression, or a named tag
! V9-NEXT: lduba [%i0] asi, %o2
lduba [%i0] asi, %o2
! V8: error: malformed ASI tag, must be a constant integer expression
! V8-NEXT: lduba [%i0] %g0, %o2
-! V9: error: malformed ASI tag, must be %asi or a constant integer expression
+! V9: error: malformed ASI tag, must be %asi, a constant integer expression, or a named tag
! V9-NEXT: lduba [%i0] %g0, %o2
lduba [%i0] %g0, %o2
! V8: error: malformed ASI tag, must be a constant integer expression
! V8-NEXT: lduba [%i0] %0, %o2
-! V9: error: malformed ASI tag, must be %asi or a constant integer expression
+! V9: error: malformed ASI tag, must be %asi, a constant integer expression, or a named tag
! V9-NEXT: lduba [%i0] %0, %o2
lduba [%i0] %0, %o2
diff --git a/llvm/test/MC/Sparc/sparc-mem-instructions.s b/llvm/test/MC/Sparc/sparc-mem-instructions.s
index cf88fcb5ba145fd..cdcfcd588ba44e9 100644
--- a/llvm/test/MC/Sparc/sparc-mem-instructions.s
+++ b/llvm/test/MC/Sparc/sparc-mem-instructions.s
@@ -1,148 +1,215 @@
-! RUN: llvm-mc %s -arch=sparc -show-encoding | FileCheck %s
-! RUN: llvm-mc %s -arch=sparcv9 -show-encoding | FileCheck %s
+! RUN: llvm-mc %s -arch=sparc -show-encoding | FileCheck %s --check-prefix=V8
+! RUN: llvm-mc %s -arch=sparcv9 -show-encoding | FileCheck %s --check-prefix=V9
- ! CHECK: ldsb [%i0+%l6], %o2 ! encoding: [0xd4,0x4e,0x00,0x16]
+ ! V8: ldsb [%i0+%l6], %o2 ! encoding: [0xd4,0x4e,0x00,0x16]
+ ! V9: ldsb [%i0+%l6], %o2 ! encoding: [0xd4,0x4e,0x00,0x16]
ldsb [%i0 + %l6], %o2
- ! CHECK: ldsb [%i0+32], %o2 ! encoding: [0xd4,0x4e,0x20,0x20]
+ ! V8: ldsb [%i0+32], %o2 ! encoding: [0xd4,0x4e,0x20,0x20]
+ ! V9: ldsb [%i0+32], %o2 ! encoding: [0xd4,0x4e,0x20,0x20]
ldsb [%i0 + 32], %o2
- ! CHECK: ldsb [%g1], %o4 ! encoding: [0xd8,0x48,0x40,0x00]
+ ! V8: ldsb [%g1], %o4 ! encoding: [0xd8,0x48,0x40,0x00]
+ ! V9: ldsb [%g1], %o4 ! encoding: [0xd8,0x48,0x40,0x00]
ldsb [%g1], %o4
- ! CHECK: ldsba [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xce,0x10,0x76]
+ ! V8: ldsba [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xce,0x10,0x76]
+ ! V9: ldsba [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0xce,0x10,0x76]
ldsba [%i0 + %l6] 131, %o2
- ! CHECK: ldsba [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xce,0x10,0x76]
+ ! V8: ldsba [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xce,0x10,0x76]
+ ! V9: ldsba [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0xce,0x10,0x76]
ldsba [%i0 + %l6] (130+1), %o2
- ! CHECK: ldsh [%i0+%l6], %o2 ! encoding: [0xd4,0x56,0x00,0x16]
+ ! V8: ldsh [%i0+%l6], %o2 ! encoding: [0xd4,0x56,0x00,0x16]
+ ! V9: ldsh [%i0+%l6], %o2 ! encoding: [0xd4,0x56,0x00,0x16]
ldsh [%i0 + %l6], %o2
- ! CHECK: ldsh [%i0+32], %o2 ! encoding: [0xd4,0x56,0x20,0x20]
+ ! V8: ldsh [%i0+32], %o2 ! encoding: [0xd4,0x56,0x20,0x20]
+ ! V9: ldsh [%i0+32], %o2 ! encoding: [0xd4,0x56,0x20,0x20]
ldsh [%i0 + 32], %o2
- ! CHECK: ldsh [%g1], %o4 ! encoding: [0xd8,0x50,0x40,0x00]
+ ! V8: ldsh [%g1], %o4 ! encoding: [0xd8,0x50,0x40,0x00]
+ ! V9: ldsh [%g1], %o4 ! encoding: [0xd8,0x50,0x40,0x00]
ldsh [%g1], %o4
- ! CHECK: ldsha [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xd6,0x10,0x76]
+ ! V8: ldsha [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xd6,0x10,0x76]
+ ! V9: ldsha [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0xd6,0x10,0x76]
ldsha [%i0 + %l6] 131, %o2
- ! CHECK: ldsha [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xd6,0x10,0x76]
+ ! V8: ldsha [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xd6,0x10,0x76]
+ ! V9: ldsha [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0xd6,0x10,0x76]
ldsha [%i0 + %l6] (130+1), %o2
- ! CHECK: ldub [%i0+%l6], %o2 ! encoding: [0xd4,0x0e,0x00,0x16]
+ ! V8: ldub [%i0+%l6], %o2 ! encoding: [0xd4,0x0e,0x00,0x16]
+ ! V9: ldub [%i0+%l6], %o2 ! encoding: [0xd4,0x0e,0x00,0x16]
ldub [%i0 + %l6], %o2
- ! CHECK: ldub [%i0+32], %o2 ! encoding: [0xd4,0x0e,0x20,0x20]
+ ! V8: ldub [%i0+32], %o2 ! encoding: [0xd4,0x0e,0x20,0x20]
+ ! V9: ldub [%i0+32], %o2 ! encoding: [0xd4,0x0e,0x20,0x20]
ldub [%i0 + 32], %o2
- ! CHECK: ldub [%g1], %o2 ! encoding: [0xd4,0x08,0x40,0x00]
+ ! V8: ldub [%g1], %o2 ! encoding: [0xd4,0x08,0x40,0x00]
+ ! V9: ldub [%g1], %o2 ! encoding: [0xd4,0x08,0x40,0x00]
ldub [%g1], %o2
- ! CHECK: lduba [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x8e,0x10,0x76]
+ ! V8: lduba [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x8e,0x10,0x76]
+ ! V9: lduba [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0x8e,0x10,0x76]
lduba [%i0 + %l6] 131, %o2
- ! CHECK: lduba [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x8e,0x10,0x76]
+ ! V8: lduba [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x8e,0x10,0x76]
+ ! V9: lduba [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0x8e,0x10,0x76]
lduba [%i0 + %l6] (130+1), %o2
- ! CHECK: lduh [%i0+%l6], %o2 ! encoding: [0xd4,0x16,0x00,0x16]
+ ! V8: lduh [%i0+%l6], %o2 ! encoding: [0xd4,0x16,0x00,0x16]
+ ! V9: lduh [%i0+%l6], %o2 ! encoding: [0xd4,0x16,0x00,0x16]
lduh [%i0 + %l6], %o2
- ! CHECK: lduh [%i0+32], %o2 ! encoding: [0xd4,0x16,0x20,0x20]
+ ! V8: lduh [%i0+32], %o2 ! encoding: [0xd4,0x16,0x20,0x20]
+ ! V9: lduh [%i0+32], %o2 ! encoding: [0xd4,0x16,0x20,0x20]
lduh [%i0 + 32], %o2
- ! CHECK: lduh [%g1], %o2 ! encoding: [0xd4,0x10,0x40,0x00]
+ ! V8: lduh [%g1], %o2 ! encoding: [0xd4,0x10,0x40,0x00]
+ ! V9: lduh [%g1], %o2 ! encoding: [0xd4,0x10,0x40,0x00]
lduh [%g1], %o2
- ! CHECK: lduha [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x96,0x10,0x76]
+ ! V8: lduha [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x96,0x10,0x76]
+ ! V9: lduha [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0x96,0x10,0x76]
lduha [%i0 + %l6] 131, %o2
- ! CHECK: lduha [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x96,0x10,0x76]
+ ! V8: lduha [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x96,0x10,0x76]
+ ! V9: lduha [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0x96,0x10,0x76]
lduha [%i0 + %l6] (130+1), %o2
- ! CHECK: ld [%i0+%l6], %o2 ! encoding: [0xd4,0x06,0x00,0x16]
+ ! V8: ld [%i0+%l6], %o2 ! encoding: [0xd4,0x06,0x00,0x16]
+ ! V9: ld [%i0+%l6], %o2 ! encoding: [0xd4,0x06,0x00,0x16]
ld [%i0 + %l6], %o2
- ! CHECK: ld [%i0+32], %o2 ! encoding: [0xd4,0x06,0x20,0x20]
+ ! V8: ld [%i0+32], %o2 ! encoding: [0xd4,0x06,0x20,0x20]
+ ! V9: ld [%i0+32], %o2 ! encoding: [0xd4,0x06,0x20,0x20]
ld [%i0 + 32], %o2
- ! CHECK: ld [%g1], %o2 ! encoding: [0xd4,0x00,0x40,0x00]
+ ! V8: ld [%g1], %o2 ! encoding: [0xd4,0x00,0x40,0x00]
+ ! V9: ld [%g1], %o2 ! encoding: [0xd4,0x00,0x40,0x00]
ld [%g1], %o2
- ! CHECK: lda [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x86,0x10,0x76]
+ ! V8: lda [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x86,0x10,0x76]
+ ! V9: lda [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0x86,0x10,0x76]
lda [%i0 + %l6] 131, %o2
- ! CHECK: lda [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x86,0x10,0x76]
+ ! V8: lda [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x86,0x10,0x76]
+ ! V9: lda [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0x86,0x10,0x76]
lda [%i0 + %l6] (130+1), %o2
- ! CHECK: ldd [%i0+%l6], %o2 ! encoding: [0xd4,0x1e,0x00,0x16]
+ ! V8: ldd [%i0+%l6], %o2 ! encoding: [0xd4,0x1e,0x00,0x16]
+ ! V9: ldd [%i0+%l6], %o2 ! encoding: [0xd4,0x1e,0x00,0x16]
ldd [%i0 + %l6], %o2
- ! CHECK: ldd [%i0+32], %o2 ! encoding: [0xd4,0x1e,0x20,0x20]
+ ! V8: ldd [%i0+32], %o2 ! encoding: [0xd4,0x1e,0x20,0x20]
+ ! V9: ldd [%i0+32], %o2 ! encoding: [0xd4,0x1e,0x20,0x20]
ldd [%i0 + 32], %o2
- ! CHECK: ldd [%g1], %o2 ! encoding: [0xd4,0x18,0x40,0x00]
+ ! V8: ldd [%g1], %o2 ! encoding: [0xd4,0x18,0x40,0x00]
+ ! V9: ldd [%g1], %o2 ! encoding: [0xd4,0x18,0x40,0x00]
ldd [%g1], %o2
- ! CHECK: ldda [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x9e,0x10,0x76]
+ ! V8: ldda [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x9e,0x10,0x76]
+ ! V9: ldda [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0x9e,0x10,0x76]
ldda [%i0 + %l6] 131, %o2
- ! CHECK: ldda [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x9e,0x10,0x76]
+ ! V8: ldda [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x9e,0x10,0x76]
+ ! V9: ldda [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0x9e,0x10,0x76]
ldda [%i0 + %l6] (130+1), %o2
- ! CHECK: stb %o2, [%i0+%l6] ! encoding: [0xd4,0x2e,0x00,0x16]
+ ! V8: stb %o2, [%i0+%l6] ! encoding: [0xd4,0x2e,0x00,0x16]
+ ! V9: stb %o2, [%i0+%l6] ! encoding: [0xd4,0x2e,0x00,0x16]
stb %o2, [%i0 + %l6]
- ! CHECK: stb %o2, [%i0+32] ! encoding: [0xd4,0x2e,0x20,0x20]
+ ! V8: stb %o2, [%i0+32] ! encoding: [0xd4,0x2e,0x20,0x20]
+ ! V9: stb %o2, [%i0+32] ! encoding: [0xd4,0x2e,0x20,0x20]
stb %o2, [%i0 + 32]
- ! CHECK: stb %o2, [%g1] ! encoding: [0xd4,0x28,0x40,0x00]
+ ! V8: stb %o2, [%g1] ! encoding: [0xd4,0x28,0x40,0x00]
+ ! V9: stb %o2, [%g1] ! encoding: [0xd4,0x28,0x40,0x00]
stb %o2, [%g1]
- ! CHECK: stb %o2, [%g1] ! encoding: [0xd4,0x28,0x40,0x00]
+ ! V8: stb %o2, [%g1] ! encoding: [0xd4,0x28,0x40,0x00]
+ ! V9: stb %o2, [%g1] ! encoding: [0xd4,0x28,0x40,0x00]
stub %o2, [%g1]
- ! CHECK: stb %o2, [%g1] ! encoding: [0xd4,0x28,0x40,0x00]
+ ! V8: stb %o2, [%g1] ! encoding: [0xd4,0x28,0x40,0x00]
+ ! V9: stb %o2, [%g1] ! encoding: [0xd4,0x28,0x40,0x00]
stsb %o2, [%g1]
- ! CHECK: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V8: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V9: stba %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xae,0x10,0x76]
stba %o2, [%i0 + %l6] 131
- ! CHECK: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V8: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V9: stba %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xae,0x10,0x76]
stba %o2, [%i0 + %l6] (130+1)
- ! CHECK: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V8: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V9: stba %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xae,0x10,0x76]
stuba %o2, [%i0 + %l6] 131
- ! CHECK: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V8: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V9: stba %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xae,0x10,0x76]
stuba %o2, [%i0 + %l6] (130+1)
- ! CHECK: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V8: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V9: stba %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xae,0x10,0x76]
stsba %o2, [%i0 + %l6] 131
- ! CHECK: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V8: stba %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xae,0x10,0x76]
+ ! V9: stba %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xae,0x10,0x76]
stsba %o2, [%i0 + %l6] (130+1)
- ! CHECK: sth %o2, [%i0+%l6] ! encoding: [0xd4,0x36,0x00,0x16]
+ ! V8: sth %o2, [%i0+%l6] ! encoding: [0xd4,0x36,0x00,0x16]
+ ! V9: sth %o2, [%i0+%l6] ! encoding: [0xd4,0x36,0x00,0x16]
sth %o2, [%i0 + %l6]
- ! CHECK: sth %o2, [%i0+32] ! encoding: [0xd4,0x36,0x20,0x20]
+ ! V8: sth %o2, [%i0+32] ! encoding: [0xd4,0x36,0x20,0x20]
+ ! V9: sth %o2, [%i0+32] ! encoding: [0xd4,0x36,0x20,0x20]
sth %o2, [%i0 + 32]
- ! CHECK: sth %o2, [%g1] ! encoding: [0xd4,0x30,0x40,0x00]
+ ! V8: sth %o2, [%g1] ! encoding: [0xd4,0x30,0x40,0x00]
+ ! V9: sth %o2, [%g1] ! encoding: [0xd4,0x30,0x40,0x00]
sth %o2, [%g1]
- ! CHECK: sth %o2, [%g1] ! encoding: [0xd4,0x30,0x40,0x00]
+ ! V8: sth %o2, [%g1] ! encoding: [0xd4,0x30,0x40,0x00]
+ ! V9: sth %o2, [%g1] ! encoding: [0xd4,0x30,0x40,0x00]
stuh %o2, [%g1]
- ! CHECK: sth %o2, [%g1] ! encoding: [0xd4,0x30,0x40,0x00]
+ ! V8: sth %o2, [%g1] ! encoding: [0xd4,0x30,0x40,0x00]
+ ! V9: sth %o2, [%g1] ! encoding: [0xd4,0x30,0x40,0x00]
stsh %o2, [%g1]
- ! CHECK: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V8: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V9: stha %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xb6,0x10,0x76]
stha %o2, [%i0 + %l6] 131
- ! CHECK: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V8: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V9: stha %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xb6,0x10,0x76]
stha %o2, [%i0 + %l6] (130+1)
- ! CHECK: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V8: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V9: stha %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xb6,0x10,0x76]
stuha %o2, [%i0 + %l6] 131
- ! CHECK: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V8: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V9: stha %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xb6,0x10,0x76]
stuha %o2, [%i0 + %l6] (130+1)
- ! CHECK: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V8: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V9: stha %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xb6,0x10,0x76]
stsha %o2, [%i0 + %l6] 131
- ! CHECK: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V8: stha %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xb6,0x10,0x76]
+ ! V9: stha %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xb6,0x10,0x76]
stsha %o2, [%i0 + %l6] (130+1)
- ! CHECK: st %o2, [%i0+%l6] ! encoding: [0xd4,0x26,0x00,0x16]
+ ! V8: st %o2, [%i0+%l6] ! encoding: [0xd4,0x26,0x00,0x16]
+ ! V9: st %o2, [%i0+%l6] ! encoding: [0xd4,0x26,0x00,0x16]
st %o2, [%i0 + %l6]
- ! CHECK: st %o2, [%i0+32] ! encoding: [0xd4,0x26,0x20,0x20]
+ ! V8: st %o2, [%i0+32] ! encoding: [0xd4,0x26,0x20,0x20]
+ ! V9: st %o2, [%i0+32] ! encoding: [0xd4,0x26,0x20,0x20]
st %o2, [%i0 + 32]
- ! CHECK: st %o2, [%g1] ! encoding: [0xd4,0x20,0x40,0x00]
+ ! V8: st %o2, [%g1] ! encoding: [0xd4,0x20,0x40,0x00]
+ ! V9: st %o2, [%g1] ! encoding: [0xd4,0x20,0x40,0x00]
st %o2, [%g1]
- ! CHECK: sta %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xa6,0x10,0x76]
+ ! V8: sta %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xa6,0x10,0x76]
+ ! V9: sta %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xa6,0x10,0x76]
sta %o2, [%i0 + %l6] 131
- ! CHECK: sta %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xa6,0x10,0x76]
+ ! V8: sta %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xa6,0x10,0x76]
+ ! V9: sta %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xa6,0x10,0x76]
sta %o2, [%i0 + %l6] (130+1)
- ! CHECK: std %o2, [%i0+%l6] ! encoding: [0xd4,0x3e,0x00,0x16]
+ ! V8: std %o2, [%i0+%l6] ! encoding: [0xd4,0x3e,0x00,0x16]
+ ! V9: std %o2, [%i0+%l6] ! encoding: [0xd4,0x3e,0x00,0x16]
std %o2, [%i0 + %l6]
- ! CHECK: std %o2, [%i0+32] ! encoding: [0xd4,0x3e,0x20,0x20]
+ ! V8: std %o2, [%i0+32] ! encoding: [0xd4,0x3e,0x20,0x20]
+ ! V9: std %o2, [%i0+32] ! encoding: [0xd4,0x3e,0x20,0x20]
std %o2, [%i0 + 32]
- ! CHECK: std %o2, [%g1] ! encoding: [0xd4,0x38,0x40,0x00]
+ ! V8: std %o2, [%g1] ! encoding: [0xd4,0x38,0x40,0x00]
+ ! V9: std %o2, [%g1] ! encoding: [0xd4,0x38,0x40,0x00]
std %o2, [%g1]
- ! CHECK: stda %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xbe,0x10,0x76]
+ ! V8: stda %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xbe,0x10,0x76]
+ ! V9: stda %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xbe,0x10,0x76]
stda %o2, [%i0 + %l6] 131
- ! CHECK: stda %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xbe,0x10,0x76]
+ ! V8: stda %o2, [%i0+%l6] 131 ! encoding: [0xd4,0xbe,0x10,0x76]
+ ! V9: stda %o2, [%i0+%l6] #ASI_SNF ! encoding: [0xd4,0xbe,0x10,0x76]
stda %o2, [%i0 + %l6] (130+1)
- ! CHECK: flush %g1+%g2 ! encoding: [0x81,0xd8,0x40,0x02]
+ ! V8: flush %g1+%g2 ! encoding: [0x81,0xd8,0x40,0x02]
+ ! V9: flush %g1+%g2 ! encoding: [0x81,0xd8,0x40,0x02]
flush %g1 + %g2
- ! CHECK: flush %g1+8 ! encoding: [0x81,0xd8,0x60,0x08]
+ ! V8: flush %g1+8 ! encoding: [0x81,0xd8,0x60,0x08]
+ ! V9: flush %g1+8 ! encoding: [0x81,0xd8,0x60,0x08]
flush %g1 + 8
- ! CHECK: flush %g1 ! encoding: [0x81,0xd8,0x40,0x00]
+ ! V8: flush %g1 ! encoding: [0x81,0xd8,0x40,0x00]
+ ! V9: flush %g1 ! encoding: [0x81,0xd8,0x40,0x00]
flush %g1
! Not specified in manual, but accepted by gas.
- ! CHECK: flush %g0 ! encoding: [0x81,0xd8,0x00,0x00]
+ ! V8: flush %g0 ! encoding: [0x81,0xd8,0x00,0x00]
+ ! V9: flush %g0 ! encoding: [0x81,0xd8,0x00,0x00]
flush
- ! CHECK: flush %g0 ! encoding: [0x81,0xd8,0x00,0x00]
+ ! V8: flush %g0 ! encoding: [0x81,0xd8,0x00,0x00]
+ ! V9: flush %g0 ! encoding: [0x81,0xd8,0x00,0x00]
iflush
diff --git a/llvm/test/MC/Sparc/sparcv9-asi-names.s b/llvm/test/MC/Sparc/sparcv9-asi-names.s
new file mode 100644
index 000000000000000..042d62380b03ad0
--- /dev/null
+++ b/llvm/test/MC/Sparc/sparcv9-asi-names.s
@@ -0,0 +1,61 @@
+! RUN: llvm-mc %s -arch=sparcv9 -show-encoding | FileCheck %s --check-prefix=V9
+
+!! Short names
+! V9: casxa [%i0] #ASI_N, %l6, %o2 ! encoding: [0xd5,0xf6,0x00,0x96]
+casxa [%i0] #ASI_N, %l6, %o2
+! V9: casxa [%i0] #ASI_N_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x01,0x96]
+casxa [%i0] #ASI_N_L, %l6, %o2
+! V9: casxa [%i0] #ASI_AIUP, %l6, %o2 ! encoding: [0xd5,0xf6,0x02,0x16]
+casxa [%i0] #ASI_AIUP, %l6, %o2
+! V9: casxa [%i0] #ASI_AIUS, %l6, %o2 ! encoding: [0xd5,0xf6,0x02,0x36]
+casxa [%i0] #ASI_AIUS, %l6, %o2
+! V9: casxa [%i0] #ASI_AIUP_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x03,0x16]
+casxa [%i0] #ASI_AIUP_L, %l6, %o2
+! V9: casxa [%i0] #ASI_AIUS_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x03,0x36]
+casxa [%i0] #ASI_AIUS_L, %l6, %o2
+! V9: casxa [%i0] #ASI_P, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x16]
+casxa [%i0] #ASI_P, %l6, %o2
+! V9: casxa [%i0] #ASI_S, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x36]
+casxa [%i0] #ASI_S, %l6, %o2
+! V9: casxa [%i0] #ASI_PNF, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x56]
+casxa [%i0] #ASI_PNF, %l6, %o2
+! V9: casxa [%i0] #ASI_SNF, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x76]
+casxa [%i0] #ASI_SNF, %l6, %o2
+! V9: casxa [%i0] #ASI_P_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x11,0x16]
+casxa [%i0] #ASI_P_L, %l6, %o2
+! V9: casxa [%i0] #ASI_S_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x11,0x36]
+casxa [%i0] #ASI_S_L, %l6, %o2
+! V9: casxa [%i0] #ASI_PNF_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x11,0x56]
+casxa [%i0] #ASI_PNF_L, %l6, %o2
+! V9: casxa [%i0] #ASI_SNF_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x11,0x76]
+casxa [%i0] #ASI_SNF_L, %l6, %o2
+
+!! Long names
+! V9: casxa [%i0] #ASI_N, %l6, %o2 ! encoding: [0xd5,0xf6,0x00,0x96]
+casxa [%i0] #ASI_NUCLEUS, %l6, %o2
+! V9: casxa [%i0] #ASI_N_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x01,0x96]
+casxa [%i0] #ASI_NUCLEUS_LITTLE, %l6, %o2
+! V9: casxa [%i0] #ASI_AIUP, %l6, %o2 ! encoding: [0xd5,0xf6,0x02,0x16]
+casxa [%i0] #ASI_AS_IF_USER_PRIMARY, %l6, %o2
+! V9: casxa [%i0] #ASI_AIUS, %l6, %o2 ! encoding: [0xd5,0xf6,0x02,0x36]
+casxa [%i0] #ASI_AS_IF_USER_SECONDARY, %l6, %o2
+! V9: casxa [%i0] #ASI_AIUP_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x03,0x16]
+casxa [%i0] #ASI_AS_IF_USER_PRIMARY_LITTLE, %l6, %o2
+! V9: casxa [%i0] #ASI_AIUS_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x03,0x36]
+casxa [%i0] #ASI_AS_IF_USER_SECONDARY_LITTLE, %l6, %o2
+! V9: casxa [%i0] #ASI_P, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x16]
+casxa [%i0] #ASI_PRIMARY, %l6, %o2
+! V9: casxa [%i0] #ASI_S, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x36]
+casxa [%i0] #ASI_SECONDARY, %l6, %o2
+! V9: casxa [%i0] #ASI_PNF, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x56]
+casxa [%i0] #ASI_PRIMARY_NOFAULT, %l6, %o2
+! V9: casxa [%i0] #ASI_SNF, %l6, %o2 ! encoding: [0xd5,0xf6,0x10,0x76]
+casxa [%i0] #ASI_SECONDARY_NOFAULT, %l6, %o2
+! V9: casxa [%i0] #ASI_P_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x11,0x16]
+casxa [%i0] #ASI_PRIMARY_LITTLE, %l6, %o2
+! V9: casxa [%i0] #ASI_S_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x11,0x36]
+casxa [%i0] #ASI_SECONDARY_LITTLE, %l6, %o2
+! V9: casxa [%i0] #ASI_PNF_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x11,0x56]
+casxa [%i0] #ASI_PRIMARY_NOFAULT_LITTLE, %l6, %o2
+! V9: casxa [%i0] #ASI_SNF_L, %l6, %o2 ! encoding: [0xd5,0xf6,0x11,0x76]
+casxa [%i0] #ASI_SECONDARY_NOFAULT_LITTLE, %l6, %o2
diff --git a/llvm/test/MC/Sparc/sparcv9-instructions.s b/llvm/test/MC/Sparc/sparcv9-instructions.s
index f5d1231ccee2126..c4c44060ed3dfd9 100644
--- a/llvm/test/MC/Sparc/sparcv9-instructions.s
+++ b/llvm/test/MC/Sparc/sparcv9-instructions.s
@@ -50,11 +50,11 @@
lduw [%g1], %o2
! V8: error: invalid instruction mnemonic
! V8-NEXT: lduwa [%i0 + %l6] 131, %o2
- ! V9: lda [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x86,0x10,0x76]
+ ! V9: lda [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0x86,0x10,0x76]
lduwa [%i0 + %l6] 131, %o2
! V8: error: invalid instruction mnemonic
! V8-NEXT: lduwa [%i0 + %l6] (130+1), %o2
- ! V9: lda [%i0+%l6] 131, %o2 ! encoding: [0xd4,0x86,0x10,0x76]
+ ! V9: lda [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0x86,0x10,0x76]
lduwa [%i0 + %l6] (130+1), %o2
! V9: ldsw [%i0+%l6], %o2 ! encoding: [0xd4,0x46,0x00,0x16]
@@ -63,9 +63,9 @@
ldsw [%i0 + 32], %o2
! V9: ldsw [%g1], %o2 ! encoding: [0xd4,0x40,0x40,0x00]
ldsw [%g1], %o2
- ! V9: ldswa [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xc6,0x10,0x76]
+ ! V9: ldswa [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0xc6,0x10,0x76]
ldswa [%i0 + %l6] 131, %o2
- ! V9: ldswa [%i0+%l6] 131, %o2 ! encoding: [0xd4,0xc6,0x10,0x76]
+ ! V9: ldswa [%i0+%l6] #ASI_SNF, %o2 ! encoding: [0xd4,0xc6,0x10,0x76]
ldswa [%i0 + %l6] (130+1), %o2
! V8: error: instruction requires a CPU feature not currently enabled
@@ -141,9 +141,9 @@
! V9: ldx [%g2+%i5], %fsr ! encoding: [0xc3,0x08,0x80,0x1d]
ldx [%g2 + %i5],%fsr
- ! V9: ldxa [%g2+%i5] 131, %g0 ! encoding: [0xc0,0xd8,0x90,0x7d]
+ ! V9: ldxa [%g2+%i5] #ASI_SNF, %g0 ! encoding: [0xc0,0xd8,0x90,0x7d]
ldxa [%g2 + %i5] 131, %g0
- ! V9: ldxa [%g2+%i5] 131, %g0 ! encoding: [0xc0,0xd8,0x90,0x7d]
+ ! V9: ldxa [%g2+%i5] #ASI_SNF, %g0 ! encoding: [0xc0,0xd8,0x90,0x7d]
ldxa [%g2 + %i5] (130+1), %g0
! V8: error: instruction requires a CPU feature not currently enabled
@@ -156,9 +156,9 @@
! V9: stx %fsr, [%g2+%i5] ! encoding: [0xc3,0x28,0x80,0x1d]
stx %fsr,[%g2 + %i5]
- ! V9: stxa %g0, [%g2+%i5] 131 ! encoding: [0xc0,0xf0,0x90,0x7d]
+ ! V9: stxa %g0, [%g2+%i5] #ASI_SNF ! encoding: [0xc0,0xf0,0x90,0x7d]
stxa %g0, [%g2 + %i5] 131
- ! V9: stxa %g0, [%g2+%i5] 131 ! encoding: [0xc0,0xf0,0x90,0x7d]
+ ! V9: stxa %g0, [%g2+%i5] #ASI_SNF ! encoding: [0xc0,0xf0,0x90,0x7d]
stxa %g0, [%g2 + %i5] (130+1)
! V8: error: instruction requires a CPU feature not currently enabled
@@ -506,6 +506,12 @@
! V9: stxa %g0, [%g2+5] %asi ! encoding: [0xc0,0xf0,0xa0,0x05]
stxa %g0, [%g2 + 5] %asi
+ !! Also make sure named ASI tags are parsed properly.
+ ! V9: ldxa [%g2+%i5] #ASI_SNF, %g0 ! encoding: [0xc0,0xd8,0x90,0x7d]
+ ldxa [%g2 + %i5] #ASI_SNF, %g0
+ ! V9: stxa %g0, [%g2+%i5] #ASI_SNF ! encoding: [0xc0,0xf0,0x90,0x7d]
+ stxa %g0, [%g2 + %i5] #ASI_SNF
+
! V8: error: instruction requires a CPU feature not currently enabled
! V8-NEXT: prefetch [ %i1 + 0xf80 ], 1
! V9: prefetch [%i1+3968], 1 ! encoding: [0xc3,0x6e,0x6f,0x80]
More information about the llvm-commits
mailing list