stage1: add @shuffle() shufflevector support

I change the semantics of the mask operand, to make it a little more
flexible. There is no real danger in this because it is a compile-error
if you do it the LLVM way (and there is an appropiate error to tell you
this).

v2: avoid problems with double-free
This commit is contained in:
Shawn Landden
2019-06-29 11:32:26 -05:00
committed by Andrew Kelley
parent 9e4065fa73
commit 193604c837
7 changed files with 426 additions and 0 deletions

View File

@@ -6484,6 +6484,19 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
"tmp.zig:7:23: error: unable to evaluate constant expression",
);
cases.addTest(
"using LLVM syntax for @shuffle",
\\export fn entry() void {
\\ const v: @Vector(4, u32) = [4]u32{0, 1, 2, 3};
\\ const x: @Vector(4, u32) = [4]u32{4, 5, 6, 7};
\\ var z = @shuffle(u32, v, x, [8]i32{0, 1, 2, 3, 4, 5, 6, 7});
\\}
,
"tmp.zig:4:39: error: mask index out of bounds",
"tmp.zig:4:39: note: when computing vector element at index 4",
"tmp.zig:4:39: note: selections from the second vector are specified with negative numbers",
);
cases.addTest(
"nested vectors",
\\export fn entry() void {