xref: /llvm-project/llvm/test/MC/AArch64/armv8.2a-crypto.s (revision f302e0b5dd402e629620a58f9115a3441c65d60f)
1// RUN: not llvm-mc -triple aarch64 -mattr=+sha3,-sm4 -show-encoding < %s 2> %t | FileCheck %s  --check-prefix=CHECK-SHA
2// RUN: FileCheck --check-prefix=CHECK-NO-SM < %t %s
3
4// RUN: not llvm-mc -triple aarch64 -mattr=+sm4,-sha3 -show-encoding < %s 2> %t | FileCheck %s --check-prefix=CHECK-SM
5// RUN: FileCheck --check-prefix=CHECK-NO-SHA < %t %s
6
7// RUN: not llvm-mc -triple aarch64 -show-encoding < %s 2> %t
8// RUN: FileCheck --check-prefix=CHECK-NO-SHA --check-prefix=CHECK-NO-SM < %t %s
9
10// RUN: not llvm-mc -triple aarch64 -mattr=+v8r -show-encoding -o - %s < %s 2> %t
11// RUN: FileCheck --check-prefix=CHECK-NO-SHA --check-prefix=CHECK-NO-SM < %t %s
12
13  sha512h   q0, q1, v2.2d
14  sha512h2  q0, q1, v2.2d
15  sha512su0 v11.2d, v12.2d
16  sha512su1 v11.2d, v13.2d, v14.2d
17  eor3  v25.16b, v12.16b, v7.16b, v2.16b
18  rax1  v30.2d, v29.2d, v26.2d
19  xar v26.2d, v21.2d, v27.2d, #63
20  bcax  v31.16b, v26.16b, v2.16b, v1.16b
21
22//CHECK-SHA:  sha512h   q0, q1, v2.2d                    // encoding: [0x20,0x80,0x62,0xce]
23//CHECK-SHA:  sha512h2  q0, q1, v2.2d                    // encoding: [0x20,0x84,0x62,0xce]
24//CHECK-SHA:  sha512su0 v11.2d, v12.2d                   // encoding: [0x8b,0x81,0xc0,0xce]
25//CHECK-SHA:  sha512su1 v11.2d, v13.2d, v14.2d           // encoding: [0xab,0x89,0x6e,0xce]
26//CHECK-SHA:  eor3  v25.16b, v12.16b, v7.16b, v2.16b     // encoding: [0x99,0x09,0x07,0xce]
27//CHECK-SHA:  rax1  v30.2d, v29.2d, v26.2d               // encoding: [0xbe,0x8f,0x7a,0xce]
28//CHECK-SHA:  xar v26.2d, v21.2d, v27.2d, #63            // encoding: [0xba,0xfe,0x9b,0xce]
29//CHECK-SHA:  bcax  v31.16b, v26.16b, v2.16b, v1.16b     // encoding: [0x5f,0x07,0x22,0xce]
30
31
32// CHECK-NO-SHA: error: instruction requires: sha3
33// CHECK-NO-SHA: error: instruction requires: sha3
34// CHECK-NO-SHA: error: instruction requires: sha3
35// CHECK-NO-SHA: error: instruction requires: sha3
36// CHECK-NO-SHA: error: instruction requires: sha3
37// CHECK-NO-SHA: error: instruction requires: sha3
38// CHECK-NO-SHA: error: instruction requires: sha3
39// CHECK-NO-SHA: error: instruction requires: sha3
40
41  sm3ss1  v20.4s, v23.4s, v21.4s, v22.4s
42  sm3tt1a v20.4s, v23.4s, v21.s[3]
43  sm3tt1b v20.4s, v23.4s, v21.s[3]
44  sm3tt2a v20.4s, v23.4s, v21.s[3]
45  sm3tt2b v20.4s, v23.4s, v21.s[3]
46  sm3partw1 v30.4s, v29.4s, v26.4s
47  sm3partw2 v30.4s, v29.4s, v26.4s
48  sm4ekey v11.4s, v11.4s, v19.4s
49  sm4e  v2.4s, v15.4s
50
51// CHECK-SM:  sm3ss1  v20.4s, v23.4s, v21.4s, v22.4s     // encoding: [0xf4,0x5a,0x55,0xce]
52// CHECK-SM:  sm3tt1a v20.4s, v23.4s, v21.s[3]           // encoding: [0xf4,0xb2,0x55,0xce]
53// CHECK-SM:  sm3tt1b v20.4s, v23.4s, v21.s[3]           // encoding: [0xf4,0xb6,0x55,0xce]
54// CHECK-SM:  sm3tt2a v20.4s, v23.4s, v21.s[3]           // encoding: [0xf4,0xba,0x55,0xce]
55// CHECK-SM:  sm3tt2b v20.4s, v23.4s, v21.s[3]           // encoding: [0xf4,0xbe,0x55,0xce]
56// CHECK-SM:  sm3partw1 v30.4s, v29.4s, v26.4s           // encoding: [0xbe,0xc3,0x7a,0xce]
57// CHECK-SM:  sm3partw2 v30.4s, v29.4s, v26.4s           // encoding: [0xbe,0xc7,0x7a,0xce]
58// CHECK-SM:  sm4ekey v11.4s, v11.4s, v19.4s             // encoding: [0x6b,0xc9,0x73,0xce]
59// CHECK-SM:  sm4e v2.4s, v15.4s                         // encoding: [0xe2,0x85,0xc0,0xce]
60
61// CHECK-NO-SM: error: instruction requires: sm4
62// CHECK-NO-SM: error: instruction requires: sm4
63// CHECK-NO-SM: error: instruction requires: sm4
64// CHECK-NO-SM: error: instruction requires: sm4
65// CHECK-NO-SM: error: instruction requires: sm4
66// CHECK-NO-SM: error: instruction requires: sm4
67// CHECK-NO-SM: error: instruction requires: sm4
68