[llvm] r323124 - [AArch64][SVE] Asm: PTRUE and PTRUES instructions
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 22 07:29:19 PST 2018
Author: s.desmalen
Date: Mon Jan 22 07:29:19 2018
New Revision: 323124
URL: http://llvm.org/viewvc/llvm-project?rev=323124&view=rev
Log:
[AArch64][SVE] Asm: PTRUE and PTRUES instructions
Summary: These instructions initialize a predicate vector from a pattern/immediate.
Reviewers: fhahn, rengolin, evandro, mcrosier, t.p.northover, samparker, olista01
Reviewed By: samparker
Subscribers: aemerson, javed.absar, tschuett, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D41819
Added:
llvm/trunk/test/MC/AArch64/SVE/ptrue-diagnostics.s
llvm/trunk/test/MC/AArch64/SVE/ptrue.s
llvm/trunk/test/MC/AArch64/SVE/ptrues-diagnostics.s
llvm/trunk/test/MC/AArch64/SVE/ptrues.s
Modified:
llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/trunk/lib/Target/AArch64/SVEInstrFormats.td
Modified: llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp?rev=323124&r1=323123&r2=323124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp Mon Jan 22 07:29:19 2018
@@ -140,8 +140,7 @@ private:
template <bool ParseSuffix>
OperandMatchResultTy tryParseSVEDataVector(OperandVector &Operands);
OperandMatchResultTy tryParseSVEPredicateVector(OperandVector &Operands);
- LLVM_ATTRIBUTE_UNUSED OperandMatchResultTy
- tryParseSVEPattern(OperandVector &Operands);
+ OperandMatchResultTy tryParseSVEPattern(OperandVector &Operands);
public:
enum AArch64MatchResultTy {
@@ -3665,6 +3664,8 @@ bool AArch64AsmParser::showMatchError(SM
ComputeAvailableFeatures(STI->getFeatureBits()));
return Error(Loc, "unrecognized instruction mnemonic" + Suggestion);
}
+ case Match_InvalidSVEPattern:
+ return Error(Loc, "invalid predicate pattern");
case Match_InvalidSVEPredicateAnyReg:
case Match_InvalidSVEPredicateBReg:
case Match_InvalidSVEPredicateHReg:
@@ -4104,6 +4105,7 @@ bool AArch64AsmParser::MatchAndEmitInstr
case Match_InvalidComplexRotationEven:
case Match_InvalidComplexRotationOdd:
case Match_InvalidSVEPredicateAnyReg:
+ case Match_InvalidSVEPattern:
case Match_InvalidSVEPredicateBReg:
case Match_InvalidSVEPredicateHReg:
case Match_InvalidSVEPredicateSReg:
Modified: llvm/trunk/lib/Target/AArch64/SVEInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/SVEInstrFormats.td?rev=323124&r1=323123&r2=323124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/SVEInstrFormats.td (original)
+++ llvm/trunk/lib/Target/AArch64/SVEInstrFormats.td Mon Jan 22 07:29:19 2018
@@ -11,6 +11,68 @@
//
//===----------------------------------------------------------------------===//
+def SVEPatternOperand : AsmOperandClass {
+ let Name = "SVEPattern";
+ let ParserMethod = "tryParseSVEPattern";
+ let PredicateMethod = "isSVEPattern";
+ let RenderMethod = "addImmOperands";
+ let DiagnosticType = "InvalidSVEPattern";
+}
+
+def sve_pred_enum : Operand<i32>, ImmLeaf<i32, [{
+ return (((uint32_t)Imm) < 32);
+ }]> {
+
+ let PrintMethod = "printSVEPattern";
+ let ParserMatchClass = SVEPatternOperand;
+}
+
+//===----------------------------------------------------------------------===//
+// SVE PTrue - These are used extensively throughout the pattern matching so
+// it's important we define them first.
+//===----------------------------------------------------------------------===//
+
+class sve_int_ptrue<bits<2> sz8_64, bits<3> opc, string asm, PPRRegOp pprty>
+: I<(outs pprty:$Pd), (ins sve_pred_enum:$pattern),
+ asm, "\t$Pd, $pattern",
+ "",
+ []>, Sched<[]> {
+ bits<4> Pd;
+ bits<5> pattern;
+ let Inst{31-24} = 0b00100101;
+ let Inst{23-22} = sz8_64;
+ let Inst{21-19} = 0b011;
+ let Inst{18-17} = opc{2-1};
+ let Inst{16} = opc{0};
+ let Inst{15-10} = 0b111000;
+ let Inst{9-5} = pattern;
+ let Inst{4} = 0b0;
+ let Inst{3-0} = Pd;
+
+ let Defs = !if(!eq (opc{0}, 1), [NZCV], []);
+}
+
+multiclass sve_int_ptrue<bits<3> opc, string asm> {
+ def _B : sve_int_ptrue<0b00, opc, asm, PPR8>;
+ def _H : sve_int_ptrue<0b01, opc, asm, PPR16>;
+ def _S : sve_int_ptrue<0b10, opc, asm, PPR32>;
+ def _D : sve_int_ptrue<0b11, opc, asm, PPR64>;
+
+ def : InstAlias<asm # "\t$Pd",
+ (!cast<Instruction>(NAME # _B) PPR8:$Pd, 0b11111), 1>;
+ def : InstAlias<asm # "\t$Pd",
+ (!cast<Instruction>(NAME # _H) PPR16:$Pd, 0b11111), 1>;
+ def : InstAlias<asm # "\t$Pd",
+ (!cast<Instruction>(NAME # _S) PPR32:$Pd, 0b11111), 1>;
+ def : InstAlias<asm # "\t$Pd",
+ (!cast<Instruction>(NAME # _D) PPR64:$Pd, 0b11111), 1>;
+}
+
+let Predicates = [HasSVE] in {
+ defm PTRUE : sve_int_ptrue<0b000, "ptrue">;
+ defm PTRUES : sve_int_ptrue<0b001, "ptrues">;
+}
+
//===----------------------------------------------------------------------===//
// SVE Permute - Cross Lane Group
//===----------------------------------------------------------------------===//
Added: llvm/trunk/test/MC/AArch64/SVE/ptrue-diagnostics.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/SVE/ptrue-diagnostics.s?rev=323124&view=auto
==============================================================================
--- llvm/trunk/test/MC/AArch64/SVE/ptrue-diagnostics.s (added)
+++ llvm/trunk/test/MC/AArch64/SVE/ptrue-diagnostics.s Mon Jan 22 07:29:19 2018
@@ -0,0 +1,29 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve 2>&1 < %s| FileCheck %s
+
+// --------------------------------------------------------------------------//
+// Invalid pattern name
+// --------------------------------------------------------------------------//
+
+ptrue p0.s, vl512
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern
+// CHECK-NEXT: ptrue p0.s, vl512
+// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
+
+ptrue p0.s, vl9
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern
+// CHECK-NEXT: ptrue p0.s, vl9
+// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Invalid immediate range
+// --------------------------------------------------------------------------//
+
+ptrue p0.s, #-1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern
+// CHECK-NEXT: ptrue p0.s, #-1
+// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
+
+ptrue p0.s, #32
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern
+// CHECK-NEXT: ptrue p0.s, #32
+// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
Added: llvm/trunk/test/MC/AArch64/SVE/ptrue.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/SVE/ptrue.s?rev=323124&view=auto
==============================================================================
--- llvm/trunk/test/MC/AArch64/SVE/ptrue.s (added)
+++ llvm/trunk/test/MC/AArch64/SVE/ptrue.s Mon Jan 22 07:29:19 2018
@@ -0,0 +1,264 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve < %s \
+// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
+// RUN: | llvm-objdump -d -mattr=+sve - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
+// RUN: | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+
+// ---------------------------------------------------------------------------//
+// Test all predicate sizes for pow2 pattern
+// ---------------------------------------------------------------------------//
+
+ptrue p0.b, pow2
+// CHECK-INST: ptrue p0.b, pow2
+// CHECK-ENCODING: [0x00,0xe0,0x18,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 e0 18 25 <unknown>
+
+ptrue p0.h, pow2
+// CHECK-INST: ptrue p0.h, pow2
+// CHECK-ENCODING: [0x00,0xe0,0x58,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 e0 58 25 <unknown>
+
+ptrue p0.s, pow2
+// CHECK-INST: ptrue p0.s, pow2
+// CHECK-ENCODING: [0x00,0xe0,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 e0 98 25 <unknown>
+
+ptrue p0.d, pow2
+// CHECK-INST: ptrue p0.d, pow2
+// CHECK-ENCODING: [0x00,0xe0,0xd8,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 e0 d8 25 <unknown>
+
+// ---------------------------------------------------------------------------//
+// Test all predicate sizes without explicit pattern
+// ---------------------------------------------------------------------------//
+
+ptrue p15.b
+// CHECK-INST: ptrue p15.b
+// CHECK-ENCODING: [0xef,0xe3,0x18,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: ef e3 18 25 <unknown>
+
+ptrue p15.h
+// CHECK-INST: ptrue p15.h
+// CHECK-ENCODING: [0xef,0xe3,0x58,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: ef e3 58 25 <unknown>
+
+ptrue p15.s
+// CHECK-INST: ptrue p15.s
+// CHECK-ENCODING: [0xef,0xe3,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: ef e3 98 25 <unknown>
+
+ptrue p15.d
+// CHECK-INST: ptrue p15.d
+// CHECK-ENCODING: [0xef,0xe3,0xd8,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: ef e3 d8 25 <unknown>
+
+// ---------------------------------------------------------------------------//
+// Test available patterns
+// ---------------------------------------------------------------------------//
+
+ptrue p7.s, #1
+// CHECK-INST: ptrue p7.s, vl1
+// CHECK-ENCODING: [0x27,0xe0,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 27 e0 98 25 <unknown>
+
+ptrue p7.s, vl1
+// CHECK-INST: ptrue p7.s, vl1
+// CHECK-ENCODING: [0x27,0xe0,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 27 e0 98 25 <unknown>
+
+ptrue p7.s, vl2
+// CHECK-INST: ptrue p7.s, vl2
+// CHECK-ENCODING: [0x47,0xe0,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 47 e0 98 25 <unknown>
+
+ptrue p7.s, vl3
+// CHECK-INST: ptrue p7.s, vl3
+// CHECK-ENCODING: [0x67,0xe0,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 67 e0 98 25 <unknown>
+
+ptrue p7.s, vl4
+// CHECK-INST: ptrue p7.s, vl4
+// CHECK-ENCODING: [0x87,0xe0,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 87 e0 98 25 <unknown>
+
+ptrue p7.s, vl5
+// CHECK-INST: ptrue p7.s, vl5
+// CHECK-ENCODING: [0xa7,0xe0,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: a7 e0 98 25 <unknown>
+
+ptrue p7.s, vl6
+// CHECK-INST: ptrue p7.s, vl6
+// CHECK-ENCODING: [0xc7,0xe0,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: c7 e0 98 25 <unknown>
+
+ptrue p7.s, vl7
+// CHECK-INST: ptrue p7.s, vl7
+// CHECK-ENCODING: [0xe7,0xe0,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: e7 e0 98 25 <unknown>
+
+ptrue p7.s, vl8
+// CHECK-INST: ptrue p7.s, vl8
+// CHECK-ENCODING: [0x07,0xe1,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 07 e1 98 25 <unknown>
+
+ptrue p7.s, vl16
+// CHECK-INST: ptrue p7.s, vl16
+// CHECK-ENCODING: [0x27,0xe1,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 27 e1 98 25 <unknown>
+
+ptrue p7.s, vl32
+// CHECK-INST: ptrue p7.s, vl32
+// CHECK-ENCODING: [0x47,0xe1,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 47 e1 98 25 <unknown>
+
+ptrue p7.s, vl64
+// CHECK-INST: ptrue p7.s, vl64
+// CHECK-ENCODING: [0x67,0xe1,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 67 e1 98 25 <unknown>
+
+ptrue p7.s, vl128
+// CHECK-INST: ptrue p7.s, vl128
+// CHECK-ENCODING: [0x87,0xe1,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 87 e1 98 25 <unknown>
+
+ptrue p7.s, vl256
+// CHECK-INST: ptrue p7.s, vl256
+// CHECK-ENCODING: [0xa7,0xe1,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: a7 e1 98 25 <unknown>
+
+ptrue p7.s, mul4
+// CHECK-INST: ptrue p7.s, mul4
+// CHECK-ENCODING: [0xa7,0xe3,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: a7 e3 98 25 <unknown>
+
+ptrue p7.s, mul3
+// CHECK-INST: ptrue p7.s, mul3
+// CHECK-ENCODING: [0xc7,0xe3,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: c7 e3 98 25 <unknown>
+
+ptrue p7.s, all
+// CHECK-INST: ptrue p7.s
+// CHECK-ENCODING: [0xe7,0xe3,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: e7 e3 98 25 <unknown>
+
+// ---------------------------------------------------------------------------//
+// Test immediate values not corresponding to a named pattern
+// ---------------------------------------------------------------------------//
+
+ptrue p7.s, #14
+// CHECK-INST: ptrue p7.s, #14
+// CHECK-ENCODING: [0xc7,0xe1,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: c7 e1 98 25 <unknown>
+
+ptrue p7.s, #15
+// CHECK-INST: ptrue p7.s, #15
+// CHECK-ENCODING: [0xe7,0xe1,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: e7 e1 98 25 <unknown>
+
+ptrue p7.s, #16
+// CHECK-INST: ptrue p7.s, #16
+// CHECK-ENCODING: [0x07,0xe2,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 07 e2 98 25 <unknown>
+
+ptrue p7.s, #17
+// CHECK-INST: ptrue p7.s, #17
+// CHECK-ENCODING: [0x27,0xe2,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 27 e2 98 25 <unknown>
+
+ptrue p7.s, #18
+// CHECK-INST: ptrue p7.s, #18
+// CHECK-ENCODING: [0x47,0xe2,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 47 e2 98 25 <unknown>
+
+ptrue p7.s, #19
+// CHECK-INST: ptrue p7.s, #19
+// CHECK-ENCODING: [0x67,0xe2,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 67 e2 98 25 <unknown>
+
+ptrue p7.s, #20
+// CHECK-INST: ptrue p7.s, #20
+// CHECK-ENCODING: [0x87,0xe2,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 87 e2 98 25 <unknown>
+
+ptrue p7.s, #21
+// CHECK-INST: ptrue p7.s, #21
+// CHECK-ENCODING: [0xa7,0xe2,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: a7 e2 98 25 <unknown>
+
+ptrue p7.s, #22
+// CHECK-INST: ptrue p7.s, #22
+// CHECK-ENCODING: [0xc7,0xe2,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: c7 e2 98 25 <unknown>
+
+ptrue p7.s, #23
+// CHECK-INST: ptrue p7.s, #23
+// CHECK-ENCODING: [0xe7,0xe2,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: e7 e2 98 25 <unknown>
+
+ptrue p7.s, #24
+// CHECK-INST: ptrue p7.s, #24
+// CHECK-ENCODING: [0x07,0xe3,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 07 e3 98 25 <unknown>
+
+ptrue p7.s, #25
+// CHECK-INST: ptrue p7.s, #25
+// CHECK-ENCODING: [0x27,0xe3,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 27 e3 98 25 <unknown>
+
+ptrue p7.s, #26
+// CHECK-INST: ptrue p7.s, #26
+// CHECK-ENCODING: [0x47,0xe3,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 47 e3 98 25 <unknown>
+
+ptrue p7.s, #27
+// CHECK-INST: ptrue p7.s, #27
+// CHECK-ENCODING: [0x67,0xe3,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 67 e3 98 25 <unknown>
+
+ptrue p7.s, #28
+// CHECK-INST: ptrue p7.s, #28
+// CHECK-ENCODING: [0x87,0xe3,0x98,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 87 e3 98 25 <unknown>
Added: llvm/trunk/test/MC/AArch64/SVE/ptrues-diagnostics.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/SVE/ptrues-diagnostics.s?rev=323124&view=auto
==============================================================================
--- llvm/trunk/test/MC/AArch64/SVE/ptrues-diagnostics.s (added)
+++ llvm/trunk/test/MC/AArch64/SVE/ptrues-diagnostics.s Mon Jan 22 07:29:19 2018
@@ -0,0 +1,29 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve 2>&1 < %s| FileCheck %s
+
+// --------------------------------------------------------------------------//
+// Invalid pattern name
+// --------------------------------------------------------------------------//
+
+ptrues p0.s, vl512
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern
+// CHECK-NEXT: ptrues p0.s, vl512
+// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
+
+ptrues p0.s, vl9
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern
+// CHECK-NEXT: ptrues p0.s, vl9
+// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Invalid immediate range
+// --------------------------------------------------------------------------//
+
+ptrues p0.s, #-1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern
+// CHECK-NEXT: ptrues p0.s, #-1
+// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
+
+ptrues p0.s, #32
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern
+// CHECK-NEXT: ptrues p0.s, #32
+// CHECK-NOT: [[@LINE-3]]:{{[0-9]+}}:
Added: llvm/trunk/test/MC/AArch64/SVE/ptrues.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/SVE/ptrues.s?rev=323124&view=auto
==============================================================================
--- llvm/trunk/test/MC/AArch64/SVE/ptrues.s (added)
+++ llvm/trunk/test/MC/AArch64/SVE/ptrues.s Mon Jan 22 07:29:19 2018
@@ -0,0 +1,264 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve < %s \
+// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
+// RUN: | llvm-objdump -d -mattr=+sve - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
+// RUN: | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+
+// ---------------------------------------------------------------------------//
+// Test all predicate sizes for pow2 pattern
+// ---------------------------------------------------------------------------//
+
+ptrues p0.b, pow2
+// CHECK-INST: ptrues p0.b, pow2
+// CHECK-ENCODING: [0x00,0xe0,0x19,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 e0 19 25 <unknown>
+
+ptrues p0.h, pow2
+// CHECK-INST: ptrues p0.h, pow2
+// CHECK-ENCODING: [0x00,0xe0,0x59,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 e0 59 25 <unknown>
+
+ptrues p0.s, pow2
+// CHECK-INST: ptrues p0.s, pow2
+// CHECK-ENCODING: [0x00,0xe0,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 e0 99 25 <unknown>
+
+ptrues p0.d, pow2
+// CHECK-INST: ptrues p0.d, pow2
+// CHECK-ENCODING: [0x00,0xe0,0xd9,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 00 e0 d9 25 <unknown>
+
+// ---------------------------------------------------------------------------//
+// Test all predicate sizes without explicit pattern
+// ---------------------------------------------------------------------------//
+
+ptrues p15.b
+// CHECK-INST: ptrues p15.b
+// CHECK-ENCODING: [0xef,0xe3,0x19,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: ef e3 19 25 <unknown>
+
+ptrues p15.h
+// CHECK-INST: ptrues p15.h
+// CHECK-ENCODING: [0xef,0xe3,0x59,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: ef e3 59 25 <unknown>
+
+ptrues p15.s
+// CHECK-INST: ptrues p15.s
+// CHECK-ENCODING: [0xef,0xe3,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: ef e3 99 25 <unknown>
+
+ptrues p15.d
+// CHECK-INST: ptrues p15.d
+// CHECK-ENCODING: [0xef,0xe3,0xd9,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: ef e3 d9 25 <unknown>
+
+// ---------------------------------------------------------------------------//
+// Test available patterns
+// ---------------------------------------------------------------------------//
+
+ptrues p7.s, #1
+// CHECK-INST: ptrues p7.s, vl1
+// CHECK-ENCODING: [0x27,0xe0,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 27 e0 99 25 <unknown>
+
+ptrues p7.s, vl1
+// CHECK-INST: ptrues p7.s, vl1
+// CHECK-ENCODING: [0x27,0xe0,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 27 e0 99 25 <unknown>
+
+ptrues p7.s, vl2
+// CHECK-INST: ptrues p7.s, vl2
+// CHECK-ENCODING: [0x47,0xe0,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 47 e0 99 25 <unknown>
+
+ptrues p7.s, vl3
+// CHECK-INST: ptrues p7.s, vl3
+// CHECK-ENCODING: [0x67,0xe0,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 67 e0 99 25 <unknown>
+
+ptrues p7.s, vl4
+// CHECK-INST: ptrues p7.s, vl4
+// CHECK-ENCODING: [0x87,0xe0,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 87 e0 99 25 <unknown>
+
+ptrues p7.s, vl5
+// CHECK-INST: ptrues p7.s, vl5
+// CHECK-ENCODING: [0xa7,0xe0,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: a7 e0 99 25 <unknown>
+
+ptrues p7.s, vl6
+// CHECK-INST: ptrues p7.s, vl6
+// CHECK-ENCODING: [0xc7,0xe0,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: c7 e0 99 25 <unknown>
+
+ptrues p7.s, vl7
+// CHECK-INST: ptrues p7.s, vl7
+// CHECK-ENCODING: [0xe7,0xe0,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: e7 e0 99 25 <unknown>
+
+ptrues p7.s, vl8
+// CHECK-INST: ptrues p7.s, vl8
+// CHECK-ENCODING: [0x07,0xe1,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 07 e1 99 25 <unknown>
+
+ptrues p7.s, vl16
+// CHECK-INST: ptrues p7.s, vl16
+// CHECK-ENCODING: [0x27,0xe1,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 27 e1 99 25 <unknown>
+
+ptrues p7.s, vl32
+// CHECK-INST: ptrues p7.s, vl32
+// CHECK-ENCODING: [0x47,0xe1,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 47 e1 99 25 <unknown>
+
+ptrues p7.s, vl64
+// CHECK-INST: ptrues p7.s, vl64
+// CHECK-ENCODING: [0x67,0xe1,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 67 e1 99 25 <unknown>
+
+ptrues p7.s, vl128
+// CHECK-INST: ptrues p7.s, vl128
+// CHECK-ENCODING: [0x87,0xe1,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 87 e1 99 25 <unknown>
+
+ptrues p7.s, vl256
+// CHECK-INST: ptrues p7.s, vl256
+// CHECK-ENCODING: [0xa7,0xe1,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: a7 e1 99 25 <unknown>
+
+ptrues p7.s, mul4
+// CHECK-INST: ptrues p7.s, mul4
+// CHECK-ENCODING: [0xa7,0xe3,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: a7 e3 99 25 <unknown>
+
+ptrues p7.s, mul3
+// CHECK-INST: ptrues p7.s, mul3
+// CHECK-ENCODING: [0xc7,0xe3,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: c7 e3 99 25 <unknown>
+
+ptrues p7.s, all
+// CHECK-INST: ptrues p7.s
+// CHECK-ENCODING: [0xe7,0xe3,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: e7 e3 99 25 <unknown>
+
+// ---------------------------------------------------------------------------//
+// Test immediate values not corresponding to a named pattern
+// ---------------------------------------------------------------------------//
+
+ptrues p7.s, #14
+// CHECK-INST: ptrues p7.s, #14
+// CHECK-ENCODING: [0xc7,0xe1,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: c7 e1 99 25 <unknown>
+
+ptrues p7.s, #15
+// CHECK-INST: ptrues p7.s, #15
+// CHECK-ENCODING: [0xe7,0xe1,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: e7 e1 99 25 <unknown>
+
+ptrues p7.s, #16
+// CHECK-INST: ptrues p7.s, #16
+// CHECK-ENCODING: [0x07,0xe2,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 07 e2 99 25 <unknown>
+
+ptrues p7.s, #17
+// CHECK-INST: ptrues p7.s, #17
+// CHECK-ENCODING: [0x27,0xe2,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 27 e2 99 25 <unknown>
+
+ptrues p7.s, #18
+// CHECK-INST: ptrues p7.s, #18
+// CHECK-ENCODING: [0x47,0xe2,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 47 e2 99 25 <unknown>
+
+ptrues p7.s, #19
+// CHECK-INST: ptrues p7.s, #19
+// CHECK-ENCODING: [0x67,0xe2,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 67 e2 99 25 <unknown>
+
+ptrues p7.s, #20
+// CHECK-INST: ptrues p7.s, #20
+// CHECK-ENCODING: [0x87,0xe2,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 87 e2 99 25 <unknown>
+
+ptrues p7.s, #21
+// CHECK-INST: ptrues p7.s, #21
+// CHECK-ENCODING: [0xa7,0xe2,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: a7 e2 99 25 <unknown>
+
+ptrues p7.s, #22
+// CHECK-INST: ptrues p7.s, #22
+// CHECK-ENCODING: [0xc7,0xe2,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: c7 e2 99 25 <unknown>
+
+ptrues p7.s, #23
+// CHECK-INST: ptrues p7.s, #23
+// CHECK-ENCODING: [0xe7,0xe2,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: e7 e2 99 25 <unknown>
+
+ptrues p7.s, #24
+// CHECK-INST: ptrues p7.s, #24
+// CHECK-ENCODING: [0x07,0xe3,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 07 e3 99 25 <unknown>
+
+ptrues p7.s, #25
+// CHECK-INST: ptrues p7.s, #25
+// CHECK-ENCODING: [0x27,0xe3,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 27 e3 99 25 <unknown>
+
+ptrues p7.s, #26
+// CHECK-INST: ptrues p7.s, #26
+// CHECK-ENCODING: [0x47,0xe3,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 47 e3 99 25 <unknown>
+
+ptrues p7.s, #27
+// CHECK-INST: ptrues p7.s, #27
+// CHECK-ENCODING: [0x67,0xe3,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 67 e3 99 25 <unknown>
+
+ptrues p7.s, #28
+// CHECK-INST: ptrues p7.s, #28
+// CHECK-ENCODING: [0x87,0xe3,0x99,0x25]
+// CHECK-ERROR: instruction requires: sve
+// CHECK-UNKNOWN: 87 e3 99 25 <unknown>
More information about the llvm-commits
mailing list