Commit 4ec421372f

Justus Klausecker <justus@klausecker.de>
2025-08-08 20:25:29
add remaining undef value tests ; fix `@truncate` undef retval type
1 parent f0ffe30
Changed files (2)
src
test
cases
src/Sema/arith.zig
@@ -1193,7 +1193,7 @@ pub fn truncate(
 ) CompileError!Value {
     const pt = sema.pt;
     const zcu = pt.zcu;
-    if (val.isUndef(zcu)) return val;
+    if (val.isUndef(zcu)) return pt.undefValue(dest_ty);
     switch (ty.zigTypeTag(zcu)) {
         .int, .comptime_int => return intTruncate(sema, val, dest_ty, dest_signedness, dest_bits),
         .vector => {
@@ -1204,7 +1204,7 @@ pub fn truncate(
             for (elem_vals, 0..) |*result_elem, elem_idx| {
                 const elem_val = try val.elemValue(pt, elem_idx);
                 result_elem.* = if (elem_val.isUndef(zcu))
-                    elem_val.toIntern()
+                    (try pt.undefValue(dest_elem_ty)).toIntern()
                 else
                     (try intTruncate(
                         sema,
test/cases/compile_errors/undef_arith_returns_undef.zig
@@ -178,6 +178,104 @@ inline fn testIntWithValue(comptime Int: type, x: Int) void {
     @compileLog(V{ x, u } *| V{ u, u }); // undef
     @compileLog(V{ u, x } *| V{ u, u }); // undef
     @compileLog(V{ u, u } *| V{ u, u }); // undef
+
+    // Saturating shift
+
+    if (@typeInfo(Int).int.signedness == .unsigned) {
+        @compileLog(x <<| u); // undef
+        @compileLog(u <<| x); // undef
+
+        @compileLog(V{ x, u } <<| V{ x, x }); // { 24, undef }
+        @compileLog(V{ u, x } <<| V{ x, x }); // { undef, 24 }
+        @compileLog(V{ u, u } <<| V{ x, x }); // undef
+
+        @compileLog(V{ x, x } <<| V{ x, u }); // { 24, undef }
+        @compileLog(V{ x, u } <<| V{ x, u }); // { 24, undef }
+        @compileLog(V{ u, x } <<| V{ x, u }); // undef
+        @compileLog(V{ u, u } <<| V{ x, u }); // undef
+
+        @compileLog(V{ x, x } <<| V{ u, x }); // { undef, 24 }
+        @compileLog(V{ x, u } <<| V{ u, x }); // undef
+        @compileLog(V{ u, x } <<| V{ u, x }); // { undef, 24 }
+        @compileLog(V{ u, u } <<| V{ u, x }); // undef
+
+        @compileLog(V{ x, x } <<| V{ u, u }); // undef
+        @compileLog(V{ x, u } <<| V{ u, u }); // undef
+        @compileLog(V{ u, x } <<| V{ u, u }); // undef
+        @compileLog(V{ u, u } <<| V{ u, u }); // undef
+    }
+
+    // Bitwise XOR
+
+    @compileLog(x ^ u); // undef
+    @compileLog(u ^ x); // undef
+
+    @compileLog(V{ x, u } ^ V{ x, x }); // { 0, undef }
+    @compileLog(V{ u, x } ^ V{ x, x }); // { undef, 0 }
+    @compileLog(V{ u, u } ^ V{ x, x }); // undef
+
+    @compileLog(V{ x, x } ^ V{ x, u }); // { 0, undef }
+    @compileLog(V{ x, u } ^ V{ x, u }); // { 0, undef }
+    @compileLog(V{ u, x } ^ V{ x, u }); // undef
+    @compileLog(V{ u, u } ^ V{ x, u }); // undef
+
+    @compileLog(V{ x, x } ^ V{ u, x }); // { undef, 0 }
+    @compileLog(V{ x, u } ^ V{ u, x }); // undef
+    @compileLog(V{ u, x } ^ V{ u, x }); // { undef, 0 }
+    @compileLog(V{ u, u } ^ V{ u, x }); // undef
+
+    @compileLog(V{ x, x } ^ V{ u, u }); // undef
+    @compileLog(V{ x, u } ^ V{ u, u }); // undef
+    @compileLog(V{ u, x } ^ V{ u, u }); // undef
+    @compileLog(V{ u, u } ^ V{ u, u }); // undef
+
+    // Bitwise NOT
+
+    @compileLog(~u); // undef
+    @compileLog(~V{ u, u }); // undef
+
+    if (Int == u8) { // Result depends on integer type
+        @compileLog(~V{ x, u }); // { 252, undef }
+        @compileLog(~V{ u, x }); // { undef, 252 }
+    }
+
+    // Other binary bitwise operations
+
+    @compileLog(u & u); // undef
+    @compileLog(u | u); // undef
+
+    @compileLog(V{ u, u } & V{ u, u }); // undef
+    @compileLog(V{ u, u } | V{ u, u }); // undef
+
+    // Truncate
+
+    if (@typeInfo(Int).int.signedness == .unsigned) {
+        const W = @Vector(2, u1);
+        @compileLog(@as(u1, @truncate(u))); // undef
+        @compileLog(@as(W, @truncate(V{ x, u }))); // { 1, undef }
+        @compileLog(@as(W, @truncate(V{ u, x }))); // { undef, 1 }
+        @compileLog(@as(W, @truncate(V{ u, u }))); // undef
+    }
+
+    // Bit reverse
+
+    @compileLog(@bitReverse(u)); // undef
+    @compileLog(@bitReverse(V{ u, u })); // undef
+
+    if (Int == u8) { // Result depends on integer type
+        @compileLog(@bitReverse(V{ x, u })); // { 192, undef }
+        @compileLog(@bitReverse(V{ u, x })); // { undef, 192 }
+    }
+
+    // Byte swap
+
+    if (Int == u8) { // Result depends on integer type and is illegal for some
+        @compileLog(@byteSwap(u)); // undef
+        @compileLog(@byteSwap(V{ u, u })); // undef
+
+        @compileLog(@byteSwap(V{ x, u })); // { 3, undef }
+        @compileLog(@byteSwap(V{ u, x })); // { undef, 3 }
+    }
 }
 
 inline fn testFloatWithValue(comptime Float: type, x: Float) void {
@@ -268,7 +366,7 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 //
 // :40:5: error: found compile log statement
 // :40:5: note: also here (5 times)
-// :189:5: note: also here (5 times)
+// :287:5: note: also here (5 times)
 //
 // Compile Log Output:
 // @as(u8, undefined)
@@ -375,6 +473,60 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, u8), undefined)
 // @as(u8, undefined)
 // @as(u8, undefined)
+// @as(@Vector(2, u8), .{ 24, undefined })
+// @as(@Vector(2, u8), .{ undefined, 24 })
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), .{ 24, undefined })
+// @as(@Vector(2, u8), .{ 24, undefined })
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), .{ undefined, 24 })
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), .{ undefined, 24 })
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(u8, undefined)
+// @as(u8, undefined)
+// @as(@Vector(2, u8), .{ 0, undefined })
+// @as(@Vector(2, u8), .{ undefined, 0 })
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), .{ 0, undefined })
+// @as(@Vector(2, u8), .{ 0, undefined })
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), .{ undefined, 0 })
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), .{ undefined, 0 })
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(u8, undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), .{ 252, undefined })
+// @as(@Vector(2, u8), .{ undefined, 252 })
+// @as(u8, undefined)
+// @as(u8, undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(u1, undefined)
+// @as(@Vector(2, u1), .{ 1, undefined })
+// @as(@Vector(2, u1), .{ undefined, 1 })
+// @as(@Vector(2, u1), undefined)
+// @as(u8, undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), .{ 192, undefined })
+// @as(@Vector(2, u8), .{ undefined, 192 })
+// @as(u8, undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), .{ 3, undefined })
+// @as(@Vector(2, u8), .{ undefined, 3 })
+// @as(u8, undefined)
+// @as(u8, undefined)
 // @as(@Vector(2, u8), [runtime value])
 // @as(@Vector(2, u8), [runtime value])
 // @as(@Vector(2, u8), undefined)
