[llvm] 8948eab - [VE] Support logical operation instructions in MC layer

Simon Moll via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 07:59:24 PDT 2020


Author: Kazushi (Jam) Marukawa
Date: 2020-06-05T16:59:05+02:00
New Revision: 8948eab28a47fd0978a300270b61aa21bd4c9fb0

URL: https://github.com/llvm/llvm-project/commit/8948eab28a47fd0978a300270b61aa21bd4c9fb0
DIFF: https://github.com/llvm/llvm-project/commit/8948eab28a47fd0978a300270b61aa21bd4c9fb0.diff

LOG: [VE] Support logical operation instructions in MC layer

Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
logical operation instructions. Also change asmparser to support CMOV
instruction. And, add new EQV/MRG/NND isntructions also.

Differential Revision: https://reviews.llvm.org/D81219

Added: 
    llvm/test/MC/VE/AND.s
    llvm/test/MC/VE/BRV.s
    llvm/test/MC/VE/BSWP.s
    llvm/test/MC/VE/CMOV.s
    llvm/test/MC/VE/EQV.s
    llvm/test/MC/VE/LDZ.s
    llvm/test/MC/VE/MRG.s
    llvm/test/MC/VE/NND.s
    llvm/test/MC/VE/OR.s
    llvm/test/MC/VE/PCNT.s
    llvm/test/MC/VE/XOR.s

Modified: 
    llvm/lib/Target/VE/AsmParser/VEAsmParser.cpp
    llvm/lib/Target/VE/VEInstrInfo.td

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/VE/AsmParser/VEAsmParser.cpp b/llvm/lib/Target/VE/AsmParser/VEAsmParser.cpp
index a1847302347c..628fce349068 100644
--- a/llvm/lib/Target/VE/AsmParser/VEAsmParser.cpp
+++ b/llvm/lib/Target/VE/AsmParser/VEAsmParser.cpp
@@ -689,6 +689,10 @@ StringRef VEAsmParser::splitMnemonic(StringRef Name, SMLoc NameLoc,
         (Name[Next + 1] == 'd' || Name[Next + 1] == 's'))
       ICC = false;
     Mnemonic = parseCC(Name, Start, Next, ICC, true, NameLoc, Operands);
+  } else if (Name.startswith("cmov.l.") || Name.startswith("cmov.w.") ||
+             Name.startswith("cmov.d.") || Name.startswith("cmov.s.")) {
+    bool ICC = Name[5] == 'l' || Name[5] == 'w';
+    Mnemonic = parseCC(Name, 7, Name.size(), ICC, false, NameLoc, Operands);
   } else {
     Operands->push_back(VEOperand::CreateToken(Mnemonic, NameLoc));
   }
@@ -696,8 +700,16 @@ StringRef VEAsmParser::splitMnemonic(StringRef Name, SMLoc NameLoc,
   return Mnemonic;
 }
 
+static void applyMnemonicAliases(StringRef &Mnemonic,
+                                 const FeatureBitset &Features,
+                                 unsigned VariantID);
+
 bool VEAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
                                    SMLoc NameLoc, OperandVector &Operands) {
+  // If the target architecture uses MnemonicAlias, call it here to parse
+  // operands correctly.
+  applyMnemonicAliases(Name, getAvailableFeatures(), 0);
+
   // Split name to first token and the rest, e.g. "bgt.l.t" to "b", "gt", and
   // ".l.t".  We treat "b" as a mnemonic, "gt" as first operand, and ".l.t"
   // as second operand.

diff  --git a/llvm/lib/Target/VE/VEInstrInfo.td b/llvm/lib/Target/VE/VEInstrInfo.td
index 46226b5ae8a2..4372a8014d7f 100644
--- a/llvm/lib/Target/VE/VEInstrInfo.td
+++ b/llvm/lib/Target/VE/VEInstrInfo.td
@@ -506,6 +506,23 @@ multiclass RRI1m<string opcStr, bits<8>opc, RegisterClass RC, ValueType Ty,
              [(set Ty:$sx, (OpNode (Ty mimm:$sz)))]>;
 }
 
