[clang] [Clang][SVE2p1]Add svboolx2 and svboolx4 types for svcreate, svget, s… (PR #74594)

Kerry McLaughlin via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 02:43:29 PST 2023


================
@@ -167,3 +167,23 @@ void test_svpmov_lane(){
   zn_u32 = svpmov_lane_u32_m(zn_u32, pn, 5); // expected-error {{argument value 5 is outside the valid range [1, 3]}}
   zn_u64 = svpmov_lane_u64_m(zn_u64, pn, 8); // expected-error {{argument value 8 is outside the valid range [1, 7]}}
 }
+
+__attribute__((target("+sve2p1")))
+void test_svget_b(uint64_t idx, svboolx2_t tuple2, svboolx4_t tuple4){
+  svbool_t res;
+
+  svset2(tuple2, -1, res); // expected-error {{argument value 18446744073709551615 is outside the valid range [0, 1]}}
+  svset2(tuple2, 2,  res); // expected-error {{argument value 2 is outside the valid range [0, 1]}}
+  svset4(tuple4, -1, res); // expected-error {{argument value 18446744073709551615 is outside the valid range [0, 3]}}
+  svset4(tuple4, 4,  res); // expected-error {{argument value 4 is outside the valid range [0, 3]}}
+
+  res = svget2(tuple2, -1); // expected-error {{argument value 18446744073709551615 is outside the valid range [0, 1]}}
+  res = svget2(tuple2,  2); // expected-error {{argument value 2 is outside the valid range [0, 1]}}
+  res = svget4(tuple4, -1); // expected-error {{argument value 18446744073709551615 is outside the valid range [0, 3]}}
+  res = svget4(tuple4,  4); // expected-error {{argument value 4 is outside the valid range [0, 3]}}
----------------
kmclaughlin-arm wrote:

I don't think you need to use `res =` here, you can just call svget similar to svset above

https://github.com/llvm/llvm-project/pull/74594


More information about the cfe-commits mailing list