From e5adfd87bc768cee227e57bc2bbf68c96af4fe22 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 5 Sep 2025 22:52:55 -0700 Subject: [PATCH] translate-c: remove cases associated with runtime vector indexing C translation is in the process of switching to be aro-based (see #24497) That codebase will need to gain some kind of helper for translating C code that uses runtime vector indexing. --- test/run_translated_c.zig | 104 -------------------------------------- 1 file changed, 104 deletions(-) diff --git a/test/run_translated_c.zig b/test/run_translated_c.zig index 73aa7d01f4..84d8b2da1c 100644 --- a/test/run_translated_c.zig +++ b/test/run_translated_c.zig @@ -1316,110 +1316,6 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void { \\} , ""); - cases.add("basic vector expressions", - \\#include - \\#include - \\typedef int16_t __v8hi __attribute__((__vector_size__(16))); - \\int main(int argc, char**argv) { - \\ __v8hi uninitialized; - \\ __v8hi empty_init = {}; - \\ for (int i = 0; i < 8; i++) { - \\ if (empty_init[i] != 0) abort(); - \\ } - \\ __v8hi partial_init = {0, 1, 2, 3}; - \\ - \\ __v8hi a = {0, 1, 2, 3, 4, 5, 6, 7}; - \\ __v8hi b = (__v8hi) {100, 200, 300, 400, 500, 600, 700, 800}; - \\ - \\ __v8hi sum = a + b; - \\ for (int i = 0; i < 8; i++) { - \\ if (sum[i] != a[i] + b[i]) abort(); - \\ } - \\ return 0; - \\} - , ""); - - cases.add("__builtin_shufflevector", - \\#include - \\#include - \\typedef int16_t __v4hi __attribute__((__vector_size__(8))); - \\typedef int16_t __v8hi __attribute__((__vector_size__(16))); - \\int main(int argc, char**argv) { - \\ __v8hi v8_a = {0, 1, 2, 3, 4, 5, 6, 7}; - \\ __v8hi v8_b = {100, 200, 300, 400, 500, 600, 700, 800}; - \\ __v8hi shuffled = __builtin_shufflevector(v8_a, v8_b, 0, 1, 2, 3, 8, 9, 10, 11); - \\ for (int i = 0; i < 8; i++) { - \\ if (i < 4) { - \\ if (shuffled[i] != v8_a[i]) abort(); - \\ } else { - \\ if (shuffled[i] != v8_b[i - 4]) abort(); - \\ } - \\ } - \\ shuffled = __builtin_shufflevector( - \\ (__v8hi) {-1, -1, -1, -1, -1, -1, -1, -1}, - \\ (__v8hi) {42, 42, 42, 42, 42, 42, 42, 42}, - \\ 0, 1, 2, 3, 8, 9, 10, 11 - \\ ); - \\ for (int i = 0; i < 8; i++) { - \\ if (i < 4) { - \\ if (shuffled[i] != -1) abort(); - \\ } else { - \\ if (shuffled[i] != 42) abort(); - \\ } - \\ } - \\ __v4hi shuffled_to_fewer_elements = __builtin_shufflevector(v8_a, v8_b, 0, 1, 8, 9); - \\ for (int i = 0; i < 4; i++) { - \\ if (i < 2) { - \\ if (shuffled_to_fewer_elements[i] != v8_a[i]) abort(); - \\ } else { - \\ if (shuffled_to_fewer_elements[i] != v8_b[i - 2]) abort(); - \\ } - \\ } - \\ __v4hi v4_a = {0, 1, 2, 3}; - \\ __v4hi v4_b = {100, 200, 300, 400}; - \\ __v8hi shuffled_to_more_elements = __builtin_shufflevector(v4_a, v4_b, 0, 1, 2, 3, 4, 5, 6, 7); - \\ for (int i = 0; i < 4; i++) { - \\ if (shuffled_to_more_elements[i] != v4_a[i]) abort(); - \\ if (shuffled_to_more_elements[i + 4] != v4_b[i]) abort(); - \\ } - \\ return 0; - \\} - , ""); - - cases.add("__builtin_convertvector", - \\#include - \\#include - \\typedef int16_t __v8hi __attribute__((__vector_size__(16))); - \\typedef uint16_t __v8hu __attribute__((__vector_size__(16))); - \\int main(int argc, char**argv) { - \\ __v8hi signed_vector = { 1, 2, 3, 4, -1, -2, -3,-4}; - \\ __v8hu unsigned_vector = __builtin_convertvector(signed_vector, __v8hu); - \\ - \\ for (int i = 0; i < 8; i++) { - \\ if (unsigned_vector[i] != (uint16_t)signed_vector[i]) abort(); - \\ } - \\ return 0; - \\} - , ""); - - cases.add("vector casting", - \\#include - \\#include - \\typedef int8_t __v8qi __attribute__((__vector_size__(8))); - \\typedef uint8_t __v8qu __attribute__((__vector_size__(8))); - \\int main(int argc, char**argv) { - \\ __v8qi signed_vector = { 1, 2, 3, 4, -1, -2, -3,-4}; - \\ - \\ uint64_t big_int = (uint64_t) signed_vector; - \\ if (big_int != 0x01020304FFFEFDFCULL && big_int != 0xFCFDFEFF04030201ULL) abort(); - \\ __v8qu unsigned_vector = (__v8qu) big_int; - \\ for (int i = 0; i < 8; i++) { - \\ if (unsigned_vector[i] != (uint8_t)signed_vector[i] && unsigned_vector[i] != (uint8_t)signed_vector[7 - i]) abort(); - \\ } - \\ return 0; - \\} - , ""); - cases.add("break from switch statement. Issue #8387", \\#include \\int switcher(int x) {