Clang Project

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