| author | |
| committer | |
| log | fc185a6f71b9bd611a6d808082999a9da0f107e8 |
| tree | a86c3bfe1fd35cdbeb0674c425bfb34def86b154 |
| parent | 0134cb0214131d1a7edb18a48f54f9d25277cf84 |
2 files changed, 18 insertions(+), 2 deletions(-)
src/stage1/astgen.cpp+5-2| ... | ... | @@ -4599,8 +4599,11 @@ static IrInstSrc *astgen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4599 | 4599 | } |
| 4600 | 4600 | case BuiltinFnIdShuffle: |
| 4601 | 4601 | { |
| 4602 | // Used for the type expr and the mask expr | |
| 4603 | Scope *comptime_scope = create_comptime_scope(ag->codegen, node, scope); | |
| 4604 | ||
| 4602 | 4605 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4603 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); | |
| 4606 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, comptime_scope); | |
| 4604 | 4607 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4605 | 4608 | return arg0_value; |
| 4606 | 4609 | |
| ... | ... | @@ -4615,7 +4618,7 @@ static IrInstSrc *astgen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4615 | 4618 | return arg2_value; |
| 4616 | 4619 | |
| 4617 | 4620 | AstNode *arg3_node = node->data.fn_call_expr.params.at(3); |
| 4618 | IrInstSrc *arg3_value = astgen_node(ag, arg3_node, scope); | |
| 4621 | IrInstSrc *arg3_value = astgen_node(ag, arg3_node, comptime_scope); | |
| 4619 | 4622 | if (arg3_value == ag->codegen->invalid_inst_src) |
| 4620 | 4623 | return arg3_value; |
| 4621 | 4624 |
test/behavior/vector.zig+13| ... | ... | @@ -634,3 +634,16 @@ test "vector reduce operation" { |
| 634 | 634 | try S.doTheTest(); |
| 635 | 635 | comptime try S.doTheTest(); |
| 636 | 636 | } |
| 637 | ||
| 638 | test "mask parameter of @shuffle is comptime scope" { | |
| 639 | const __v4hi = std.meta.Vector(4, i16); | |
| 640 | var v4_a = __v4hi{ 0, 0, 0, 0 }; | |
| 641 | var v4_b = __v4hi{ 0, 0, 0, 0 }; | |
| 642 | var shuffled: __v4hi = @shuffle(i16, v4_a, v4_b, std.meta.Vector(4, i32){ | |
| 643 | std.zig.c_translation.shuffleVectorIndex(0, @typeInfo(@TypeOf(v4_a)).Vector.len), | |
| 644 | std.zig.c_translation.shuffleVectorIndex(0, @typeInfo(@TypeOf(v4_a)).Vector.len), | |
| 645 | std.zig.c_translation.shuffleVectorIndex(0, @typeInfo(@TypeOf(v4_a)).Vector.len), | |
| 646 | std.zig.c_translation.shuffleVectorIndex(0, @typeInfo(@TypeOf(v4_a)).Vector.len), | |
| 647 | }); | |
| 648 | _ = shuffled; | |
| 649 | } |