1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple arm-none-linux-gnueabi -target-feature +neon \
2*0a6a1f1dSLionel Sambuc // RUN: -target-feature +crypto -target-cpu cortex-a57 -emit-llvm -O1 -o - %s | FileCheck %s
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
5*0a6a1f1dSLionel Sambuc // RUN: -target-feature +crypto -emit-llvm -O1 -o - %s | FileCheck %s
6*0a6a1f1dSLionel Sambuc // RUN: not %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
7*0a6a1f1dSLionel Sambuc // RUN: -S -O3 -o - %s 2>&1 | FileCheck --check-prefix=CHECK-NO-CRYPTO %s
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc // Test new aarch64 intrinsics and types
10*0a6a1f1dSLionel Sambuc
11*0a6a1f1dSLionel Sambuc #include <arm_neon.h>
12*0a6a1f1dSLionel Sambuc
test_vaeseq_u8(uint8x16_t data,uint8x16_t key)13*0a6a1f1dSLionel Sambuc uint8x16_t test_vaeseq_u8(uint8x16_t data, uint8x16_t key) {
14*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vaeseq_u8
15*0a6a1f1dSLionel Sambuc // CHECK-NO-CRYPTO: warning: implicit declaration of function 'vaeseq_u8' is invalid in C99
16*0a6a1f1dSLionel Sambuc return vaeseq_u8(data, key);
17*0a6a1f1dSLionel Sambuc // CHECK: call <16 x i8> @llvm.{{arm.neon|aarch64.crypto}}.aese(<16 x i8> %data, <16 x i8> %key)
18*0a6a1f1dSLionel Sambuc }
19*0a6a1f1dSLionel Sambuc
test_vaesdq_u8(uint8x16_t data,uint8x16_t key)20*0a6a1f1dSLionel Sambuc uint8x16_t test_vaesdq_u8(uint8x16_t data, uint8x16_t key) {
21*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vaesdq_u8
22*0a6a1f1dSLionel Sambuc return vaesdq_u8(data, key);
23*0a6a1f1dSLionel Sambuc // CHECK: call <16 x i8> @llvm.{{arm.neon|aarch64.crypto}}.aesd(<16 x i8> %data, <16 x i8> %key)
24*0a6a1f1dSLionel Sambuc }
25*0a6a1f1dSLionel Sambuc
test_vaesmcq_u8(uint8x16_t data)26*0a6a1f1dSLionel Sambuc uint8x16_t test_vaesmcq_u8(uint8x16_t data) {
27*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vaesmcq_u8
28*0a6a1f1dSLionel Sambuc return vaesmcq_u8(data);
29*0a6a1f1dSLionel Sambuc // CHECK: call <16 x i8> @llvm.{{arm.neon|aarch64.crypto}}.aesmc(<16 x i8> %data)
30*0a6a1f1dSLionel Sambuc }
31*0a6a1f1dSLionel Sambuc
test_vaesimcq_u8(uint8x16_t data)32*0a6a1f1dSLionel Sambuc uint8x16_t test_vaesimcq_u8(uint8x16_t data) {
33*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vaesimcq_u8
34*0a6a1f1dSLionel Sambuc return vaesimcq_u8(data);
35*0a6a1f1dSLionel Sambuc // CHECK: call <16 x i8> @llvm.{{arm.neon|aarch64.crypto}}.aesimc(<16 x i8> %data)
36*0a6a1f1dSLionel Sambuc }
37*0a6a1f1dSLionel Sambuc
test_vsha1h_u32(uint32_t hash_e)38*0a6a1f1dSLionel Sambuc uint32_t test_vsha1h_u32(uint32_t hash_e) {
39*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vsha1h_u32
40*0a6a1f1dSLionel Sambuc return vsha1h_u32(hash_e);
41*0a6a1f1dSLionel Sambuc // CHECK: call i32 @llvm.{{arm.neon|aarch64.crypto}}.sha1h(i32 %hash_e)
42*0a6a1f1dSLionel Sambuc }
43*0a6a1f1dSLionel Sambuc
test_vsha1su1q_u32(uint32x4_t w0_3,uint32x4_t w12_15)44*0a6a1f1dSLionel Sambuc uint32x4_t test_vsha1su1q_u32(uint32x4_t w0_3, uint32x4_t w12_15) {
45*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vsha1su1q_u32
46*0a6a1f1dSLionel Sambuc return vsha1su1q_u32(w0_3, w12_15);
47*0a6a1f1dSLionel Sambuc // CHECK: call <4 x i32> @llvm.{{arm.neon|aarch64.crypto}}.sha1su1(<4 x i32> %w0_3, <4 x i32> %w12_15)
48*0a6a1f1dSLionel Sambuc }
49*0a6a1f1dSLionel Sambuc
test_vsha256su0q_u32(uint32x4_t w0_3,uint32x4_t w4_7)50*0a6a1f1dSLionel Sambuc uint32x4_t test_vsha256su0q_u32(uint32x4_t w0_3, uint32x4_t w4_7) {
51*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vsha256su0q_u32
52*0a6a1f1dSLionel Sambuc return vsha256su0q_u32(w0_3, w4_7);
53*0a6a1f1dSLionel Sambuc // CHECK: call <4 x i32> @llvm.{{arm.neon|aarch64.crypto}}.sha256su0(<4 x i32> %w0_3, <4 x i32> %w4_7)
54*0a6a1f1dSLionel Sambuc }
55*0a6a1f1dSLionel Sambuc
test_vsha1cq_u32(uint32x4_t hash_abcd,uint32_t hash_e,uint32x4_t wk)56*0a6a1f1dSLionel Sambuc uint32x4_t test_vsha1cq_u32(uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk) {
57*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vsha1cq_u32
58*0a6a1f1dSLionel Sambuc return vsha1cq_u32(hash_abcd, hash_e, wk);
59*0a6a1f1dSLionel Sambuc // CHECK: call <4 x i32> @llvm.{{arm.neon|aarch64.crypto}}.sha1c(<4 x i32> %hash_abcd, i32 %hash_e, <4 x i32> %wk)
60*0a6a1f1dSLionel Sambuc }
61*0a6a1f1dSLionel Sambuc
test_vsha1pq_u32(uint32x4_t hash_abcd,uint32_t hash_e,uint32x4_t wk)62*0a6a1f1dSLionel Sambuc uint32x4_t test_vsha1pq_u32(uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk) {
63*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vsha1pq_u32
64*0a6a1f1dSLionel Sambuc return vsha1pq_u32(hash_abcd, hash_e, wk);
65*0a6a1f1dSLionel Sambuc // CHECK: call <4 x i32> @llvm.{{arm.neon|aarch64.crypto}}.sha1p(<4 x i32> %hash_abcd, i32 %hash_e, <4 x i32> %wk)
66*0a6a1f1dSLionel Sambuc }
67*0a6a1f1dSLionel Sambuc
test_vsha1mq_u32(uint32x4_t hash_abcd,uint32_t hash_e,uint32x4_t wk)68*0a6a1f1dSLionel Sambuc uint32x4_t test_vsha1mq_u32(uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk) {
69*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vsha1mq_u32
70*0a6a1f1dSLionel Sambuc return vsha1mq_u32(hash_abcd, hash_e, wk);
71*0a6a1f1dSLionel Sambuc // CHECK: call <4 x i32> @llvm.{{arm.neon|aarch64.crypto}}.sha1m(<4 x i32> %hash_abcd, i32 %hash_e, <4 x i32> %wk)
72*0a6a1f1dSLionel Sambuc }
73*0a6a1f1dSLionel Sambuc
test_vsha1su0q_u32(uint32x4_t w0_3,uint32x4_t w4_7,uint32x4_t w8_11)74*0a6a1f1dSLionel Sambuc uint32x4_t test_vsha1su0q_u32(uint32x4_t w0_3, uint32x4_t w4_7, uint32x4_t w8_11) {
75*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vsha1su0q_u32
76*0a6a1f1dSLionel Sambuc return vsha1su0q_u32(w0_3, w4_7, w8_11);
77*0a6a1f1dSLionel Sambuc // CHECK: call <4 x i32> @llvm.{{arm.neon|aarch64.crypto}}.sha1su0(<4 x i32> %w0_3, <4 x i32> %w4_7, <4 x i32> %w8_11)
78*0a6a1f1dSLionel Sambuc }
79*0a6a1f1dSLionel Sambuc
test_vsha256hq_u32(uint32x4_t hash_abcd,uint32x4_t hash_efgh,uint32x4_t wk)80*0a6a1f1dSLionel Sambuc uint32x4_t test_vsha256hq_u32(uint32x4_t hash_abcd, uint32x4_t hash_efgh, uint32x4_t wk) {
81*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vsha256hq_u32
82*0a6a1f1dSLionel Sambuc return vsha256hq_u32(hash_abcd, hash_efgh, wk);
83*0a6a1f1dSLionel Sambuc // CHECK: call <4 x i32> @llvm.{{arm.neon|aarch64.crypto}}.sha256h(<4 x i32> %hash_abcd, <4 x i32> %hash_efgh, <4 x i32> %wk)
84*0a6a1f1dSLionel Sambuc }
85*0a6a1f1dSLionel Sambuc
test_vsha256h2q_u32(uint32x4_t hash_efgh,uint32x4_t hash_abcd,uint32x4_t wk)86*0a6a1f1dSLionel Sambuc uint32x4_t test_vsha256h2q_u32(uint32x4_t hash_efgh, uint32x4_t hash_abcd, uint32x4_t wk) {
87*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vsha256h2q_u32
88*0a6a1f1dSLionel Sambuc return vsha256h2q_u32(hash_efgh, hash_abcd, wk);
89*0a6a1f1dSLionel Sambuc // CHECK: call <4 x i32> @llvm.{{arm.neon|aarch64.crypto}}.sha256h2(<4 x i32> %hash_efgh, <4 x i32> %hash_abcd, <4 x i32> %wk)
90*0a6a1f1dSLionel Sambuc }
91*0a6a1f1dSLionel Sambuc
test_vsha256su1q_u32(uint32x4_t w0_3,uint32x4_t w8_11,uint32x4_t w12_15)92*0a6a1f1dSLionel Sambuc uint32x4_t test_vsha256su1q_u32(uint32x4_t w0_3, uint32x4_t w8_11, uint32x4_t w12_15) {
93*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test_vsha256su1q_u32
94*0a6a1f1dSLionel Sambuc return vsha256su1q_u32(w0_3, w8_11, w12_15);
95*0a6a1f1dSLionel Sambuc // CHECK: call <4 x i32> @llvm.{{arm.neon|aarch64.crypto}}.sha256su1(<4 x i32> %w0_3, <4 x i32> %w8_11, <4 x i32> %w12_15)
96*0a6a1f1dSLionel Sambuc }
97