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 -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 -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_vmaxnmq_f16(
8 // CHECK-NEXT:  entry:
9 // CHECK-NEXT:    [[TMP0:%.*]] = call <8 x half> @llvm.maxnum.v8f16(<8 x half> [[A:%.*]], <8 x half> [[B:%.*]])
10 // CHECK-NEXT:    ret <8 x half> [[TMP0]]
11 //
test_vmaxnmq_f16(float16x8_t a,float16x8_t b)12 float16x8_t test_vmaxnmq_f16(float16x8_t a, float16x8_t b)
13 {
14 #ifdef POLYMORPHIC
15     return vmaxnmq(a, b);
16 #else /* POLYMORPHIC */
17     return vmaxnmq_f16(a, b);
18 #endif /* POLYMORPHIC */
19 }
20 
21 // CHECK-LABEL: @test_vmaxnmq_f32(
22 // CHECK-NEXT:  entry:
23 // CHECK-NEXT:    [[TMP0:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[A:%.*]], <4 x float> [[B:%.*]])
24 // CHECK-NEXT:    ret <4 x float> [[TMP0]]
25 //
test_vmaxnmq_f32(float32x4_t a,float32x4_t b)26 float32x4_t test_vmaxnmq_f32(float32x4_t a, float32x4_t b)
27 {
28 #ifdef POLYMORPHIC
29     return vmaxnmq(a, b);
30 #else /* POLYMORPHIC */
31     return vmaxnmq_f32(a, b);
32 #endif /* POLYMORPHIC */
33 }
34 
35 // CHECK-LABEL: @test_vmaxnmq_m_f16(
36 // CHECK-NEXT:  entry:
37 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
38 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
39 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x half> @llvm.arm.mve.max.predicated.v8f16.v8i1(<8 x half> [[A:%.*]], <8 x half> [[B:%.*]], i32 0, <8 x i1> [[TMP1]], <8 x half> [[INACTIVE:%.*]])
40 // CHECK-NEXT:    ret <8 x half> [[TMP2]]
41 //
test_vmaxnmq_m_f16(float16x8_t inactive,float16x8_t a,float16x8_t b,mve_pred16_t p)42 float16x8_t test_vmaxnmq_m_f16(float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p)
43 {
44 #ifdef POLYMORPHIC
45     return vmaxnmq_m(inactive, a, b, p);
46 #else /* POLYMORPHIC */
47     return vmaxnmq_m_f16(inactive, a, b, p);
48 #endif /* POLYMORPHIC */
49 }
50 
51 // CHECK-LABEL: @test_vmaxnmq_m_f32(
52 // CHECK-NEXT:  entry:
53 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
54 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
55 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x float> @llvm.arm.mve.max.predicated.v4f32.v4i1(<4 x float> [[A:%.*]], <4 x float> [[B:%.*]], i32 0, <4 x i1> [[TMP1]], <4 x float> [[INACTIVE:%.*]])
56 // CHECK-NEXT:    ret <4 x float> [[TMP2]]
57 //
test_vmaxnmq_m_f32(float32x4_t inactive,float32x4_t a,float32x4_t b,mve_pred16_t p)58 float32x4_t test_vmaxnmq_m_f32(float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p)
59 {
60 #ifdef POLYMORPHIC
61     return vmaxnmq_m(inactive, a, b, p);
62 #else /* POLYMORPHIC */
63     return vmaxnmq_m_f32(inactive, a, b, p);
64 #endif /* POLYMORPHIC */
65 }
66 
67 // CHECK-LABEL: @test_vmaxnmq_x_f16(
68 // CHECK-NEXT:  entry:
69 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
70 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
71 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x half> @llvm.arm.mve.max.predicated.v8f16.v8i1(<8 x half> [[A:%.*]], <8 x half> [[B:%.*]], i32 0, <8 x i1> [[TMP1]], <8 x half> undef)
72 // CHECK-NEXT:    ret <8 x half> [[TMP2]]
73 //
test_vmaxnmq_x_f16(float16x8_t a,float16x8_t b,mve_pred16_t p)74 float16x8_t test_vmaxnmq_x_f16(float16x8_t a, float16x8_t b, mve_pred16_t p)
75 {
76 #ifdef POLYMORPHIC
77     return vmaxnmq_x(a, b, p);
78 #else /* POLYMORPHIC */
79     return vmaxnmq_x_f16(a, b, p);
80 #endif /* POLYMORPHIC */
81 }
82 
83 // CHECK-LABEL: @test_vmaxnmq_x_f32(
84 // CHECK-NEXT:  entry:
85 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
86 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
87 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x float> @llvm.arm.mve.max.predicated.v4f32.v4i1(<4 x float> [[A:%.*]], <4 x float> [[B:%.*]], i32 0, <4 x i1> [[TMP1]], <4 x float> undef)
88 // CHECK-NEXT:    ret <4 x float> [[TMP2]]
89 //
test_vmaxnmq_x_f32(float32x4_t a,float32x4_t b,mve_pred16_t p)90 float32x4_t test_vmaxnmq_x_f32(float32x4_t a, float32x4_t b, mve_pred16_t p)
91 {
92 #ifdef POLYMORPHIC
93     return vmaxnmq_x(a, b, p);
94 #else /* POLYMORPHIC */
95     return vmaxnmq_x_f32(a, b, p);
96 #endif /* POLYMORPHIC */
97 }
98