+// Special RR multiclass for MRG instruction.
+//   e.g. MRG
+let Constraints = "$sx = $sd", DisableEncoding = "$sd", hasSideEffects = 0 in
+multiclass RRMRGm<string opcStr, bits<8>opc, RegisterClass RC, ValueType Ty> {
+  def rr : RR<opc, (outs RC:$sx), (ins RC:$sy, RC:$sz, RC:$sd),
+              !strconcat(opcStr, " $sx, $sy, $sz")>;
+  let cy = 0 in
+  def ir : RR<opc, (outs RC:$sx), (ins simm7:$sy, RC:$sz, RC:$sd),
+              !strconcat(opcStr, " $sx, $sy, $sz")>;
+  let cz = 0 in
+  def rm : RR<opc, (outs RC:$sx), (ins RC:$sy, mimm:$sz, RC:$sd),
+              !strconcat(opcStr, " $sx, $sy, $sz")>;
+  let cy = 0, cz = 0 in
+  def im : RR<opc, (outs RC:$sx), (ins simm7:$sy, mimm:$sz, RC:$sd),
+              !strconcat(opcStr, " $sx, $sy, $sz")>;
+}
+
 // Special RR multiclass for BSWP instruction.
 //   e.g. BSWP
 let hasSideEffects = 0 in
@@ -892,8 +909,13 @@ defm XOR : RRm<"xor", 0x46, I64, i64, xor>;
 let isCodeGenOnly = 1 in defm XOR32 : RRm<"xor", 0x46, I32, i32, xor>;
 
 // Section 8.5.4 - EQV (Equivalence)
+defm EQV : RRm<"eqv", 0x47, I64, i64>;
+
 // Section 8.5.5 - NND (Negate AND)
+defm NND : RRNCm<"nnd", 0x54, I64, i64>;
+
 // Section 8.5.6 - MRG (Merge)
+defm MRG : RRMRGm<"mrg", 0x56, I64, i64>;
 
 // Section 8.5.7 - LDZ (Leading Zero Count)
 defm LDZ : RRI1m<"ldz", 0x67, I64, i64, ctlz>;
@@ -912,6 +934,10 @@ let cw = 0, cw2 = 0 in defm CMOVL : RRCMOVm<"cmov.l.${cfw}", 0x3B, I64, i64>;
 let cw = 1, cw2 = 0 in defm CMOVW : RRCMOVm<"cmov.w.${cfw}", 0x3B, I32, i32>;
 let cw = 0, cw2 = 1 in defm CMOVD : RRCMOVm<"cmov.d.${cfw}", 0x3B, I64, f64>;
 let cw = 1, cw2 = 1 in defm CMOVS : RRCMOVm<"cmov.s.${cfw}", 0x3B, F32, f32>;
+def : MnemonicAlias<"cmov.l", "cmov.l.at">;
+def : MnemonicAlias<"cmov.w", "cmov.w.at">;
+def : MnemonicAlias<"cmov.d", "cmov.d.at">;
+def : MnemonicAlias<"cmov.s", "cmov.s.at">;
 
 //-----------------------------------------------------------------------------
 // Section 8.6 - Shift Operation Instructions

diff  --git a/llvm/test/MC/VE/AND.s b/llvm/test/MC/VE/AND.s
new file mode 100644
index 000000000000..60b5d1af9f2a
--- /dev/null
+++ b/llvm/test/MC/VE/AND.s
@@ -0,0 +1,28 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: and %s11, %s11, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x8b,0x0b,0x44]
+and %s11, %s11, %s11
+
+# CHECK-INST: and %s11, 63, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x3f,0x0b,0x44]
+and %s11, 63, %s11
+
+# CHECK-INST: and %s11, -1, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x7f,0x0b,0x44]
+and %s11, -1, %s11
+
+# CHECK-INST: and %s11, -64, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x40,0x0b,0x44]
+and %s11, -64, %s11
+
+# CHECK-INST: and %s11, -64, (32)1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x20,0x40,0x0b,0x44]
+and %s11, -64, (32)1
+
+# CHECK-INST: and %s11, 63, (32)0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x60,0x3f,0x0b,0x44]
+and %s11, 63, (32)0

diff  --git a/llvm/test/MC/VE/BRV.s b/llvm/test/MC/VE/BRV.s
new file mode 100644
index 000000000000..c75218704566
--- /dev/null
+++ b/llvm/test/MC/VE/BRV.s
@@ -0,0 +1,16 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: brv %s11, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x00,0x0b,0x39]
+brv %s11, %s11
+
+# CHECK-INST: brv %s11, (32)1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x20,0x00,0x0b,0x39]
+brv %s11, (32)1
+
+# CHECK-INST: brv %s11, (63)0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x7f,0x00,0x0b,0x39]
+brv %s11, (63)0

