xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/arm64_vadd.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -O1 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - -emit-llvm %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc // Test ARM64 SIMD add intrinsics
3*0a6a1f1dSLionel Sambuc 
4*0a6a1f1dSLionel Sambuc #include <arm_neon.h>
test_vaddlv_s32(int32x2_t a1)5*0a6a1f1dSLionel Sambuc int64_t test_vaddlv_s32(int32x2_t a1) {
6*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddlv_s32
7*0a6a1f1dSLionel Sambuc   return vaddlv_s32(a1);
8*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.saddlv.i64.v2i32
9*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: ret
10*0a6a1f1dSLionel Sambuc }
11*0a6a1f1dSLionel Sambuc 
test_vaddlv_u32(uint32x2_t a1)12*0a6a1f1dSLionel Sambuc uint64_t test_vaddlv_u32(uint32x2_t a1) {
13*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddlv_u32
14*0a6a1f1dSLionel Sambuc   return vaddlv_u32(a1);
15*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.uaddlv.i64.v2i32
16*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: ret
17*0a6a1f1dSLionel Sambuc }
18*0a6a1f1dSLionel Sambuc 
test_vaddv_s8(int8x8_t a1)19*0a6a1f1dSLionel Sambuc int8_t test_vaddv_s8(int8x8_t a1) {
20*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddv_s8
21*0a6a1f1dSLionel Sambuc   return vaddv_s8(a1);
22*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.saddv.i32.v8i8
23*0a6a1f1dSLionel Sambuc   // don't check for return here (there's a trunc?)
24*0a6a1f1dSLionel Sambuc }
25*0a6a1f1dSLionel Sambuc 
test_vaddv_s16(int16x4_t a1)26*0a6a1f1dSLionel Sambuc int16_t test_vaddv_s16(int16x4_t a1) {
27*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddv_s16
28*0a6a1f1dSLionel Sambuc   return vaddv_s16(a1);
29*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.saddv.i32.v4i16
30*0a6a1f1dSLionel Sambuc   // don't check for return here (there's a trunc?)
31*0a6a1f1dSLionel Sambuc }
32*0a6a1f1dSLionel Sambuc 
test_vaddv_s32(int32x2_t a1)33*0a6a1f1dSLionel Sambuc int32_t test_vaddv_s32(int32x2_t a1) {
34*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddv_s32
35*0a6a1f1dSLionel Sambuc   return vaddv_s32(a1);
36*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.saddv.i32.v2i32
37*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: ret
38*0a6a1f1dSLionel Sambuc }
39*0a6a1f1dSLionel Sambuc 
test_vaddv_u8(int8x8_t a1)40*0a6a1f1dSLionel Sambuc uint8_t test_vaddv_u8(int8x8_t a1) {
41*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddv_u8
42*0a6a1f1dSLionel Sambuc   return vaddv_u8(a1);
43*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.uaddv.i32.v8i8
44*0a6a1f1dSLionel Sambuc   // don't check for return here (there's a trunc?)
45*0a6a1f1dSLionel Sambuc }
46*0a6a1f1dSLionel Sambuc 
test_vaddv_u16(int16x4_t a1)47*0a6a1f1dSLionel Sambuc uint16_t test_vaddv_u16(int16x4_t a1) {
48*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddv_u16
49*0a6a1f1dSLionel Sambuc   return vaddv_u16(a1);
50*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.uaddv.i32.v4i16
51*0a6a1f1dSLionel Sambuc   // don't check for return here (there's a trunc?)
52*0a6a1f1dSLionel Sambuc }
53*0a6a1f1dSLionel Sambuc 
test_vaddv_u32(int32x2_t a1)54*0a6a1f1dSLionel Sambuc uint32_t test_vaddv_u32(int32x2_t a1) {
55*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddv_u32
56*0a6a1f1dSLionel Sambuc   return vaddv_u32(a1);
57*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.uaddv.i32.v2i32
58*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: ret
59*0a6a1f1dSLionel Sambuc }
60*0a6a1f1dSLionel Sambuc 
test_vaddvq_s8(int8x16_t a1)61*0a6a1f1dSLionel Sambuc int8_t test_vaddvq_s8(int8x16_t a1) {
62*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddvq_s8
63*0a6a1f1dSLionel Sambuc   return vaddvq_s8(a1);
64*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.saddv.i32.v16i8
65*0a6a1f1dSLionel Sambuc   // don't check for return here (there's a trunc?)
66*0a6a1f1dSLionel Sambuc }
67*0a6a1f1dSLionel Sambuc 
test_vaddvq_s16(int16x8_t a1)68*0a6a1f1dSLionel Sambuc int16_t test_vaddvq_s16(int16x8_t a1) {
69*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddvq_s16
70*0a6a1f1dSLionel Sambuc   return vaddvq_s16(a1);
71*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.saddv.i32.v8i16
72*0a6a1f1dSLionel Sambuc   // don't check for return here (there's a trunc?)
73*0a6a1f1dSLionel Sambuc }
74*0a6a1f1dSLionel Sambuc 
test_vaddvq_s32(int32x4_t a1)75*0a6a1f1dSLionel Sambuc int32_t test_vaddvq_s32(int32x4_t a1) {
76*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddvq_s32
77*0a6a1f1dSLionel Sambuc   return vaddvq_s32(a1);
78*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.saddv.i32.v4i32
79*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: ret
80*0a6a1f1dSLionel Sambuc }
81*0a6a1f1dSLionel Sambuc 
test_vaddvq_u8(int8x16_t a1)82*0a6a1f1dSLionel Sambuc uint8_t test_vaddvq_u8(int8x16_t a1) {
83*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddvq_u8
84*0a6a1f1dSLionel Sambuc   return vaddvq_u8(a1);
85*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.uaddv.i32.v16i8
86*0a6a1f1dSLionel Sambuc   // don't check for return here (there's a trunc?)
87*0a6a1f1dSLionel Sambuc }
88*0a6a1f1dSLionel Sambuc 
test_vaddvq_u16(int16x8_t a1)89*0a6a1f1dSLionel Sambuc uint16_t test_vaddvq_u16(int16x8_t a1) {
90*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddvq_u16
91*0a6a1f1dSLionel Sambuc   return vaddvq_u16(a1);
92*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.uaddv.i32.v8i16
93*0a6a1f1dSLionel Sambuc   // don't check for return here (there's a trunc?)
94*0a6a1f1dSLionel Sambuc }
95*0a6a1f1dSLionel Sambuc 
test_vaddvq_u32(int32x4_t a1)96*0a6a1f1dSLionel Sambuc uint32_t test_vaddvq_u32(int32x4_t a1) {
97*0a6a1f1dSLionel Sambuc   // CHECK: test_vaddvq_u32
98*0a6a1f1dSLionel Sambuc   return vaddvq_u32(a1);
99*0a6a1f1dSLionel Sambuc   // CHECK: llvm.aarch64.neon.uaddv.i32.v4i32
100*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: ret
101*0a6a1f1dSLionel Sambuc }
102*0a6a1f1dSLionel Sambuc 
103