[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / arm64-lanes.c
blobf9470572e9311cdd96e9cacb67daf198f9e28c45
1 // RUN: %clang_cc1 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s
2 // RUN: %clang_cc1 -triple aarch64_be-linux-gnu -target-feature +neon -ffreestanding -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s --check-prefix CHECK-BE
4 // REQUIRES: aarch64-registered-target || arm-registered-target
6 #include <arm_neon.h>
8 int8_t test_vdupb_lane_s8(int8x8_t src) {
9 return vdupb_lane_s8(src, 2);
10 // CHECK-LABEL: @test_vdupb_lane_s8
11 // CHECK: extractelement <8 x i8> %src, i32 2
13 // CHECK-BE-LABEL: @test_vdupb_lane_s8
14 // CHECK-BE: [[REV:%.*]] = shufflevector <8 x i8> %src, <8 x i8> %src, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
15 // CHECK-BE: extractelement <8 x i8> [[REV]], i32 2
18 uint8_t test_vdupb_lane_u8(uint8x8_t src) {
19 return vdupb_lane_u8(src, 2);
20 // CHECK-LABEL: @test_vdupb_lane_u8
21 // CHECK: extractelement <8 x i8> %src, i32 2
23 // CHECK-BE-LABEL: @test_vdupb_lane_u8
24 // CHECK-BE: [[REV:%.*]] = shufflevector <8 x i8> %src, <8 x i8> %src, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
25 // CHECK-BE: extractelement <8 x i8> [[REV]], i32 2
28 int16_t test_vduph_lane_s16(int16x4_t src) {
29 return vduph_lane_s16(src, 2);
30 // CHECK-LABEL: @test_vduph_lane_s16
31 // CHECK: extractelement <4 x i16> %src, i32 2
33 // CHECK-BE-LABEL: @test_vduph_lane_s16
34 // CHECK-BE: [[REV:%.*]] = shufflevector <4 x i16> %src, <4 x i16> %src, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
35 // CHECK-BE: extractelement <4 x i16> [[REV]], i32 2
38 uint16_t test_vduph_lane_u16(uint16x4_t src) {
39 return vduph_lane_u16(src, 2);
40 // CHECK-LABEL: @test_vduph_lane_u16
41 // CHECK: extractelement <4 x i16> %src, i32 2
43 // CHECK-BE-LABEL: @test_vduph_lane_u16
44 // CHECK-BE: [[REV:%.*]] = shufflevector <4 x i16> %src, <4 x i16> %src, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
45 // CHECK-BE: extractelement <4 x i16> [[REV]], i32 2
48 int32_t test_vdups_lane_s32(int32x2_t src) {
49 return vdups_lane_s32(src, 0);
50 // CHECK-LABEL: @test_vdups_lane_s32
51 // CHECK: extractelement <2 x i32> %src, i32 0
53 // CHECK-BE-LABEL: @test_vdups_lane_s32
54 // CHECK-BE: [[REV:%.*]] = shufflevector <2 x i32> %src, <2 x i32> %src, <2 x i32> <i32 1, i32 0>
55 // CHECK-BE: extractelement <2 x i32> [[REV]], i32 0
58 uint32_t test_vdups_lane_u32(uint32x2_t src) {
59 return vdups_lane_u32(src, 0);
60 // CHECK-LABEL: @test_vdups_lane_u32
61 // CHECK: extractelement <2 x i32> %src, i32 0
63 // CHECK-BE-LABEL: @test_vdups_lane_u32
64 // CHECK-BE: [[REV:%.*]] = shufflevector <2 x i32> %src, <2 x i32> %src, <2 x i32> <i32 1, i32 0>
65 // CHECK-BE: extractelement <2 x i32> [[REV]], i32 0
68 float32_t test_vdups_lane_f32(float32x2_t src) {
69 return vdups_lane_f32(src, 0);
70 // CHECK-LABEL: @test_vdups_lane_f32
71 // CHECK: extractelement <2 x float> %src, i32 0
73 // CHECK-BE-LABEL: @test_vdups_lane_f32
74 // CHECK-BE: [[REV:%.*]] = shufflevector <2 x float> %src, <2 x float> %src, <2 x i32> <i32 1, i32 0>
75 // CHECK-BE: extractelement <2 x float> [[REV]], i32 0
78 int64_t test_vdupd_lane_s64(int64x1_t src) {
79 return vdupd_lane_s64(src, 0);
80 // CHECK-LABEL: @test_vdupd_lane_s64
81 // CHECK: extractelement <1 x i64> %src, i32 0
83 // CHECK-BE-LABEL: @test_vdupd_lane_s64
84 // CHECK-BE: extractelement <1 x i64> %src, i32 0
87 uint64_t test_vdupd_lane_u64(uint64x1_t src) {
88 return vdupd_lane_u64(src, 0);
89 // CHECK-LABEL: @test_vdupd_lane_u64
90 // CHECK: extractelement <1 x i64> %src, i32 0
92 // CHECK-BE-LABEL: @test_vdupd_lane_u64
93 // CHECK-BE: extractelement <1 x i64> %src, i32 0
96 float64_t test_vdupd_lane_f64(float64x1_t src) {
97 return vdupd_lane_f64(src, 0);
98 // CHECK-LABEL: @test_vdupd_lane_f64
99 // CHECK: extractelement <1 x double> %src, i32 0
101 // CHECK-BE-LABEL: @test_vdupd_lane_f64
102 // CHECK-BE: extractelement <1 x double> %src, i32 0