[PATCH] D78674: [SveEmitter] Add builtins for contiguous prefetches
This revision was automatically updated to reflect the committed changes. Closed by commit rG823e2a670a9d: [SveEmitter] Add builtins for contiguous prefetches (authored by sdesmalen). Changed prior to commit: https://reviews.llvm.org/D78674?vs=259587=259851#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78674/new/ https://reviews.llvm.org/D78674 Files: clang/include/clang/Basic/TargetBuiltins.h clang/include/clang/Basic/arm_sve.td clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaChecking.cpp clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfb.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfd.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfh.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfw.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfb.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfd.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c clang/utils/TableGen/SveEmitter.cpp Index: clang/utils/TableGen/SveEmitter.cpp === --- clang/utils/TableGen/SveEmitter.cpp +++ clang/utils/TableGen/SveEmitter.cpp @@ -536,6 +536,15 @@ Immediate = true; PredicatePattern = true; break; + case 'J': +Predicate = false; +Float = false; +ElementBitwidth = Bitwidth = 32; +NumVectors = 0; +Signed = true; +Immediate = true; +PrefetchOp = true; +break; case 'k': Predicate = false; Signed = true; @@ -703,6 +712,9 @@ if (T.isPredicatePattern()) ImmChecks.emplace_back( I - 1, Emitter.getEnumValueForImmCheck("ImmCheck0_31")); + else if (T.isPrefetchOp()) +ImmChecks.emplace_back( +I - 1, Emitter.getEnumValueForImmCheck("ImmCheck0_13")); } } @@ -1005,6 +1017,22 @@ OS << " SV_ALL = 31\n"; OS << "} sv_pattern;\n\n"; + OS << "typedef enum\n"; + OS << "{\n"; + OS << " SV_PLDL1KEEP = 0,\n"; + OS << " SV_PLDL1STRM = 1,\n"; + OS << " SV_PLDL2KEEP = 2,\n"; + OS << " SV_PLDL2STRM = 3,\n"; + OS << " SV_PLDL3KEEP = 4,\n"; + OS << " SV_PLDL3STRM = 5,\n"; + OS << " SV_PSTL1KEEP = 8,\n"; + OS << " SV_PSTL1STRM = 9,\n"; + OS << " SV_PSTL2KEEP = 10,\n"; + OS << " SV_PSTL2STRM = 11,\n"; + OS << " SV_PSTL3KEEP = 12,\n"; + OS << " SV_PSTL3STRM = 13\n"; + OS << "} sv_prfop;\n\n"; + OS << "/* Function attributes */\n"; OS << "#define __aio static inline __attribute__((__always_inline__, " "__nodebug__, __overloadable__))\n\n"; Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c === --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s + +#include + +void test_svprfw(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfw(pg, base, 14); +} + +void test_svprfw_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfw(pg, base, -1); +} + +void test_svprfw_vnum(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfw_vnum(pg, base, 0, 14); +} + +void test_svprfw_vnum_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfw_vnum(pg, base, 0, -1); +} Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c === --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s + +#include + +void test_svprfh(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfh(pg, base, 14); +} + +void test_svprfh_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfh(pg, base, -1); +} + +void test_svprfh_vnum(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfh_vnum(pg, base, 0, 14); +} + +void test_svprfh_vnum_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfh_vnum(pg, base, 0, -1); +} Index:
[PATCH] D78674: [SveEmitter] Add builtins for contiguous prefetches
efriedma accepted this revision. efriedma added a comment. LGTM Comment at: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfb.c:22 + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfb(pg, base, -1); +} sdesmalen wrote: > efriedma wrote: > > Maybe worth adding a negative test for svprfb_vnum? > Yes good catch I've added them. I'm not necessarily sure we also need to add > them for all the gather variants as well. I think just having tests where the > position of the prefetch specifier is different should be sufficient. Yes, that seems fine. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78674/new/ https://reviews.llvm.org/D78674 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D78674: [SveEmitter] Add builtins for contiguous prefetches
sdesmalen marked an inline comment as done. sdesmalen added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:7727 + Value *Offset = Ops.size() > 3 ? Ops[2] : Builder.getInt32(0); + BasePtr = Builder.CreateGEP(MemoryTy, BasePtr, Offset); + efriedma wrote: > It seems sort of silly to emit a no-op bitcast+gep+bitcast in the `Ops.size() > <= 3` case, but I guess it doesn't matter much. You're right that was a bit silly. I've changed it now. Comment at: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfb.c:22 + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfb(pg, base, -1); +} efriedma wrote: > Maybe worth adding a negative test for svprfb_vnum? Yes good catch I've added them. I'm not necessarily sure we also need to add them for all the gather variants as well. I think just having tests where the position of the prefetch specifier is different should be sufficient. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78674/new/ https://reviews.llvm.org/D78674 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D78674: [SveEmitter] Add builtins for contiguous prefetches
sdesmalen updated this revision to Diff 259587. sdesmalen marked an inline comment as done. sdesmalen added a comment. - Don't emit bitcast+gep+bitcast when offset is 0. - Added negative tests for _vnum cases. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78674/new/ https://reviews.llvm.org/D78674 Files: clang/include/clang/Basic/TargetBuiltins.h clang/include/clang/Basic/arm_sve.td clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaChecking.cpp clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfb.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfd.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfh.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfw.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfb.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfd.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c clang/utils/TableGen/SveEmitter.cpp Index: clang/utils/TableGen/SveEmitter.cpp === --- clang/utils/TableGen/SveEmitter.cpp +++ clang/utils/TableGen/SveEmitter.cpp @@ -537,6 +537,15 @@ Immediate = true; PredicatePattern = true; break; + case 'J': +Predicate = false; +Float = false; +ElementBitwidth = Bitwidth = 32; +NumVectors = 0; +Signed = true; +Immediate = true; +PrefetchOp = true; +break; case 'k': Predicate = false; Signed = true; @@ -704,6 +713,9 @@ if (T.isPredicatePattern()) ImmChecks.emplace_back( I - 1, Emitter.getEnumValueForImmCheck("ImmCheck0_31")); + else if (T.isPrefetchOp()) +ImmChecks.emplace_back( +I - 1, Emitter.getEnumValueForImmCheck("ImmCheck0_13")); } } @@ -1006,6 +1018,22 @@ OS << " SV_ALL = 31\n"; OS << "} sv_pattern;\n\n"; + OS << "typedef enum\n"; + OS << "{\n"; + OS << " SV_PLDL1KEEP = 0,\n"; + OS << " SV_PLDL1STRM = 1,\n"; + OS << " SV_PLDL2KEEP = 2,\n"; + OS << " SV_PLDL2STRM = 3,\n"; + OS << " SV_PLDL3KEEP = 4,\n"; + OS << " SV_PLDL3STRM = 5,\n"; + OS << " SV_PSTL1KEEP = 8,\n"; + OS << " SV_PSTL1STRM = 9,\n"; + OS << " SV_PSTL2KEEP = 10,\n"; + OS << " SV_PSTL2STRM = 11,\n"; + OS << " SV_PSTL3KEEP = 12,\n"; + OS << " SV_PSTL3STRM = 13\n"; + OS << "} sv_prfop;\n\n"; + OS << "/* Function attributes */\n"; OS << "#define __aio static inline __attribute__((__always_inline__, " "__nodebug__, __overloadable__))\n\n"; Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c === --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s + +#include + +void test_svprfw(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfw(pg, base, 14); +} + +void test_svprfw_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfw(pg, base, -1); +} + +void test_svprfw_vnum(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfw_vnum(pg, base, 0, 14); +} + +void test_svprfw_vnum_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfw_vnum(pg, base, 0, -1); +} Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c === --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s + +#include + +void test_svprfh(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfh(pg, base, 14); +} + +void test_svprfh_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfh(pg, base, -1); +} + +void test_svprfh_vnum(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfh_vnum(pg, base, 0, 14); +} + +void test_svprfh_vnum_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfh_vnum(pg, base, 0, -1); +} Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfd.c
[PATCH] D78674: [SveEmitter] Add builtins for contiguous prefetches
efriedma accepted this revision. efriedma added a comment. This revision is now accepted and ready to land. LGTM with a couple minor comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:7727 + Value *Offset = Ops.size() > 3 ? Ops[2] : Builder.getInt32(0); + BasePtr = Builder.CreateGEP(MemoryTy, BasePtr, Offset); + It seems sort of silly to emit a no-op bitcast+gep+bitcast in the `Ops.size() <= 3` case, but I guess it doesn't matter much. Comment at: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfb.c:22 + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfb(pg, base, -1); +} Maybe worth adding a negative test for svprfb_vnum? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78674/new/ https://reviews.llvm.org/D78674 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D78674: [SveEmitter] Add builtins for contiguous prefetches
sdesmalen updated this revision to Diff 259403. sdesmalen added a comment. - Removed unrelated whitespace changes. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78674/new/ https://reviews.llvm.org/D78674 Files: clang/include/clang/Basic/TargetBuiltins.h clang/include/clang/Basic/arm_sve.td clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaChecking.cpp clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfb.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfd.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfh.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfw.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfb.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfd.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c clang/utils/TableGen/SveEmitter.cpp Index: clang/utils/TableGen/SveEmitter.cpp === --- clang/utils/TableGen/SveEmitter.cpp +++ clang/utils/TableGen/SveEmitter.cpp @@ -537,6 +537,15 @@ Immediate = true; PredicatePattern = true; break; + case 'J': +Predicate = false; +Float = false; +ElementBitwidth = Bitwidth = 32; +NumVectors = 0; +Signed = true; +Immediate = true; +PrefetchOp = true; +break; case 'k': Predicate = false; Signed = true; @@ -704,6 +713,9 @@ if (T.isPredicatePattern()) ImmChecks.emplace_back( I - 1, Emitter.getEnumValueForImmCheck("ImmCheck0_31")); + else if (T.isPrefetchOp()) +ImmChecks.emplace_back( +I - 1, Emitter.getEnumValueForImmCheck("ImmCheck0_13")); } } @@ -1006,6 +1018,22 @@ OS << " SV_ALL = 31\n"; OS << "} sv_pattern;\n\n"; + OS << "typedef enum\n"; + OS << "{\n"; + OS << " SV_PLDL1KEEP = 0,\n"; + OS << " SV_PLDL1STRM = 1,\n"; + OS << " SV_PLDL2KEEP = 2,\n"; + OS << " SV_PLDL2STRM = 3,\n"; + OS << " SV_PLDL3KEEP = 4,\n"; + OS << " SV_PLDL3STRM = 5,\n"; + OS << " SV_PSTL1KEEP = 8,\n"; + OS << " SV_PSTL1STRM = 9,\n"; + OS << " SV_PSTL2KEEP = 10,\n"; + OS << " SV_PSTL2STRM = 11,\n"; + OS << " SV_PSTL3KEEP = 12,\n"; + OS << " SV_PSTL3STRM = 13\n"; + OS << "} sv_prfop;\n\n"; + OS << "/* Function attributes */\n"; OS << "#define __aio static inline __attribute__((__always_inline__, " "__nodebug__, __overloadable__))\n\n"; Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c === --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s + +#ifdef SVE_OVERLOADED_FORMS +// A simple used,unused... macro, long enough to represent any SVE builtin. +#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 +#else +#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 +#endif + +#include + +void test_svprfw(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfw(pg, base, 14); +} + +void test_svprfw_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfw(pg, base, -1); +} Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c === --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s + +#ifdef SVE_OVERLOADED_FORMS +// A simple used,unused... macro, long enough to represent any SVE builtin. +#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 +#else +#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 +#endif + +#include + +void test_svprfh(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfh(pg, base, 14); +} + +void test_svprfh_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfh(pg, base, -1); +} Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfd.c === ---
[PATCH] D78674: [SveEmitter] Add builtins for contiguous prefetches
sdesmalen created this revision. sdesmalen added reviewers: SjoerdMeijer, efriedma, ctetreau. Herald added a subscriber: tschuett. Herald added a project: clang. sdesmalen updated this revision to Diff 259403. sdesmalen added a comment. - Removed unrelated whitespace changes. This patch also adds the enum `sv_prfop` for the prefetch operation specifier and checks to ensure the passed enum values are valid. https://reviews.llvm.org/D78674 Files: clang/include/clang/Basic/TargetBuiltins.h clang/include/clang/Basic/arm_sve.td clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaChecking.cpp clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfb.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfd.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfh.c clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_prfw.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfb.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfd.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c clang/utils/TableGen/SveEmitter.cpp Index: clang/utils/TableGen/SveEmitter.cpp === --- clang/utils/TableGen/SveEmitter.cpp +++ clang/utils/TableGen/SveEmitter.cpp @@ -537,6 +537,15 @@ Immediate = true; PredicatePattern = true; break; + case 'J': +Predicate = false; +Float = false; +ElementBitwidth = Bitwidth = 32; +NumVectors = 0; +Signed = true; +Immediate = true; +PrefetchOp = true; +break; case 'k': Predicate = false; Signed = true; @@ -704,6 +713,9 @@ if (T.isPredicatePattern()) ImmChecks.emplace_back( I - 1, Emitter.getEnumValueForImmCheck("ImmCheck0_31")); + else if (T.isPrefetchOp()) +ImmChecks.emplace_back( +I - 1, Emitter.getEnumValueForImmCheck("ImmCheck0_13")); } } @@ -1006,6 +1018,22 @@ OS << " SV_ALL = 31\n"; OS << "} sv_pattern;\n\n"; + OS << "typedef enum\n"; + OS << "{\n"; + OS << " SV_PLDL1KEEP = 0,\n"; + OS << " SV_PLDL1STRM = 1,\n"; + OS << " SV_PLDL2KEEP = 2,\n"; + OS << " SV_PLDL2STRM = 3,\n"; + OS << " SV_PLDL3KEEP = 4,\n"; + OS << " SV_PLDL3STRM = 5,\n"; + OS << " SV_PSTL1KEEP = 8,\n"; + OS << " SV_PSTL1STRM = 9,\n"; + OS << " SV_PSTL2KEEP = 10,\n"; + OS << " SV_PSTL2STRM = 11,\n"; + OS << " SV_PSTL3KEEP = 12,\n"; + OS << " SV_PSTL3STRM = 13\n"; + OS << "} sv_prfop;\n\n"; + OS << "/* Function attributes */\n"; OS << "#define __aio static inline __attribute__((__always_inline__, " "__nodebug__, __overloadable__))\n\n"; Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c === --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfw.c @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s + +#ifdef SVE_OVERLOADED_FORMS +// A simple used,unused... macro, long enough to represent any SVE builtin. +#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 +#else +#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 +#endif + +#include + +void test_svprfw(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfw(pg, base, 14); +} + +void test_svprfw_1(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value -1 is outside the valid range [0, 13]}} + return svprfw(pg, base, -1); +} Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c === --- /dev/null +++ clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_prfh.c @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s + +#ifdef SVE_OVERLOADED_FORMS +// A simple used,unused... macro, long enough to represent any SVE builtin. +#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 +#else +#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 +#endif + +#include + +void test_svprfh(svbool_t pg, const void *base) +{ + // expected-error@+1 {{argument value 14 is outside the valid range [0, 13]}} + return svprfh(pg, base, 14); +} + +void test_svprfh_1(svbool_t pg, const void *base) +{ + // expected-error@+1