| author | |
| committer | |
| log | 82281d53fb9cf2883fa099cff1e06790f8099c05 |
| tree | 033e32a4a59e912fc473fe3acef497a2c0f62e8e |
| parent | dc71137626b001b7ceff685a9fd533b960f62756 |
| signature | Signed by SSH key SHA256:tmUEGJn/zF+25GuUWrgw46/H3HO5tyY5DOfoj51gjV0 |
2 files changed, 11 insertions(+), 1 deletions(-)
src/Air/Legalize.zig+1-1| ... | ... | @@ -904,7 +904,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 904 | 904 | .splat => { |
| 905 | 905 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; |
| 906 | 906 | switch (ty_op.ty.zigTypeTag(zcu)) { |
| 907 | .vector => switch (ty_op.ty.vectorLen(zcu)) { | |
| 907 | .vector => if (l.features.has(.splat_one_elem_to_bit_cast)) switch (ty_op.ty.vectorLen(zcu)) { | |
| 908 | 908 | 0 => unreachable, |
| 909 | 909 | 1 => continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{ |
| 910 | 910 | .ty = ty_op.ty, |
test/behavior/splat.zig+10| ... | ... | @@ -145,6 +145,16 @@ test "vector @splat" { |
| 145 | 145 | try testForT(8 * 2, @as(f16, 3.1415)); |
| 146 | 146 | try testForT(4 * 2, @as(f32, 3.1415)); |
| 147 | 147 | try testForT(2 * 2, @as(f64, 3.1415)); |
| 148 | ||
| 149 | // Splats into one-element vectors. | |
| 150 | try testForT(1, @as(u8, 0xEE)); | |
| 151 | try testForT(1, @as(u16, 0xBEEF)); | |
| 152 | try testForT(1, @as(u32, 0xDEADBEEF)); | |
| 153 | try testForT(1, @as(u64, 0xCAFEF00DDEADBEEF)); | |
| 154 | ||
| 155 | try testForT(1, @as(f16, 3.1415)); | |
| 156 | try testForT(1, @as(f32, 3.1415)); | |
| 157 | try testForT(1, @as(f64, 3.1415)); | |
| 148 | 158 | } |
| 149 | 159 | }; |
| 150 | 160 | try S.doTheTest(); |