1 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \ 2 // RUN: -fallow-half-arguments-and-returns -emit-llvm -o - %s \ 3 // RUN: | opt -S -mem2reg | FileCheck %s 4 // Test new aarch64 intrinsics and types 5 6 #include <arm_neon.h> 7 8 // CHECK-LABEL: define <8 x i8> @test_vget_high_s8(<16 x i8> %a) #0 { 9 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <16 x i8> %a, <16 x i8> %a, <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15> 10 // CHECK: ret <8 x i8> [[SHUFFLE_I]] 11 int8x8_t test_vget_high_s8(int8x16_t a) { 12 return vget_high_s8(a); 13 } 14 15 // CHECK-LABEL: define <4 x i16> @test_vget_high_s16(<8 x i16> %a) #0 { 16 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x i16> %a, <8 x i16> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 7> 17 // CHECK: ret <4 x i16> [[SHUFFLE_I]] 18 int16x4_t test_vget_high_s16(int16x8_t a) { 19 return vget_high_s16(a); 20 } 21 22 // CHECK-LABEL: define <2 x i32> @test_vget_high_s32(<4 x i32> %a) #0 { 23 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <4 x i32> %a, <4 x i32> %a, <2 x i32> <i32 2, i32 3> 24 // CHECK: ret <2 x i32> [[SHUFFLE_I]] 25 int32x2_t test_vget_high_s32(int32x4_t a) { 26 return vget_high_s32(a); 27 } 28 29 // CHECK-LABEL: define <1 x i64> @test_vget_high_s64(<2 x i64> %a) #0 { 30 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x i64> %a, <2 x i64> %a, <1 x i32> <i32 1> 31 // CHECK: ret <1 x i64> [[SHUFFLE_I]] 32 int64x1_t test_vget_high_s64(int64x2_t a) { 33 return vget_high_s64(a); 34 } 35 36 // CHECK-LABEL: define <8 x i8> @test_vget_high_u8(<16 x i8> %a) #0 { 37 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <16 x i8> %a, <16 x i8> %a, <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15> 38 // CHECK: ret <8 x i8> [[SHUFFLE_I]] 39 uint8x8_t test_vget_high_u8(uint8x16_t a) { 40 return vget_high_u8(a); 41 } 42 43 // CHECK-LABEL: define <4 x i16> @test_vget_high_u16(<8 x i16> %a) #0 { 44 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x i16> %a, <8 x i16> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 7> 45 // CHECK: ret <4 x i16> [[SHUFFLE_I]] 46 uint16x4_t test_vget_high_u16(uint16x8_t a) { 47 return vget_high_u16(a); 48 } 49 50 // CHECK-LABEL: define <2 x i32> @test_vget_high_u32(<4 x i32> %a) #0 { 51 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <4 x i32> %a, <4 x i32> %a, <2 x i32> <i32 2, i32 3> 52 // CHECK: ret <2 x i32> [[SHUFFLE_I]] 53 uint32x2_t test_vget_high_u32(uint32x4_t a) { 54 return vget_high_u32(a); 55 } 56 57 // CHECK-LABEL: define <1 x i64> @test_vget_high_u64(<2 x i64> %a) #0 { 58 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x i64> %a, <2 x i64> %a, <1 x i32> <i32 1> 59 // CHECK: ret <1 x i64> [[SHUFFLE_I]] 60 uint64x1_t test_vget_high_u64(uint64x2_t a) { 61 return vget_high_u64(a); 62 } 63 64 // CHECK-LABEL: define <1 x i64> @test_vget_high_p64(<2 x i64> %a) #0 { 65 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x i64> %a, <2 x i64> %a, <1 x i32> <i32 1> 66 // CHECK: ret <1 x i64> [[SHUFFLE_I]] 67 poly64x1_t test_vget_high_p64(poly64x2_t a) { 68 return vget_high_p64(a); 69 } 70 71 // CHECK-LABEL: define <4 x half> @test_vget_high_f16(<8 x half> %a) #0 { 72 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x half> %a, <8 x half> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 7> 73 // CHECK: ret <4 x half> [[SHUFFLE_I]] 74 float16x4_t test_vget_high_f16(float16x8_t a) { 75 return vget_high_f16(a); 76 } 77 78 // CHECK-LABEL: define <2 x float> @test_vget_high_f32(<4 x float> %a) #0 { 79 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <4 x float> %a, <4 x float> %a, <2 x i32> <i32 2, i32 3> 80 // CHECK: ret <2 x float> [[SHUFFLE_I]] 81 float32x2_t test_vget_high_f32(float32x4_t a) { 82 return vget_high_f32(a); 83 } 84 85 // CHECK-LABEL: define <8 x i8> @test_vget_high_p8(<16 x i8> %a) #0 { 86 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <16 x i8> %a, <16 x i8> %a, <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15> 87 // CHECK: ret <8 x i8> [[SHUFFLE_I]] 88 poly8x8_t test_vget_high_p8(poly8x16_t a) { 89 return vget_high_p8(a); 90 } 91 92 // CHECK-LABEL: define <4 x i16> @test_vget_high_p16(<8 x i16> %a) #0 { 93 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x i16> %a, <8 x i16> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 7> 94 // CHECK: ret <4 x i16> [[SHUFFLE_I]] 95 poly16x4_t test_vget_high_p16(poly16x8_t a) { 96 return vget_high_p16(a); 97 } 98 99 // CHECK-LABEL: define <1 x double> @test_vget_high_f64(<2 x double> %a) #0 { 100 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x double> %a, <2 x double> %a, <1 x i32> <i32 1> 101 // CHECK: ret <1 x double> [[SHUFFLE_I]] 102 float64x1_t test_vget_high_f64(float64x2_t a) { 103 return vget_high_f64(a); 104 } 105 106 // CHECK-LABEL: define <8 x i8> @test_vget_low_s8(<16 x i8> %a) #0 { 107 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <16 x i8> %a, <16 x i8> %a, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> 108 // CHECK: ret <8 x i8> [[SHUFFLE_I]] 109 int8x8_t test_vget_low_s8(int8x16_t a) { 110 return vget_low_s8(a); 111 } 112 113 // CHECK-LABEL: define <4 x i16> @test_vget_low_s16(<8 x i16> %a) #0 { 114 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x i16> %a, <8 x i16> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 3> 115 // CHECK: ret <4 x i16> [[SHUFFLE_I]] 116 int16x4_t test_vget_low_s16(int16x8_t a) { 117 return vget_low_s16(a); 118 } 119 120 // CHECK-LABEL: define <2 x i32> @test_vget_low_s32(<4 x i32> %a) #0 { 121 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <4 x i32> %a, <4 x i32> %a, <2 x i32> <i32 0, i32 1> 122 // CHECK: ret <2 x i32> [[SHUFFLE_I]] 123 int32x2_t test_vget_low_s32(int32x4_t a) { 124 return vget_low_s32(a); 125 } 126 127 // CHECK-LABEL: define <1 x i64> @test_vget_low_s64(<2 x i64> %a) #0 { 128 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x i64> %a, <2 x i64> %a, <1 x i32> zeroinitializer 129 // CHECK: ret <1 x i64> [[SHUFFLE_I]] 130 int64x1_t test_vget_low_s64(int64x2_t a) { 131 return vget_low_s64(a); 132 } 133 134 // CHECK-LABEL: define <8 x i8> @test_vget_low_u8(<16 x i8> %a) #0 { 135 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <16 x i8> %a, <16 x i8> %a, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> 136 // CHECK: ret <8 x i8> [[SHUFFLE_I]] 137 uint8x8_t test_vget_low_u8(uint8x16_t a) { 138 return vget_low_u8(a); 139 } 140 141 // CHECK-LABEL: define <4 x i16> @test_vget_low_u16(<8 x i16> %a) #0 { 142 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x i16> %a, <8 x i16> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 3> 143 // CHECK: ret <4 x i16> [[SHUFFLE_I]] 144 uint16x4_t test_vget_low_u16(uint16x8_t a) { 145 return vget_low_u16(a); 146 } 147 148 // CHECK-LABEL: define <2 x i32> @test_vget_low_u32(<4 x i32> %a) #0 { 149 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <4 x i32> %a, <4 x i32> %a, <2 x i32> <i32 0, i32 1> 150 // CHECK: ret <2 x i32> [[SHUFFLE_I]] 151 uint32x2_t test_vget_low_u32(uint32x4_t a) { 152 return vget_low_u32(a); 153 } 154 155 // CHECK-LABEL: define <1 x i64> @test_vget_low_u64(<2 x i64> %a) #0 { 156 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x i64> %a, <2 x i64> %a, <1 x i32> zeroinitializer 157 // CHECK: ret <1 x i64> [[SHUFFLE_I]] 158 uint64x1_t test_vget_low_u64(uint64x2_t a) { 159 return vget_low_u64(a); 160 } 161 162 // CHECK-LABEL: define <1 x i64> @test_vget_low_p64(<2 x i64> %a) #0 { 163 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x i64> %a, <2 x i64> %a, <1 x i32> zeroinitializer 164 // CHECK: ret <1 x i64> [[SHUFFLE_I]] 165 poly64x1_t test_vget_low_p64(poly64x2_t a) { 166 return vget_low_p64(a); 167 } 168 169 // CHECK-LABEL: define <4 x half> @test_vget_low_f16(<8 x half> %a) #0 { 170 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x half> %a, <8 x half> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 3> 171 // CHECK: ret <4 x half> [[SHUFFLE_I]] 172 float16x4_t test_vget_low_f16(float16x8_t a) { 173 return vget_low_f16(a); 174 } 175 176 // CHECK-LABEL: define <2 x float> @test_vget_low_f32(<4 x float> %a) #0 { 177 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <4 x float> %a, <4 x float> %a, <2 x i32> <i32 0, i32 1> 178 // CHECK: ret <2 x float> [[SHUFFLE_I]] 179 float32x2_t test_vget_low_f32(float32x4_t a) { 180 return vget_low_f32(a); 181 } 182 183 // CHECK-LABEL: define <8 x i8> @test_vget_low_p8(<16 x i8> %a) #0 { 184 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <16 x i8> %a, <16 x i8> %a, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> 185 // CHECK: ret <8 x i8> [[SHUFFLE_I]] 186 poly8x8_t test_vget_low_p8(poly8x16_t a) { 187 return vget_low_p8(a); 188 } 189 190 // CHECK-LABEL: define <4 x i16> @test_vget_low_p16(<8 x i16> %a) #0 { 191 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <8 x i16> %a, <8 x i16> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 3> 192 // CHECK: ret <4 x i16> [[SHUFFLE_I]] 193 poly16x4_t test_vget_low_p16(poly16x8_t a) { 194 return vget_low_p16(a); 195 } 196 197 // CHECK-LABEL: define <1 x double> @test_vget_low_f64(<2 x double> %a) #0 { 198 // CHECK: [[SHUFFLE_I:%.*]] = shufflevector <2 x double> %a, <2 x double> %a, <1 x i32> zeroinitializer 199 // CHECK: ret <1 x double> [[SHUFFLE_I]] 200 float64x1_t test_vget_low_f64(float64x2_t a) { 201 return vget_low_f64(a); 202 } 203 204