diff  --git a/llvm/test/MC/VE/BSWP.s b/llvm/test/MC/VE/BSWP.s
new file mode 100644
index 000000000000..6a6ae5b76631
--- /dev/null
+++ b/llvm/test/MC/VE/BSWP.s
@@ -0,0 +1,20 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: bswp %s11, %s11, 0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x00,0x0b,0x2b]
+bswp %s11, %s11, 0
+
+# CHECK-INST: bswp %s11, %s11, 1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x01,0x0b,0x2b]
+bswp %s11, %s11, 1
+
+# CHECK-INST: bswp %s11, (32)1, 0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x20,0x00,0x0b,0x2b]
+bswp %s11, (32)1, 0
+
+# CHECK-INST: bswp %s11, (32)0, 1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x60,0x01,0x0b,0x2b]
+bswp %s11, (32)0, 1

diff  --git a/llvm/test/MC/VE/CMOV.s b/llvm/test/MC/VE/CMOV.s
new file mode 100644
index 000000000000..990309d95c45
--- /dev/null
+++ b/llvm/test/MC/VE/CMOV.s
@@ -0,0 +1,72 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: cmov.l.at %s11, %s12, 63
+# CHECK-ENCODING: encoding: [0x0f,0x00,0x00,0x00,0x8c,0x3f,0x0b,0x3b]
+cmov.l %s11, %s12, 63
+
+# CHECK-INST: cmov.w.at %s11, %s12, %s13
+# CHECK-ENCODING: encoding: [0x8f,0x00,0x00,0x00,0x8c,0x8d,0x0b,0x3b]
+cmov.w.at %s11, %s12, %s13
+
+# CHECK-INST: cmov.d.af %s11, (20)0, %s12
+# CHECK-ENCODING: encoding: [0x40,0x00,0x00,0x00,0x54,0x8c,0x0b,0x3b]
+cmov.d.af %s11, (20)0, %s12
+
+# CHECK-INST: cmov.s.gt %s11, (63)1, %s12
+# CHECK-ENCODING: encoding: [0xc1,0x00,0x00,0x00,0x3f,0x8c,0x0b,0x3b]
+cmov.s.gt %s11, (63)1, %s12
+
+# CHECK-INST: cmov.l.lt %s11, %s12, 63
+# CHECK-ENCODING: encoding: [0x02,0x00,0x00,0x00,0x8c,0x3f,0x0b,0x3b]
+cmov.l.lt %s11, %s12, 63
+
+# CHECK-INST: cmov.w.ne %s11, %s12, %s13
+# CHECK-ENCODING: encoding: [0x83,0x00,0x00,0x00,0x8c,0x8d,0x0b,0x3b]
+cmov.w.ne %s11, %s12, %s13
+
+# CHECK-INST: cmov.d.eq %s11, (20)0, %s12
+# CHECK-ENCODING: encoding: [0x44,0x00,0x00,0x00,0x54,0x8c,0x0b,0x3b]
+cmov.d.eq %s11, (20)0, %s12
+
+# CHECK-INST: cmov.s.ge %s11, (63)1, %s12
+# CHECK-ENCODING: encoding: [0xc5,0x00,0x00,0x00,0x3f,0x8c,0x0b,0x3b]
+cmov.s.ge %s11, (63)1, %s12
+
+# CHECK-INST: cmov.l.le %s11, %s12, 63
+# CHECK-ENCODING: encoding: [0x06,0x00,0x00,0x00,0x8c,0x3f,0x0b,0x3b]
+cmov.l.le %s11, %s12, 63
+
+# CHECK-INST: cmov.d.num %s11, %s12, %s13
+# CHECK-ENCODING: encoding: [0x47,0x00,0x00,0x00,0x8c,0x8d,0x0b,0x3b]
+cmov.d.num %s11, %s12, %s13
+
+# CHECK-INST: cmov.s.nan %s11, (63)1, %s12
+# CHECK-ENCODING: encoding: [0xc8,0x00,0x00,0x00,0x3f,0x8c,0x0b,0x3b]
+cmov.s.nan %s11, (63)1, %s12
+
+# CHECK-INST: cmov.d.gtnan %s11, %s12, %s13
+# CHECK-ENCODING: encoding: [0x49,0x00,0x00,0x00,0x8c,0x8d,0x0b,0x3b]
+cmov.d.gtnan %s11, %s12, %s13
+
+# CHECK-INST: cmov.s.ltnan %s11, (63)1, %s12
+# CHECK-ENCODING: encoding: [0xca,0x00,0x00,0x00,0x3f,0x8c,0x0b,0x3b]
+cmov.s.ltnan %s11, (63)1, %s12
+
+# CHECK-INST: cmov.d.nenan %s11, %s12, %s13
+# CHECK-ENCODING: encoding: [0x4b,0x00,0x00,0x00,0x8c,0x8d,0x0b,0x3b]
+cmov.d.nenan %s11, %s12, %s13
+
+# CHECK-INST: cmov.s.eqnan %s11, (63)1, %s12
+# CHECK-ENCODING: encoding: [0xcc,0x00,0x00,0x00,0x3f,0x8c,0x0b,0x3b]
+cmov.s.eqnan %s11, (63)1, %s12
+
+# CHECK-INST: cmov.d.genan %s11, %s12, %s13
+# CHECK-ENCODING: encoding: [0x4d,0x00,0x00,0x00,0x8c,0x8d,0x0b,0x3b]
+cmov.d.genan %s11, %s12, %s13
+
+# CHECK-INST: cmov.s.lenan %s11, (63)1, %s12
+# CHECK-ENCODING: encoding: [0xce,0x00,0x00,0x00,0x3f,0x8c,0x0b,0x3b]
+cmov.s.lenan %s11, (63)1, %s12

