xref: /llvm-project/clang/test/CodeGen/AArch64/poly-add.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: -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg \
4*207e5cccSFangrui Song // RUN:  | FileCheck %s
5*207e5cccSFangrui Song 
6*207e5cccSFangrui Song // REQUIRES: aarch64-registered-target
7*207e5cccSFangrui Song 
8*207e5cccSFangrui Song #include <arm_neon.h>
9*207e5cccSFangrui Song 
10*207e5cccSFangrui Song // CHECK-LABEL: @test_vadd_p8(
11*207e5cccSFangrui Song // CHECK-NEXT:  entry:
12*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = xor <8 x i8> [[A:%.*]], [[B:%.*]]
13*207e5cccSFangrui Song // CHECK-NEXT:    ret <8 x i8> [[TMP0]]
14*207e5cccSFangrui Song //
15*207e5cccSFangrui Song poly8x8_t test_vadd_p8(poly8x8_t a, poly8x8_t b) {
16*207e5cccSFangrui Song   return vadd_p8 (a, b);
17*207e5cccSFangrui Song }
18*207e5cccSFangrui Song 
19*207e5cccSFangrui Song // CHECK-LABEL: @test_vadd_p16(
20*207e5cccSFangrui Song // CHECK-NEXT:  entry:
21*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <4 x i16> [[A:%.*]] to <8 x i8>
22*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
23*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = xor <8 x i8> [[TMP0]], [[TMP1]]
24*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP3:%.*]] = bitcast <8 x i8> [[TMP2]] to <4 x i16>
25*207e5cccSFangrui Song // CHECK-NEXT:    ret <4 x i16> [[TMP3]]
26*207e5cccSFangrui Song //
27*207e5cccSFangrui Song poly16x4_t test_vadd_p16(poly16x4_t a, poly16x4_t b) {
28*207e5cccSFangrui Song   return vadd_p16 (a, b);
29*207e5cccSFangrui Song }
30*207e5cccSFangrui Song 
31*207e5cccSFangrui Song // CHECK-LABEL: @test_vadd_p64(
32*207e5cccSFangrui Song // CHECK-NEXT:  entry:
33*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <1 x i64> [[A:%.*]] to <8 x i8>
34*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <1 x i64> [[B:%.*]] to <8 x i8>
35*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = xor <8 x i8> [[TMP0]], [[TMP1]]
36*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP3:%.*]] = bitcast <8 x i8> [[TMP2]] to <1 x i64>
37*207e5cccSFangrui Song // CHECK-NEXT:    ret <1 x i64> [[TMP3]]
38*207e5cccSFangrui Song //
39*207e5cccSFangrui Song poly64x1_t test_vadd_p64(poly64x1_t a, poly64x1_t b) {
40*207e5cccSFangrui Song   return vadd_p64(a, b);
41*207e5cccSFangrui Song }
42*207e5cccSFangrui Song 
43*207e5cccSFangrui Song // CHECK-LABEL: @test_vaddq_p8(
44*207e5cccSFangrui Song // CHECK-NEXT:  entry:
45*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = xor <16 x i8> [[A:%.*]], [[B:%.*]]
46*207e5cccSFangrui Song // CHECK-NEXT:    ret <16 x i8> [[TMP0]]
47*207e5cccSFangrui Song //
48*207e5cccSFangrui Song poly8x16_t test_vaddq_p8(poly8x16_t a, poly8x16_t b){
49*207e5cccSFangrui Song   return vaddq_p8(a, b);
50*207e5cccSFangrui Song }
51*207e5cccSFangrui Song 
52*207e5cccSFangrui Song // CHECK-LABEL: @test_vaddq_p16(
53*207e5cccSFangrui Song // CHECK-NEXT:  entry:
54*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <8 x i16> [[A:%.*]] to <16 x i8>
55*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <8 x i16> [[B:%.*]] to <16 x i8>
56*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = xor <16 x i8> [[TMP0]], [[TMP1]]
57*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP3:%.*]] = bitcast <16 x i8> [[TMP2]] to <8 x i16>
58*207e5cccSFangrui Song // CHECK-NEXT:    ret <8 x i16> [[TMP3]]
59*207e5cccSFangrui Song //
60*207e5cccSFangrui Song poly16x8_t test_vaddq_p16(poly16x8_t a, poly16x8_t b){
61*207e5cccSFangrui Song   return vaddq_p16(a, b);
62*207e5cccSFangrui Song }
63*207e5cccSFangrui Song 
64*207e5cccSFangrui Song // CHECK-LABEL: @test_vaddq_p64(
65*207e5cccSFangrui Song // CHECK-NEXT:  entry:
66*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <2 x i64> [[A:%.*]] to <16 x i8>
67*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <2 x i64> [[B:%.*]] to <16 x i8>
68*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = xor <16 x i8> [[TMP0]], [[TMP1]]
69*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP3:%.*]] = bitcast <16 x i8> [[TMP2]] to <2 x i64>
70*207e5cccSFangrui Song // CHECK-NEXT:    ret <2 x i64> [[TMP3]]
71*207e5cccSFangrui Song //
72*207e5cccSFangrui Song poly64x2_t test_vaddq_p64(poly64x2_t a, poly64x2_t b){
73*207e5cccSFangrui Song   return vaddq_p64(a, b);
74*207e5cccSFangrui Song }
75*207e5cccSFangrui Song 
76*207e5cccSFangrui Song // CHECK-LABEL: @test_vaddq_p128(
77*207e5cccSFangrui Song // CHECK-NEXT:  entry:
78*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = bitcast i128 [[A:%.*]] to <16 x i8>
79*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = bitcast i128 [[B:%.*]] to <16 x i8>
80*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = xor <16 x i8> [[TMP0]], [[TMP1]]
81*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP3:%.*]] = bitcast <16 x i8> [[TMP2]] to i128
82*207e5cccSFangrui Song // CHECK-NEXT:    ret i128 [[TMP3]]
83*207e5cccSFangrui Song //
84*207e5cccSFangrui Song poly128_t test_vaddq_p128 (poly128_t a, poly128_t b){
85*207e5cccSFangrui Song   return vaddq_p128(a, b);
86*207e5cccSFangrui Song }
87