@@ -475,6 +627,60 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, u8), undefined)
 // @as(@Vector(2, u8), undefined)
 // @as(@Vector(2, u8), undefined)
+// @as(u8, undefined)
+// @as(u8, undefined)
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(u8, [runtime value])
+// @as(u8, [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), undefined)
+// @as(u8, undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(u8, undefined)
+// @as(u8, undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(u1, undefined)
+// @as(@Vector(2, u1), [runtime value])
+// @as(@Vector(2, u1), [runtime value])
+// @as(@Vector(2, u1), undefined)
+// @as(u8, undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
+// @as(u8, undefined)
+// @as(@Vector(2, u8), undefined)
+// @as(@Vector(2, u8), [runtime value])
+// @as(@Vector(2, u8), [runtime value])
 // @as(i8, undefined)
 // @as(i8, undefined)
 // @as(@Vector(2, i8), .{ 6, undefined })
@@ -579,6 +785,31 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, i8), undefined)
 // @as(i8, undefined)
 // @as(i8, undefined)
+// @as(@Vector(2, i8), .{ 0, undefined })
+// @as(@Vector(2, i8), .{ undefined, 0 })
+// @as(@Vector(2, i8), undefined)
+// @as(@Vector(2, i8), .{ 0, undefined })
+// @as(@Vector(2, i8), .{ 0, undefined })
+// @as(@Vector(2, i8), undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(@Vector(2, i8), .{ undefined, 0 })
+// @as(@Vector(2, i8), undefined)
+// @as(@Vector(2, i8), .{ undefined, 0 })
+// @as(@Vector(2, i8), undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(i8, undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(i8, undefined)
+// @as(i8, undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(i8, undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(i8, undefined)
+// @as(i8, undefined)
 // @as(@Vector(2, i8), [runtime value])
 // @as(@Vector(2, i8), [runtime value])
 // @as(@Vector(2, i8), undefined)
