345 lines · c
1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py2// RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -O0 -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes='mem2reg,sroa,early-cse<>' | FileCheck %s3// RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -O0 -disable-O0-optnone -DPOLYMORPHIC -emit-llvm -o - %s | opt -S -passes='mem2reg,sroa,early-cse<>' | FileCheck %s4 5// REQUIRES: aarch64-registered-target || arm-registered-target6 7#include <arm_mve.h>8 9// CHECK-LABEL: @test_vdupq_n_f16(10// CHECK-NEXT: entry:11// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x half> poison, half [[A:%.*]], i64 012// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> poison, <8 x i32> zeroinitializer13// CHECK-NEXT: ret <8 x half> [[DOTSPLAT]]14//15float16x8_t test_vdupq_n_f16(float16_t a)16{17 return vdupq_n_f16(a);18}19 20// CHECK-LABEL: @test_vdupq_n_f32(21// CHECK-NEXT: entry:22// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> poison, float [[A:%.*]], i64 023// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> poison, <4 x i32> zeroinitializer24// CHECK-NEXT: ret <4 x float> [[DOTSPLAT]]25//26float32x4_t test_vdupq_n_f32(float32_t a)27{28 return vdupq_n_f32(a);29}30 31// CHECK-LABEL: @test_vdupq_n_s8(32// CHECK-NEXT: entry:33// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <16 x i8> poison, i8 [[A:%.*]], i64 034// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <16 x i8> [[DOTSPLATINSERT]], <16 x i8> poison, <16 x i32> zeroinitializer35// CHECK-NEXT: ret <16 x i8> [[DOTSPLAT]]36//37int8x16_t test_vdupq_n_s8(int8_t a)38{39 return vdupq_n_s8(a);40}41 42// CHECK-LABEL: @test_vdupq_n_s16(43// CHECK-NEXT: entry:44// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x i16> poison, i16 [[A:%.*]], i64 045// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x i16> [[DOTSPLATINSERT]], <8 x i16> poison, <8 x i32> zeroinitializer46// CHECK-NEXT: ret <8 x i16> [[DOTSPLAT]]47//48int16x8_t test_vdupq_n_s16(int16_t a)49{50 return vdupq_n_s16(a);51}52 53// CHECK-LABEL: @test_vdupq_n_s32(54// CHECK-NEXT: entry:55// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[A:%.*]], i64 056// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer57// CHECK-NEXT: ret <4 x i32> [[DOTSPLAT]]58//59int32x4_t test_vdupq_n_s32(int32_t a)60{61 return vdupq_n_s32(a);62}63 64// CHECK-LABEL: @test_vdupq_n_u8(65// CHECK-NEXT: entry:66// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <16 x i8> poison, i8 [[A:%.*]], i64 067// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <16 x i8> [[DOTSPLATINSERT]], <16 x i8> poison, <16 x i32> zeroinitializer68// CHECK-NEXT: ret <16 x i8> [[DOTSPLAT]]69//70uint8x16_t test_vdupq_n_u8(uint8_t a)71{72 return vdupq_n_u8(a);73}74 75// CHECK-LABEL: @test_vdupq_n_u16(76// CHECK-NEXT: entry:77// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x i16> poison, i16 [[A:%.*]], i64 078// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x i16> [[DOTSPLATINSERT]], <8 x i16> poison, <8 x i32> zeroinitializer79// CHECK-NEXT: ret <8 x i16> [[DOTSPLAT]]80//81uint16x8_t test_vdupq_n_u16(uint16_t a)82{83 return vdupq_n_u16(a);84}85 86// CHECK-LABEL: @test_vdupq_n_u32(87// CHECK-NEXT: entry:88// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[A:%.*]], i64 089// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer90// CHECK-NEXT: ret <4 x i32> [[DOTSPLAT]]91//92uint32x4_t test_vdupq_n_u32(uint32_t a)93{94 return vdupq_n_u32(a);95}96 97// CHECK-LABEL: @test_vdupq_m_n_f16(98// CHECK-NEXT: entry:99// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32100// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])101// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x half> poison, half [[A:%.*]], i64 0102// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> poison, <8 x i32> zeroinitializer103// CHECK-NEXT: [[TMP2:%.*]] = select <8 x i1> [[TMP1]], <8 x half> [[DOTSPLAT]], <8 x half> [[INACTIVE:%.*]]104// CHECK-NEXT: ret <8 x half> [[TMP2]]105//106float16x8_t test_vdupq_m_n_f16(float16x8_t inactive, float16_t a, mve_pred16_t p)107{108#ifdef POLYMORPHIC109 return vdupq_m(inactive, a, p);110#else /* POLYMORPHIC */111 return vdupq_m_n_f16(inactive, a, p);112#endif /* POLYMORPHIC */113}114 115// CHECK-LABEL: @test_vdupq_m_n_f32(116// CHECK-NEXT: entry:117// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32118// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])119// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> poison, float [[A:%.*]], i64 0120// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> poison, <4 x i32> zeroinitializer121// CHECK-NEXT: [[TMP2:%.*]] = select <4 x i1> [[TMP1]], <4 x float> [[DOTSPLAT]], <4 x float> [[INACTIVE:%.*]]122// CHECK-NEXT: ret <4 x float> [[TMP2]]123//124float32x4_t test_vdupq_m_n_f32(float32x4_t inactive, float32_t a, mve_pred16_t p)125{126#ifdef POLYMORPHIC127 return vdupq_m(inactive, a, p);128#else /* POLYMORPHIC */129 return vdupq_m_n_f32(inactive, a, p);130#endif /* POLYMORPHIC */131}132 133// CHECK-LABEL: @test_vdupq_m_n_s8(134// CHECK-NEXT: entry:135// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32136// CHECK-NEXT: [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])137// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <16 x i8> poison, i8 [[A:%.*]], i64 0138// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <16 x i8> [[DOTSPLATINSERT]], <16 x i8> poison, <16 x i32> zeroinitializer139// CHECK-NEXT: [[TMP2:%.*]] = select <16 x i1> [[TMP1]], <16 x i8> [[DOTSPLAT]], <16 x i8> [[INACTIVE:%.*]]140// CHECK-NEXT: ret <16 x i8> [[TMP2]]141//142int8x16_t test_vdupq_m_n_s8(int8x16_t inactive, int8_t a, mve_pred16_t p)143{144#ifdef POLYMORPHIC145 return vdupq_m(inactive, a, p);146#else /* POLYMORPHIC */147 return vdupq_m_n_s8(inactive, a, p);148#endif /* POLYMORPHIC */149}150 151// CHECK-LABEL: @test_vdupq_m_n_s16(152// CHECK-NEXT: entry:153// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32154// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])155// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x i16> poison, i16 [[A:%.*]], i64 0156// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x i16> [[DOTSPLATINSERT]], <8 x i16> poison, <8 x i32> zeroinitializer157// CHECK-NEXT: [[TMP2:%.*]] = select <8 x i1> [[TMP1]], <8 x i16> [[DOTSPLAT]], <8 x i16> [[INACTIVE:%.*]]158// CHECK-NEXT: ret <8 x i16> [[TMP2]]159//160int16x8_t test_vdupq_m_n_s16(int16x8_t inactive, int16_t a, mve_pred16_t p)161{162#ifdef POLYMORPHIC163 return vdupq_m(inactive, a, p);164#else /* POLYMORPHIC */165 return vdupq_m_n_s16(inactive, a, p);166#endif /* POLYMORPHIC */167}168 169// CHECK-LABEL: @test_vdupq_m_n_s32(170// CHECK-NEXT: entry:171// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32172// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])173// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[A:%.*]], i64 0174// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer175// CHECK-NEXT: [[TMP2:%.*]] = select <4 x i1> [[TMP1]], <4 x i32> [[DOTSPLAT]], <4 x i32> [[INACTIVE:%.*]]176// CHECK-NEXT: ret <4 x i32> [[TMP2]]177//178int32x4_t test_vdupq_m_n_s32(int32x4_t inactive, int32_t a, mve_pred16_t p)179{180#ifdef POLYMORPHIC181 return vdupq_m(inactive, a, p);182#else /* POLYMORPHIC */183 return vdupq_m_n_s32(inactive, a, p);184#endif /* POLYMORPHIC */185}186 187// CHECK-LABEL: @test_vdupq_m_n_u8(188// CHECK-NEXT: entry:189// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32190// CHECK-NEXT: [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])191// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <16 x i8> poison, i8 [[A:%.*]], i64 0192// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <16 x i8> [[DOTSPLATINSERT]], <16 x i8> poison, <16 x i32> zeroinitializer193// CHECK-NEXT: [[TMP2:%.*]] = select <16 x i1> [[TMP1]], <16 x i8> [[DOTSPLAT]], <16 x i8> [[INACTIVE:%.*]]194// CHECK-NEXT: ret <16 x i8> [[TMP2]]195//196uint8x16_t test_vdupq_m_n_u8(uint8x16_t inactive, uint8_t a, mve_pred16_t p)197{198#ifdef POLYMORPHIC199 return vdupq_m(inactive, a, p);200#else /* POLYMORPHIC */201 return vdupq_m_n_u8(inactive, a, p);202#endif /* POLYMORPHIC */203}204 205// CHECK-LABEL: @test_vdupq_m_n_u16(206// CHECK-NEXT: entry:207// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32208// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])209// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x i16> poison, i16 [[A:%.*]], i64 0210// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x i16> [[DOTSPLATINSERT]], <8 x i16> poison, <8 x i32> zeroinitializer211// CHECK-NEXT: [[TMP2:%.*]] = select <8 x i1> [[TMP1]], <8 x i16> [[DOTSPLAT]], <8 x i16> [[INACTIVE:%.*]]212// CHECK-NEXT: ret <8 x i16> [[TMP2]]213//214uint16x8_t test_vdupq_m_n_u16(uint16x8_t inactive, uint16_t a, mve_pred16_t p)215{216#ifdef POLYMORPHIC217 return vdupq_m(inactive, a, p);218#else /* POLYMORPHIC */219 return vdupq_m_n_u16(inactive, a, p);220#endif /* POLYMORPHIC */221}222 223// CHECK-LABEL: @test_vdupq_m_n_u32(224// CHECK-NEXT: entry:225// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32226// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])227// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[A:%.*]], i64 0228// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer229// CHECK-NEXT: [[TMP2:%.*]] = select <4 x i1> [[TMP1]], <4 x i32> [[DOTSPLAT]], <4 x i32> [[INACTIVE:%.*]]230// CHECK-NEXT: ret <4 x i32> [[TMP2]]231//232uint32x4_t test_vdupq_m_n_u32(uint32x4_t inactive, uint32_t a, mve_pred16_t p)233{234#ifdef POLYMORPHIC235 return vdupq_m(inactive, a, p);236#else /* POLYMORPHIC */237 return vdupq_m_n_u32(inactive, a, p);238#endif /* POLYMORPHIC */239}240 241// CHECK-LABEL: @test_vdupq_x_n_f16(242// CHECK-NEXT: entry:243// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32244// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])245// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x half> poison, half [[A:%.*]], i64 0246// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> poison, <8 x i32> zeroinitializer247// CHECK-NEXT: ret <8 x half> [[DOTSPLAT]]248//249float16x8_t test_vdupq_x_n_f16(float16_t a, mve_pred16_t p)250{251 return vdupq_x_n_f16(a, p);252}253 254// CHECK-LABEL: @test_vdupq_x_n_f32(255// CHECK-NEXT: entry:256// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32257// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])258// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> poison, float [[A:%.*]], i64 0259// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> poison, <4 x i32> zeroinitializer260// CHECK-NEXT: ret <4 x float> [[DOTSPLAT]]261//262float32x4_t test_vdupq_x_n_f32(float32_t a, mve_pred16_t p)263{264 return vdupq_x_n_f32(a, p);265}266 267// CHECK-LABEL: @test_vdupq_x_n_s8(268// CHECK-NEXT: entry:269// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32270// CHECK-NEXT: [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])271// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <16 x i8> poison, i8 [[A:%.*]], i64 0272// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <16 x i8> [[DOTSPLATINSERT]], <16 x i8> poison, <16 x i32> zeroinitializer273// CHECK-NEXT: ret <16 x i8> [[DOTSPLAT]]274//275int8x16_t test_vdupq_x_n_s8(int8_t a, mve_pred16_t p)276{277 return vdupq_x_n_s8(a, p);278}279 280// CHECK-LABEL: @test_vdupq_x_n_s16(281// CHECK-NEXT: entry:282// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32283// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])284// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x i16> poison, i16 [[A:%.*]], i64 0285// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x i16> [[DOTSPLATINSERT]], <8 x i16> poison, <8 x i32> zeroinitializer286// CHECK-NEXT: ret <8 x i16> [[DOTSPLAT]]287//288int16x8_t test_vdupq_x_n_s16(int16_t a, mve_pred16_t p)289{290 return vdupq_x_n_s16(a, p);291}292 293// CHECK-LABEL: @test_vdupq_x_n_s32(294// CHECK-NEXT: entry:295// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32296// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])297// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[A:%.*]], i64 0298// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer299// CHECK-NEXT: ret <4 x i32> [[DOTSPLAT]]300//301int32x4_t test_vdupq_x_n_s32(int32_t a, mve_pred16_t p)302{303 return vdupq_x_n_s32(a, p);304}305 306// CHECK-LABEL: @test_vdupq_x_n_u8(307// CHECK-NEXT: entry:308// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32309// CHECK-NEXT: [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])310// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <16 x i8> poison, i8 [[A:%.*]], i64 0311// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <16 x i8> [[DOTSPLATINSERT]], <16 x i8> poison, <16 x i32> zeroinitializer312// CHECK-NEXT: ret <16 x i8> [[DOTSPLAT]]313//314uint8x16_t test_vdupq_x_n_u8(uint8_t a, mve_pred16_t p)315{316 return vdupq_x_n_u8(a, p);317}318 319// CHECK-LABEL: @test_vdupq_x_n_u16(320// CHECK-NEXT: entry:321// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32322// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])323// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x i16> poison, i16 [[A:%.*]], i64 0324// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x i16> [[DOTSPLATINSERT]], <8 x i16> poison, <8 x i32> zeroinitializer325// CHECK-NEXT: ret <8 x i16> [[DOTSPLAT]]326//327uint16x8_t test_vdupq_x_n_u16(uint16_t a, mve_pred16_t p)328{329 return vdupq_x_n_u16(a, p);330}331 332// CHECK-LABEL: @test_vdupq_x_n_u32(333// CHECK-NEXT: entry:334// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32335// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])336// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[A:%.*]], i64 0337// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer338// CHECK-NEXT: ret <4 x i32> [[DOTSPLAT]]339//340uint32x4_t test_vdupq_x_n_u32(uint32_t a, mve_pred16_t p)341{342 return vdupq_x_n_u32(a, p);343}344 345