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 | |
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> {{.*}}, <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 | |
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> {{.*}}, <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 | |
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: [[TMP1:%.*]] = bitcast <4 x i16> %src to [[TYPE:.*]] |
30 | // CHECK: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <4 x i16> |
31 | // CHECK: extractelement <4 x i16> [[TMP2]], i32 2 |
32 | |
33 | // CHECK-BE-LABEL: @test_vduph_lane_s16 |
34 | // CHECK-BE: [[REV:%.*]] = shufflevector <4 x i16> {{.*}}, <4 x i32> <i32 3, i32 2, i32 1, i32 0> |
35 | // CHECK-BE: [[TMP1:%.*]] = bitcast <4 x i16> [[REV]] to [[TYPE:.*]] |
36 | // CHECK-BE: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <4 x i16> |
37 | // CHECK-BE: extractelement <4 x i16> [[TMP2]], i32 2 |
38 | } |
39 | |
40 | uint16_t test_vduph_lane_u16(uint16x4_t src) { |
41 | return vduph_lane_u16(src, 2); |
42 | // CHECK-LABEL: @test_vduph_lane_u16 |
43 | // CHECK: [[TMP1:%.*]] = bitcast <4 x i16> %src to [[TYPE:.*]] |
44 | // CHECK: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <4 x i16> |
45 | // CHECK: extractelement <4 x i16> [[TMP2]], i32 2 |
46 | |
47 | // CHECK-BE-LABEL: @test_vduph_lane_u16 |
48 | // CHECK-BE: [[REV:%.*]] = shufflevector <4 x i16> {{.*}}, <4 x i32> <i32 3, i32 2, i32 1, i32 0> |
49 | // CHECK-BE: [[TMP1:%.*]] = bitcast <4 x i16> [[REV]] to [[TYPE:.*]] |
50 | // CHECK-BE: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <4 x i16> |
51 | // CHECK-BE: extractelement <4 x i16> [[TMP2]], i32 2 |
52 | } |
53 | |
54 | int32_t test_vdups_lane_s32(int32x2_t src) { |
55 | return vdups_lane_s32(src, 0); |
56 | // CHECK-LABEL: @test_vdups_lane_s32 |
57 | // CHECK: [[TMP1:%.*]] = bitcast <2 x i32> %src to [[TYPE:.*]] |
58 | // CHECK: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <2 x i32> |
59 | // CHECK: extractelement <2 x i32> [[TMP2]], i32 0 |
60 | |
61 | // CHECK-BE-LABEL: @test_vdups_lane_s32 |
62 | // CHECK-BE: [[REV:%.*]] = shufflevector <2 x i32> {{.*}}, <2 x i32> <i32 1, i32 0> |
63 | // CHECK-BE: [[TMP1:%.*]] = bitcast <2 x i32> [[REV]] to [[TYPE:.*]] |
64 | // CHECK-BE: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <2 x i32> |
65 | // CHECK-BE: extractelement <2 x i32> [[TMP2]], i32 0 |
66 | } |
67 | |
68 | uint32_t test_vdups_lane_u32(uint32x2_t src) { |
69 | return vdups_lane_u32(src, 0); |
70 | // CHECK-LABEL: @test_vdups_lane_u32 |
71 | // CHECK: [[TMP1:%.*]] = bitcast <2 x i32> %src to [[TYPE:.*]] |
72 | // CHECK: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <2 x i32> |
73 | // CHECK: extractelement <2 x i32> [[TMP2]], i32 0 |
74 | |
75 | // CHECK-BE-LABEL: @test_vdups_lane_u32 |
76 | // CHECK-BE: [[REV:%.*]] = shufflevector <2 x i32> {{.*}}, <2 x i32> <i32 1, i32 0> |
77 | // CHECK-BE: [[TMP1:%.*]] = bitcast <2 x i32> [[REV]] to [[TYPE:.*]] |
78 | // CHECK-BE: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <2 x i32> |
79 | // CHECK-BE: extractelement <2 x i32> [[TMP2]], i32 0 |
80 | } |
81 | |
82 | float32_t test_vdups_lane_f32(float32x2_t src) { |
83 | return vdups_lane_f32(src, 0); |
84 | // CHECK-LABEL: @test_vdups_lane_f32 |
85 | // CHECK: [[TMP1:%.*]] = bitcast <2 x float> %src to [[TYPE:.*]] |
86 | // CHECK: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <2 x float> |
87 | // CHECK: extractelement <2 x float> [[TMP2]], i32 0 |
88 | |
89 | // CHECK-BE-LABEL: @test_vdups_lane_f32 |
90 | // CHECK-BE: [[REV:%.*]] = shufflevector <2 x float> {{.*}}, <2 x i32> <i32 1, i32 0> |
91 | // CHECK-BE: [[TMP1:%.*]] = bitcast <2 x float> [[REV]] to [[TYPE:.*]] |
92 | // CHECK-BE: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <2 x float> |
93 | // CHECK-BE: extractelement <2 x float> [[TMP2]], i32 0 |
94 | } |
95 | |
96 | int64_t test_vdupd_lane_s64(int64x1_t src) { |
97 | return vdupd_lane_s64(src, 0); |
98 | // CHECK-LABEL: @test_vdupd_lane_s64 |
99 | // CHECK: [[TMP1:%.*]] = bitcast <1 x i64> %src to [[TYPE:.*]] |
100 | // CHECK: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <1 x i64> |
101 | // CHECK: extractelement <1 x i64> [[TMP2]], i32 0 |
102 | |
103 | // CHECK-BE-LABEL: @test_vdupd_lane_s64 |
104 | // CHECK-BE: extractelement <1 x i64> {{.*}}, i32 0 |
105 | } |
106 | |
107 | uint64_t test_vdupd_lane_u64(uint64x1_t src) { |
108 | return vdupd_lane_u64(src, 0); |
109 | // CHECK-LABEL: @test_vdupd_lane_u64 |
110 | // CHECK: [[TMP1:%.*]] = bitcast <1 x i64> %src to [[TYPE:.*]] |
111 | // CHECK: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <1 x i64> |
112 | // CHECK: extractelement <1 x i64> [[TMP2]], i32 0 |
113 | |
114 | // CHECK-BE-LABEL: @test_vdupd_lane_u64 |
115 | // CHECK-BE: extractelement <1 x i64> {{.*}}, i32 0 |
116 | } |
117 | |
118 | float64_t test_vdupd_lane_f64(float64x1_t src) { |
119 | return vdupd_lane_f64(src, 0); |
120 | // CHECK-LABEL: @test_vdupd_lane_f64 |
121 | // CHECK: [[TMP1:%.*]] = bitcast <1 x double> %src to [[TYPE:.*]] |
122 | // CHECK: [[TMP2:%.*]] = bitcast [[TYPE]] [[TMP1]] to <1 x double> |
123 | // CHECK: extractelement <1 x double> [[TMP2]], i32 0 |
124 | |
125 | // CHECK-BE-LABEL: @test_vdupd_lane_f64 |
126 | // CHECK-BE: extractelement <1 x double> {{.*}}, i32 0 |
127 | } |
128 | |