1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
3 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 -disable-O0-optnone -DPOLYMORPHIC -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
4 
5 #include <arm_mve.h>
6 
7 // CHECK-LABEL: @test_vqdmulltq_s16(
8 // CHECK-NEXT:  entry:
9 // CHECK-NEXT:    [[TMP0:%.*]] = call <4 x i32> @llvm.arm.mve.vqdmull.v4i32.v8i16(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], i32 1)
10 // CHECK-NEXT:    ret <4 x i32> [[TMP0]]
11 //
test_vqdmulltq_s16(int16x8_t a,int16x8_t b)12 int32x4_t test_vqdmulltq_s16(int16x8_t a, int16x8_t b) {
13 #ifdef POLYMORPHIC
14   return vqdmulltq(a, b);
15 #else  /* POLYMORPHIC */
16   return vqdmulltq_s16(a, b);
17 #endif /* POLYMORPHIC */
18 }
19 
20 // CHECK-LABEL: @test_vqdmulltq_s32(
21 // CHECK-NEXT:  entry:
22 // CHECK-NEXT:    [[TMP0:%.*]] = call <2 x i64> @llvm.arm.mve.vqdmull.v2i64.v4i32(<4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], i32 1)
23 // CHECK-NEXT:    ret <2 x i64> [[TMP0]]
24 //
test_vqdmulltq_s32(int32x4_t a,int32x4_t b)25 int64x2_t test_vqdmulltq_s32(int32x4_t a, int32x4_t b) {
26 #ifdef POLYMORPHIC
27   return vqdmulltq(a, b);
28 #else  /* POLYMORPHIC */
29   return vqdmulltq_s32(a, b);
30 #endif /* POLYMORPHIC */
31 }
32 
33 // CHECK-LABEL: @test_vqdmulltq_m_s16(
34 // CHECK-NEXT:  entry:
35 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
36 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
37 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.vqdmull.predicated.v4i32.v8i16.v4i1(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], i32 1, <4 x i1> [[TMP1]], <4 x i32> [[INACTIVE:%.*]])
38 // CHECK-NEXT:    ret <4 x i32> [[TMP2]]
39 //
test_vqdmulltq_m_s16(int32x4_t inactive,int16x8_t a,int16x8_t b,mve_pred16_t p)40 int32x4_t test_vqdmulltq_m_s16(int32x4_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) {
41 #ifdef POLYMORPHIC
42   return vqdmulltq_m(inactive, a, b, p);
43 #else  /* POLYMORPHIC */
44   return vqdmulltq_m_s16(inactive, a, b, p);
45 #endif /* POLYMORPHIC */
46 }
47 
48 // CHECK-LABEL: @test_vqdmulltq_m_s32(
49 // CHECK-NEXT:  entry:
50 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
51 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
52 // CHECK-NEXT:    [[TMP2:%.*]] = call <2 x i64> @llvm.arm.mve.vqdmull.predicated.v2i64.v4i32.v4i1(<4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], i32 1, <4 x i1> [[TMP1]], <2 x i64> [[INACTIVE:%.*]])
53 // CHECK-NEXT:    ret <2 x i64> [[TMP2]]
54 //
test_vqdmulltq_m_s32(int64x2_t inactive,int32x4_t a,int32x4_t b,mve_pred16_t p)55 int64x2_t test_vqdmulltq_m_s32(int64x2_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p) {
56 #ifdef POLYMORPHIC
57   return vqdmulltq_m(inactive, a, b, p);
58 #else  /* POLYMORPHIC */
59   return vqdmulltq_m_s32(inactive, a, b, p);
60 #endif /* POLYMORPHIC */
61 }
62 
63 // CHECK-LABEL: @test_vqdmulltq_n_s16(
64 // CHECK-NEXT:  entry:
65 // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <8 x i16> undef, i16 [[B:%.*]], i32 0
66 // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <8 x i16> [[DOTSPLATINSERT]], <8 x i16> undef, <8 x i32> zeroinitializer
67 // CHECK-NEXT:    [[TMP0:%.*]] = call <4 x i32> @llvm.arm.mve.vqdmull.v4i32.v8i16(<8 x i16> [[A:%.*]], <8 x i16> [[DOTSPLAT]], i32 1)
68 // CHECK-NEXT:    ret <4 x i32> [[TMP0]]
69 //
test_vqdmulltq_n_s16(int16x8_t a,int16_t b)70 int32x4_t test_vqdmulltq_n_s16(int16x8_t a, int16_t b) {
71 #ifdef POLYMORPHIC
72   return vqdmulltq(a, b);
73 #else  /* POLYMORPHIC */
74   return vqdmulltq_n_s16(a, b);
75 #endif /* POLYMORPHIC */
76 }
77 
78 // CHECK-LABEL: @test_vqdmulltq_n_s32(
79 // CHECK-NEXT:  entry:
80 // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> undef, i32 [[B:%.*]], i32 0
81 // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> undef, <4 x i32> zeroinitializer
82 // CHECK-NEXT:    [[TMP0:%.*]] = call <2 x i64> @llvm.arm.mve.vqdmull.v2i64.v4i32(<4 x i32> [[A:%.*]], <4 x i32> [[DOTSPLAT]], i32 1)
83 // CHECK-NEXT:    ret <2 x i64> [[TMP0]]
84 //
test_vqdmulltq_n_s32(int32x4_t a,int32_t b)85 int64x2_t test_vqdmulltq_n_s32(int32x4_t a, int32_t b) {
86 #ifdef POLYMORPHIC
87   return vqdmulltq(a, b);
88 #else  /* POLYMORPHIC */
89   return vqdmulltq_n_s32(a, b);
90 #endif /* POLYMORPHIC */
91 }
92 
93 // CHECK-LABEL: @test_vqdmulltq_m_n_s16(
94 // CHECK-NEXT:  entry:
95 // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <8 x i16> undef, i16 [[B:%.*]], i32 0
96 // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <8 x i16> [[DOTSPLATINSERT]], <8 x i16> undef, <8 x i32> zeroinitializer
97 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
98 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
99 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.vqdmull.predicated.v4i32.v8i16.v4i1(<8 x i16> [[A:%.*]], <8 x i16> [[DOTSPLAT]], i32 1, <4 x i1> [[TMP1]], <4 x i32> [[INACTIVE:%.*]])
100 // CHECK-NEXT:    ret <4 x i32> [[TMP2]]
101 //
test_vqdmulltq_m_n_s16(int32x4_t inactive,int16x8_t a,int16_t b,mve_pred16_t p)102 int32x4_t test_vqdmulltq_m_n_s16(int32x4_t inactive, int16x8_t a, int16_t b, mve_pred16_t p) {
103 #ifdef POLYMORPHIC
104   return vqdmulltq_m(inactive, a, b, p);
105 #else  /* POLYMORPHIC */
106   return vqdmulltq_m_n_s16(inactive, a, b, p);
107 #endif /* POLYMORPHIC */
108 }
109 
110 // CHECK-LABEL: @test_vqdmulltq_m_n_s32(
111 // CHECK-NEXT:  entry:
112 // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> undef, i32 [[B:%.*]], i32 0
113 // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> undef, <4 x i32> zeroinitializer
114 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
115 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
116 // CHECK-NEXT:    [[TMP2:%.*]] = call <2 x i64> @llvm.arm.mve.vqdmull.predicated.v2i64.v4i32.v4i1(<4 x i32> [[A:%.*]], <4 x i32> [[DOTSPLAT]], i32 1, <4 x i1> [[TMP1]], <2 x i64> [[INACTIVE:%.*]])
117 // CHECK-NEXT:    ret <2 x i64> [[TMP2]]
118 //
test_vqdmulltq_m_n_s32(int64x2_t inactive,int32x4_t a,int32_t b,mve_pred16_t p)119 int64x2_t test_vqdmulltq_m_n_s32(int64x2_t inactive, int32x4_t a, int32_t b, mve_pred16_t p) {
120 #ifdef POLYMORPHIC
121   return vqdmulltq_m(inactive, a, b, p);
122 #else  /* POLYMORPHIC */
123   return vqdmulltq_m_n_s32(inactive, a, b, p);
124 #endif /* POLYMORPHIC */
125 }
126