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