@@ -679,6 +910,31 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, i8), undefined)
 // @as(@Vector(2, i8), undefined)
 // @as(@Vector(2, i8), undefined)
+// @as(i8, [runtime value])
+// @as(i8, [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), [runtime value])
+// @as(@Vector(2, i8), undefined)
+// @as(i8, undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(i8, undefined)
+// @as(i8, undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(@Vector(2, i8), undefined)
+// @as(i8, undefined)
+// @as(@Vector(2, i8), undefined)
 // @as(u32, undefined)
 // @as(u32, undefined)
 // @as(@Vector(2, u32), .{ 6, undefined })
@@ -783,6 +1039,69 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, u32), undefined)
 // @as(u32, undefined)
 // @as(u32, undefined)
+// @as(@Vector(2, u32), .{ 24, undefined })
+// @as(@Vector(2, u32), .{ undefined, 24 })
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), .{ 24, undefined })
+// @as(@Vector(2, u32), .{ 24, undefined })
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), .{ undefined, 24 })
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), .{ undefined, 24 })
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(u32, undefined)
+// @as(u32, undefined)
+// @as(@Vector(2, u32), .{ 0, undefined })
+// @as(@Vector(2, u32), .{ undefined, 0 })
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), .{ 0, undefined })
+// @as(@Vector(2, u32), .{ 0, undefined })
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), .{ undefined, 0 })
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), .{ undefined, 0 })
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(u32, undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(u32, undefined)
+// @as(u32, undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(u1, undefined)
+// @as(@Vector(2, u1), .{ 1, undefined })
+// @as(@Vector(2, u1), .{ undefined, 1 })
+// @as(@Vector(2, u1), undefined)
+// @as(u32, undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(u32, undefined)
+// @as(u32, undefined)
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(u32, undefined)
+// @as(u32, undefined)
 // @as(@Vector(2, u32), [runtime value])
 // @as(@Vector(2, u32), [runtime value])
 // @as(@Vector(2, u32), undefined)
@@ -883,6 +1202,35 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, u32), undefined)
 // @as(@Vector(2, u32), undefined)
 // @as(@Vector(2, u32), undefined)
+// @as(u32, [runtime value])
+// @as(u32, [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), [runtime value])
+// @as(@Vector(2, u32), undefined)
+// @as(u32, undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(u32, undefined)
+// @as(u32, undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(@Vector(2, u32), undefined)
+// @as(u1, undefined)
+// @as(@Vector(2, u1), [runtime value])
+// @as(@Vector(2, u1), [runtime value])
+// @as(@Vector(2, u1), undefined)
+// @as(u32, undefined)
+// @as(@Vector(2, u32), undefined)
 // @as(i32, undefined)
 // @as(i32, undefined)
 // @as(@Vector(2, i32), .{ 6, undefined })
@@ -987,6 +1335,31 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, i32), undefined)
 // @as(i32, undefined)
 // @as(i32, undefined)
+// @as(@Vector(2, i32), .{ 0, undefined })
+// @as(@Vector(2, i32), .{ undefined, 0 })
+// @as(@Vector(2, i32), undefined)
+// @as(@Vector(2, i32), .{ 0, undefined })
+// @as(@Vector(2, i32), .{ 0, undefined })
+// @as(@Vector(2, i32), undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(@Vector(2, i32), .{ undefined, 0 })
+// @as(@Vector(2, i32), undefined)
+// @as(@Vector(2, i32), .{ undefined, 0 })
+// @as(@Vector(2, i32), undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(i32, undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(i32, undefined)
+// @as(i32, undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(i32, undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(i32, undefined)
+// @as(i32, undefined)
 // @as(@Vector(2, i32), [runtime value])
 // @as(@Vector(2, i32), [runtime value])
 // @as(@Vector(2, i32), undefined)
