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_vminnmaq_f16(
8 // CHECK-NEXT:  entry:
9 // CHECK-NEXT:    [[TMP0:%.*]] = call <8 x half> @llvm.fabs.v8f16(<8 x half> [[A:%.*]])
10 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x half> @llvm.fabs.v8f16(<8 x half> [[B:%.*]])
11 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x half> @llvm.minnum.v8f16(<8 x half> [[TMP0]], <8 x half> [[TMP1]])
12 // CHECK-NEXT:    ret <8 x half> [[TMP2]]
13 //
test_vminnmaq_f16(float16x8_t a,float16x8_t b)14 float16x8_t test_vminnmaq_f16(float16x8_t a, float16x8_t b)
15 {
16 #ifdef POLYMORPHIC
17     return vminnmaq(a, b);
18 #else /* POLYMORPHIC */
19     return vminnmaq_f16(a, b);
20 #endif /* POLYMORPHIC */
21 }
22 
23 // CHECK-LABEL: @test_vminnmaq_f32(
24 // CHECK-NEXT:  entry:
25 // CHECK-NEXT:    [[TMP0:%.*]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> [[A:%.*]])
26 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> [[B:%.*]])
27 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x float> @llvm.minnum.v4f32(<4 x float> [[TMP0]], <4 x float> [[TMP1]])
28 // CHECK-NEXT:    ret <4 x float> [[TMP2]]
29 //
test_vminnmaq_f32(float32x4_t a,float32x4_t b)30 float32x4_t test_vminnmaq_f32(float32x4_t a, float32x4_t b)
31 {
32 #ifdef POLYMORPHIC
33     return vminnmaq(a, b);
34 #else /* POLYMORPHIC */
35     return vminnmaq_f32(a, b);
36 #endif /* POLYMORPHIC */
37 }
38 
39 // CHECK-LABEL: @test_vminnmaq_m_f16(
40 // CHECK-NEXT:  entry:
41 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
42 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
43 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x half> @llvm.arm.mve.vminnma.predicated.v8f16.v8i1(<8 x half> [[A:%.*]], <8 x half> [[B:%.*]], <8 x i1> [[TMP1]])
44 // CHECK-NEXT:    ret <8 x half> [[TMP2]]
45 //
test_vminnmaq_m_f16(float16x8_t a,float16x8_t b,mve_pred16_t p)46 float16x8_t test_vminnmaq_m_f16(float16x8_t a, float16x8_t b, mve_pred16_t p)
47 {
48 #ifdef POLYMORPHIC
49     return vminnmaq_m(a, b, p);
50 #else /* POLYMORPHIC */
51     return vminnmaq_m_f16(a, b, p);
52 #endif /* POLYMORPHIC */
53 }
54 
55 // CHECK-LABEL: @test_vminnmaq_m_f32(
56 // CHECK-NEXT:  entry:
57 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
58 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
59 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x float> @llvm.arm.mve.vminnma.predicated.v4f32.v4i1(<4 x float> [[A:%.*]], <4 x float> [[B:%.*]], <4 x i1> [[TMP1]])
60 // CHECK-NEXT:    ret <4 x float> [[TMP2]]
61 //
test_vminnmaq_m_f32(float32x4_t a,float32x4_t b,mve_pred16_t p)62 float32x4_t test_vminnmaq_m_f32(float32x4_t a, float32x4_t b, mve_pred16_t p)
63 {
64 #ifdef POLYMORPHIC
65     return vminnmaq_m(a, b, p);
66 #else /* POLYMORPHIC */
67     return vminnmaq_m_f32(a, b, p);
68 #endif /* POLYMORPHIC */
69 }
70