forked from OSchip/llvm-project
[clang][SveEmitter] Fix enum declarations. [NFCI]
Adapt the declarations of `svpattern` and `svprfop` to the most recent one defined in section "5. Enum declarations" of the SVE ACLE specifications [1]. The signature of the intrinsics using these enums have been changed accordingly. A test has been added to make sure that `svpattern` and `svprfop` are not typedefs. [1] https://developer.arm.com/documentation/100987/latest, version 00bet6 Reviewed By: joechrisellis Differential Revision: https://reviews.llvm.org/D91333
This commit is contained in:
parent
37e7a80aed
commit
02bdbdc760
|
@ -0,0 +1,19 @@
|
|||
// REQUIRES: aarch64-registered-target
|
||||
// RUN: %clang_cc1 %s -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify
|
||||
// expected-no-diagnostics
|
||||
|
||||
// This test makes sure that the enum declarations in section "5. Enum
|
||||
// declarations" of the SVE ACLE [1] are not presented as typedefs in
|
||||
// `arm_sve.h`. It does so by creating a typedef'd struct with the
|
||||
// same identifier as the one defined in `arm_sve.h`, then checking that
|
||||
// it does not overload the enum defined in `arm_sve.h`.
|
||||
//
|
||||
// [1] https://developer.arm.com/documentation/100987/latest version 00bet6
|
||||
|
||||
typedef struct { float f; } svpattern;
|
||||
typedef struct { float f; } svprfop;
|
||||
#include <arm_sve.h>
|
||||
enum svpattern a1 = SV_ALL;
|
||||
svpattern b1 = {1.0f};
|
||||
enum svprfop a2 = SV_PLDL1KEEP;
|
||||
svprfop b2 = {1.0f};
|
|
@ -416,10 +416,10 @@ std::string SVEType::builtin_str() const {
|
|||
|
||||
std::string SVEType::str() const {
|
||||
if (isPredicatePattern())
|
||||
return "sv_pattern";
|
||||
return "enum svpattern";
|
||||
|
||||
if (isPrefetchOp())
|
||||
return "sv_prfop";
|
||||
return "enum svprfop";
|
||||
|
||||
std::string S;
|
||||
if (Void)
|
||||
|
@ -1163,7 +1163,7 @@ void SVEEmitter::createHeader(raw_ostream &OS) {
|
|||
OS << "typedef __clang_svbfloat16x4_t svbfloat16x4_t;\n";
|
||||
OS << "#endif\n";
|
||||
|
||||
OS << "typedef enum\n";
|
||||
OS << "enum svpattern\n";
|
||||
OS << "{\n";
|
||||
OS << " SV_POW2 = 0,\n";
|
||||
OS << " SV_VL1 = 1,\n";
|
||||
|
@ -1182,9 +1182,9 @@ void SVEEmitter::createHeader(raw_ostream &OS) {
|
|||
OS << " SV_MUL4 = 29,\n";
|
||||
OS << " SV_MUL3 = 30,\n";
|
||||
OS << " SV_ALL = 31\n";
|
||||
OS << "} sv_pattern;\n\n";
|
||||
OS << "};\n\n";
|
||||
|
||||
OS << "typedef enum\n";
|
||||
OS << "enum svprfop\n";
|
||||
OS << "{\n";
|
||||
OS << " SV_PLDL1KEEP = 0,\n";
|
||||
OS << " SV_PLDL1STRM = 1,\n";
|
||||
|
@ -1198,7 +1198,7 @@ void SVEEmitter::createHeader(raw_ostream &OS) {
|
|||
OS << " SV_PSTL2STRM = 11,\n";
|
||||
OS << " SV_PSTL3KEEP = 12,\n";
|
||||
OS << " SV_PSTL3STRM = 13\n";
|
||||
OS << "} sv_prfop;\n\n";
|
||||
OS << "};\n\n";
|
||||
|
||||
OS << "/* Function attributes */\n";
|
||||
OS << "#define __aio static inline __attribute__((__always_inline__, "
|
||||
|
|
Loading…
Reference in New Issue