@@ -1087,6 +1460,31 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, i32), undefined)
 // @as(@Vector(2, i32), undefined)
 // @as(@Vector(2, i32), undefined)
+// @as(i32, [runtime value])
+// @as(i32, [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), [runtime value])
+// @as(@Vector(2, i32), undefined)
+// @as(i32, undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(i32, undefined)
+// @as(i32, undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(@Vector(2, i32), undefined)
+// @as(i32, undefined)
+// @as(@Vector(2, i32), undefined)
 // @as(u500, undefined)
 // @as(u500, undefined)
 // @as(@Vector(2, u500), .{ 6, undefined })
@@ -1191,6 +1589,52 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, u500), undefined)
 // @as(u500, undefined)
 // @as(u500, undefined)
+// @as(@Vector(2, u500), .{ 24, undefined })
+// @as(@Vector(2, u500), .{ undefined, 24 })
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), .{ 24, undefined })
+// @as(@Vector(2, u500), .{ 24, undefined })
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), .{ undefined, 24 })
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), .{ undefined, 24 })
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(u500, undefined)
+// @as(u500, undefined)
+// @as(@Vector(2, u500), .{ 0, undefined })
+// @as(@Vector(2, u500), .{ undefined, 0 })
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), .{ 0, undefined })
+// @as(@Vector(2, u500), .{ 0, undefined })
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), .{ undefined, 0 })
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), .{ undefined, 0 })
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(u500, undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(u500, undefined)
+// @as(u500, undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(u1, undefined)
+// @as(@Vector(2, u1), .{ 1, undefined })
+// @as(@Vector(2, u1), .{ undefined, 1 })
+// @as(@Vector(2, u1), undefined)
+// @as(u500, undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(u500, undefined)
+// @as(u500, undefined)
 // @as(@Vector(2, u500), [runtime value])
 // @as(@Vector(2, u500), [runtime value])
 // @as(@Vector(2, u500), undefined)
@@ -1291,6 +1735,52 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, u500), undefined)
 // @as(@Vector(2, u500), undefined)
 // @as(@Vector(2, u500), undefined)
+// @as(u500, undefined)
+// @as(u500, undefined)
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(u500, [runtime value])
+// @as(u500, [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), [runtime value])
+// @as(@Vector(2, u500), undefined)
+// @as(u500, undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(u500, undefined)
+// @as(u500, undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(@Vector(2, u500), undefined)
+// @as(u1, undefined)
+// @as(@Vector(2, u1), [runtime value])
+// @as(@Vector(2, u1), [runtime value])
+// @as(@Vector(2, u1), undefined)
+// @as(u500, undefined)
+// @as(@Vector(2, u500), undefined)
 // @as(i500, undefined)
 // @as(i500, undefined)
 // @as(@Vector(2, i500), .{ 6, undefined })
@@ -1395,6 +1885,31 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, i500), undefined)
 // @as(i500, undefined)
 // @as(i500, undefined)
+// @as(@Vector(2, i500), .{ 0, undefined })
+// @as(@Vector(2, i500), .{ undefined, 0 })
+// @as(@Vector(2, i500), undefined)
+// @as(@Vector(2, i500), .{ 0, undefined })
+// @as(@Vector(2, i500), .{ 0, undefined })
+// @as(@Vector(2, i500), undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(@Vector(2, i500), .{ undefined, 0 })
+// @as(@Vector(2, i500), undefined)
+// @as(@Vector(2, i500), .{ undefined, 0 })
+// @as(@Vector(2, i500), undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(i500, undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(i500, undefined)
+// @as(i500, undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(i500, undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(i500, undefined)
+// @as(i500, undefined)
 // @as(@Vector(2, i500), [runtime value])
 // @as(@Vector(2, i500), [runtime value])
 // @as(@Vector(2, i500), undefined)
@@ -1495,6 +2010,31 @@ inline fn testFloatWithValue(comptime Float: type, x: Float) void {
 // @as(@Vector(2, i500), undefined)
 // @as(@Vector(2, i500), undefined)
 // @as(@Vector(2, i500), undefined)
+// @as(i500, [runtime value])
+// @as(i500, [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), [runtime value])
+// @as(@Vector(2, i500), undefined)
+// @as(i500, undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(i500, undefined)
+// @as(i500, undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(@Vector(2, i500), undefined)
+// @as(i500, undefined)
+// @as(@Vector(2, i500), undefined)
 // @as(f16, undefined)
 // @as(f16, undefined)
 // @as(@Vector(2, f16), .{ 6, undefined })