202 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 | 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 | FileCheck %s4 5// REQUIRES: aarch64-registered-target || arm-registered-target6 7#include <arm_mve.h>8 9// CHECK-LABEL: @test_vandq_u8(10// CHECK-NEXT: entry:11// CHECK-NEXT: [[TMP0:%.*]] = and <16 x i8> [[A:%.*]], [[B:%.*]]12// CHECK-NEXT: ret <16 x i8> [[TMP0]]13//14uint8x16_t test_vandq_u8(uint8x16_t a, uint8x16_t b)15{16#ifdef POLYMORPHIC17 return vandq(a, b);18#else /* POLYMORPHIC */19 return vandq_u8(a, b);20#endif /* POLYMORPHIC */21}22 23// CHECK-LABEL: @test_vandq_s16(24// CHECK-NEXT: entry:25// CHECK-NEXT: [[TMP0:%.*]] = and <8 x i16> [[A:%.*]], [[B:%.*]]26// CHECK-NEXT: ret <8 x i16> [[TMP0]]27//28int16x8_t test_vandq_s16(int16x8_t a, int16x8_t b)29{30#ifdef POLYMORPHIC31 return vandq(a, b);32#else /* POLYMORPHIC */33 return vandq_s16(a, b);34#endif /* POLYMORPHIC */35}36 37// CHECK-LABEL: @test_vandq_u32(38// CHECK-NEXT: entry:39// CHECK-NEXT: [[TMP0:%.*]] = and <4 x i32> [[A:%.*]], [[B:%.*]]40// CHECK-NEXT: ret <4 x i32> [[TMP0]]41//42uint32x4_t test_vandq_u32(uint32x4_t a, uint32x4_t b)43{44#ifdef POLYMORPHIC45 return vandq(a, b);46#else /* POLYMORPHIC */47 return vandq_u32(a, b);48#endif /* POLYMORPHIC */49}50 51// CHECK-LABEL: @test_vandq_f32(52// CHECK-NEXT: entry:53// CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x float> [[A:%.*]] to <4 x i32>54// CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x float> [[B:%.*]] to <4 x i32>55// CHECK-NEXT: [[TMP2:%.*]] = and <4 x i32> [[TMP0]], [[TMP1]]56// CHECK-NEXT: [[TMP3:%.*]] = bitcast <4 x i32> [[TMP2]] to <4 x float>57// CHECK-NEXT: ret <4 x float> [[TMP3]]58//59float32x4_t test_vandq_f32(float32x4_t a, float32x4_t b)60{61#ifdef POLYMORPHIC62 return vandq(a, b);63#else /* POLYMORPHIC */64 return vandq_f32(a, b);65#endif /* POLYMORPHIC */66}67 68// CHECK-LABEL: @test_vandq_m_s8(69// CHECK-NEXT: entry:70// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i3271// CHECK-NEXT: [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])72// CHECK-NEXT: [[TMP2:%.*]] = call <16 x i8> @llvm.arm.mve.and.predicated.v16i8.v16i1(<16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]], <16 x i1> [[TMP1]], <16 x i8> [[INACTIVE:%.*]])73// CHECK-NEXT: ret <16 x i8> [[TMP2]]74//75int8x16_t test_vandq_m_s8(int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p)76{77#ifdef POLYMORPHIC78 return vandq_m(inactive, a, b, p);79#else /* POLYMORPHIC */80 return vandq_m_s8(inactive, a, b, p);81#endif /* POLYMORPHIC */82}83 84// CHECK-LABEL: @test_vandq_m_u16(85// CHECK-NEXT: entry:86// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i3287// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])88// CHECK-NEXT: [[TMP2:%.*]] = call <8 x i16> @llvm.arm.mve.and.predicated.v8i16.v8i1(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], <8 x i1> [[TMP1]], <8 x i16> [[INACTIVE:%.*]])89// CHECK-NEXT: ret <8 x i16> [[TMP2]]90//91uint16x8_t test_vandq_m_u16(uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p)92{93#ifdef POLYMORPHIC94 return vandq_m(inactive, a, b, p);95#else /* POLYMORPHIC */96 return vandq_m_u16(inactive, a, b, p);97#endif /* POLYMORPHIC */98}99 100// CHECK-LABEL: @test_vandq_m_s32(101// CHECK-NEXT: entry:102// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32103// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])104// CHECK-NEXT: [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.and.predicated.v4i32.v4i1(<4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], <4 x i1> [[TMP1]], <4 x i32> [[INACTIVE:%.*]])105// CHECK-NEXT: ret <4 x i32> [[TMP2]]106//107int32x4_t test_vandq_m_s32(int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p)108{109#ifdef POLYMORPHIC110 return vandq_m(inactive, a, b, p);111#else /* POLYMORPHIC */112 return vandq_m_s32(inactive, a, b, p);113#endif /* POLYMORPHIC */114}115 116// CHECK-LABEL: @test_vandq_m_f16(117// CHECK-NEXT: entry:118// CHECK-NEXT: [[TMP0:%.*]] = bitcast <8 x half> [[A:%.*]] to <8 x i16>119// CHECK-NEXT: [[TMP1:%.*]] = bitcast <8 x half> [[B:%.*]] to <8 x i16>120// CHECK-NEXT: [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32121// CHECK-NEXT: [[TMP3:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP2]])122// CHECK-NEXT: [[TMP4:%.*]] = bitcast <8 x half> [[INACTIVE:%.*]] to <8 x i16>123// CHECK-NEXT: [[TMP5:%.*]] = call <8 x i16> @llvm.arm.mve.and.predicated.v8i16.v8i1(<8 x i16> [[TMP0]], <8 x i16> [[TMP1]], <8 x i1> [[TMP3]], <8 x i16> [[TMP4]])124// CHECK-NEXT: [[TMP6:%.*]] = bitcast <8 x i16> [[TMP5]] to <8 x half>125// CHECK-NEXT: ret <8 x half> [[TMP6]]126//127float16x8_t test_vandq_m_f16(float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p)128{129#ifdef POLYMORPHIC130 return vandq_m(inactive, a, b, p);131#else /* POLYMORPHIC */132 return vandq_m_f16(inactive, a, b, p);133#endif /* POLYMORPHIC */134}135 136// CHECK-LABEL: @test_vandq_x_u8(137// CHECK-NEXT: entry:138// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32139// CHECK-NEXT: [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])140// CHECK-NEXT: [[TMP2:%.*]] = call <16 x i8> @llvm.arm.mve.and.predicated.v16i8.v16i1(<16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]], <16 x i1> [[TMP1]], <16 x i8> undef)141// CHECK-NEXT: ret <16 x i8> [[TMP2]]142//143uint8x16_t test_vandq_x_u8(uint8x16_t a, uint8x16_t b, mve_pred16_t p)144{145#ifdef POLYMORPHIC146 return vandq_x(a, b, p);147#else /* POLYMORPHIC */148 return vandq_x_u8(a, b, p);149#endif /* POLYMORPHIC */150}151 152// CHECK-LABEL: @test_vandq_x_s16(153// CHECK-NEXT: entry:154// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32155// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])156// CHECK-NEXT: [[TMP2:%.*]] = call <8 x i16> @llvm.arm.mve.and.predicated.v8i16.v8i1(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], <8 x i1> [[TMP1]], <8 x i16> undef)157// CHECK-NEXT: ret <8 x i16> [[TMP2]]158//159int16x8_t test_vandq_x_s16(int16x8_t a, int16x8_t b, mve_pred16_t p)160{161#ifdef POLYMORPHIC162 return vandq_x(a, b, p);163#else /* POLYMORPHIC */164 return vandq_x_s16(a, b, p);165#endif /* POLYMORPHIC */166}167 168// CHECK-LABEL: @test_vandq_x_u32(169// CHECK-NEXT: entry:170// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32171// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])172// CHECK-NEXT: [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.and.predicated.v4i32.v4i1(<4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], <4 x i1> [[TMP1]], <4 x i32> undef)173// CHECK-NEXT: ret <4 x i32> [[TMP2]]174//175uint32x4_t test_vandq_x_u32(uint32x4_t a, uint32x4_t b, mve_pred16_t p)176{177#ifdef POLYMORPHIC178 return vandq_x(a, b, p);179#else /* POLYMORPHIC */180 return vandq_x_u32(a, b, p);181#endif /* POLYMORPHIC */182}183 184// CHECK-LABEL: @test_vandq_m_f32(185// CHECK-NEXT: entry:186// CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x float> [[A:%.*]] to <4 x i32>187// CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x float> [[B:%.*]] to <4 x i32>188// CHECK-NEXT: [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32189// CHECK-NEXT: [[TMP3:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP2]])190// CHECK-NEXT: [[TMP4:%.*]] = call <4 x i32> @llvm.arm.mve.and.predicated.v4i32.v4i1(<4 x i32> [[TMP0]], <4 x i32> [[TMP1]], <4 x i1> [[TMP3]], <4 x i32> undef)191// CHECK-NEXT: [[TMP5:%.*]] = bitcast <4 x i32> [[TMP4]] to <4 x float>192// CHECK-NEXT: ret <4 x float> [[TMP5]]193//194float32x4_t test_vandq_m_f32(float32x4_t a, float32x4_t b, mve_pred16_t p)195{196#ifdef POLYMORPHIC197 return vandq_x(a, b, p);198#else /* POLYMORPHIC */199 return vandq_x_f32(a, b, p);200#endif /* POLYMORPHIC */201}202