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