1*67e74705SXin Li // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -fallow-half-arguments-and-returns -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
2*67e74705SXin Li
3*67e74705SXin Li // Test new aarch64 intrinsics and types
4*67e74705SXin Li
5*67e74705SXin Li #include <arm_neon.h>
6*67e74705SXin Li
7*67e74705SXin Li // CHECK-LABEL: define <16 x i8> @test_vcombine_s8(<8 x i8> %low, <8 x i8> %high) #0 {
8*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x i8> %low, <8 x i8> %high, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
9*67e74705SXin Li // CHECK: ret <16 x i8> [[SHUFFLE_I]]
test_vcombine_s8(int8x8_t low,int8x8_t high)10*67e74705SXin Li int8x16_t test_vcombine_s8(int8x8_t low, int8x8_t high) {
11*67e74705SXin Li return vcombine_s8(low, high);
12*67e74705SXin Li }
13*67e74705SXin Li
14*67e74705SXin Li // CHECK-LABEL: define <8 x i16> @test_vcombine_s16(<4 x i16> %low, <4 x i16> %high) #0 {
15*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <4 x i16> %low, <4 x i16> %high, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
16*67e74705SXin Li // CHECK: ret <8 x i16> [[SHUFFLE_I]]
test_vcombine_s16(int16x4_t low,int16x4_t high)17*67e74705SXin Li int16x8_t test_vcombine_s16(int16x4_t low, int16x4_t high) {
18*67e74705SXin Li return vcombine_s16(low, high);
19*67e74705SXin Li }
20*67e74705SXin Li
21*67e74705SXin Li // CHECK-LABEL: define <4 x i32> @test_vcombine_s32(<2 x i32> %low, <2 x i32> %high) #0 {
22*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x i32> %low, <2 x i32> %high, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
23*67e74705SXin Li // CHECK: ret <4 x i32> [[SHUFFLE_I]]
test_vcombine_s32(int32x2_t low,int32x2_t high)24*67e74705SXin Li int32x4_t test_vcombine_s32(int32x2_t low, int32x2_t high) {
25*67e74705SXin Li return vcombine_s32(low, high);
26*67e74705SXin Li }
27*67e74705SXin Li
28*67e74705SXin Li // CHECK-LABEL: define <2 x i64> @test_vcombine_s64(<1 x i64> %low, <1 x i64> %high) #0 {
29*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <1 x i64> %low, <1 x i64> %high, <2 x i32> <i32 0, i32 1>
30*67e74705SXin Li // CHECK: ret <2 x i64> [[SHUFFLE_I]]
test_vcombine_s64(int64x1_t low,int64x1_t high)31*67e74705SXin Li int64x2_t test_vcombine_s64(int64x1_t low, int64x1_t high) {
32*67e74705SXin Li return vcombine_s64(low, high);
33*67e74705SXin Li }
34*67e74705SXin Li
35*67e74705SXin Li // CHECK-LABEL: define <16 x i8> @test_vcombine_u8(<8 x i8> %low, <8 x i8> %high) #0 {
36*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x i8> %low, <8 x i8> %high, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
37*67e74705SXin Li // CHECK: ret <16 x i8> [[SHUFFLE_I]]
test_vcombine_u8(uint8x8_t low,uint8x8_t high)38*67e74705SXin Li uint8x16_t test_vcombine_u8(uint8x8_t low, uint8x8_t high) {
39*67e74705SXin Li return vcombine_u8(low, high);
40*67e74705SXin Li }
41*67e74705SXin Li
42*67e74705SXin Li // CHECK-LABEL: define <8 x i16> @test_vcombine_u16(<4 x i16> %low, <4 x i16> %high) #0 {
43*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <4 x i16> %low, <4 x i16> %high, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
44*67e74705SXin Li // CHECK: ret <8 x i16> [[SHUFFLE_I]]
test_vcombine_u16(uint16x4_t low,uint16x4_t high)45*67e74705SXin Li uint16x8_t test_vcombine_u16(uint16x4_t low, uint16x4_t high) {
46*67e74705SXin Li return vcombine_u16(low, high);
47*67e74705SXin Li }
48*67e74705SXin Li
49*67e74705SXin Li // CHECK-LABEL: define <4 x i32> @test_vcombine_u32(<2 x i32> %low, <2 x i32> %high) #0 {
50*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x i32> %low, <2 x i32> %high, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
51*67e74705SXin Li // CHECK: ret <4 x i32> [[SHUFFLE_I]]
test_vcombine_u32(uint32x2_t low,uint32x2_t high)52*67e74705SXin Li uint32x4_t test_vcombine_u32(uint32x2_t low, uint32x2_t high) {
53*67e74705SXin Li return vcombine_u32(low, high);
54*67e74705SXin Li }
55*67e74705SXin Li
56*67e74705SXin Li // CHECK-LABEL: define <2 x i64> @test_vcombine_u64(<1 x i64> %low, <1 x i64> %high) #0 {
57*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <1 x i64> %low, <1 x i64> %high, <2 x i32> <i32 0, i32 1>
58*67e74705SXin Li // CHECK: ret <2 x i64> [[SHUFFLE_I]]
test_vcombine_u64(uint64x1_t low,uint64x1_t high)59*67e74705SXin Li uint64x2_t test_vcombine_u64(uint64x1_t low, uint64x1_t high) {
60*67e74705SXin Li return vcombine_u64(low, high);
61*67e74705SXin Li }
62*67e74705SXin Li
63*67e74705SXin Li // CHECK-LABEL: define <2 x i64> @test_vcombine_p64(<1 x i64> %low, <1 x i64> %high) #0 {
64*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <1 x i64> %low, <1 x i64> %high, <2 x i32> <i32 0, i32 1>
65*67e74705SXin Li // CHECK: ret <2 x i64> [[SHUFFLE_I]]
test_vcombine_p64(poly64x1_t low,poly64x1_t high)66*67e74705SXin Li poly64x2_t test_vcombine_p64(poly64x1_t low, poly64x1_t high) {
67*67e74705SXin Li return vcombine_p64(low, high);
68*67e74705SXin Li }
69*67e74705SXin Li
70*67e74705SXin Li // CHECK-LABEL: define <8 x half> @test_vcombine_f16(<4 x half> %low, <4 x half> %high) #0 {
71*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <4 x half> %low, <4 x half> %high, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
72*67e74705SXin Li // CHECK: ret <8 x half> [[SHUFFLE_I]]
test_vcombine_f16(float16x4_t low,float16x4_t high)73*67e74705SXin Li float16x8_t test_vcombine_f16(float16x4_t low, float16x4_t high) {
74*67e74705SXin Li return vcombine_f16(low, high);
75*67e74705SXin Li }
76*67e74705SXin Li
77*67e74705SXin Li // CHECK-LABEL: define <4 x float> @test_vcombine_f32(<2 x float> %low, <2 x float> %high) #0 {
78*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x float> %low, <2 x float> %high, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
79*67e74705SXin Li // CHECK: ret <4 x float> [[SHUFFLE_I]]
test_vcombine_f32(float32x2_t low,float32x2_t high)80*67e74705SXin Li float32x4_t test_vcombine_f32(float32x2_t low, float32x2_t high) {
81*67e74705SXin Li return vcombine_f32(low, high);
82*67e74705SXin Li }
83*67e74705SXin Li
84*67e74705SXin Li // CHECK-LABEL: define <16 x i8> @test_vcombine_p8(<8 x i8> %low, <8 x i8> %high) #0 {
85*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x i8> %low, <8 x i8> %high, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
86*67e74705SXin Li // CHECK: ret <16 x i8> [[SHUFFLE_I]]
test_vcombine_p8(poly8x8_t low,poly8x8_t high)87*67e74705SXin Li poly8x16_t test_vcombine_p8(poly8x8_t low, poly8x8_t high) {
88*67e74705SXin Li return vcombine_p8(low, high);
89*67e74705SXin Li }
90*67e74705SXin Li
91*67e74705SXin Li // CHECK-LABEL: define <8 x i16> @test_vcombine_p16(<4 x i16> %low, <4 x i16> %high) #0 {
92*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <4 x i16> %low, <4 x i16> %high, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
93*67e74705SXin Li // CHECK: ret <8 x i16> [[SHUFFLE_I]]
test_vcombine_p16(poly16x4_t low,poly16x4_t high)94*67e74705SXin Li poly16x8_t test_vcombine_p16(poly16x4_t low, poly16x4_t high) {
95*67e74705SXin Li return vcombine_p16(low, high);
96*67e74705SXin Li }
97*67e74705SXin Li
98*67e74705SXin Li // CHECK-LABEL: define <2 x double> @test_vcombine_f64(<1 x double> %low, <1 x double> %high) #0 {
99*67e74705SXin Li // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <1 x double> %low, <1 x double> %high, <2 x i32> <i32 0, i32 1>
100*67e74705SXin Li // CHECK: ret <2 x double> [[SHUFFLE_I]]
test_vcombine_f64(float64x1_t low,float64x1_t high)101*67e74705SXin Li float64x2_t test_vcombine_f64(float64x1_t low, float64x1_t high) {
102*67e74705SXin Li return vcombine_f64(low, high);
103*67e74705SXin Li }
104