1 // RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-feature +neon -target-feature +crypto -ffreestanding -Os -S -o - %s | FileCheck %s
2 // REQUIRES: aarch64-registered-target
3
4 #include <arm_neon.h>
5
test_aese(uint8x16_t data,uint8x16_t key)6 uint8x16_t test_aese(uint8x16_t data, uint8x16_t key) {
7 // CHECK-LABEL: test_aese:
8 // CHECK: aese.16b v0, v1
9 return vaeseq_u8(data, key);
10 }
11
test_aesd(uint8x16_t data,uint8x16_t key)12 uint8x16_t test_aesd(uint8x16_t data, uint8x16_t key) {
13 // CHECK-LABEL: test_aesd:
14 // CHECK: aesd.16b v0, v1
15 return vaesdq_u8(data, key);
16 }
17
test_aesmc(uint8x16_t data,uint8x16_t key)18 uint8x16_t test_aesmc(uint8x16_t data, uint8x16_t key) {
19 // CHECK-LABEL: test_aesmc:
20 // CHECK: aesmc.16b v0, v0
21 return vaesmcq_u8(data);
22 }
23
test_aesimc(uint8x16_t data,uint8x16_t key)24 uint8x16_t test_aesimc(uint8x16_t data, uint8x16_t key) {
25 // CHECK-LABEL: test_aesimc:
26 // CHECK: aesimc.16b v0, v0
27 return vaesimcq_u8(data);
28 }
29
test_sha1c(uint32x4_t hash_abcd,uint32_t hash_e,uint32x4_t wk)30 uint32x4_t test_sha1c(uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk) {
31 // CHECK-LABEL: test_sha1c:
32 // CHECK: fmov [[HASH_E:s[0-9]+]], w0
33 // CHECK: sha1c.4s q0, [[HASH_E]], v1
34 return vsha1cq_u32(hash_abcd, hash_e, wk);
35 }
36
test_sha1p(uint32x4_t hash_abcd,uint32_t hash_e,uint32x4_t wk)37 uint32x4_t test_sha1p(uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk) {
38 // CHECK-LABEL: test_sha1p:
39 // CHECK: fmov [[HASH_E:s[0-9]+]], w0
40 // CHECK: sha1p.4s q0, [[HASH_E]], v1
41 return vsha1pq_u32(hash_abcd, hash_e, wk);
42 }
43
test_sha1m(uint32x4_t hash_abcd,uint32_t hash_e,uint32x4_t wk)44 uint32x4_t test_sha1m(uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk) {
45 // CHECK-LABEL: test_sha1m:
46 // CHECK: fmov [[HASH_E:s[0-9]+]], w0
47 // CHECK: sha1m.4s q0, [[HASH_E]], v1
48 return vsha1mq_u32(hash_abcd, hash_e, wk);
49 }
50
test_sha1h(uint32_t hash_e)51 uint32_t test_sha1h(uint32_t hash_e) {
52 // CHECK-LABEL: test_sha1h:
53 // CHECK: fmov [[HASH_E:s[0-9]+]], w0
54 // CHECK: sha1h [[RES:s[0-9]+]], [[HASH_E]]
55 // CHECK: fmov w0, [[RES]]
56 return vsha1h_u32(hash_e);
57 }
58
test_sha1su0(uint32x4_t wk0_3,uint32x4_t wk4_7,uint32x4_t wk8_11)59 uint32x4_t test_sha1su0(uint32x4_t wk0_3, uint32x4_t wk4_7, uint32x4_t wk8_11) {
60 // CHECK-LABEL: test_sha1su0:
61 // CHECK: sha1su0.4s v0, v1, v2
62 return vsha1su0q_u32(wk0_3, wk4_7, wk8_11);
63 }
64
test_sha1su1(uint32x4_t wk0_3,uint32x4_t wk12_15)65 uint32x4_t test_sha1su1(uint32x4_t wk0_3, uint32x4_t wk12_15) {
66 // CHECK-LABEL: test_sha1su1:
67 // CHECK: sha1su1.4s v0, v1
68 return vsha1su1q_u32(wk0_3, wk12_15);
69 }
70
test_sha256h(uint32x4_t hash_abcd,uint32x4_t hash_efgh,uint32x4_t wk)71 uint32x4_t test_sha256h(uint32x4_t hash_abcd, uint32x4_t hash_efgh, uint32x4_t wk) {
72 // CHECK-LABEL: test_sha256h:
73 // CHECK: sha256h.4s q0, q1, v2
74 return vsha256hq_u32(hash_abcd, hash_efgh, wk);
75 }
76
test_sha256h2(uint32x4_t hash_efgh,uint32x4_t hash_abcd,uint32x4_t wk)77 uint32x4_t test_sha256h2(uint32x4_t hash_efgh, uint32x4_t hash_abcd, uint32x4_t wk) {
78 // CHECK-LABEL: test_sha256h2:
79 // CHECK: sha256h2.4s q0, q1, v2
80 return vsha256h2q_u32(hash_efgh, hash_abcd, wk);
81 }
82
test_sha256su0(uint32x4_t w0_3,uint32x4_t w4_7)83 uint32x4_t test_sha256su0(uint32x4_t w0_3, uint32x4_t w4_7) {
84 // CHECK-LABEL: test_sha256su0:
85 // CHECK: sha256su0.4s v0, v1
86 return vsha256su0q_u32(w0_3, w4_7);
87 }
88
test_sha256su1(uint32x4_t w0_3,uint32x4_t w8_11,uint32x4_t w12_15)89 uint32x4_t test_sha256su1(uint32x4_t w0_3, uint32x4_t w8_11, uint32x4_t w12_15) {
90 // CHECK-LABEL: test_sha256su1:
91 // CHECK: sha256su1.4s v0, v1, v2
92 return vsha256su1q_u32(w0_3, w8_11, w12_15);
93 }
94