1// RUN: %clang_cc1 -O3 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -emit-llvm -o - %s | FileCheck %s
2// RUN: %clang_cc1 -O3 -triple arm64_be-linux-gnu -target-feature +neon -ffreestanding -emit-llvm -o - %s | FileCheck %s --check-prefix CHECK-BE
3
4#include <arm_neon.h>
5
6// CHECK-LABEL: @test_vdupb_lane_s8
7int8_t test_vdupb_lane_s8(int8x8_t src) {
8  return vdupb_lane_s8(src, 2);
9  // CHECK: extractelement <8 x i8> %src, i32 2
10  // CHECK-BE: extractelement <8 x i8> %src, i32 5
11}
12
13// CHECK-LABEL: @test_vdupb_lane_u8
14uint8_t test_vdupb_lane_u8(uint8x8_t src) {
15  return vdupb_lane_u8(src, 2);
16  // CHECK: extractelement <8 x i8> %src, i32 2
17  // CHECK-BE: extractelement <8 x i8> %src, i32 5
18}
19
20// CHECK-LABEL: @test_vduph_lane_s16
21int16_t test_vduph_lane_s16(int16x4_t src) {
22  return vduph_lane_s16(src, 2);
23  // CHECK: extractelement <4 x i16> %src, i32 2
24  // CHECK-BE: extractelement <4 x i16> %src, i32 1
25}
26
27// CHECK-LABEL: @test_vduph_lane_u16
28uint16_t test_vduph_lane_u16(uint16x4_t src) {
29  return vduph_lane_u16(src, 2);
30  // CHECK: extractelement <4 x i16> %src, i32 2
31  // CHECK-BE: extractelement <4 x i16> %src, i32 1
32}
33
34// CHECK-LABEL: @test_vdups_lane_s32
35int32_t test_vdups_lane_s32(int32x2_t src) {
36  return vdups_lane_s32(src, 0);
37  // CHECK: extractelement <2 x i32> %src, i32 0
38  // CHECK-BE: extractelement <2 x i32> %src, i32 1
39}
40
41// CHECK-LABEL: @test_vdups_lane_u32
42uint32_t test_vdups_lane_u32(uint32x2_t src) {
43  return vdups_lane_u32(src, 0);
44  // CHECK: extractelement <2 x i32> %src, i32 0
45  // CHECK-BE: extractelement <2 x i32> %src, i32 1
46}
47
48// CHECK-LABEL: @test_vdups_lane_f32
49float32_t test_vdups_lane_f32(float32x2_t src) {
50  return vdups_lane_f32(src, 0);
51  // CHECK: extractelement <2 x float> %src, i32 0
52  // CHECK-BE: extractelement <2 x float> %src, i32 1
53}
54
55// CHECK-LABEL: @test_vdupd_lane_s64
56int64_t test_vdupd_lane_s64(int64x1_t src) {
57  return vdupd_lane_s64(src, 0);
58  // CHECK: extractelement <1 x i64> %src, i32 0
59  // CHECK-BE: extractelement <1 x i64> %src, i32 0
60}
61
62// CHECK-LABEL: @test_vdupd_lane_u64
63uint64_t test_vdupd_lane_u64(uint64x1_t src) {
64  return vdupd_lane_u64(src, 0);
65  // CHECK: extractelement <1 x i64> %src, i32 0
66  // CHECK-BE: extractelement <1 x i64> %src, i32 0
67}
68
69// CHECK-LABEL: @test_vdupd_lane_f64
70float64_t test_vdupd_lane_f64(float64x1_t src) {
71  return vdupd_lane_f64(src, 0);
72  // CHECK: extractelement <1 x double> %src, i32 0
73  // CHECK-BE: extractelement <1 x double> %src, i32 0
74}
75