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
3
4 // REQUIRES: aarch64-registered-target || arm-registered-target
5
6 #include <arm_neon.h>
7
test_vdupb_lane_s8(int8x8_t src)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
12
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
16 }
17
test_vdupb_lane_u8(uint8x8_t src)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
22
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
26 }
27
test_vduph_lane_s16(int16x4_t src)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
32
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
36 }
37
test_vduph_lane_u16(uint16x4_t src)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
42
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
46 }
47
test_vdups_lane_s32(int32x2_t src)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
52
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
56 }
57
test_vdups_lane_u32(uint32x2_t src)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
62
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
66 }
67
test_vdups_lane_f32(float32x2_t src)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
72
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
76 }
77
test_vdupd_lane_s64(int64x1_t src)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
82
83 // CHECK-BE-LABEL: @test_vdupd_lane_s64
84 // CHECK-BE: extractelement <1 x i64> %src, i32 0
85 }
86
test_vdupd_lane_u64(uint64x1_t src)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
91
92 // CHECK-BE-LABEL: @test_vdupd_lane_u64
93 // CHECK-BE: extractelement <1 x i64> %src, i32 0
94 }
95
test_vdupd_lane_f64(float64x1_t src)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
100
101 // CHECK-BE-LABEL: @test_vdupd_lane_f64
102 // CHECK-BE: extractelement <1 x double> %src, i32 0
103 }
104