forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AArch64][SVE] Asm: Support for CNT(B|H|W|D) and CNTP instructions.
This patch adds support for the following instructions: CNTB CNTH - Determine the number of active elements implied by CNTW CNTD the named predicate constant, multiplied by an immediate, e.g. cnth x0, vl8, #16 CNTP - Count active predicate elements, e.g. cntp x0, p0, p1.b counts the number of active elements in p1, predicated by p0, and stores the result in x0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336552 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
1 parent
955b8d4
commit da17564
Showing
12 changed files
with
519 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve 2>&1 < %s| FileCheck %s | ||
|
||
// ------------------------------------------------------------------------- // | ||
// Invalid result register | ||
|
||
cntb w0 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cntb w0 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntb sp | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cntb sp | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntb z0.b | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cntb z0.b | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
|
||
// ------------------------------------------------------------------------- // | ||
// Immediate not compatible with encode/decode function. | ||
|
||
cntb x0, all, mul #-1 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [1, 16] | ||
// CHECK-NEXT: cntb x0, all, mul #-1 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntb x0, all, mul #0 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [1, 16] | ||
// CHECK-NEXT: cntb x0, all, mul #0 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntb x0, all, mul #17 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [1, 16] | ||
// CHECK-NEXT: cntb x0, all, mul #17 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
|
||
// ------------------------------------------------------------------------- // | ||
// Invalid predicate patterns | ||
|
||
cntb x0, #-1 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern | ||
// CHECK-NEXT: cntb x0, #-1 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntb x0, #32 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern | ||
// CHECK-NEXT: cntb x0, #32 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntb x0, vl512 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cntb x0, vl512 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// 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 | ||
|
||
cntb x0 | ||
// CHECK-INST: cntb x0 | ||
// CHECK-ENCODING: [0xe0,0xe3,0x20,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: e0 e3 20 04 <unknown> | ||
|
||
cntb x0, all | ||
// CHECK-INST: cntb x0 | ||
// CHECK-ENCODING: [0xe0,0xe3,0x20,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: e0 e3 20 04 <unknown> | ||
|
||
cntb x0, all, mul #1 | ||
// CHECK-INST: cntb x0 | ||
// CHECK-ENCODING: [0xe0,0xe3,0x20,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: e0 e3 20 04 <unknown> | ||
|
||
cntb x0, all, mul #16 | ||
// CHECK-INST: cntb x0, all, mul #16 | ||
// CHECK-ENCODING: [0xe0,0xe3,0x2f,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: e0 e3 2f 04 <unknown> | ||
|
||
cntb x0, pow2 | ||
// CHECK-INST: cntb x0, pow2 | ||
// CHECK-ENCODING: [0x00,0xe0,0x20,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: 00 e0 20 04 <unknown> | ||
|
||
cntb x0, #28 | ||
// CHECK-INST: cntb x0, #28 | ||
// CHECK-ENCODING: [0x80,0xe3,0x20,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: 80 e3 20 04 <unknown> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve 2>&1 < %s| FileCheck %s | ||
|
||
// ------------------------------------------------------------------------- // | ||
// Invalid result register | ||
|
||
cntd w0 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cntd w0 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntd sp | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cntd sp | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntd z0.b | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cntd z0.b | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
|
||
// ------------------------------------------------------------------------- // | ||
// Immediate not compatible with encode/decode function. | ||
|
||
cntd x0, all, mul #-1 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [1, 16] | ||
// CHECK-NEXT: cntd x0, all, mul #-1 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntd x0, all, mul #0 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [1, 16] | ||
// CHECK-NEXT: cntd x0, all, mul #0 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntd x0, all, mul #17 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [1, 16] | ||
// CHECK-NEXT: cntd x0, all, mul #17 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
|
||
// ------------------------------------------------------------------------- // | ||
// Invalid predicate patterns | ||
|
||
cntd x0, #-1 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern | ||
// CHECK-NEXT: cntd x0, #-1 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntd x0, #32 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern | ||
// CHECK-NEXT: cntd x0, #32 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cntd x0, vl512 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cntd x0, vl512 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// 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 | ||
|
||
cntd x0 | ||
// CHECK-INST: cntd x0 | ||
// CHECK-ENCODING: [0xe0,0xe3,0xe0,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: e0 e3 e0 04 <unknown> | ||
|
||
cntd x0, all | ||
// CHECK-INST: cntd x0 | ||
// CHECK-ENCODING: [0xe0,0xe3,0xe0,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: e0 e3 e0 04 <unknown> | ||
|
||
cntd x0, all, mul #1 | ||
// CHECK-INST: cntd x0 | ||
// CHECK-ENCODING: [0xe0,0xe3,0xe0,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: e0 e3 e0 04 <unknown> | ||
|
||
cntd x0, all, mul #16 | ||
// CHECK-INST: cntd x0, all, mul #16 | ||
// CHECK-ENCODING: [0xe0,0xe3,0xef,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: e0 e3 ef 04 <unknown> | ||
|
||
cntd x0, pow2 | ||
// CHECK-INST: cntd x0, pow2 | ||
// CHECK-ENCODING: [0x00,0xe0,0xe0,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: 00 e0 e0 04 <unknown> | ||
|
||
cntd x0, #28 | ||
// CHECK-INST: cntd x0, #28 | ||
// CHECK-ENCODING: [0x80,0xe3,0xe0,0x04] | ||
// CHECK-ERROR: instruction requires: sve | ||
// CHECK-UNKNOWN: 80 e3 e0 04 <unknown> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve 2>&1 < %s| FileCheck %s | ||
|
||
// ------------------------------------------------------------------------- // | ||
// Invalid result register | ||
|
||
cnth w0 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cnth w0 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cnth sp | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cnth sp | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cnth z0.b | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cnth z0.b | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
|
||
// ------------------------------------------------------------------------- // | ||
// Immediate not compatible with encode/decode function. | ||
|
||
cnth x0, all, mul #-1 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [1, 16] | ||
// CHECK-NEXT: cnth x0, all, mul #-1 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cnth x0, all, mul #0 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [1, 16] | ||
// CHECK-NEXT: cnth x0, all, mul #0 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cnth x0, all, mul #17 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: immediate must be an integer in range [1, 16] | ||
// CHECK-NEXT: cnth x0, all, mul #17 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
|
||
// ------------------------------------------------------------------------- // | ||
// Invalid predicate patterns | ||
|
||
cnth x0, #-1 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern | ||
// CHECK-NEXT: cnth x0, #-1 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cnth x0, #32 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid predicate pattern | ||
// CHECK-NEXT: cnth x0, #32 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: | ||
|
||
cnth x0, vl512 | ||
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand | ||
// CHECK-NEXT: cnth x0, vl512 | ||
// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: |
Oops, something went wrong.