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