1*207e5cccSFangrui Song // RUN: %clang_cc1 -triple arm64-apple-darwin -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{{.*}} i8 @test_vget_lane_u8(<8 x i8> noundef %a) #0 { 10*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <8 x i8> %a, i32 7 11*207e5cccSFangrui Song // CHECK: ret i8 [[VGET_LANE]] 12*207e5cccSFangrui Song uint8_t test_vget_lane_u8(uint8x8_t a) { 13*207e5cccSFangrui Song return vget_lane_u8(a, 7); 14*207e5cccSFangrui Song } 15*207e5cccSFangrui Song 16*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i16 @test_vget_lane_u16(<4 x i16> noundef %a) #0 { 17*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <4 x i16> %a, i32 3 18*207e5cccSFangrui Song // CHECK: ret i16 [[VGET_LANE]] 19*207e5cccSFangrui Song uint16_t test_vget_lane_u16(uint16x4_t a) { 20*207e5cccSFangrui Song return vget_lane_u16(a, 3); 21*207e5cccSFangrui Song } 22*207e5cccSFangrui Song 23*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i32 @test_vget_lane_u32(<2 x i32> noundef %a) #0 { 24*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <2 x i32> %a, i32 1 25*207e5cccSFangrui Song // CHECK: ret i32 [[VGET_LANE]] 26*207e5cccSFangrui Song uint32_t test_vget_lane_u32(uint32x2_t a) { 27*207e5cccSFangrui Song return vget_lane_u32(a, 1); 28*207e5cccSFangrui Song } 29*207e5cccSFangrui Song 30*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i8 @test_vget_lane_s8(<8 x i8> noundef %a) #0 { 31*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <8 x i8> %a, i32 7 32*207e5cccSFangrui Song // CHECK: ret i8 [[VGET_LANE]] 33*207e5cccSFangrui Song int8_t test_vget_lane_s8(int8x8_t a) { 34*207e5cccSFangrui Song return vget_lane_s8(a, 7); 35*207e5cccSFangrui Song } 36*207e5cccSFangrui Song 37*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i16 @test_vget_lane_s16(<4 x i16> noundef %a) #0 { 38*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <4 x i16> %a, i32 3 39*207e5cccSFangrui Song // CHECK: ret i16 [[VGET_LANE]] 40*207e5cccSFangrui Song int16_t test_vget_lane_s16(int16x4_t a) { 41*207e5cccSFangrui Song return vget_lane_s16(a, 3); 42*207e5cccSFangrui Song } 43*207e5cccSFangrui Song 44*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i32 @test_vget_lane_s32(<2 x i32> noundef %a) #0 { 45*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <2 x i32> %a, i32 1 46*207e5cccSFangrui Song // CHECK: ret i32 [[VGET_LANE]] 47*207e5cccSFangrui Song int32_t test_vget_lane_s32(int32x2_t a) { 48*207e5cccSFangrui Song return vget_lane_s32(a, 1); 49*207e5cccSFangrui Song } 50*207e5cccSFangrui Song 51*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i8 @test_vget_lane_p8(<8 x i8> noundef %a) #0 { 52*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <8 x i8> %a, i32 7 53*207e5cccSFangrui Song // CHECK: ret i8 [[VGET_LANE]] 54*207e5cccSFangrui Song poly8_t test_vget_lane_p8(poly8x8_t a) { 55*207e5cccSFangrui Song return vget_lane_p8(a, 7); 56*207e5cccSFangrui Song } 57*207e5cccSFangrui Song 58*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i16 @test_vget_lane_p16(<4 x i16> noundef %a) #0 { 59*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <4 x i16> %a, i32 3 60*207e5cccSFangrui Song // CHECK: ret i16 [[VGET_LANE]] 61*207e5cccSFangrui Song poly16_t test_vget_lane_p16(poly16x4_t a) { 62*207e5cccSFangrui Song return vget_lane_p16(a, 3); 63*207e5cccSFangrui Song } 64*207e5cccSFangrui Song 65*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} float @test_vget_lane_f32(<2 x float> noundef %a) #0 { 66*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <2 x float> %a, i32 1 67*207e5cccSFangrui Song // CHECK: ret float [[VGET_LANE]] 68*207e5cccSFangrui Song float32_t test_vget_lane_f32(float32x2_t a) { 69*207e5cccSFangrui Song return vget_lane_f32(a, 1); 70*207e5cccSFangrui Song } 71*207e5cccSFangrui Song 72*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} float @test_vget_lane_f16(<4 x half> noundef %a) #0 { 73*207e5cccSFangrui Song // CHECK: [[__REINT_242:%.*]] = alloca <4 x half>, align 8 74*207e5cccSFangrui Song // CHECK: [[__REINT1_242:%.*]] = alloca i16, align 2 75*207e5cccSFangrui Song // CHECK: store <4 x half> %a, ptr [[__REINT_242]], align 8 76*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = load <4 x i16>, ptr [[__REINT_242]], align 8 77*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <4 x i16> [[TMP1]], i32 1 78*207e5cccSFangrui Song // CHECK: store i16 [[VGET_LANE]], ptr [[__REINT1_242]], align 2 79*207e5cccSFangrui Song // CHECK: [[TMP5:%.*]] = load half, ptr [[__REINT1_242]], align 2 80*207e5cccSFangrui Song // CHECK: [[CONV:%.*]] = fpext half [[TMP5]] to float 81*207e5cccSFangrui Song // CHECK: ret float [[CONV]] 82*207e5cccSFangrui Song float32_t test_vget_lane_f16(float16x4_t a) { 83*207e5cccSFangrui Song return vget_lane_f16(a, 1); 84*207e5cccSFangrui Song } 85*207e5cccSFangrui Song 86*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i8 @test_vgetq_lane_u8(<16 x i8> noundef %a) #0 { 87*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <16 x i8> %a, i32 15 88*207e5cccSFangrui Song // CHECK: ret i8 [[VGETQ_LANE]] 89*207e5cccSFangrui Song uint8_t test_vgetq_lane_u8(uint8x16_t a) { 90*207e5cccSFangrui Song return vgetq_lane_u8(a, 15); 91*207e5cccSFangrui Song } 92*207e5cccSFangrui Song 93*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i16 @test_vgetq_lane_u16(<8 x i16> noundef %a) #0 { 94*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <8 x i16> %a, i32 7 95*207e5cccSFangrui Song // CHECK: ret i16 [[VGETQ_LANE]] 96*207e5cccSFangrui Song uint16_t test_vgetq_lane_u16(uint16x8_t a) { 97*207e5cccSFangrui Song return vgetq_lane_u16(a, 7); 98*207e5cccSFangrui Song } 99*207e5cccSFangrui Song 100*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i32 @test_vgetq_lane_u32(<4 x i32> noundef %a) #0 { 101*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <4 x i32> %a, i32 3 102*207e5cccSFangrui Song // CHECK: ret i32 [[VGETQ_LANE]] 103*207e5cccSFangrui Song uint32_t test_vgetq_lane_u32(uint32x4_t a) { 104*207e5cccSFangrui Song return vgetq_lane_u32(a, 3); 105*207e5cccSFangrui Song } 106*207e5cccSFangrui Song 107*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i8 @test_vgetq_lane_s8(<16 x i8> noundef %a) #0 { 108*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <16 x i8> %a, i32 15 109*207e5cccSFangrui Song // CHECK: ret i8 [[VGETQ_LANE]] 110*207e5cccSFangrui Song int8_t test_vgetq_lane_s8(int8x16_t a) { 111*207e5cccSFangrui Song return vgetq_lane_s8(a, 15); 112*207e5cccSFangrui Song } 113*207e5cccSFangrui Song 114*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i16 @test_vgetq_lane_s16(<8 x i16> noundef %a) #0 { 115*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <8 x i16> %a, i32 7 116*207e5cccSFangrui Song // CHECK: ret i16 [[VGETQ_LANE]] 117*207e5cccSFangrui Song int16_t test_vgetq_lane_s16(int16x8_t a) { 118*207e5cccSFangrui Song return vgetq_lane_s16(a, 7); 119*207e5cccSFangrui Song } 120*207e5cccSFangrui Song 121*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i32 @test_vgetq_lane_s32(<4 x i32> noundef %a) #0 { 122*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <4 x i32> %a, i32 3 123*207e5cccSFangrui Song // CHECK: ret i32 [[VGETQ_LANE]] 124*207e5cccSFangrui Song int32_t test_vgetq_lane_s32(int32x4_t a) { 125*207e5cccSFangrui Song return vgetq_lane_s32(a, 3); 126*207e5cccSFangrui Song } 127*207e5cccSFangrui Song 128*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i8 @test_vgetq_lane_p8(<16 x i8> noundef %a) #0 { 129*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <16 x i8> %a, i32 15 130*207e5cccSFangrui Song // CHECK: ret i8 [[VGETQ_LANE]] 131*207e5cccSFangrui Song poly8_t test_vgetq_lane_p8(poly8x16_t a) { 132*207e5cccSFangrui Song return vgetq_lane_p8(a, 15); 133*207e5cccSFangrui Song } 134*207e5cccSFangrui Song 135*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i16 @test_vgetq_lane_p16(<8 x i16> noundef %a) #0 { 136*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <8 x i16> %a, i32 7 137*207e5cccSFangrui Song // CHECK: ret i16 [[VGETQ_LANE]] 138*207e5cccSFangrui Song poly16_t test_vgetq_lane_p16(poly16x8_t a) { 139*207e5cccSFangrui Song return vgetq_lane_p16(a, 7); 140*207e5cccSFangrui Song } 141*207e5cccSFangrui Song 142*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} float @test_vgetq_lane_f32(<4 x float> noundef %a) #0 { 143*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <4 x float> %a, i32 3 144*207e5cccSFangrui Song // CHECK: ret float [[VGETQ_LANE]] 145*207e5cccSFangrui Song float32_t test_vgetq_lane_f32(float32x4_t a) { 146*207e5cccSFangrui Song return vgetq_lane_f32(a, 3); 147*207e5cccSFangrui Song } 148*207e5cccSFangrui Song 149*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} float @test_vgetq_lane_f16(<8 x half> noundef %a) #0 { 150*207e5cccSFangrui Song // CHECK: [[__REINT_244:%.*]] = alloca <8 x half>, align 16 151*207e5cccSFangrui Song // CHECK: [[__REINT1_244:%.*]] = alloca i16, align 2 152*207e5cccSFangrui Song // CHECK: store <8 x half> %a, ptr [[__REINT_244]], align 16 153*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = load <8 x i16>, ptr [[__REINT_244]], align 16 154*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <8 x i16> [[TMP1]], i32 3 155*207e5cccSFangrui Song // CHECK: store i16 [[VGETQ_LANE]], ptr [[__REINT1_244]], align 2 156*207e5cccSFangrui Song // CHECK: [[TMP5:%.*]] = load half, ptr [[__REINT1_244]], align 2 157*207e5cccSFangrui Song // CHECK: [[CONV:%.*]] = fpext half [[TMP5]] to float 158*207e5cccSFangrui Song // CHECK: ret float [[CONV]] 159*207e5cccSFangrui Song float32_t test_vgetq_lane_f16(float16x8_t a) { 160*207e5cccSFangrui Song return vgetq_lane_f16(a, 3); 161*207e5cccSFangrui Song } 162*207e5cccSFangrui Song 163*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i64 @test_vget_lane_s64(<1 x i64> noundef %a) #0 { 164*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <1 x i64> %a, i32 0 165*207e5cccSFangrui Song // CHECK: ret i64 [[VGET_LANE]] 166*207e5cccSFangrui Song int64_t test_vget_lane_s64(int64x1_t a) { 167*207e5cccSFangrui Song return vget_lane_s64(a, 0); 168*207e5cccSFangrui Song } 169*207e5cccSFangrui Song 170*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i64 @test_vget_lane_u64(<1 x i64> noundef %a) #0 { 171*207e5cccSFangrui Song // CHECK: [[VGET_LANE:%.*]] = extractelement <1 x i64> %a, i32 0 172*207e5cccSFangrui Song // CHECK: ret i64 [[VGET_LANE]] 173*207e5cccSFangrui Song uint64_t test_vget_lane_u64(uint64x1_t a) { 174*207e5cccSFangrui Song return vget_lane_u64(a, 0); 175*207e5cccSFangrui Song } 176*207e5cccSFangrui Song 177*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i64 @test_vgetq_lane_s64(<2 x i64> noundef %a) #0 { 178*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <2 x i64> %a, i32 1 179*207e5cccSFangrui Song // CHECK: ret i64 [[VGETQ_LANE]] 180*207e5cccSFangrui Song int64_t test_vgetq_lane_s64(int64x2_t a) { 181*207e5cccSFangrui Song return vgetq_lane_s64(a, 1); 182*207e5cccSFangrui Song } 183*207e5cccSFangrui Song 184*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} i64 @test_vgetq_lane_u64(<2 x i64> noundef %a) #0 { 185*207e5cccSFangrui Song // CHECK: [[VGETQ_LANE:%.*]] = extractelement <2 x i64> %a, i32 1 186*207e5cccSFangrui Song // CHECK: ret i64 [[VGETQ_LANE]] 187*207e5cccSFangrui Song uint64_t test_vgetq_lane_u64(uint64x2_t a) { 188*207e5cccSFangrui Song return vgetq_lane_u64(a, 1); 189*207e5cccSFangrui Song } 190*207e5cccSFangrui Song 191*207e5cccSFangrui Song 192*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <8 x i8> @test_vset_lane_u8(i8 noundef %a, <8 x i8> noundef %b) #0 { 193*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <8 x i8> %b, i8 %a, i32 7 194*207e5cccSFangrui Song // CHECK: ret <8 x i8> [[VSET_LANE]] 195*207e5cccSFangrui Song uint8x8_t test_vset_lane_u8(uint8_t a, uint8x8_t b) { 196*207e5cccSFangrui Song return vset_lane_u8(a, b, 7); 197*207e5cccSFangrui Song } 198*207e5cccSFangrui Song 199*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <4 x i16> @test_vset_lane_u16(i16 noundef %a, <4 x i16> noundef %b) #0 { 200*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <4 x i16> %b, i16 %a, i32 3 201*207e5cccSFangrui Song // CHECK: ret <4 x i16> [[VSET_LANE]] 202*207e5cccSFangrui Song uint16x4_t test_vset_lane_u16(uint16_t a, uint16x4_t b) { 203*207e5cccSFangrui Song return vset_lane_u16(a, b, 3); 204*207e5cccSFangrui Song } 205*207e5cccSFangrui Song 206*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <2 x i32> @test_vset_lane_u32(i32 noundef %a, <2 x i32> noundef %b) #0 { 207*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <2 x i32> %b, i32 %a, i32 1 208*207e5cccSFangrui Song // CHECK: ret <2 x i32> [[VSET_LANE]] 209*207e5cccSFangrui Song uint32x2_t test_vset_lane_u32(uint32_t a, uint32x2_t b) { 210*207e5cccSFangrui Song return vset_lane_u32(a, b, 1); 211*207e5cccSFangrui Song } 212*207e5cccSFangrui Song 213*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <8 x i8> @test_vset_lane_s8(i8 noundef %a, <8 x i8> noundef %b) #0 { 214*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <8 x i8> %b, i8 %a, i32 7 215*207e5cccSFangrui Song // CHECK: ret <8 x i8> [[VSET_LANE]] 216*207e5cccSFangrui Song int8x8_t test_vset_lane_s8(int8_t a, int8x8_t b) { 217*207e5cccSFangrui Song return vset_lane_s8(a, b, 7); 218*207e5cccSFangrui Song } 219*207e5cccSFangrui Song 220*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <4 x i16> @test_vset_lane_s16(i16 noundef %a, <4 x i16> noundef %b) #0 { 221*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <4 x i16> %b, i16 %a, i32 3 222*207e5cccSFangrui Song // CHECK: ret <4 x i16> [[VSET_LANE]] 223*207e5cccSFangrui Song int16x4_t test_vset_lane_s16(int16_t a, int16x4_t b) { 224*207e5cccSFangrui Song return vset_lane_s16(a, b, 3); 225*207e5cccSFangrui Song } 226*207e5cccSFangrui Song 227*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <2 x i32> @test_vset_lane_s32(i32 noundef %a, <2 x i32> noundef %b) #0 { 228*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <2 x i32> %b, i32 %a, i32 1 229*207e5cccSFangrui Song // CHECK: ret <2 x i32> [[VSET_LANE]] 230*207e5cccSFangrui Song int32x2_t test_vset_lane_s32(int32_t a, int32x2_t b) { 231*207e5cccSFangrui Song return vset_lane_s32(a, b, 1); 232*207e5cccSFangrui Song } 233*207e5cccSFangrui Song 234*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <8 x i8> @test_vset_lane_p8(i8 noundef %a, <8 x i8> noundef %b) #0 { 235*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <8 x i8> %b, i8 %a, i32 7 236*207e5cccSFangrui Song // CHECK: ret <8 x i8> [[VSET_LANE]] 237*207e5cccSFangrui Song poly8x8_t test_vset_lane_p8(poly8_t a, poly8x8_t b) { 238*207e5cccSFangrui Song return vset_lane_p8(a, b, 7); 239*207e5cccSFangrui Song } 240*207e5cccSFangrui Song 241*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <4 x i16> @test_vset_lane_p16(i16 noundef %a, <4 x i16> noundef %b) #0 { 242*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <4 x i16> %b, i16 %a, i32 3 243*207e5cccSFangrui Song // CHECK: ret <4 x i16> [[VSET_LANE]] 244*207e5cccSFangrui Song poly16x4_t test_vset_lane_p16(poly16_t a, poly16x4_t b) { 245*207e5cccSFangrui Song return vset_lane_p16(a, b, 3); 246*207e5cccSFangrui Song } 247*207e5cccSFangrui Song 248*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <2 x float> @test_vset_lane_f32(float noundef %a, <2 x float> noundef %b) #0 { 249*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <2 x float> %b, float %a, i32 1 250*207e5cccSFangrui Song // CHECK: ret <2 x float> [[VSET_LANE]] 251*207e5cccSFangrui Song float32x2_t test_vset_lane_f32(float32_t a, float32x2_t b) { 252*207e5cccSFangrui Song return vset_lane_f32(a, b, 1); 253*207e5cccSFangrui Song } 254*207e5cccSFangrui Song 255*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <4 x half> @test_vset_lane_f16(ptr noundef %a, <4 x half> noundef %b) #0 { 256*207e5cccSFangrui Song // CHECK: [[__REINT_246:%.*]] = alloca half, align 2 257*207e5cccSFangrui Song // CHECK: [[__REINT1_246:%.*]] = alloca <4 x half>, align 8 258*207e5cccSFangrui Song // CHECK: [[__REINT2_246:%.*]] = alloca <4 x i16>, align 8 259*207e5cccSFangrui Song // CHECK: [[TMP0:%.*]] = load half, ptr %a, align 2 260*207e5cccSFangrui Song // CHECK: store half [[TMP0]], ptr [[__REINT_246]], align 2 261*207e5cccSFangrui Song // CHECK: store <4 x half> %b, ptr [[__REINT1_246]], align 8 262*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = load i16, ptr [[__REINT_246]], align 2 263*207e5cccSFangrui Song // CHECK: [[TMP4:%.*]] = load <4 x i16>, ptr [[__REINT1_246]], align 8 264*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <4 x i16> [[TMP4]], i16 [[TMP2]], i32 3 265*207e5cccSFangrui Song // CHECK: store <4 x i16> [[VSET_LANE]], ptr [[__REINT2_246]], align 8 266*207e5cccSFangrui Song // CHECK: [[TMP8:%.*]] = load <4 x half>, ptr [[__REINT2_246]], align 8 267*207e5cccSFangrui Song // CHECK: ret <4 x half> [[TMP8]] 268*207e5cccSFangrui Song float16x4_t test_vset_lane_f16(float16_t *a, float16x4_t b) { 269*207e5cccSFangrui Song return vset_lane_f16(*a, b, 3); 270*207e5cccSFangrui Song } 271*207e5cccSFangrui Song 272*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <16 x i8> @test_vsetq_lane_u8(i8 noundef %a, <16 x i8> noundef %b) #0 { 273*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <16 x i8> %b, i8 %a, i32 15 274*207e5cccSFangrui Song // CHECK: ret <16 x i8> [[VSET_LANE]] 275*207e5cccSFangrui Song uint8x16_t test_vsetq_lane_u8(uint8_t a, uint8x16_t b) { 276*207e5cccSFangrui Song return vsetq_lane_u8(a, b, 15); 277*207e5cccSFangrui Song } 278*207e5cccSFangrui Song 279*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <8 x i16> @test_vsetq_lane_u16(i16 noundef %a, <8 x i16> noundef %b) #0 { 280*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <8 x i16> %b, i16 %a, i32 7 281*207e5cccSFangrui Song // CHECK: ret <8 x i16> [[VSET_LANE]] 282*207e5cccSFangrui Song uint16x8_t test_vsetq_lane_u16(uint16_t a, uint16x8_t b) { 283*207e5cccSFangrui Song return vsetq_lane_u16(a, b, 7); 284*207e5cccSFangrui Song } 285*207e5cccSFangrui Song 286*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <4 x i32> @test_vsetq_lane_u32(i32 noundef %a, <4 x i32> noundef %b) #0 { 287*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <4 x i32> %b, i32 %a, i32 3 288*207e5cccSFangrui Song // CHECK: ret <4 x i32> [[VSET_LANE]] 289*207e5cccSFangrui Song uint32x4_t test_vsetq_lane_u32(uint32_t a, uint32x4_t b) { 290*207e5cccSFangrui Song return vsetq_lane_u32(a, b, 3); 291*207e5cccSFangrui Song } 292*207e5cccSFangrui Song 293*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <16 x i8> @test_vsetq_lane_s8(i8 noundef %a, <16 x i8> noundef %b) #0 { 294*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <16 x i8> %b, i8 %a, i32 15 295*207e5cccSFangrui Song // CHECK: ret <16 x i8> [[VSET_LANE]] 296*207e5cccSFangrui Song int8x16_t test_vsetq_lane_s8(int8_t a, int8x16_t b) { 297*207e5cccSFangrui Song return vsetq_lane_s8(a, b, 15); 298*207e5cccSFangrui Song } 299*207e5cccSFangrui Song 300*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <8 x i16> @test_vsetq_lane_s16(i16 noundef %a, <8 x i16> noundef %b) #0 { 301*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <8 x i16> %b, i16 %a, i32 7 302*207e5cccSFangrui Song // CHECK: ret <8 x i16> [[VSET_LANE]] 303*207e5cccSFangrui Song int16x8_t test_vsetq_lane_s16(int16_t a, int16x8_t b) { 304*207e5cccSFangrui Song return vsetq_lane_s16(a, b, 7); 305*207e5cccSFangrui Song } 306*207e5cccSFangrui Song 307*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <4 x i32> @test_vsetq_lane_s32(i32 noundef %a, <4 x i32> noundef %b) #0 { 308*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <4 x i32> %b, i32 %a, i32 3 309*207e5cccSFangrui Song // CHECK: ret <4 x i32> [[VSET_LANE]] 310*207e5cccSFangrui Song int32x4_t test_vsetq_lane_s32(int32_t a, int32x4_t b) { 311*207e5cccSFangrui Song return vsetq_lane_s32(a, b, 3); 312*207e5cccSFangrui Song } 313*207e5cccSFangrui Song 314*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <16 x i8> @test_vsetq_lane_p8(i8 noundef %a, <16 x i8> noundef %b) #0 { 315*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <16 x i8> %b, i8 %a, i32 15 316*207e5cccSFangrui Song // CHECK: ret <16 x i8> [[VSET_LANE]] 317*207e5cccSFangrui Song poly8x16_t test_vsetq_lane_p8(poly8_t a, poly8x16_t b) { 318*207e5cccSFangrui Song return vsetq_lane_p8(a, b, 15); 319*207e5cccSFangrui Song } 320*207e5cccSFangrui Song 321*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <8 x i16> @test_vsetq_lane_p16(i16 noundef %a, <8 x i16> noundef %b) #0 { 322*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <8 x i16> %b, i16 %a, i32 7 323*207e5cccSFangrui Song // CHECK: ret <8 x i16> [[VSET_LANE]] 324*207e5cccSFangrui Song poly16x8_t test_vsetq_lane_p16(poly16_t a, poly16x8_t b) { 325*207e5cccSFangrui Song return vsetq_lane_p16(a, b, 7); 326*207e5cccSFangrui Song } 327*207e5cccSFangrui Song 328*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <4 x float> @test_vsetq_lane_f32(float noundef %a, <4 x float> noundef %b) #0 { 329*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <4 x float> %b, float %a, i32 3 330*207e5cccSFangrui Song // CHECK: ret <4 x float> [[VSET_LANE]] 331*207e5cccSFangrui Song float32x4_t test_vsetq_lane_f32(float32_t a, float32x4_t b) { 332*207e5cccSFangrui Song return vsetq_lane_f32(a, b, 3); 333*207e5cccSFangrui Song } 334*207e5cccSFangrui Song 335*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <8 x half> @test_vsetq_lane_f16(ptr noundef %a, <8 x half> noundef %b) #0 { 336*207e5cccSFangrui Song // CHECK: [[__REINT_248:%.*]] = alloca half, align 2 337*207e5cccSFangrui Song // CHECK: [[__REINT1_248:%.*]] = alloca <8 x half>, align 16 338*207e5cccSFangrui Song // CHECK: [[__REINT2_248:%.*]] = alloca <8 x i16>, align 16 339*207e5cccSFangrui Song // CHECK: [[TMP0:%.*]] = load half, ptr %a, align 2 340*207e5cccSFangrui Song // CHECK: store half [[TMP0]], ptr [[__REINT_248]], align 2 341*207e5cccSFangrui Song // CHECK: store <8 x half> %b, ptr [[__REINT1_248]], align 16 342*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = load i16, ptr [[__REINT_248]], align 2 343*207e5cccSFangrui Song // CHECK: [[TMP4:%.*]] = load <8 x i16>, ptr [[__REINT1_248]], align 16 344*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <8 x i16> [[TMP4]], i16 [[TMP2]], i32 7 345*207e5cccSFangrui Song // CHECK: store <8 x i16> [[VSET_LANE]], ptr [[__REINT2_248]], align 16 346*207e5cccSFangrui Song // CHECK: [[TMP8:%.*]] = load <8 x half>, ptr [[__REINT2_248]], align 16 347*207e5cccSFangrui Song // CHECK: ret <8 x half> [[TMP8]] 348*207e5cccSFangrui Song float16x8_t test_vsetq_lane_f16(float16_t *a, float16x8_t b) { 349*207e5cccSFangrui Song return vsetq_lane_f16(*a, b, 7); 350*207e5cccSFangrui Song } 351*207e5cccSFangrui Song 352*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <1 x i64> @test_vset_lane_s64(i64 noundef %a, <1 x i64> noundef %b) #0 { 353*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <1 x i64> %b, i64 %a, i32 0 354*207e5cccSFangrui Song // CHECK: ret <1 x i64> [[VSET_LANE]] 355*207e5cccSFangrui Song int64x1_t test_vset_lane_s64(int64_t a, int64x1_t b) { 356*207e5cccSFangrui Song return vset_lane_s64(a, b, 0); 357*207e5cccSFangrui Song } 358*207e5cccSFangrui Song 359*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <1 x i64> @test_vset_lane_u64(i64 noundef %a, <1 x i64> noundef %b) #0 { 360*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <1 x i64> %b, i64 %a, i32 0 361*207e5cccSFangrui Song // CHECK: ret <1 x i64> [[VSET_LANE]] 362*207e5cccSFangrui Song uint64x1_t test_vset_lane_u64(uint64_t a, uint64x1_t b) { 363*207e5cccSFangrui Song return vset_lane_u64(a, b, 0); 364*207e5cccSFangrui Song } 365*207e5cccSFangrui Song 366*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <2 x i64> @test_vsetq_lane_s64(i64 noundef %a, <2 x i64> noundef %b) #0 { 367*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <2 x i64> %b, i64 %a, i32 1 368*207e5cccSFangrui Song // CHECK: ret <2 x i64> [[VSET_LANE]] 369*207e5cccSFangrui Song int64x2_t test_vsetq_lane_s64(int64_t a, int64x2_t b) { 370*207e5cccSFangrui Song return vsetq_lane_s64(a, b, 1); 371*207e5cccSFangrui Song } 372*207e5cccSFangrui Song 373*207e5cccSFangrui Song // CHECK-LABEL: define{{.*}} <2 x i64> @test_vsetq_lane_u64(i64 noundef %a, <2 x i64> noundef %b) #0 { 374*207e5cccSFangrui Song // CHECK: [[VSET_LANE:%.*]] = insertelement <2 x i64> %b, i64 %a, i32 1 375*207e5cccSFangrui Song // CHECK: ret <2 x i64> [[VSET_LANE]] 376*207e5cccSFangrui Song uint64x2_t test_vsetq_lane_u64(uint64_t a, uint64x2_t b) { 377*207e5cccSFangrui Song return vsetq_lane_u64(a, b, 1); 378*207e5cccSFangrui Song } 379