xref: /llvm-project/clang/test/CodeGen/AArch64/neon-sha3.c (revision 207e5ccceec8d3cc3f32723e78f2a142bc61b07d)
1*207e5cccSFangrui Song // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2*207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon \
3*207e5cccSFangrui Song // RUN:  -target-feature +sha3 -emit-llvm -o - %s \
4*207e5cccSFangrui Song // RUN:  | FileCheck %s
5*207e5cccSFangrui Song 
6*207e5cccSFangrui Song // REQUIRES: aarch64-registered-target || arm-registered-target
7*207e5cccSFangrui Song 
8*207e5cccSFangrui Song #include <arm_neon.h>
9*207e5cccSFangrui Song 
10*207e5cccSFangrui Song // CHECK-LABEL: @test_vsha512h(
11*207e5cccSFangrui Song // CHECK:    call <2 x i64> @llvm.aarch64.crypto.sha512h
12*207e5cccSFangrui Song //
13*207e5cccSFangrui Song void test_vsha512h(uint64x2_t hash_ed, uint64x2_t hash_gf, uint64x2_t kwh_kwh2) {
14*207e5cccSFangrui Song   uint64x2_t result = vsha512hq_u64(hash_ed, hash_gf, kwh_kwh2);
15*207e5cccSFangrui Song }
16*207e5cccSFangrui Song 
17*207e5cccSFangrui Song // CHECK-LABEL: @test_vsha512h2(
18*207e5cccSFangrui Song // CHECK:    call <2 x i64> @llvm.aarch64.crypto.sha512h2
19*207e5cccSFangrui Song //
20*207e5cccSFangrui Song void test_vsha512h2(uint64x2_t sum_ab, uint64x2_t hash_c_, uint64x2_t hash_ab) {
21*207e5cccSFangrui Song   uint64x2_t result = vsha512h2q_u64(sum_ab, hash_c_, hash_ab);
22*207e5cccSFangrui Song }
23*207e5cccSFangrui Song 
24*207e5cccSFangrui Song // CHECK-LABEL: @test_vsha512su0(
25*207e5cccSFangrui Song // CHECK:    call <2 x i64> @llvm.aarch64.crypto.sha512su0
26*207e5cccSFangrui Song //
27*207e5cccSFangrui Song void test_vsha512su0(uint64x2_t w0_1, uint64x2_t w2_) {
28*207e5cccSFangrui Song   uint64x2_t result = vsha512su0q_u64(w0_1, w2_);
29*207e5cccSFangrui Song }
30*207e5cccSFangrui Song 
31*207e5cccSFangrui Song // CHECK-LABEL: @test_vsha512su1(
32*207e5cccSFangrui Song // CHECK:    call <2 x i64> @llvm.aarch64.crypto.sha512su1
33*207e5cccSFangrui Song //
34*207e5cccSFangrui Song void test_vsha512su1(uint64x2_t s01_s02, uint64x2_t w14_15, uint64x2_t w9_10) {
35*207e5cccSFangrui Song   uint64x2_t result = vsha512su1q_u64(s01_s02, w14_15, w9_10);
36*207e5cccSFangrui Song }
37*207e5cccSFangrui Song 
38*207e5cccSFangrui Song // CHECK-LABEL: @test_vrax1(
39*207e5cccSFangrui Song // CHECK:    call <2 x i64> @llvm.aarch64.crypto.rax1
40*207e5cccSFangrui Song //
41*207e5cccSFangrui Song void test_vrax1(uint64x2_t a, uint64x2_t b) {
42*207e5cccSFangrui Song   uint64x2_t result = vrax1q_u64(a, b);
43*207e5cccSFangrui Song }
44*207e5cccSFangrui Song 
45*207e5cccSFangrui Song 
46*207e5cccSFangrui Song // CHECK-LABEL: @test_xar(
47*207e5cccSFangrui Song // CHECK:    call <2 x i64> @llvm.aarch64.crypto.xar
48*207e5cccSFangrui Song //
49*207e5cccSFangrui Song void test_xar(uint64x2_t a, uint64x2_t b) {
50*207e5cccSFangrui Song   uint64x2_t result = vxarq_u64(a, b, 10);
51*207e5cccSFangrui Song }
52*207e5cccSFangrui Song 
53*207e5cccSFangrui Song 
54*207e5cccSFangrui Song // CHECK-LABEL: @test_vbcax_u8(
55*207e5cccSFangrui Song // CHECK:    call <16 x i8> @llvm.aarch64.crypto.bcaxu.v16i8
56*207e5cccSFangrui Song //
57*207e5cccSFangrui Song void test_vbcax_u8(uint8x16_t a, uint8x16_t b, uint8x16_t c) {
58*207e5cccSFangrui Song   uint8x16_t result = vbcaxq_u8(a, b, c);
59*207e5cccSFangrui Song }
60*207e5cccSFangrui Song 
61*207e5cccSFangrui Song // CHECK-LABEL: @test_vbcax_u16(
62*207e5cccSFangrui Song // CHECK:    call <8 x i16> @llvm.aarch64.crypto.bcaxu.v8i16
63*207e5cccSFangrui Song //
64*207e5cccSFangrui Song void test_vbcax_u16(uint16x8_t a, uint16x8_t b, uint16x8_t c) {
65*207e5cccSFangrui Song   uint16x8_t result = vbcaxq_u16(a, b, c);
66*207e5cccSFangrui Song }
67*207e5cccSFangrui Song 
68*207e5cccSFangrui Song // CHECK-LABEL: @test_vbcax_u32(
69*207e5cccSFangrui Song // CHECK:    call <4 x i32> @llvm.aarch64.crypto.bcaxu.v4i32
70*207e5cccSFangrui Song //
71*207e5cccSFangrui Song void test_vbcax_u32(uint32x4_t a, uint32x4_t b, uint32x4_t c) {
72*207e5cccSFangrui Song   uint32x4_t result = vbcaxq_u32(a, b, c);
73*207e5cccSFangrui Song }
74*207e5cccSFangrui Song 
75*207e5cccSFangrui Song // CHECK-LABEL: @test_vbcax_u64(
76*207e5cccSFangrui Song // CHECK:    call <2 x i64> @llvm.aarch64.crypto.bcaxu.v2i64
77*207e5cccSFangrui Song //
78*207e5cccSFangrui Song void test_vbcax_u64(uint64x2_t a, uint64x2_t b, uint64x2_t c) {
79*207e5cccSFangrui Song   uint64x2_t result = vbcaxq_u64(a, b, c);
80*207e5cccSFangrui Song }
81*207e5cccSFangrui Song 
82*207e5cccSFangrui Song // CHECK-LABEL: @test_vbcax_s8(
83*207e5cccSFangrui Song // CHECK:    call <16 x i8> @llvm.aarch64.crypto.bcaxs.v16i8
84*207e5cccSFangrui Song //
85*207e5cccSFangrui Song void test_vbcax_s8(int8x16_t a, int8x16_t b, int8x16_t c) {
86*207e5cccSFangrui Song   int8x16_t result = vbcaxq_s8(a, b, c);
87*207e5cccSFangrui Song }
88*207e5cccSFangrui Song 
89*207e5cccSFangrui Song // CHECK-LABEL: @test_vbcax_s16(
90*207e5cccSFangrui Song // CHECK:    call <8 x i16> @llvm.aarch64.crypto.bcaxs.v8i16
91*207e5cccSFangrui Song //
92*207e5cccSFangrui Song void test_vbcax_s16(int16x8_t a, int16x8_t b, int16x8_t c) {
93*207e5cccSFangrui Song   int16x8_t result = vbcaxq_s16(a, b, c);
94*207e5cccSFangrui Song }
95*207e5cccSFangrui Song 
96*207e5cccSFangrui Song // CHECK-LABEL: @test_vbcax_s32(
97*207e5cccSFangrui Song // CHECK:    call <4 x i32> @llvm.aarch64.crypto.bcaxs.v4i32
98*207e5cccSFangrui Song //
99*207e5cccSFangrui Song void test_vbcax_s32(int32x4_t a, int32x4_t b, int32x4_t c) {
100*207e5cccSFangrui Song   int32x4_t result = vbcaxq_s32(a, b, c);
101*207e5cccSFangrui Song }
102*207e5cccSFangrui Song 
103*207e5cccSFangrui Song // CHECK-LABEL: @test_vbcax_s64(
104*207e5cccSFangrui Song // CHECK:    call <2 x i64> @llvm.aarch64.crypto.bcaxs.v2i64
105*207e5cccSFangrui Song //
106*207e5cccSFangrui Song void test_vbcax_s64(int64x2_t a, int64x2_t b, int64x2_t c) {
107*207e5cccSFangrui Song   int64x2_t result = vbcaxq_s64(a, b, c);
108*207e5cccSFangrui Song }
109*207e5cccSFangrui Song 
110*207e5cccSFangrui Song // CHECK-LABEL: @test_veor3_u8(
111*207e5cccSFangrui Song // CHECK:    call <16 x i8> @llvm.aarch64.crypto.eor3u.v16i8
112*207e5cccSFangrui Song //
113*207e5cccSFangrui Song void test_veor3_u8(uint8x16_t a, uint8x16_t b, uint8x16_t c) {
114*207e5cccSFangrui Song   uint8x16_t result = veor3q_u8(a, b, c);
115*207e5cccSFangrui Song }
116*207e5cccSFangrui Song 
117*207e5cccSFangrui Song // CHECK-LABEL: @test_veor3_u16(
118*207e5cccSFangrui Song // CHECK:    call <8 x i16> @llvm.aarch64.crypto.eor3u.v8i16
119*207e5cccSFangrui Song //
120*207e5cccSFangrui Song void test_veor3_u16(uint16x8_t a, uint16x8_t b, uint16x8_t c) {
121*207e5cccSFangrui Song   uint16x8_t result = veor3q_u16(a, b, c);
122*207e5cccSFangrui Song }
123*207e5cccSFangrui Song 
124*207e5cccSFangrui Song // CHECK-LABEL: @test_veor3_u32(
125*207e5cccSFangrui Song // CHECK:    call <4 x i32> @llvm.aarch64.crypto.eor3u.v4i32
126*207e5cccSFangrui Song //
127*207e5cccSFangrui Song void test_veor3_u32(uint32x4_t a, uint32x4_t b, uint32x4_t c) {
128*207e5cccSFangrui Song   uint32x4_t result = veor3q_u32(a, b, c);
129*207e5cccSFangrui Song }
130*207e5cccSFangrui Song 
131*207e5cccSFangrui Song // CHECK-LABEL: @test_veor3_u64(
132*207e5cccSFangrui Song // CHECK:    call <2 x i64> @llvm.aarch64.crypto.eor3u.v2i64
133*207e5cccSFangrui Song //
134*207e5cccSFangrui Song void test_veor3_u64(uint64x2_t a, uint64x2_t b, uint64x2_t c) {
135*207e5cccSFangrui Song   uint64x2_t result = veor3q_u64(a, b, c);
136*207e5cccSFangrui Song }
137*207e5cccSFangrui Song 
138*207e5cccSFangrui Song // CHECK-LABEL: @test_veor3_s8(
139*207e5cccSFangrui Song // CHECK:    call <16 x i8> @llvm.aarch64.crypto.eor3s.v16i8
140*207e5cccSFangrui Song //
141*207e5cccSFangrui Song void test_veor3_s8(int8x16_t a, int8x16_t b, int8x16_t c) {
142*207e5cccSFangrui Song   int8x16_t result = veor3q_s8(a, b, c);
143*207e5cccSFangrui Song }
144*207e5cccSFangrui Song 
145*207e5cccSFangrui Song // CHECK-LABEL: @test_veor3_s16(
146*207e5cccSFangrui Song // CHECK:     call <8 x i16> @llvm.aarch64.crypto.eor3s.v8i16
147*207e5cccSFangrui Song //
148*207e5cccSFangrui Song void test_veor3_s16(int16x8_t a, int16x8_t b, int16x8_t c) {
149*207e5cccSFangrui Song   int16x8_t result = veor3q_s16(a, b, c);
150*207e5cccSFangrui Song }
151*207e5cccSFangrui Song 
152*207e5cccSFangrui Song // CHECK-LABEL: @test_veor3_s32(
153*207e5cccSFangrui Song // CHECK:    call <4 x i32> @llvm.aarch64.crypto.eor3s.v4i32
154*207e5cccSFangrui Song //
155*207e5cccSFangrui Song void test_veor3_s32(int32x4_t a, int32x4_t b, int32x4_t c) {
156*207e5cccSFangrui Song   int32x4_t result = veor3q_s32(a, b, c);
157*207e5cccSFangrui Song }
158*207e5cccSFangrui Song 
159*207e5cccSFangrui Song // CHECK-LABEL: @test_veor3_s64(
160*207e5cccSFangrui Song // CHECK:    call <2 x i64> @llvm.aarch64.crypto.eor3s.v2i64
161*207e5cccSFangrui Song //
162*207e5cccSFangrui Song void test_veor3_s64(int64x2_t a, int64x2_t b, int64x2_t c) {
163*207e5cccSFangrui Song   int64x2_t result = veor3q_s64(a, b, c);
164*207e5cccSFangrui Song }
165