diff  --git a/llvm/test/MC/VE/EQV.s b/llvm/test/MC/VE/EQV.s
new file mode 100644
index 000000000000..7e37043cc122
--- /dev/null
+++ b/llvm/test/MC/VE/EQV.s
@@ -0,0 +1,28 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: eqv %s11, %s11, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x8b,0x0b,0x47]
+eqv %s11, %s11, %s11
+
+# CHECK-INST: eqv %s11, 63, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x3f,0x0b,0x47]
+eqv %s11, 63, %s11
+
+# CHECK-INST: eqv %s11, -1, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x7f,0x0b,0x47]
+eqv %s11, -1, %s11
+
+# CHECK-INST: eqv %s11, -64, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x40,0x0b,0x47]
+eqv %s11, -64, %s11
+
+# CHECK-INST: eqv %s11, -64, (32)1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x20,0x40,0x0b,0x47]
+eqv %s11, -64, (32)1
+
+# CHECK-INST: eqv %s11, 63, (32)0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x60,0x3f,0x0b,0x47]
+eqv %s11, 63, (32)0

diff  --git a/llvm/test/MC/VE/LDZ.s b/llvm/test/MC/VE/LDZ.s
new file mode 100644
index 000000000000..fae8cee92869
--- /dev/null
+++ b/llvm/test/MC/VE/LDZ.s
@@ -0,0 +1,16 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: ldz %s11, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x00,0x0b,0x67]
+ldz %s11, %s11
+
+# CHECK-INST: ldz %s11, (32)1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x20,0x00,0x0b,0x67]
+ldz %s11, (32)1
+
+# CHECK-INST: ldz %s11, (63)0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x7f,0x00,0x0b,0x67]
+ldz %s11, (63)0

diff  --git a/llvm/test/MC/VE/MRG.s b/llvm/test/MC/VE/MRG.s
new file mode 100644
index 000000000000..4db57989e984
--- /dev/null
+++ b/llvm/test/MC/VE/MRG.s
@@ -0,0 +1,28 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: mrg %s11, %s11, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x8b,0x0b,0x56]
+mrg %s11, %s11, %s11
+
+# CHECK-INST: mrg %s11, 63, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x3f,0x0b,0x56]
+mrg %s11, 63, %s11
+
+# CHECK-INST: mrg %s11, -1, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x7f,0x0b,0x56]
+mrg %s11, -1, %s11
+
+# CHECK-INST: mrg %s11, -64, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x40,0x0b,0x56]
+mrg %s11, -64, %s11
+
+# CHECK-INST: mrg %s11, -64, (32)1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x20,0x40,0x0b,0x56]
+mrg %s11, -64, (32)1
+
+# CHECK-INST: mrg %s11, 63, (32)0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x60,0x3f,0x0b,0x56]
+mrg %s11, 63, (32)0

