diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -3244,6 +3244,9 @@ if (auto *VecTy = QT->getAs()) QT = VecTy->getElementType(); + else if (QT->isVLSBuiltinType()) + QT = QT->getVLSEltType(getContext()); + if (QT->isIntegerType()) Result = Builder.CreateBinaryIntrinsic( llvm::Intrinsic::abs, EmitScalarExpr(E->getArg(0)), @@ -3319,6 +3322,9 @@ QualType Ty = E->getArg(0)->getType(); if (auto *VecTy = Ty->getAs()) Ty = VecTy->getElementType(); + else if (Ty->isVLSBuiltinType()) + Ty = Ty->getVLSEltType(getContext()); + bool IsSigned = Ty->isSignedIntegerType(); unsigned Opc; if (BuiltinIDIfNoAsmLabel == Builtin::BI__builtin_elementwise_add_sat) @@ -3337,6 +3343,9 @@ QualType Ty = E->getArg(0)->getType(); if (auto *VecTy = Ty->getAs()) Ty = VecTy->getElementType(); + else if (Ty->isVLSBuiltinType()) + Ty = Ty->getVLSEltType(getContext()); + Result = Builder.CreateBinaryIntrinsic(Ty->isSignedIntegerType() ? llvm::Intrinsic::smax : llvm::Intrinsic::umax, diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -2041,7 +2041,8 @@ // false. static bool checkMathBuiltinElementType(Sema &S, SourceLocation Loc, QualType Ty) { - if (!Ty->getAs() && !ConstantMatrixType::isValidElementType(Ty)) { + if (!Ty->isVLSBuiltinType() && !Ty->getAs() && + !ConstantMatrixType::isValidElementType(Ty)) { return S.Diag(Loc, diag::err_builtin_invalid_arg_type) << 1 << /* vector, integer or float ty*/ 0 << Ty; } @@ -2054,6 +2055,8 @@ QualType EltTy = ArgTy; if (auto *VecTy = EltTy->getAs()) EltTy = VecTy->getElementType(); + else if (EltTy->isVLSBuiltinType()) + EltTy = EltTy->getVLSEltType(S.Context); if (!EltTy->isRealFloatingType()) { return S.Diag(Loc, diag::err_builtin_invalid_arg_type) @@ -2618,6 +2621,9 @@ if (auto *VecTy = EltTy->getAs()) EltTy = VecTy->getElementType(); + else if (EltTy->isVLSBuiltinType()) + EltTy = EltTy->getVLSEltType(Context); + if (EltTy->isUnsignedIntegerType()) { Diag(TheCall->getArg(0)->getBeginLoc(), diag::err_builtin_invalid_arg_type) @@ -2688,6 +2694,8 @@ if (auto *VecTy = EltTy->getAs()) EltTy = VecTy->getElementType(); + else if (EltTy->isVLSBuiltinType()) + EltTy = EltTy->getVLSEltType(Context); if (!EltTy->isIntegerType()) { Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type) @@ -2713,6 +2721,8 @@ if (auto *VecTy = EltTy->getAs()) EltTy = VecTy->getElementType(); + else if (EltTy->isVLSBuiltinType()) + EltTy = EltTy->getVLSEltType(Context); if (!EltTy->isIntegerType()) { Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type) diff --git a/clang/test/CodeGen/aarch64-sve-vector-elementwise-ops.c b/clang/test/CodeGen/aarch64-sve-vector-elementwise-ops.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/aarch64-sve-vector-elementwise-ops.c @@ -0,0 +1,528 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \ +// RUN: -disable-O0-optnone \ +// RUN: -emit-llvm -o - %s | opt -S -passes=sroa | FileCheck %s + +// REQUIRES: aarch64-registered-target + +#include + +// CHECK-LABEL: @test_builtin_elementwise_abs( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_ABS:%.*]] = call @llvm.abs.nxv16i8( [[VI8:%.*]], i1 false) +// CHECK-NEXT: [[ELT_ABS1:%.*]] = call @llvm.abs.nxv8i16( [[VI16:%.*]], i1 false) +// CHECK-NEXT: [[ELT_ABS2:%.*]] = call @llvm.abs.nxv4i32( [[VI32:%.*]], i1 false) +// CHECK-NEXT: [[ELT_ABS3:%.*]] = call @llvm.abs.nxv2i64( [[VI64:%.*]], i1 false) +// CHECK-NEXT: [[ELT_ABS4:%.*]] = call @llvm.fabs.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_ABS5:%.*]] = call @llvm.fabs.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_ABS6:%.*]] = call @llvm.fabs.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_abs(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svint8_t res_vi8 = __builtin_elementwise_abs(vi8); + svint16_t res_vi16 = __builtin_elementwise_abs(vi16); + svint32_t res_vi32 = __builtin_elementwise_abs(vi32); + svint64_t res_vi64 = __builtin_elementwise_abs(vi64); + svfloat16_t res_vf16 = __builtin_elementwise_abs(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_abs(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_abs(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_add_sat( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_SAT:%.*]] = call @llvm.sadd.sat.nxv16i8( [[VI8:%.*]], [[VI8]]) +// CHECK-NEXT: [[ELT_SAT1:%.*]] = call @llvm.sadd.sat.nxv8i16( [[VI16:%.*]], [[VI16]]) +// CHECK-NEXT: [[ELT_SAT2:%.*]] = call @llvm.sadd.sat.nxv4i32( [[VI32:%.*]], [[VI32]]) +// CHECK-NEXT: [[ELT_SAT3:%.*]] = call @llvm.sadd.sat.nxv2i64( [[VI64:%.*]], [[VI64]]) +// CHECK-NEXT: [[ELT_SAT4:%.*]] = call @llvm.uadd.sat.nxv16i8( [[VU8:%.*]], [[VU8]]) +// CHECK-NEXT: [[ELT_SAT5:%.*]] = call @llvm.uadd.sat.nxv8i16( [[VU16:%.*]], [[VU16]]) +// CHECK-NEXT: [[ELT_SAT6:%.*]] = call @llvm.uadd.sat.nxv4i32( [[VU32:%.*]], [[VU32]]) +// CHECK-NEXT: [[ELT_SAT7:%.*]] = call @llvm.uadd.sat.nxv2i64( [[VU64:%.*]], [[VU64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_add_sat(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svint8_t res_vi8 = __builtin_elementwise_add_sat(vi8, vi8); + svint16_t res_vi16 = __builtin_elementwise_add_sat(vi16, vi16); + svint32_t res_vi32 = __builtin_elementwise_add_sat(vi32, vi32); + svint64_t res_vi64 = __builtin_elementwise_add_sat(vi64, vi64); + svuint8_t res_vu8 = __builtin_elementwise_add_sat(vu8, vu8); + svuint16_t res_vu16 = __builtin_elementwise_add_sat(vu16, vu16); + svuint32_t res_vu32 = __builtin_elementwise_add_sat(vu32, vu32); + svuint64_t res_vu64 = __builtin_elementwise_add_sat(vu64, vu64); +} + +// CHECK-LABEL: @test_builtin_elementwise_sub_sat( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_SAT:%.*]] = call @llvm.ssub.sat.nxv16i8( [[VI8:%.*]], [[VI8]]) +// CHECK-NEXT: [[ELT_SAT1:%.*]] = call @llvm.ssub.sat.nxv8i16( [[VI16:%.*]], [[VI16]]) +// CHECK-NEXT: [[ELT_SAT2:%.*]] = call @llvm.ssub.sat.nxv4i32( [[VI32:%.*]], [[VI32]]) +// CHECK-NEXT: [[ELT_SAT3:%.*]] = call @llvm.ssub.sat.nxv2i64( [[VI64:%.*]], [[VI64]]) +// CHECK-NEXT: [[ELT_SAT4:%.*]] = call @llvm.usub.sat.nxv16i8( [[VU8:%.*]], [[VU8]]) +// CHECK-NEXT: [[ELT_SAT5:%.*]] = call @llvm.usub.sat.nxv8i16( [[VU16:%.*]], [[VU16]]) +// CHECK-NEXT: [[ELT_SAT6:%.*]] = call @llvm.usub.sat.nxv4i32( [[VU32:%.*]], [[VU32]]) +// CHECK-NEXT: [[ELT_SAT7:%.*]] = call @llvm.usub.sat.nxv2i64( [[VU64:%.*]], [[VU64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_sub_sat(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svint8_t res_vi8 = __builtin_elementwise_sub_sat(vi8, vi8); + svint16_t res_vi16 = __builtin_elementwise_sub_sat(vi16, vi16); + svint32_t res_vi32 = __builtin_elementwise_sub_sat(vi32, vi32); + svint64_t res_vi64 = __builtin_elementwise_sub_sat(vi64, vi64); + svuint8_t res_vu8 = __builtin_elementwise_sub_sat(vu8, vu8); + svuint16_t res_vu16 = __builtin_elementwise_sub_sat(vu16, vu16); + svuint32_t res_vu32 = __builtin_elementwise_sub_sat(vu32, vu32); + svuint64_t res_vu64 = __builtin_elementwise_sub_sat(vu64, vu64); +} + +// CHECK-LABEL: @test_builtin_elementwise_max( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_MAX:%.*]] = call @llvm.smax.nxv16i8( [[VI8:%.*]], [[VI8]]) +// CHECK-NEXT: [[ELT_MAX1:%.*]] = call @llvm.smax.nxv8i16( [[VI16:%.*]], [[VI16]]) +// CHECK-NEXT: [[ELT_MAX2:%.*]] = call @llvm.smax.nxv4i32( [[VI32:%.*]], [[VI32]]) +// CHECK-NEXT: [[ELT_MAX3:%.*]] = call @llvm.smax.nxv2i64( [[VI64:%.*]], [[VI64]]) +// CHECK-NEXT: [[ELT_MAX4:%.*]] = call @llvm.umax.nxv16i8( [[VU8:%.*]], [[VU8]]) +// CHECK-NEXT: [[ELT_MAX5:%.*]] = call @llvm.umax.nxv8i16( [[VU16:%.*]], [[VU16]]) +// CHECK-NEXT: [[ELT_MAX6:%.*]] = call @llvm.umax.nxv4i32( [[VU32:%.*]], [[VU32]]) +// CHECK-NEXT: [[ELT_MAX7:%.*]] = call @llvm.umax.nxv2i64( [[VU64:%.*]], [[VU64]]) +// CHECK-NEXT: [[ELT_MAX8:%.*]] = call @llvm.maxnum.nxv8f16( [[VF16:%.*]], [[VF16]]) +// CHECK-NEXT: [[ELT_MAX9:%.*]] = call @llvm.maxnum.nxv4f32( [[VF32:%.*]], [[VF32]]) +// CHECK-NEXT: [[ELT_MAX10:%.*]] = call @llvm.maxnum.nxv2f64( [[VF64:%.*]], [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_max(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svint8_t res_vi8 = __builtin_elementwise_max(vi8, vi8); + svint16_t res_vi16 = __builtin_elementwise_max(vi16, vi16); + svint32_t res_vi32 = __builtin_elementwise_max(vi32, vi32); + svint64_t res_vi64 = __builtin_elementwise_max(vi64, vi64); + svuint8_t res_vu8 = __builtin_elementwise_max(vu8, vu8); + svuint16_t res_vu16 = __builtin_elementwise_max(vu16, vu16); + svuint32_t res_vu32 = __builtin_elementwise_max(vu32, vu32); + svuint64_t res_vu64 = __builtin_elementwise_max(vu64, vu64); + svfloat16_t res_vf16 = __builtin_elementwise_max(vf16, vf16); + svfloat32_t res_vf32 = __builtin_elementwise_max(vf32, vf32); + svfloat64_t res_vf64 = __builtin_elementwise_max(vf64, vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_min( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_MIN:%.*]] = call @llvm.umin.nxv16i8( [[VI8:%.*]], [[VI8]]) +// CHECK-NEXT: [[ELT_MIN1:%.*]] = call @llvm.umin.nxv8i16( [[VI16:%.*]], [[VI16]]) +// CHECK-NEXT: [[ELT_MIN2:%.*]] = call @llvm.umin.nxv4i32( [[VI32:%.*]], [[VI32]]) +// CHECK-NEXT: [[ELT_MIN3:%.*]] = call @llvm.umin.nxv2i64( [[VI64:%.*]], [[VI64]]) +// CHECK-NEXT: [[ELT_MIN4:%.*]] = call @llvm.umin.nxv16i8( [[VU8:%.*]], [[VU8]]) +// CHECK-NEXT: [[ELT_MIN5:%.*]] = call @llvm.umin.nxv8i16( [[VU16:%.*]], [[VU16]]) +// CHECK-NEXT: [[ELT_MIN6:%.*]] = call @llvm.umin.nxv4i32( [[VU32:%.*]], [[VU32]]) +// CHECK-NEXT: [[ELT_MIN7:%.*]] = call @llvm.umin.nxv2i64( [[VU64:%.*]], [[VU64]]) +// CHECK-NEXT: [[ELT_MIN8:%.*]] = call @llvm.minnum.nxv8f16( [[VF16:%.*]], [[VF16]]) +// CHECK-NEXT: [[ELT_MIN9:%.*]] = call @llvm.minnum.nxv4f32( [[VF32:%.*]], [[VF32]]) +// CHECK-NEXT: [[ELT_MIN10:%.*]] = call @llvm.minnum.nxv2f64( [[VF64:%.*]], [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_min(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svint8_t res_vi8 = __builtin_elementwise_min(vi8, vi8); + svint16_t res_vi16 = __builtin_elementwise_min(vi16, vi16); + svint32_t res_vi32 = __builtin_elementwise_min(vi32, vi32); + svint64_t res_vi64 = __builtin_elementwise_min(vi64, vi64); + svuint8_t res_vu8 = __builtin_elementwise_min(vu8, vu8); + svuint16_t res_vu16 = __builtin_elementwise_min(vu16, vu16); + svuint32_t res_vu32 = __builtin_elementwise_min(vu32, vu32); + svuint64_t res_vu64 = __builtin_elementwise_min(vu64, vu64); + svfloat16_t res_vf16 = __builtin_elementwise_min(vf16, vf16); + svfloat32_t res_vf32 = __builtin_elementwise_min(vf32, vf32); + svfloat64_t res_vf64 = __builtin_elementwise_min(vf64, vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_bitreverse( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_BITREVERSE:%.*]] = call @llvm.bitreverse.nxv16i8( [[VI8:%.*]]) +// CHECK-NEXT: [[ELT_BITREVERSE1:%.*]] = call @llvm.bitreverse.nxv8i16( [[VI16:%.*]]) +// CHECK-NEXT: [[ELT_BITREVERSE2:%.*]] = call @llvm.bitreverse.nxv4i32( [[VI32:%.*]]) +// CHECK-NEXT: [[ELT_BITREVERSE3:%.*]] = call @llvm.bitreverse.nxv2i64( [[VI64:%.*]]) +// CHECK-NEXT: [[ELT_BITREVERSE4:%.*]] = call @llvm.bitreverse.nxv16i8( [[VU8:%.*]]) +// CHECK-NEXT: [[ELT_BITREVERSE5:%.*]] = call @llvm.bitreverse.nxv8i16( [[VU16:%.*]]) +// CHECK-NEXT: [[ELT_BITREVERSE6:%.*]] = call @llvm.bitreverse.nxv4i32( [[VU32:%.*]]) +// CHECK-NEXT: [[ELT_BITREVERSE7:%.*]] = call @llvm.bitreverse.nxv2i64( [[VU64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_bitreverse(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svint8_t res_vi8 = __builtin_elementwise_bitreverse(vi8); + svint16_t res_vi16 = __builtin_elementwise_bitreverse(vi16); + svint32_t res_vi32 = __builtin_elementwise_bitreverse(vi32); + svint64_t res_vi64 = __builtin_elementwise_bitreverse(vi64); + svuint8_t res_vu8 = __builtin_elementwise_bitreverse(vu8); + svuint16_t res_vu16 = __builtin_elementwise_bitreverse(vu16); + svuint32_t res_vu32 = __builtin_elementwise_bitreverse(vu32); + svuint64_t res_vu64 = __builtin_elementwise_bitreverse(vu64); +} + +// CHECK-LABEL: @test_builtin_elementwise_ceil( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_CEIL:%.*]] = call @llvm.ceil.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_CEIL1:%.*]] = call @llvm.ceil.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_CEIL2:%.*]] = call @llvm.ceil.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_ceil(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_ceil(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_ceil(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_ceil(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_cos( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_COS:%.*]] = call @llvm.cos.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_COS1:%.*]] = call @llvm.cos.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_COS2:%.*]] = call @llvm.cos.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_cos(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_cos(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_cos(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_cos(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_exp( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_EXP:%.*]] = call @llvm.exp.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_EXP1:%.*]] = call @llvm.exp.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_EXP2:%.*]] = call @llvm.exp.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_exp(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_exp(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_exp(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_exp(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_exp2( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_EXP2:%.*]] = call @llvm.exp2.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_EXP21:%.*]] = call @llvm.exp2.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_EXP22:%.*]] = call @llvm.exp2.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_exp2(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_exp2(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_exp2(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_exp2(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_floor( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_FLOOR:%.*]] = call @llvm.floor.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_FLOOR1:%.*]] = call @llvm.floor.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_FLOOR2:%.*]] = call @llvm.floor.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_floor(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_floor(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_floor(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_floor(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_log( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_LOG:%.*]] = call @llvm.log.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_LOG1:%.*]] = call @llvm.log.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_LOG2:%.*]] = call @llvm.log.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_log(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_log(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_log(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_log(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_log10( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_LOG10:%.*]] = call @llvm.log10.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_LOG101:%.*]] = call @llvm.log10.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_LOG102:%.*]] = call @llvm.log10.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_log10(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_log10(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_log10(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_log10(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_log2( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_LOG2:%.*]] = call @llvm.log2.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_LOG21:%.*]] = call @llvm.log2.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_LOG22:%.*]] = call @llvm.log2.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_log2(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_log2(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_log2(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_log2(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_pow( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = call @llvm.pow.nxv8f16( [[VF16:%.*]], [[VF16]]) +// CHECK-NEXT: [[TMP1:%.*]] = call @llvm.pow.nxv4f32( [[VF32:%.*]], [[VF32]]) +// CHECK-NEXT: [[TMP2:%.*]] = call @llvm.pow.nxv2f64( [[VF64:%.*]], [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_pow(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_pow(vf16, vf16); + svfloat32_t res_vf32 = __builtin_elementwise_pow(vf32, vf32); + svfloat64_t res_vf64 = __builtin_elementwise_pow(vf64, vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_roundeven( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_ROUNDEVEN:%.*]] = call @llvm.roundeven.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_ROUNDEVEN1:%.*]] = call @llvm.roundeven.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_ROUNDEVEN2:%.*]] = call @llvm.roundeven.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_roundeven(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_roundeven(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_roundeven(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_roundeven(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_round( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_ROUND:%.*]] = call @llvm.round.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_ROUND1:%.*]] = call @llvm.round.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_ROUND2:%.*]] = call @llvm.round.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_round(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_round(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_round(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_round(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_rint( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_RINT:%.*]] = call @llvm.rint.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_RINT1:%.*]] = call @llvm.rint.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_RINT2:%.*]] = call @llvm.rint.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_rint(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_rint(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_rint(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_rint(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_nearbyint( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_NEARBYINT:%.*]] = call @llvm.nearbyint.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_NEARBYINT1:%.*]] = call @llvm.nearbyint.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_NEARBYINT2:%.*]] = call @llvm.nearbyint.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_nearbyint(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_nearbyint(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_nearbyint(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_nearbyint(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_sin( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_SIN:%.*]] = call @llvm.sin.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_SIN1:%.*]] = call @llvm.sin.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_SIN2:%.*]] = call @llvm.sin.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_sin(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_sin(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_sin(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_sin(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_sqrt( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = call @llvm.sqrt.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[TMP1:%.*]] = call @llvm.sqrt.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[TMP2:%.*]] = call @llvm.sqrt.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_sqrt(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_sqrt(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_sqrt(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_sqrt(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_trunc( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_TRUNC:%.*]] = call @llvm.trunc.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_TRUNC1:%.*]] = call @llvm.trunc.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_TRUNC2:%.*]] = call @llvm.trunc.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_trunc(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_trunc(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_trunc(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_trunc(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_canonicalize( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_CANONICALIZE:%.*]] = call @llvm.canonicalize.nxv8f16( [[VF16:%.*]]) +// CHECK-NEXT: [[ELT_CANONICALIZE1:%.*]] = call @llvm.canonicalize.nxv4f32( [[VF32:%.*]]) +// CHECK-NEXT: [[ELT_CANONICALIZE2:%.*]] = call @llvm.canonicalize.nxv2f64( [[VF64:%.*]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_canonicalize(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_canonicalize(vf16); + svfloat32_t res_vf32 = __builtin_elementwise_canonicalize(vf32); + svfloat64_t res_vf64 = __builtin_elementwise_canonicalize(vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_copysign( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = call @llvm.copysign.nxv8f16( [[VF16:%.*]], [[VF16]]) +// CHECK-NEXT: [[TMP1:%.*]] = call @llvm.copysign.nxv4f32( [[VF32:%.*]], [[VF32]]) +// CHECK-NEXT: [[TMP2:%.*]] = call @llvm.copysign.nxv2f64( [[VF64:%.*]], [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_copysign(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_copysign(vf16, vf16); + svfloat32_t res_vf32 = __builtin_elementwise_copysign(vf32, vf32); + svfloat64_t res_vf64 = __builtin_elementwise_copysign(vf64, vf64); +} + +// CHECK-LABEL: @test_builtin_elementwise_fma( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = call @llvm.fma.nxv8f16( [[VF16:%.*]], [[VF16]], [[VF16]]) +// CHECK-NEXT: [[TMP1:%.*]] = call @llvm.fma.nxv4f32( [[VF32:%.*]], [[VF32]], [[VF32]]) +// CHECK-NEXT: [[TMP2:%.*]] = call @llvm.fma.nxv2f64( [[VF64:%.*]], [[VF64]], [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_fma(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_fma(vf16, vf16, vf16); + svfloat32_t res_vf32 = __builtin_elementwise_fma(vf32, vf32, vf32); + svfloat64_t res_vf64 = __builtin_elementwise_fma(vf64, vf64, vf64); +} diff --git a/clang/test/CodeGen/riscv-rvv-vector-elementwise-ops.c b/clang/test/CodeGen/riscv-rvv-vector-elementwise-ops.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/riscv-rvv-vector-elementwise-ops.c @@ -0,0 +1,553 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// RUN: %clang_cc1 -triple riscv64-none-linux-gnu -target-feature +zve64d \ +// RUN: -target-feature +f -target-feature +d -target-feature +zvfh -target-feature +zfh -disable-O0-optnone \ +// RUN: -mvscale-min=4 -mvscale-max=4 -emit-llvm -o - %s | \ +// RUN: opt -S -passes=sroa | FileCheck %s +// REQUIRES: riscv-registered-target + +#include + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_abs +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_ABS:%.*]] = call @llvm.abs.nxv8i8( [[VI8]], i1 false) +// CHECK-NEXT: [[ELT_ABS1:%.*]] = call @llvm.abs.nxv4i16( [[VI16]], i1 false) +// CHECK-NEXT: [[ELT_ABS2:%.*]] = call @llvm.abs.nxv2i32( [[VI32]], i1 false) +// CHECK-NEXT: [[ELT_ABS3:%.*]] = call @llvm.abs.nxv1i64( [[VI64]], i1 false) +// CHECK-NEXT: [[ELT_ABS4:%.*]] = call @llvm.fabs.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_ABS5:%.*]] = call @llvm.fabs.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_ABS6:%.*]] = call @llvm.fabs.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_abs(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vint8m1_t res_vi8 = __builtin_elementwise_abs(vi8); + vint16m1_t res_vi16 = __builtin_elementwise_abs(vi16); + vint32m1_t res_vi32 = __builtin_elementwise_abs(vi32); + vint64m1_t res_vi64 = __builtin_elementwise_abs(vi64); + vfloat16m1_t res_vf16 = __builtin_elementwise_abs(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_abs(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_abs(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_add_sat +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_SAT:%.*]] = call @llvm.sadd.sat.nxv8i8( [[VI8]], [[VI8]]) +// CHECK-NEXT: [[ELT_SAT1:%.*]] = call @llvm.sadd.sat.nxv4i16( [[VI16]], [[VI16]]) +// CHECK-NEXT: [[ELT_SAT2:%.*]] = call @llvm.sadd.sat.nxv2i32( [[VI32]], [[VI32]]) +// CHECK-NEXT: [[ELT_SAT3:%.*]] = call @llvm.sadd.sat.nxv1i64( [[VI64]], [[VI64]]) +// CHECK-NEXT: [[ELT_SAT4:%.*]] = call @llvm.uadd.sat.nxv8i8( [[VU8]], [[VU8]]) +// CHECK-NEXT: [[ELT_SAT5:%.*]] = call @llvm.uadd.sat.nxv4i16( [[VU16]], [[VU16]]) +// CHECK-NEXT: [[ELT_SAT6:%.*]] = call @llvm.uadd.sat.nxv2i32( [[VU32]], [[VU32]]) +// CHECK-NEXT: [[ELT_SAT7:%.*]] = call @llvm.uadd.sat.nxv1i64( [[VU64]], [[VU64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_add_sat(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vint8m1_t res_vi8 = __builtin_elementwise_add_sat(vi8, vi8); + vint16m1_t res_vi16 = __builtin_elementwise_add_sat(vi16, vi16); + vint32m1_t res_vi32 = __builtin_elementwise_add_sat(vi32, vi32); + vint64m1_t res_vi64 = __builtin_elementwise_add_sat(vi64, vi64); + vuint8m1_t res_vu8 = __builtin_elementwise_add_sat(vu8, vu8); + vuint16m1_t res_vu16 = __builtin_elementwise_add_sat(vu16, vu16); + vuint32m1_t res_vu32 = __builtin_elementwise_add_sat(vu32, vu32); + vuint64m1_t res_vu64 = __builtin_elementwise_add_sat(vu64, vu64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_sub_sat +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_SAT:%.*]] = call @llvm.ssub.sat.nxv8i8( [[VI8]], [[VI8]]) +// CHECK-NEXT: [[ELT_SAT1:%.*]] = call @llvm.ssub.sat.nxv4i16( [[VI16]], [[VI16]]) +// CHECK-NEXT: [[ELT_SAT2:%.*]] = call @llvm.ssub.sat.nxv2i32( [[VI32]], [[VI32]]) +// CHECK-NEXT: [[ELT_SAT3:%.*]] = call @llvm.ssub.sat.nxv1i64( [[VI64]], [[VI64]]) +// CHECK-NEXT: [[ELT_SAT4:%.*]] = call @llvm.usub.sat.nxv8i8( [[VU8]], [[VU8]]) +// CHECK-NEXT: [[ELT_SAT5:%.*]] = call @llvm.usub.sat.nxv4i16( [[VU16]], [[VU16]]) +// CHECK-NEXT: [[ELT_SAT6:%.*]] = call @llvm.usub.sat.nxv2i32( [[VU32]], [[VU32]]) +// CHECK-NEXT: [[ELT_SAT7:%.*]] = call @llvm.usub.sat.nxv1i64( [[VU64]], [[VU64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_sub_sat(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vint8m1_t res_vi8 = __builtin_elementwise_sub_sat(vi8, vi8); + vint16m1_t res_vi16 = __builtin_elementwise_sub_sat(vi16, vi16); + vint32m1_t res_vi32 = __builtin_elementwise_sub_sat(vi32, vi32); + vint64m1_t res_vi64 = __builtin_elementwise_sub_sat(vi64, vi64); + vuint8m1_t res_vu8 = __builtin_elementwise_sub_sat(vu8, vu8); + vuint16m1_t res_vu16 = __builtin_elementwise_sub_sat(vu16, vu16); + vuint32m1_t res_vu32 = __builtin_elementwise_sub_sat(vu32, vu32); + vuint64m1_t res_vu64 = __builtin_elementwise_sub_sat(vu64, vu64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_max +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_MAX:%.*]] = call @llvm.smax.nxv8i8( [[VI8]], [[VI8]]) +// CHECK-NEXT: [[ELT_MAX1:%.*]] = call @llvm.smax.nxv4i16( [[VI16]], [[VI16]]) +// CHECK-NEXT: [[ELT_MAX2:%.*]] = call @llvm.smax.nxv2i32( [[VI32]], [[VI32]]) +// CHECK-NEXT: [[ELT_MAX3:%.*]] = call @llvm.smax.nxv1i64( [[VI64]], [[VI64]]) +// CHECK-NEXT: [[ELT_MAX4:%.*]] = call @llvm.umax.nxv8i8( [[VU8]], [[VU8]]) +// CHECK-NEXT: [[ELT_MAX5:%.*]] = call @llvm.umax.nxv4i16( [[VU16]], [[VU16]]) +// CHECK-NEXT: [[ELT_MAX6:%.*]] = call @llvm.umax.nxv2i32( [[VU32]], [[VU32]]) +// CHECK-NEXT: [[ELT_MAX7:%.*]] = call @llvm.umax.nxv1i64( [[VU64]], [[VU64]]) +// CHECK-NEXT: [[ELT_MAX8:%.*]] = call @llvm.maxnum.nxv4f16( [[VF16]], [[VF16]]) +// CHECK-NEXT: [[ELT_MAX9:%.*]] = call @llvm.maxnum.nxv2f32( [[VF32]], [[VF32]]) +// CHECK-NEXT: [[ELT_MAX10:%.*]] = call @llvm.maxnum.nxv1f64( [[VF64]], [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_max(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vint8m1_t res_vi8 = __builtin_elementwise_max(vi8, vi8); + vint16m1_t res_vi16 = __builtin_elementwise_max(vi16, vi16); + vint32m1_t res_vi32 = __builtin_elementwise_max(vi32, vi32); + vint64m1_t res_vi64 = __builtin_elementwise_max(vi64, vi64); + vuint8m1_t res_vu8 = __builtin_elementwise_max(vu8, vu8); + vuint16m1_t res_vu16 = __builtin_elementwise_max(vu16, vu16); + vuint32m1_t res_vu32 = __builtin_elementwise_max(vu32, vu32); + vuint64m1_t res_vu64 = __builtin_elementwise_max(vu64, vu64); + vfloat16m1_t res_vf16 = __builtin_elementwise_max(vf16, vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_max(vf32, vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_max(vf64, vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_min +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_MIN:%.*]] = call @llvm.umin.nxv8i8( [[VI8]], [[VI8]]) +// CHECK-NEXT: [[ELT_MIN1:%.*]] = call @llvm.umin.nxv4i16( [[VI16]], [[VI16]]) +// CHECK-NEXT: [[ELT_MIN2:%.*]] = call @llvm.umin.nxv2i32( [[VI32]], [[VI32]]) +// CHECK-NEXT: [[ELT_MIN3:%.*]] = call @llvm.umin.nxv1i64( [[VI64]], [[VI64]]) +// CHECK-NEXT: [[ELT_MIN4:%.*]] = call @llvm.umin.nxv8i8( [[VU8]], [[VU8]]) +// CHECK-NEXT: [[ELT_MIN5:%.*]] = call @llvm.umin.nxv4i16( [[VU16]], [[VU16]]) +// CHECK-NEXT: [[ELT_MIN6:%.*]] = call @llvm.umin.nxv2i32( [[VU32]], [[VU32]]) +// CHECK-NEXT: [[ELT_MIN7:%.*]] = call @llvm.umin.nxv1i64( [[VU64]], [[VU64]]) +// CHECK-NEXT: [[ELT_MIN8:%.*]] = call @llvm.minnum.nxv4f16( [[VF16]], [[VF16]]) +// CHECK-NEXT: [[ELT_MIN9:%.*]] = call @llvm.minnum.nxv2f32( [[VF32]], [[VF32]]) +// CHECK-NEXT: [[ELT_MIN10:%.*]] = call @llvm.minnum.nxv1f64( [[VF64]], [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_min(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vint8m1_t res_vi8 = __builtin_elementwise_min(vi8, vi8); + vint16m1_t res_vi16 = __builtin_elementwise_min(vi16, vi16); + vint32m1_t res_vi32 = __builtin_elementwise_min(vi32, vi32); + vint64m1_t res_vi64 = __builtin_elementwise_min(vi64, vi64); + vuint8m1_t res_vu8 = __builtin_elementwise_min(vu8, vu8); + vuint16m1_t res_vu16 = __builtin_elementwise_min(vu16, vu16); + vuint32m1_t res_vu32 = __builtin_elementwise_min(vu32, vu32); + vuint64m1_t res_vu64 = __builtin_elementwise_min(vu64, vu64); + vfloat16m1_t res_vf16 = __builtin_elementwise_min(vf16, vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_min(vf32, vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_min(vf64, vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_bitreverse +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_BITREVERSE:%.*]] = call @llvm.bitreverse.nxv8i8( [[VI8]]) +// CHECK-NEXT: [[ELT_BITREVERSE1:%.*]] = call @llvm.bitreverse.nxv4i16( [[VI16]]) +// CHECK-NEXT: [[ELT_BITREVERSE2:%.*]] = call @llvm.bitreverse.nxv2i32( [[VI32]]) +// CHECK-NEXT: [[ELT_BITREVERSE3:%.*]] = call @llvm.bitreverse.nxv1i64( [[VI64]]) +// CHECK-NEXT: [[ELT_BITREVERSE4:%.*]] = call @llvm.bitreverse.nxv8i8( [[VU8]]) +// CHECK-NEXT: [[ELT_BITREVERSE5:%.*]] = call @llvm.bitreverse.nxv4i16( [[VU16]]) +// CHECK-NEXT: [[ELT_BITREVERSE6:%.*]] = call @llvm.bitreverse.nxv2i32( [[VU32]]) +// CHECK-NEXT: [[ELT_BITREVERSE7:%.*]] = call @llvm.bitreverse.nxv1i64( [[VU64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_bitreverse(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vint8m1_t res_vi8 = __builtin_elementwise_bitreverse(vi8); + vint16m1_t res_vi16 = __builtin_elementwise_bitreverse(vi16); + vint32m1_t res_vi32 = __builtin_elementwise_bitreverse(vi32); + vint64m1_t res_vi64 = __builtin_elementwise_bitreverse(vi64); + vuint8m1_t res_vu8 = __builtin_elementwise_bitreverse(vu8); + vuint16m1_t res_vu16 = __builtin_elementwise_bitreverse(vu16); + vuint32m1_t res_vu32 = __builtin_elementwise_bitreverse(vu32); + vuint64m1_t res_vu64 = __builtin_elementwise_bitreverse(vu64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_ceil +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_CEIL:%.*]] = call @llvm.ceil.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_CEIL1:%.*]] = call @llvm.ceil.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_CEIL2:%.*]] = call @llvm.ceil.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_ceil(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_ceil(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_ceil(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_ceil(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_cos +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_COS:%.*]] = call @llvm.cos.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_COS1:%.*]] = call @llvm.cos.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_COS2:%.*]] = call @llvm.cos.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_cos(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_cos(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_cos(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_cos(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_exp +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_EXP:%.*]] = call @llvm.exp.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_EXP1:%.*]] = call @llvm.exp.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_EXP2:%.*]] = call @llvm.exp.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_exp(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_exp(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_exp(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_exp(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_exp2 +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_EXP2:%.*]] = call @llvm.exp2.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_EXP21:%.*]] = call @llvm.exp2.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_EXP22:%.*]] = call @llvm.exp2.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_exp2(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_exp2(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_exp2(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_exp2(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_floor +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_FLOOR:%.*]] = call @llvm.floor.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_FLOOR1:%.*]] = call @llvm.floor.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_FLOOR2:%.*]] = call @llvm.floor.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_floor(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_floor(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_floor(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_floor(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_log +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_LOG:%.*]] = call @llvm.log.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_LOG1:%.*]] = call @llvm.log.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_LOG2:%.*]] = call @llvm.log.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_log(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_log(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_log(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_log(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_log10 +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_LOG10:%.*]] = call @llvm.log10.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_LOG101:%.*]] = call @llvm.log10.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_LOG102:%.*]] = call @llvm.log10.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_log10(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_log10(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_log10(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_log10(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_log2 +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_LOG2:%.*]] = call @llvm.log2.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_LOG21:%.*]] = call @llvm.log2.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_LOG22:%.*]] = call @llvm.log2.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_log2(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_log2(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_log2(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_log2(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_pow +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = call @llvm.pow.nxv4f16( [[VF16]], [[VF16]]) +// CHECK-NEXT: [[TMP1:%.*]] = call @llvm.pow.nxv2f32( [[VF32]], [[VF32]]) +// CHECK-NEXT: [[TMP2:%.*]] = call @llvm.pow.nxv1f64( [[VF64]], [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_pow(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_pow(vf16, vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_pow(vf32, vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_pow(vf64, vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_roundeven +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_ROUNDEVEN:%.*]] = call @llvm.roundeven.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_ROUNDEVEN1:%.*]] = call @llvm.roundeven.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_ROUNDEVEN2:%.*]] = call @llvm.roundeven.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_roundeven(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_roundeven(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_roundeven(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_roundeven(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_round +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_ROUND:%.*]] = call @llvm.round.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_ROUND1:%.*]] = call @llvm.round.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_ROUND2:%.*]] = call @llvm.round.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_round(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_round(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_round(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_round(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_rint +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_RINT:%.*]] = call @llvm.rint.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_RINT1:%.*]] = call @llvm.rint.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_RINT2:%.*]] = call @llvm.rint.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_rint(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_rint(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_rint(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_rint(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_nearbyint +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_NEARBYINT:%.*]] = call @llvm.nearbyint.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_NEARBYINT1:%.*]] = call @llvm.nearbyint.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_NEARBYINT2:%.*]] = call @llvm.nearbyint.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_nearbyint(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_nearbyint(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_nearbyint(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_nearbyint(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_sin +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_SIN:%.*]] = call @llvm.sin.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_SIN1:%.*]] = call @llvm.sin.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_SIN2:%.*]] = call @llvm.sin.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_sin(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_sin(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_sin(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_sin(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_sqrt +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = call @llvm.sqrt.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[TMP1:%.*]] = call @llvm.sqrt.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[TMP2:%.*]] = call @llvm.sqrt.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_sqrt(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_sqrt(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_sqrt(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_sqrt(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_trunc +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_TRUNC:%.*]] = call @llvm.trunc.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_TRUNC1:%.*]] = call @llvm.trunc.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_TRUNC2:%.*]] = call @llvm.trunc.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_trunc(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_trunc(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_trunc(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_trunc(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_canonicalize +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ELT_CANONICALIZE:%.*]] = call @llvm.canonicalize.nxv4f16( [[VF16]]) +// CHECK-NEXT: [[ELT_CANONICALIZE1:%.*]] = call @llvm.canonicalize.nxv2f32( [[VF32]]) +// CHECK-NEXT: [[ELT_CANONICALIZE2:%.*]] = call @llvm.canonicalize.nxv1f64( [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_canonicalize(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_canonicalize(vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_canonicalize(vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_canonicalize(vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_copysign +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = call @llvm.copysign.nxv4f16( [[VF16]], [[VF16]]) +// CHECK-NEXT: [[TMP1:%.*]] = call @llvm.copysign.nxv2f32( [[VF32]], [[VF32]]) +// CHECK-NEXT: [[TMP2:%.*]] = call @llvm.copysign.nxv1f64( [[VF64]], [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_copysign(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_copysign(vf16, vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_copysign(vf32, vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_copysign(vf64, vf64); +} + +// CHECK-LABEL: define dso_local void @test_builtin_elementwise_fma +// CHECK-SAME: ( [[VI8:%.*]], [[VI16:%.*]], [[VI32:%.*]], [[VI64:%.*]], [[VU8:%.*]], [[VU16:%.*]], [[VU32:%.*]], [[VU64:%.*]], [[VF16:%.*]], [[VF32:%.*]], [[VF64:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: [[TMP0:%.*]] = call @llvm.fma.nxv4f16( [[VF16]], [[VF16]], [[VF16]]) +// CHECK-NEXT: [[TMP1:%.*]] = call @llvm.fma.nxv2f32( [[VF32]], [[VF32]], [[VF32]]) +// CHECK-NEXT: [[TMP2:%.*]] = call @llvm.fma.nxv1f64( [[VF64]], [[VF64]], [[VF64]]) +// CHECK-NEXT: ret void +// +void test_builtin_elementwise_fma(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_fma(vf16, vf16, vf16); + vfloat32m1_t res_vf32 = __builtin_elementwise_fma(vf32, vf32, vf32); + vfloat64m1_t res_vf64 = __builtin_elementwise_fma(vf64, vf64, vf64); +} diff --git a/clang/test/Sema/aarch64-sve-vector-elementwise.c b/clang/test/Sema/aarch64-sve-vector-elementwise.c new file mode 100644 --- /dev/null +++ b/clang/test/Sema/aarch64-sve-vector-elementwise.c @@ -0,0 +1,519 @@ +// RUN: %clang_cc1 -verify -triple aarch64-none-linux-gnu -target-feature +sve -fsyntax-only %s + +// REQUIRES: aarch64-registered-target + +#include + +void test_builtin_elementwise_abs(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_abs(vu8); + // expected-error@-1 {{1st argument must be a signed integer or floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_abs(vu16); + // expected-error@-1 {{1st argument must be a signed integer or floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_abs(vu32); + // expected-error@-1 {{1st argument must be a signed integer or floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_abs(vu64); + // expected-error@-1 {{1st argument must be a signed integer or floating point type}} +} + +void test_builtin_elementwise_add_sat(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_add_sat(vf16, vf16); + // expected-error@-1 {{1st argument must be a vector of integers}} + svfloat32_t res_vf32 = __builtin_elementwise_add_sat(vf32, vf32); + // expected-error@-1 {{1st argument must be a vector of integers}} + svfloat64_t res_vf64 = __builtin_elementwise_add_sat(vf64, vf64); + // expected-error@-1 {{1st argument must be a vector of integers}} +} + +void test_builtin_elementwise_sub_sat(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_sub_sat(vf16, vf16); + // expected-error@-1 {{1st argument must be a vector of integers}} + svfloat32_t res_vf32 = __builtin_elementwise_sub_sat(vf32, vf32); + // expected-error@-1 {{1st argument must be a vector of integers}} + svfloat64_t res_vf64 = __builtin_elementwise_sub_sat(vf64, vf64); + // expected-error@-1 {{1st argument must be a vector of integers}} +} + +void test_builtin_elementwise_bitreverse(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svfloat16_t res_vf16 = __builtin_elementwise_bitreverse(vf16); + // expected-error@-1 {{1st argument must be a vector of integers}} + svfloat32_t res_vf32 = __builtin_elementwise_bitreverse(vf32); + // expected-error@-1 {{1st argument must be a vector of integers}} + svfloat64_t res_vf64 = __builtin_elementwise_bitreverse(vf64); + // expected-error@-1 {{1st argument must be a vector of integers}} +} + +void test_builtin_elementwise_ceil(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_ceil(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_ceil(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_ceil(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_ceil(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_ceil(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_ceil(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_ceil(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_ceil(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_cos(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_cos(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_cos(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_cos(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_cos(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_cos(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_cos(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_cos(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_cos(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_exp(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_exp(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_exp(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_exp(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_exp(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_exp(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_exp(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_exp(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_exp(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_exp2(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_exp2(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_exp2(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_exp2(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_exp2(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_exp2(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_exp2(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_exp2(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_exp2(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_floor(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_floor(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_floor(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_floor(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_floor(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_floor(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_floor(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_floor(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_floor(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_log(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_log(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_log(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_log(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_log(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_log(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_log(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_log(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_log(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_log10(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_log10(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_log10(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_log10(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_log10(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_log10(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_log10(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_log10(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_log10(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_log2(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_log2(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_log2(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_log2(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_log2(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_log2(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_log2(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_log2(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_log2(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_pow(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_pow(vu8, vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_pow(vu16, vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_pow(vu32, vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_pow(vu64, vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_pow(vi8, vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_pow(vi16, vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_pow(vi32, vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_pow(vi64, vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_roundeven(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_roundeven(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_roundeven(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_roundeven(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_roundeven(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_roundeven(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_roundeven(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_roundeven(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_roundeven(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_round(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_round(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_round(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_round(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_round(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_round(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_round(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_round(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_round(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_rint(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_rint(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_rint(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_rint(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_rint(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_rint(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_rint(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_rint(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_rint(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_nearbyint(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_nearbyint(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_nearbyint(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_nearbyint(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_nearbyint(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_nearbyint(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_nearbyint(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_nearbyint(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_nearbyint(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_sin(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_sin(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_sin(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_sin(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_sin(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_sin(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_sin(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_sin(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_sin(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_sqrt(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_sqrt(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_sqrt(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_sqrt(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_sqrt(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_sqrt(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_sqrt(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_sqrt(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_sqrt(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_trunc(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_trunc(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_trunc(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_trunc(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_trunc(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_trunc(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_trunc(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_trunc(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_trunc(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_canonicalize(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_canonicalize(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_canonicalize(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_canonicalize(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_canonicalize(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_canonicalize(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_canonicalize(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_canonicalize(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_canonicalize(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_copysign(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_copysign(vu8, vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_copysign(vu16, vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_copysign(vu32, vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_copysign(vu64, vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_copysign(vi8, vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_copysign(vi16, vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_copysign(vi32, vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_copysign(vi64, vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_fma(svint8_t vi8, svint16_t vi16, + svint32_t vi32, svint64_t vi64, + svuint8_t vu8, svuint16_t vu16, + svuint32_t vu32, svuint64_t vu64, + svfloat16_t vf16, svfloat32_t vf32, + svfloat64_t vf64) { + svuint8_t res_vu8 = __builtin_elementwise_fma(vu8, vu8, vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vu16 = __builtin_elementwise_fma(vu16, vu16, vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vu32 = __builtin_elementwise_fma(vu32, vu32, vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vu64 = __builtin_elementwise_fma(vu64, vu64, vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint8_t res_vi8 = __builtin_elementwise_fma(vi8, vi8, vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint16_t res_vi16 = __builtin_elementwise_fma(vi16, vi16, vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint32_t res_vi32 = __builtin_elementwise_fma(vi32, vi32, vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + svuint64_t res_vi64 = __builtin_elementwise_fma(vi64, vi64, vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} diff --git a/clang/test/Sema/aarch64-sve-vector-exp-ops.c b/clang/test/Sema/aarch64-sve-vector-exp-ops.c deleted file mode 100644 --- a/clang/test/Sema/aarch64-sve-vector-exp-ops.c +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: %clang_cc1 -triple aarch64 -target-feature +sve \ -// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify -// REQUIRES: aarch64-registered-target - -#include - -svfloat32_t test_exp_vv_i8mf8(svfloat32_t v) { - - return __builtin_elementwise_exp(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} - -svfloat32_t test_exp2_vv_i8mf8(svfloat32_t v) { - - return __builtin_elementwise_exp2(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} diff --git a/clang/test/Sema/aarch64-sve-vector-log-ops.c b/clang/test/Sema/aarch64-sve-vector-log-ops.c deleted file mode 100644 --- a/clang/test/Sema/aarch64-sve-vector-log-ops.c +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: %clang_cc1 -triple aarch64 -target-feature +sve \ -// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify -// REQUIRES: aarch64-registered-target - -#include - -svfloat32_t test_log_vv_i8mf8(svfloat32_t v) { - - return __builtin_elementwise_log(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} - -svfloat32_t test_log10_vv_i8mf8(svfloat32_t v) { - - return __builtin_elementwise_log10(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} - -svfloat32_t test_log2_vv_i8mf8(svfloat32_t v) { - - return __builtin_elementwise_log2(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} diff --git a/clang/test/Sema/aarch64-sve-vector-pow-ops.c b/clang/test/Sema/aarch64-sve-vector-pow-ops.c deleted file mode 100644 --- a/clang/test/Sema/aarch64-sve-vector-pow-ops.c +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: %clang_cc1 -triple aarch64 -target-feature +sve \ -// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify -// REQUIRES: aarch64-registered-target - -#include - -svfloat32_t test_pow_vv_i8mf8(svfloat32_t v) { - - return __builtin_elementwise_pow(v, v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} diff --git a/clang/test/Sema/aarch64-sve-vector-trig-ops.c b/clang/test/Sema/aarch64-sve-vector-trig-ops.c deleted file mode 100644 --- a/clang/test/Sema/aarch64-sve-vector-trig-ops.c +++ /dev/null @@ -1,18 +0,0 @@ -// RUN: %clang_cc1 -triple aarch64 -target-feature +sve \ -// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify -// REQUIRES: aarch64-registered-target - -#include - - -svfloat32_t test_sin_vv_i8mf8(svfloat32_t v) { - - return __builtin_elementwise_sin(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} - -svfloat32_t test_cos_vv_i8mf8(svfloat32_t v) { - - return __builtin_elementwise_cos(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} diff --git a/clang/test/Sema/riscv-rvv-vector-elementwise.c b/clang/test/Sema/riscv-rvv-vector-elementwise.c new file mode 100644 --- /dev/null +++ b/clang/test/Sema/riscv-rvv-vector-elementwise.c @@ -0,0 +1,520 @@ +// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \ +// RUN: -target-feature +v -target-feature +zfh -target-feature +zvfh \ +// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify +// REQUIRES: riscv-registered-target + +#include + +void test_builtin_elementwise_abs(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_abs(vu8); + // expected-error@-1 {{1st argument must be a signed integer or floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_abs(vu16); + // expected-error@-1 {{1st argument must be a signed integer or floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_abs(vu32); + // expected-error@-1 {{1st argument must be a signed integer or floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_abs(vu64); + // expected-error@-1 {{1st argument must be a signed integer or floating point type}} +} + +void test_builtin_elementwise_add_sat(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_add_sat(vf16, vf16); + // expected-error@-1 {{1st argument must be a vector of integers}} + vfloat32m1_t res_vf32 = __builtin_elementwise_add_sat(vf32, vf32); + // expected-error@-1 {{1st argument must be a vector of integers}} + vfloat64m1_t res_vf64 = __builtin_elementwise_add_sat(vf64, vf64); + // expected-error@-1 {{1st argument must be a vector of integers}} +} + +void test_builtin_elementwise_sub_sat(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_sub_sat(vf16, vf16); + // expected-error@-1 {{1st argument must be a vector of integers}} + vfloat32m1_t res_vf32 = __builtin_elementwise_sub_sat(vf32, vf32); + // expected-error@-1 {{1st argument must be a vector of integers}} + vfloat64m1_t res_vf64 = __builtin_elementwise_sub_sat(vf64, vf64); + // expected-error@-1 {{1st argument must be a vector of integers}} +} + +void test_builtin_elementwise_bitreverse(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vfloat16m1_t res_vf16 = __builtin_elementwise_bitreverse(vf16); + // expected-error@-1 {{1st argument must be a vector of integers}} + vfloat32m1_t res_vf32 = __builtin_elementwise_bitreverse(vf32); + // expected-error@-1 {{1st argument must be a vector of integers}} + vfloat64m1_t res_vf64 = __builtin_elementwise_bitreverse(vf64); + // expected-error@-1 {{1st argument must be a vector of integers}} +} + +void test_builtin_elementwise_ceil(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_ceil(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_ceil(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_ceil(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_ceil(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_ceil(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_ceil(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_ceil(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_ceil(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_cos(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_cos(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_cos(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_cos(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_cos(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_cos(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_cos(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_cos(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_cos(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_exp(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_exp(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_exp(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_exp(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_exp(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_exp(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_exp(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_exp(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_exp(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_exp2(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_exp2(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_exp2(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_exp2(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_exp2(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_exp2(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_exp2(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_exp2(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_exp2(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_floor(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_floor(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_floor(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_floor(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_floor(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_floor(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_floor(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_floor(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_floor(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_log(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_log(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_log(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_log(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_log(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_log(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_log(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_log(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_log(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_log10(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_log10(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_log10(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_log10(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_log10(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_log10(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_log10(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_log10(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_log10(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_log2(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_log2(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_log2(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_log2(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_log2(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_log2(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_log2(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_log2(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_log2(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_pow(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_pow(vu8, vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_pow(vu16, vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_pow(vu32, vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_pow(vu64, vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_pow(vi8, vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_pow(vi16, vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_pow(vi32, vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_pow(vi64, vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_roundeven(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_roundeven(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_roundeven(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_roundeven(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_roundeven(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_roundeven(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_roundeven(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_roundeven(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_roundeven(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_round(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_round(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_round(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_round(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_round(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_round(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_round(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_round(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_round(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_rint(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_rint(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_rint(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_rint(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_rint(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_rint(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_rint(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_rint(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_rint(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_nearbyint(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_nearbyint(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_nearbyint(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_nearbyint(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_nearbyint(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_nearbyint(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_nearbyint(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_nearbyint(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_nearbyint(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_sin(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_sin(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_sin(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_sin(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_sin(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_sin(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_sin(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_sin(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_sin(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_sqrt(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_sqrt(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_sqrt(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_sqrt(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_sqrt(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_sqrt(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_sqrt(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_sqrt(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_sqrt(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_trunc(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_trunc(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_trunc(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_trunc(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_trunc(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_trunc(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_trunc(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_trunc(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_trunc(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_canonicalize(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_canonicalize(vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_canonicalize(vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_canonicalize(vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_canonicalize(vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_canonicalize(vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_canonicalize(vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_canonicalize(vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_canonicalize(vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_copysign(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_copysign(vu8, vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_copysign(vu16, vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_copysign(vu32, vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_copysign(vu64, vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_copysign(vi8, vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_copysign(vi16, vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_copysign(vi32, vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_copysign(vi64, vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} + +void test_builtin_elementwise_fma(vint8m1_t vi8, vint16m1_t vi16, + vint32m1_t vi32, vint64m1_t vi64, + vuint8m1_t vu8, vuint16m1_t vu16, + vuint32m1_t vu32, vuint64m1_t vu64, + vfloat16m1_t vf16, vfloat32m1_t vf32, + vfloat64m1_t vf64) { + vuint8m1_t res_vu8 = __builtin_elementwise_fma(vu8, vu8, vu8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vu16 = __builtin_elementwise_fma(vu16, vu16, vu16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vu32 = __builtin_elementwise_fma(vu32, vu32, vu32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vu64 = __builtin_elementwise_fma(vu64, vu64, vu64); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint8m1_t res_vi8 = __builtin_elementwise_fma(vi8, vi8, vi8); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint16m1_t res_vi16 = __builtin_elementwise_fma(vi16, vi16, vi16); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint32m1_t res_vi32 = __builtin_elementwise_fma(vi32, vi32, vi32); + // expected-error@-1 {{1st argument must be a floating point type}} + vuint64m1_t res_vi64 = __builtin_elementwise_fma(vi64, vi64, vi64); + // expected-error@-1 {{1st argument must be a floating point type}} +} diff --git a/clang/test/Sema/riscv-rvv-vector-exp-ops.c b/clang/test/Sema/riscv-rvv-vector-exp-ops.c deleted file mode 100644 --- a/clang/test/Sema/riscv-rvv-vector-exp-ops.c +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \ -// RUN: -target-feature +v -target-feature +zfh -target-feature +zvfh \ -// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify -// REQUIRES: riscv-registered-target - -#include - - -vfloat32mf2_t test_exp_vv_i8mf8(vfloat32mf2_t v) { - - return __builtin_elementwise_exp(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} - -vfloat32mf2_t test_exp2_vv_i8mf8(vfloat32mf2_t v) { - - return __builtin_elementwise_exp2(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} diff --git a/clang/test/Sema/riscv-rvv-vector-log-ops.c b/clang/test/Sema/riscv-rvv-vector-log-ops.c deleted file mode 100644 --- a/clang/test/Sema/riscv-rvv-vector-log-ops.c +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \ -// RUN: -target-feature +v -target-feature +zfh -target-feature +zvfh \ -// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify -// REQUIRES: riscv-registered-target - -#include - - -vfloat32mf2_t test_log_vv_i8mf8(vfloat32mf2_t v) { - - return __builtin_elementwise_log(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} - -vfloat32mf2_t test_log10_vv_i8mf8(vfloat32mf2_t v) { - - return __builtin_elementwise_log10(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} - -vfloat32mf2_t test_log2_vv_i8mf8(vfloat32mf2_t v) { - - return __builtin_elementwise_log2(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} diff --git a/clang/test/Sema/riscv-rvv-vector-trig-ops.c b/clang/test/Sema/riscv-rvv-vector-trig-ops.c deleted file mode 100644 --- a/clang/test/Sema/riscv-rvv-vector-trig-ops.c +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \ -// RUN: -target-feature +v -target-feature +zfh -target-feature +zvfh \ -// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify -// REQUIRES: riscv-registered-target - -#include - - -vfloat32mf2_t test_sin_vv_i8mf8(vfloat32mf2_t v) { - - return __builtin_elementwise_sin(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} - -vfloat32mf2_t test_cos_vv_i8mf8(vfloat32mf2_t v) { - - return __builtin_elementwise_cos(v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -} diff --git a/clang/test/Sema/riscv-sve-vector-pow-ops.c b/clang/test/Sema/riscv-sve-vector-pow-ops.c deleted file mode 100644 --- a/clang/test/Sema/riscv-sve-vector-pow-ops.c +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \ -// RUN: -target-feature +v -target-feature +zfh -target-feature +experimental-zvfh \ -// RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify -// REQUIRES: riscv-registered-target - -#include - - -vfloat32mf2_t test_pow_vv_i8mf8(vfloat32mf2_t v) { - - return __builtin_elementwise_pow(v, v); - // expected-error@-1 {{1st argument must be a vector, integer or floating point type}} -}