1 // RUN: %clang_cc1 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -disable-O0-optnone -emit-llvm -o - %s | opt -S -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 -mem2reg | FileCheck %s --check-prefix CHECK-BE
3 
4 #include <arm_neon.h>
5 
test_vdupb_lane_s8(int8x8_t src)6 int8_t test_vdupb_lane_s8(int8x8_t src) {
7   return vdupb_lane_s8(src, 2);
8   // CHECK-LABEL: @test_vdupb_lane_s8
9   // CHECK: extractelement <8 x i8> %src, i32 2
10 
11   // CHECK-BE-LABEL: @test_vdupb_lane_s8
12   // 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>
13   // CHECK-BE: extractelement <8 x i8> [[REV]], i32 2
14 }
15 
test_vdupb_lane_u8(uint8x8_t src)16 uint8_t test_vdupb_lane_u8(uint8x8_t src) {
17   return vdupb_lane_u8(src, 2);
18   // CHECK-LABEL: @test_vdupb_lane_u8
19   // CHECK: extractelement <8 x i8> %src, i32 2
20 
21   // CHECK-BE-LABEL: @test_vdupb_lane_u8
22   // 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>
23   // CHECK-BE: extractelement <8 x i8> [[REV]], i32 2
24 }
25 
test_vduph_lane_s16(int16x4_t src)26 int16_t test_vduph_lane_s16(int16x4_t src) {
27   return vduph_lane_s16(src, 2);
28   // CHECK-LABEL: @test_vduph_lane_s16
29   // CHECK: extractelement <4 x i16> %src, i32 2
30 
31   // CHECK-BE-LABEL: @test_vduph_lane_s16
32   // CHECK-BE: [[REV:%.*]] = shufflevector <4 x i16> %src, <4 x i16> %src, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
33   // CHECK-BE: extractelement <4 x i16> [[REV]], i32 2
34 }
35 
test_vduph_lane_u16(uint16x4_t src)36 uint16_t test_vduph_lane_u16(uint16x4_t src) {
37   return vduph_lane_u16(src, 2);
38   // CHECK-LABEL: @test_vduph_lane_u16
39   // CHECK: extractelement <4 x i16> %src, i32 2
40 
41   // CHECK-BE-LABEL: @test_vduph_lane_u16
42   // CHECK-BE: [[REV:%.*]] = shufflevector <4 x i16> %src, <4 x i16> %src, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
43   // CHECK-BE: extractelement <4 x i16> [[REV]], i32 2
44 }
45 
test_vdups_lane_s32(int32x2_t src)46 int32_t test_vdups_lane_s32(int32x2_t src) {
47   return vdups_lane_s32(src, 0);
48   // CHECK-LABEL: @test_vdups_lane_s32
49   // CHECK: extractelement <2 x i32> %src, i32 0
50 
51   // CHECK-BE-LABEL: @test_vdups_lane_s32
52   // CHECK-BE: [[REV:%.*]] = shufflevector <2 x i32> %src, <2 x i32> %src, <2 x i32> <i32 1, i32 0>
53   // CHECK-BE: extractelement <2 x i32> [[REV]], i32 0
54 }
55 
test_vdups_lane_u32(uint32x2_t src)56 uint32_t test_vdups_lane_u32(uint32x2_t src) {
57   return vdups_lane_u32(src, 0);
58   // CHECK-LABEL: @test_vdups_lane_u32
59   // CHECK: extractelement <2 x i32> %src, i32 0
60 
61   // CHECK-BE-LABEL: @test_vdups_lane_u32
62   // CHECK-BE: [[REV:%.*]] = shufflevector <2 x i32> %src, <2 x i32> %src, <2 x i32> <i32 1, i32 0>
63   // CHECK-BE: extractelement <2 x i32> [[REV]], i32 0
64 }
65 
test_vdups_lane_f32(float32x2_t src)66 float32_t test_vdups_lane_f32(float32x2_t src) {
67   return vdups_lane_f32(src, 0);
68   // CHECK-LABEL: @test_vdups_lane_f32
69   // CHECK: extractelement <2 x float> %src, i32 0
70 
71   // CHECK-BE-LABEL: @test_vdups_lane_f32
72   // CHECK-BE: [[REV:%.*]] = shufflevector <2 x float> %src, <2 x float> %src, <2 x i32> <i32 1, i32 0>
73   // CHECK-BE: extractelement <2 x float> [[REV]], i32 0
74 }
75 
test_vdupd_lane_s64(int64x1_t src)76 int64_t test_vdupd_lane_s64(int64x1_t src) {
77   return vdupd_lane_s64(src, 0);
78   // CHECK-LABEL: @test_vdupd_lane_s64
79   // CHECK: extractelement <1 x i64> %src, i32 0
80 
81   // CHECK-BE-LABEL: @test_vdupd_lane_s64
82   // CHECK-BE: extractelement <1 x i64> %src, i32 0
83 }
84 
test_vdupd_lane_u64(uint64x1_t src)85 uint64_t test_vdupd_lane_u64(uint64x1_t src) {
86   return vdupd_lane_u64(src, 0);
87   // CHECK-LABEL: @test_vdupd_lane_u64
88   // CHECK: extractelement <1 x i64> %src, i32 0
89 
90   // CHECK-BE-LABEL: @test_vdupd_lane_u64
91   // CHECK-BE: extractelement <1 x i64> %src, i32 0
92 }
93 
test_vdupd_lane_f64(float64x1_t src)94 float64_t test_vdupd_lane_f64(float64x1_t src) {
95   return vdupd_lane_f64(src, 0);
96   // CHECK-LABEL: @test_vdupd_lane_f64
97   // CHECK: extractelement <1 x double> %src, i32 0
98 
99   // CHECK-BE-LABEL: @test_vdupd_lane_f64
100   // CHECK-BE: extractelement <1 x double> %src, i32 0
101 }
102