100 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 -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s3// RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -disable-O0-optnone -DPOLYMORPHIC -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s4 5// REQUIRES: aarch64-registered-target || arm-registered-target6 7#include <arm_mve.h>8 9// CHECK-LABEL: @test_vmaxnmq_f16(10// CHECK-NEXT: entry:11// CHECK-NEXT: [[TMP0:%.*]] = call <8 x half> @llvm.maxnum.v8f16(<8 x half> [[A:%.*]], <8 x half> [[B:%.*]])12// CHECK-NEXT: ret <8 x half> [[TMP0]]13//14float16x8_t test_vmaxnmq_f16(float16x8_t a, float16x8_t b)15{16#ifdef POLYMORPHIC17 return vmaxnmq(a, b);18#else /* POLYMORPHIC */19 return vmaxnmq_f16(a, b);20#endif /* POLYMORPHIC */21}22 23// CHECK-LABEL: @test_vmaxnmq_f32(24// CHECK-NEXT: entry:25// CHECK-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[A:%.*]], <4 x float> [[B:%.*]])26// CHECK-NEXT: ret <4 x float> [[TMP0]]27//28float32x4_t test_vmaxnmq_f32(float32x4_t a, float32x4_t b)29{30#ifdef POLYMORPHIC31 return vmaxnmq(a, b);32#else /* POLYMORPHIC */33 return vmaxnmq_f32(a, b);34#endif /* POLYMORPHIC */35}36 37// CHECK-LABEL: @test_vmaxnmq_m_f16(38// CHECK-NEXT: entry:39// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i3240// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])41// 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:%.*]])42// CHECK-NEXT: ret <8 x half> [[TMP2]]43//44float16x8_t test_vmaxnmq_m_f16(float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p)45{46#ifdef POLYMORPHIC47 return vmaxnmq_m(inactive, a, b, p);48#else /* POLYMORPHIC */49 return vmaxnmq_m_f16(inactive, a, b, p);50#endif /* POLYMORPHIC */51}52 53// CHECK-LABEL: @test_vmaxnmq_m_f32(54// CHECK-NEXT: entry:55// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i3256// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])57// 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:%.*]])58// CHECK-NEXT: ret <4 x float> [[TMP2]]59//60float32x4_t test_vmaxnmq_m_f32(float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p)61{62#ifdef POLYMORPHIC63 return vmaxnmq_m(inactive, a, b, p);64#else /* POLYMORPHIC */65 return vmaxnmq_m_f32(inactive, a, b, p);66#endif /* POLYMORPHIC */67}68 69// CHECK-LABEL: @test_vmaxnmq_x_f16(70// CHECK-NEXT: entry:71// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i3272// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])73// 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)74// CHECK-NEXT: ret <8 x half> [[TMP2]]75//76float16x8_t test_vmaxnmq_x_f16(float16x8_t a, float16x8_t b, mve_pred16_t p)77{78#ifdef POLYMORPHIC79 return vmaxnmq_x(a, b, p);80#else /* POLYMORPHIC */81 return vmaxnmq_x_f16(a, b, p);82#endif /* POLYMORPHIC */83}84 85// CHECK-LABEL: @test_vmaxnmq_x_f32(86// CHECK-NEXT: entry:87// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i3288// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])89// 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)90// CHECK-NEXT: ret <4 x float> [[TMP2]]91//92float32x4_t test_vmaxnmq_x_f32(float32x4_t a, float32x4_t b, mve_pred16_t p)93{94#ifdef POLYMORPHIC95 return vmaxnmq_x(a, b, p);96#else /* POLYMORPHIC */97 return vmaxnmq_x_f32(a, b, p);98#endif /* POLYMORPHIC */99}100