diff  --git a/llvm/test/MC/VE/NND.s b/llvm/test/MC/VE/NND.s
new file mode 100644
index 000000000000..9e52811dfda4
--- /dev/null
+++ b/llvm/test/MC/VE/NND.s
@@ -0,0 +1,28 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: nnd %s11, %s11, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x8b,0x0b,0x54]
+nnd %s11, %s11, %s11
+
+# CHECK-INST: nnd %s11, 63, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x3f,0x0b,0x54]
+nnd %s11, 63, %s11
+
+# CHECK-INST: nnd %s11, -1, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x7f,0x0b,0x54]
+nnd %s11, -1, %s11
+
+# CHECK-INST: nnd %s11, -64, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x40,0x0b,0x54]
+nnd %s11, -64, %s11
+
+# CHECK-INST: nnd %s11, -64, (32)1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x20,0x40,0x0b,0x54]
+nnd %s11, -64, (32)1
+
+# CHECK-INST: nnd %s11, 63, (32)0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x60,0x3f,0x0b,0x54]
+nnd %s11, 63, (32)0

diff  --git a/llvm/test/MC/VE/OR.s b/llvm/test/MC/VE/OR.s
new file mode 100644
index 000000000000..d7014e6fa106
--- /dev/null
+++ b/llvm/test/MC/VE/OR.s
@@ -0,0 +1,28 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: or %s11, %s11, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x8b,0x0b,0x45]
+or %s11, %s11, %s11
+
+# CHECK-INST: or %s11, 63, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x3f,0x0b,0x45]
+or %s11, 63, %s11
+
+# CHECK-INST: or %s11, -1, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x7f,0x0b,0x45]
+or %s11, -1, %s11
+
+# CHECK-INST: or %s11, -64, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x40,0x0b,0x45]
+or %s11, -64, %s11
+
+# CHECK-INST: or %s11, -64, (32)1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x20,0x40,0x0b,0x45]
+or %s11, -64, (32)1
+
+# CHECK-INST: or %s11, 63, (32)0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x60,0x3f,0x0b,0x45]
+or %s11, 63, (32)0

diff  --git a/llvm/test/MC/VE/PCNT.s b/llvm/test/MC/VE/PCNT.s
new file mode 100644
index 000000000000..4950c3375f8e
--- /dev/null
+++ b/llvm/test/MC/VE/PCNT.s
@@ -0,0 +1,16 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: pcnt %s11, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x00,0x0b,0x38]
+pcnt %s11, %s11
+
+# CHECK-INST: pcnt %s11, (32)1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x20,0x00,0x0b,0x38]
+pcnt %s11, (32)1
+
+# CHECK-INST: pcnt %s11, (63)0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x7f,0x00,0x0b,0x38]
+pcnt %s11, (63)0

diff  --git a/llvm/test/MC/VE/XOR.s b/llvm/test/MC/VE/XOR.s
new file mode 100644
index 000000000000..3ff6771a2b1a
--- /dev/null
+++ b/llvm/test/MC/VE/XOR.s
@@ -0,0 +1,28 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN:     | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: xor %s11, %s11, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x8b,0x0b,0x46]
+xor %s11, %s11, %s11
+
+# CHECK-INST: xor %s11, 63, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x3f,0x0b,0x46]
+xor %s11, 63, %s11
+
+# CHECK-INST: xor %s11, -1, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x7f,0x0b,0x46]
+xor %s11, -1, %s11
+
+# CHECK-INST: xor %s11, -64, %s11
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x8b,0x40,0x0b,0x46]
+xor %s11, -64, %s11
+
+# CHECK-INST: xor %s11, -64, (32)1
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x20,0x40,0x0b,0x46]
+xor %s11, -64, (32)1
+
+# CHECK-INST: xor %s11, 63, (32)0
+# CHECK-ENCODING: encoding: [0x00,0x00,0x00,0x00,0x60,0x3f,0x0b,0x46]
+xor %s11, 63, (32)0


        


More information about the llvm-commits mailing list