llvm-project/clang/test/SemaCXX/aarch64-sve-vector-conditional-op.cpp
David Green 123064dc39 [Clang][Arm] Convert -fallow-half-arguments-and-returns to a target option. NFC
This cc1 option -fallow-half-arguments-and-returns allows __fp16 to be
passed by argument and returned, without giving an error. It is
currently always enabled for Arm and AArch64, by forcing the option in
the driver. This means any cc1 tests (especially those needing
arm_neon.h) need to specify the option too, to prevent the error from
being emitted.

This changes it to a target option instead, set to true for Arm and
AArch64. This allows the option to be removed. Previously it was implied
by -fnative_half_arguments_and_returns, which is set for certain
languages like open_cl, renderscript and hlsl, so that option now too
controls the errors. There were are few other non-arm uses of
-fallow-half-arguments-and-returns but I believe they were unnecessary.
The strictfp_builtins.c tests were converted from __fp16 to _Float16 to
avoid the issues.

Differential Revision: https://reviews.llvm.org/D133885
2022-09-29 11:00:32 +01:00

22 lines
1.9 KiB
C++

// RUN: %clang_cc1 -verify -triple aarch64-none-linux-gnu -target-feature +sve -fsyntax-only %s
// REQUIRES: aarch64-registered-target
#include <arm_sve.h>
void cond(svint8_t i8, svint16_t i16, svint32_t i32, svint64_t i64,
svuint8_t u8, svuint16_t u16, svuint32_t u32, svuint64_t u64,
svfloat16_t f16, svfloat32_t f32, svfloat64_t f64,
svbool_t b) {
i8 ? i16 : i16; // expected-error{{vector condition type 'svint8_t' (aka '__SVInt8_t') and result type 'svint16_t' (aka '__SVInt16_t') do not have the same number of elements}}
i8 ? i32 : i32; // expected-error{{vector condition type 'svint8_t' (aka '__SVInt8_t') and result type 'svint32_t' (aka '__SVInt32_t') do not have the same number of elements}}
i8 ? i64 : i64; // expected-error{{vector condition type 'svint8_t' (aka '__SVInt8_t') and result type 'svint64_t' (aka '__SVInt64_t') do not have the same number of elements}}
i16 ? i16 : i8; // expected-error{{vector operands to the vector conditional must be the same type ('svint16_t' (aka '__SVInt16_t') and 'svint8_t' (aka '__SVInt8_t'))}}
i16 ? i16 : i32; // expected-error{{vector operands to the vector conditional must be the same type ('svint16_t' (aka '__SVInt16_t') and 'svint32_t' (aka '__SVInt32_t'))}}
i16 ? i16 : i64; // expected-error{{vector operands to the vector conditional must be the same type ('svint16_t' (aka '__SVInt16_t') and 'svint64_t' (aka '__SVInt64_t'))}}
i16 ? i8 : i16; // expected-error{{vector operands to the vector conditional must be the same type ('svint8_t' (aka '__SVInt8_t') and 'svint16_t' (aka '__SVInt16_t'))}}
i16 ? i32 : i16; // expected-error{{vector operands to the vector conditional must be the same type ('svint32_t' (aka '__SVInt32_t') and 'svint16_t' (aka '__SVInt16_t'))}}
i16 ? i64 : i16; // expected-error{{vector operands to the vector conditional must be the same type ('svint64_t' (aka '__SVInt64_t') and 'svint16_t' (aka '__SVInt16_t'))}}
}