authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-19 10:48:04-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-19 10:58:12-04:00
log005a54a853a77b9c28551490fc08dc37cd7d7715
tree7f13cd3b88f33f5103a5a539a37abd4f9fd1ceb1
parent01577a3af480cff02c5f78864f8056487b3d3b44
signaturelock-open Commit is signed but in an unrecognized format.

fixups for `@splat`

* Fix codegen for splat - instead of giving vectors of length N to shufflevector for both of the operands, it gives vectors of length 1. The mask vector is the only one that needs N elements. * Separate Splat into SplatSrc and SplatGen; the `len` is not needed once it gets to codegen since it is redundant with the result type. * Refactor compile error for wrong vector element type so that the compile error message is not duplicated in zig source code * Improve implementation to correctly handle comptime values such as undefined and lazy values. * Improve compile error for bad vector element type to point to the correct place. * Delete dead code. * Modify behavior test to use an array cast instead of vector element indexing since I'm merging this splat commit out-of-order from Shawn's patch set.

6 files changed, 101 insertions(+), 64 deletions(-)

src/all_types.hpp+9-2
...@@ -2432,7 +2432,8 @@ enum IrInstructionId {...@@ -2432,7 +2432,8 @@ enum IrInstructionId {
2432 IrInstructionIdIntType,2432 IrInstructionIdIntType,
2433 IrInstructionIdVectorType,2433 IrInstructionIdVectorType,
2434 IrInstructionIdShuffleVector,2434 IrInstructionIdShuffleVector,
2435 IrInstructionIdSplat,2435 IrInstructionIdSplatSrc,
2436 IrInstructionIdSplatGen,
2436 IrInstructionIdBoolNot,2437 IrInstructionIdBoolNot,
2437 IrInstructionIdMemset,2438 IrInstructionIdMemset,
2438 IrInstructionIdMemcpy,2439 IrInstructionIdMemcpy,
...@@ -3683,13 +3684,19 @@ struct IrInstructionShuffleVector {...@@ -3683,13 +3684,19 @@ struct IrInstructionShuffleVector {
3683 IrInstruction *mask; // This is in zig-format, not llvm format3684 IrInstruction *mask; // This is in zig-format, not llvm format
3684};3685};
36853686
3686struct IrInstructionSplat {3687struct IrInstructionSplatSrc {
3687 IrInstruction base;3688 IrInstruction base;
36883689
3689 IrInstruction *len;3690 IrInstruction *len;
3690 IrInstruction *scalar;3691 IrInstruction *scalar;
3691};3692};
36923693
3694struct IrInstructionSplatGen {
3695 IrInstruction base;
3696
3697 IrInstruction *scalar;
3698};
3699
3693struct IrInstructionAssertZero {3700struct IrInstructionAssertZero {
3694 IrInstruction base;3701 IrInstruction base;
36953702
src/codegen.cpp+13-14
...@@ -4619,18 +4619,16 @@ static LLVMValueRef ir_render_shuffle_vector(CodeGen *g, IrExecutable *executabl...@@ -4619,18 +4619,16 @@ static LLVMValueRef ir_render_shuffle_vector(CodeGen *g, IrExecutable *executabl
4619 llvm_mask_value, "");4619 llvm_mask_value, "");
4620}4620}
46214621
4622static LLVMValueRef ir_render_splat(CodeGen *g, IrExecutable *executable, IrInstructionSplat *instruction) {4622static LLVMValueRef ir_render_splat(CodeGen *g, IrExecutable *executable, IrInstructionSplatGen *instruction) {
4623 uint64_t len = bigint_as_u64(&instruction->len->value.data.x_bigint);4623 ZigType *result_type = instruction->base.value.type;
4624 LLVMValueRef wrapped_scalar_undef = LLVMGetUndef(instruction->base.value.type->llvm_type);4624 src_assert(result_type->id == ZigTypeIdVector, instruction->base.source_node);
4625 LLVMValueRef wrapped_scalar = LLVMBuildInsertElement(g->builder, wrapped_scalar_undef,4625 uint32_t len = result_type->data.vector.len;
4626 ir_llvm_value(g, instruction->scalar),4626 LLVMTypeRef op_llvm_type = LLVMVectorType(get_llvm_type(g, instruction->scalar->value.type), 1);
4627 LLVMConstInt(LLVMInt32Type(), 0, false),4627 LLVMTypeRef mask_llvm_type = LLVMVectorType(LLVMInt32Type(), len);
4628 "");4628 LLVMValueRef undef_vector = LLVMGetUndef(op_llvm_type);
4629 return LLVMBuildShuffleVector(g->builder,4629 LLVMValueRef op_vector = LLVMBuildInsertElement(g->builder, undef_vector,
4630 wrapped_scalar,4630 ir_llvm_value(g, instruction->scalar), LLVMConstInt(LLVMInt32Type(), 0, false), "");
4631 wrapped_scalar_undef,4631 return LLVMBuildShuffleVector(g->builder, op_vector, undef_vector, LLVMConstNull(mask_llvm_type), "");
4632 LLVMConstNull(LLVMVectorType(g->builtin_types.entry_u32->llvm_type, (uint32_t)len)),
4633 "");
4634}4632}
46354633
4636static LLVMValueRef ir_render_pop_count(CodeGen *g, IrExecutable *executable, IrInstructionPopCount *instruction) {4634static LLVMValueRef ir_render_pop_count(CodeGen *g, IrExecutable *executable, IrInstructionPopCount *instruction) {
...@@ -6000,6 +5998,7 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,...@@ -6000,6 +5998,7 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
6000 case IrInstructionIdFrameSizeSrc:5998 case IrInstructionIdFrameSizeSrc:
6001 case IrInstructionIdAllocaGen:5999 case IrInstructionIdAllocaGen:
6002 case IrInstructionIdAwaitSrc:6000 case IrInstructionIdAwaitSrc:
6001 case IrInstructionIdSplatSrc:
6003 zig_unreachable();6002 zig_unreachable();
60046003
6005 case IrInstructionIdDeclVarGen:6004 case IrInstructionIdDeclVarGen:
...@@ -6160,8 +6159,8 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,...@@ -6160,8 +6159,8 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
6160 return ir_render_spill_end(g, executable, (IrInstructionSpillEnd *)instruction);6159 return ir_render_spill_end(g, executable, (IrInstructionSpillEnd *)instruction);
6161 case IrInstructionIdShuffleVector:6160 case IrInstructionIdShuffleVector:
6162 return ir_render_shuffle_vector(g, executable, (IrInstructionShuffleVector *) instruction);6161 return ir_render_shuffle_vector(g, executable, (IrInstructionShuffleVector *) instruction);
6163 case IrInstructionIdSplat:6162 case IrInstructionIdSplatGen:
6164 return ir_render_splat(g, executable, (IrInstructionSplat *) instruction);6163 return ir_render_splat(g, executable, (IrInstructionSplatGen *) instruction);
6165 }6164 }
6166 zig_unreachable();6165 zig_unreachable();
6167}6166}
src/ir.cpp+57-38
...@@ -721,8 +721,12 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionShuffleVector *)...@@ -721,8 +721,12 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionShuffleVector *)
721 return IrInstructionIdShuffleVector;721 return IrInstructionIdShuffleVector;
722}722}
723723
724static constexpr IrInstructionId ir_instruction_id(IrInstructionSplat *) {724static constexpr IrInstructionId ir_instruction_id(IrInstructionSplatSrc *) {
725 return IrInstructionIdSplat;725 return IrInstructionIdSplatSrc;
726}
727
728static constexpr IrInstructionId ir_instruction_id(IrInstructionSplatGen *) {
729 return IrInstructionIdSplatGen;
726}730}
727731
728static constexpr IrInstructionId ir_instruction_id(IrInstructionBoolNot *) {732static constexpr IrInstructionId ir_instruction_id(IrInstructionBoolNot *) {
...@@ -2304,10 +2308,10 @@ static IrInstruction *ir_build_shuffle_vector(IrBuilder *irb, Scope *scope, AstN...@@ -2304,10 +2308,10 @@ static IrInstruction *ir_build_shuffle_vector(IrBuilder *irb, Scope *scope, AstN
2304 return &instruction->base;2308 return &instruction->base;
2305}2309}
23062310
2307static IrInstruction *ir_build_splat(IrBuilder *irb, Scope *scope, AstNode *source_node,2311static IrInstruction *ir_build_splat_src(IrBuilder *irb, Scope *scope, AstNode *source_node,
2308 IrInstruction *len, IrInstruction *scalar)2312 IrInstruction *len, IrInstruction *scalar)
2309{2313{
2310 IrInstructionSplat *instruction = ir_build_instruction<IrInstructionSplat>(irb, scope, source_node);2314 IrInstructionSplatSrc *instruction = ir_build_instruction<IrInstructionSplatSrc>(irb, scope, source_node);
2311 instruction->len = len;2315 instruction->len = len;
2312 instruction->scalar = scalar;2316 instruction->scalar = scalar;
23132317
...@@ -2373,6 +2377,19 @@ static IrInstruction *ir_build_slice_src(IrBuilder *irb, Scope *scope, AstNode *...@@ -2373,6 +2377,19 @@ static IrInstruction *ir_build_slice_src(IrBuilder *irb, Scope *scope, AstNode *
2373 return &instruction->base;2377 return &instruction->base;
2374}2378}
23752379
2380static IrInstruction *ir_build_splat_gen(IrAnalyze *ira, IrInstruction *source_instruction, ZigType *result_type,
2381 IrInstruction *scalar)
2382{
2383 IrInstructionSplatGen *instruction = ir_build_instruction<IrInstructionSplatGen>(
2384 &ira->new_irb, source_instruction->scope, source_instruction->source_node);
2385 instruction->base.value.type = result_type;
2386 instruction->scalar = scalar;
2387
2388 ir_ref_instruction(scalar, ira->new_irb.current_basic_block);
2389
2390 return &instruction->base;
2391}
2392
2376static IrInstruction *ir_build_slice_gen(IrAnalyze *ira, IrInstruction *source_instruction, ZigType *slice_type,2393static IrInstruction *ir_build_slice_gen(IrAnalyze *ira, IrInstruction *source_instruction, ZigType *slice_type,
2377 IrInstruction *ptr, IrInstruction *start, IrInstruction *end, bool safety_check_on, IrInstruction *result_loc)2394 IrInstruction *ptr, IrInstruction *start, IrInstruction *end, bool safety_check_on, IrInstruction *result_loc)
2378{2395{
...@@ -5014,7 +5031,7 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo...@@ -5014,7 +5031,7 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo
5014 if (arg1_value == irb->codegen->invalid_instruction)5031 if (arg1_value == irb->codegen->invalid_instruction)
5015 return arg1_value;5032 return arg1_value;
50165033
5017 IrInstruction *splat = ir_build_splat(irb, scope, node,5034 IrInstruction *splat = ir_build_splat_src(irb, scope, node,
5018 arg0_value, arg1_value);5035 arg0_value, arg1_value);
5019 return ir_lval_wrap(irb, scope, splat, lval, result_loc);5036 return ir_lval_wrap(irb, scope, splat, lval, result_loc);
5020 }5037 }
...@@ -11082,16 +11099,23 @@ static ZigType *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) {...@@ -11082,16 +11099,23 @@ static ZigType *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) {
11082 return ir_resolve_const_type(ira->codegen, ira->new_irb.exec, type_value->source_node, val);11099 return ir_resolve_const_type(ira->codegen, ira->new_irb.exec, type_value->source_node, val);
11083}11100}
1108411101
11102static Error ir_validate_vector_elem_type(IrAnalyze *ira, IrInstruction *source_instr, ZigType *elem_type) {
11103 if (!is_valid_vector_elem_type(elem_type)) {
11104 ir_add_error(ira, source_instr,
11105 buf_sprintf("vector element type must be integer, float, bool, or pointer; '%s' is invalid",
11106 buf_ptr(&elem_type->name)));
11107 return ErrorSemanticAnalyzeFail;
11108 }
11109 return ErrorNone;
11110}
11111
11085static ZigType *ir_resolve_vector_elem_type(IrAnalyze *ira, IrInstruction *elem_type_value) {11112static ZigType *ir_resolve_vector_elem_type(IrAnalyze *ira, IrInstruction *elem_type_value) {
11113 Error err;
11086 ZigType *elem_type = ir_resolve_type(ira, elem_type_value);11114 ZigType *elem_type = ir_resolve_type(ira, elem_type_value);
11087 if (type_is_invalid(elem_type))11115 if (type_is_invalid(elem_type))
11088 return ira->codegen->builtin_types.entry_invalid;11116 return ira->codegen->builtin_types.entry_invalid;
11089 if (!is_valid_vector_elem_type(elem_type)) {11117 if ((err = ir_validate_vector_elem_type(ira, elem_type_value, elem_type)))
11090 ir_add_error(ira, elem_type_value,
11091 buf_sprintf("vector element type must be integer, float, bool, or pointer; '%s' is invalid",
11092 buf_ptr(&elem_type->name)));
11093 return ira->codegen->builtin_types.entry_invalid;11118 return ira->codegen->builtin_types.entry_invalid;
11094 }
11095 return elem_type;11119 return elem_type;
11096}11120}
1109711121
...@@ -22357,7 +22381,9 @@ static IrInstruction *ir_analyze_instruction_shuffle_vector(IrAnalyze *ira, IrIn...@@ -22357,7 +22381,9 @@ static IrInstruction *ir_analyze_instruction_shuffle_vector(IrAnalyze *ira, IrIn
22357 return ir_analyze_shuffle_vector(ira, &instruction->base, scalar_type, a, b, mask);22381 return ir_analyze_shuffle_vector(ira, &instruction->base, scalar_type, a, b, mask);
22358}22382}
2235922383
22360static IrInstruction *ir_analyze_instruction_splat(IrAnalyze *ira, IrInstructionSplat *instruction) {22384static IrInstruction *ir_analyze_instruction_splat(IrAnalyze *ira, IrInstructionSplatSrc *instruction) {
22385 Error err;
22386
22361 IrInstruction *len = instruction->len->child;22387 IrInstruction *len = instruction->len->child;
22362 if (type_is_invalid(len->value.type))22388 if (type_is_invalid(len->value.type))
22363 return ira->codegen->invalid_instruction;22389 return ira->codegen->invalid_instruction;
...@@ -22366,41 +22392,32 @@ static IrInstruction *ir_analyze_instruction_splat(IrAnalyze *ira, IrInstruction...@@ -22366,41 +22392,32 @@ static IrInstruction *ir_analyze_instruction_splat(IrAnalyze *ira, IrInstruction
22366 if (type_is_invalid(scalar->value.type))22392 if (type_is_invalid(scalar->value.type))
22367 return ira->codegen->invalid_instruction;22393 return ira->codegen->invalid_instruction;
2236822394
22369 uint64_t len_int;22395 uint64_t len_u64;
22370 if (!ir_resolve_unsigned(ira, len, ira->codegen->builtin_types.entry_u32, &len_int)) {22396 if (!ir_resolve_unsigned(ira, len, ira->codegen->builtin_types.entry_u32, &len_u64))
22371 ir_add_error(ira, len,
22372 buf_sprintf("splat length must be comptime"));
22373 return ira->codegen->invalid_instruction;22397 return ira->codegen->invalid_instruction;
22374 }22398 uint32_t len_int = len_u64;
2237522399
22376 if (!is_valid_vector_elem_type(scalar->value.type)) {22400 if ((err = ir_validate_vector_elem_type(ira, scalar, scalar->value.type)))
22377 ir_add_error(ira, len,
22378 buf_sprintf("vector element type must be integer, float, bool, or pointer; '%s' is invalid",
22379 buf_ptr(&scalar->value.type->name)));
22380 return ira->codegen->invalid_instruction;22401 return ira->codegen->invalid_instruction;
22381 }
2238222402
22383 ZigType *return_type = get_vector_type(ira->codegen, len_int, scalar->value.type);22403 ZigType *return_type = get_vector_type(ira->codegen, len_int, scalar->value.type);
2238422404
22385 if (instr_is_comptime(scalar)) {22405 if (instr_is_comptime(scalar)) {
22386 IrInstruction *result = ir_const_undef(ira, scalar, return_type);22406 ConstExprValue *scalar_val = ir_resolve_const(ira, scalar, UndefOk);
22387 result->value.data.x_array.data.s_none.elements =22407 if (scalar_val == nullptr)
22388 allocate<ConstExprValue>(len_int);22408 return ira->codegen->invalid_instruction;
22389 for (uint32_t i = 0; i < len_int; i++) {22409 if (scalar_val->special == ConstValSpecialUndef)
22390 result->value.data.x_array.data.s_none.elements[i] =22410 return ir_const_undef(ira, &instruction->base, return_type);
22391 scalar->value;22411
22412 IrInstruction *result = ir_const(ira, &instruction->base, return_type);
22413 result->value.data.x_array.data.s_none.elements = create_const_vals(len_int);
22414 for (uint32_t i = 0; i < len_int; i += 1) {
22415 copy_const_val(&result->value.data.x_array.data.s_none.elements[i], scalar_val, false);
22392 }22416 }
22393 result->value.type = return_type;
22394 result->value.special = ConstValSpecialStatic;
22395 return result;22417 return result;
22396 }22418 }
2239722419
22398 IrInstruction *result = ir_build_splat(&ira->new_irb,22420 return ir_build_splat_gen(ira, &instruction->base, return_type, scalar);
22399 instruction->base.scope, instruction->base.source_node,
22400 instruction->len->child, instruction->scalar->child);
22401 result->value.type = return_type;
22402 result->value.special = ConstValSpecialRuntime;
22403 return result;
22404}22421}
2240522422
22406static IrInstruction *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstructionBoolNot *instruction) {22423static IrInstruction *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstructionBoolNot *instruction) {
...@@ -25857,6 +25874,7 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction...@@ -25857,6 +25874,7 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction
25857 case IrInstructionIdTestErrGen:25874 case IrInstructionIdTestErrGen:
25858 case IrInstructionIdFrameSizeGen:25875 case IrInstructionIdFrameSizeGen:
25859 case IrInstructionIdAwaitGen:25876 case IrInstructionIdAwaitGen:
25877 case IrInstructionIdSplatGen:
25860 zig_unreachable();25878 zig_unreachable();
2586125879
25862 case IrInstructionIdReturn:25880 case IrInstructionIdReturn:
...@@ -25987,8 +26005,8 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction...@@ -25987,8 +26005,8 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction
25987 return ir_analyze_instruction_vector_type(ira, (IrInstructionVectorType *)instruction);26005 return ir_analyze_instruction_vector_type(ira, (IrInstructionVectorType *)instruction);
25988 case IrInstructionIdShuffleVector:26006 case IrInstructionIdShuffleVector:
25989 return ir_analyze_instruction_shuffle_vector(ira, (IrInstructionShuffleVector *)instruction);26007 return ir_analyze_instruction_shuffle_vector(ira, (IrInstructionShuffleVector *)instruction);
25990 case IrInstructionIdSplat:26008 case IrInstructionIdSplatSrc:
25991 return ir_analyze_instruction_splat(ira, (IrInstructionSplat *)instruction);26009 return ir_analyze_instruction_splat(ira, (IrInstructionSplatSrc *)instruction);
25992 case IrInstructionIdBoolNot:26010 case IrInstructionIdBoolNot:
25993 return ir_analyze_instruction_bool_not(ira, (IrInstructionBoolNot *)instruction);26011 return ir_analyze_instruction_bool_not(ira, (IrInstructionBoolNot *)instruction);
25994 case IrInstructionIdMemset:26012 case IrInstructionIdMemset:
...@@ -26325,7 +26343,8 @@ bool ir_has_side_effects(IrInstruction *instruction) {...@@ -26325,7 +26343,8 @@ bool ir_has_side_effects(IrInstruction *instruction) {
26325 case IrInstructionIdIntType:26343 case IrInstructionIdIntType:
26326 case IrInstructionIdVectorType:26344 case IrInstructionIdVectorType:
26327 case IrInstructionIdShuffleVector:26345 case IrInstructionIdShuffleVector:
26328 case IrInstructionIdSplat:26346 case IrInstructionIdSplatSrc:
26347 case IrInstructionIdSplatGen:
26329 case IrInstructionIdBoolNot:26348 case IrInstructionIdBoolNot:
26330 case IrInstructionIdSliceSrc:26349 case IrInstructionIdSliceSrc:
26331 case IrInstructionIdMemberCount:26350 case IrInstructionIdMemberCount:
src/ir_print.cpp+16-5
...@@ -44,8 +44,10 @@ static const char* ir_instruction_type_str(IrInstruction* instruction) {...@@ -44,8 +44,10 @@ static const char* ir_instruction_type_str(IrInstruction* instruction) {
44 return "Invalid";44 return "Invalid";
45 case IrInstructionIdShuffleVector:45 case IrInstructionIdShuffleVector:
46 return "Shuffle";46 return "Shuffle";
47 case IrInstructionIdSplat:47 case IrInstructionIdSplatSrc:
48 return "Splat";48 return "SplatSrc";
49 case IrInstructionIdSplatGen:
50 return "SplatGen";
49 case IrInstructionIdDeclVarSrc:51 case IrInstructionIdDeclVarSrc:
50 return "DeclVarSrc";52 return "DeclVarSrc";
51 case IrInstructionIdDeclVarGen:53 case IrInstructionIdDeclVarGen:
...@@ -1224,7 +1226,7 @@ static void ir_print_shuffle_vector(IrPrint *irp, IrInstructionShuffleVector *in...@@ -1224,7 +1226,7 @@ static void ir_print_shuffle_vector(IrPrint *irp, IrInstructionShuffleVector *in
1224 fprintf(irp->f, ")");1226 fprintf(irp->f, ")");
1225}1227}
12261228
1227static void ir_print_splat(IrPrint *irp, IrInstructionSplat *instruction) {1229static void ir_print_splat_src(IrPrint *irp, IrInstructionSplatSrc *instruction) {
1228 fprintf(irp->f, "@splat(");1230 fprintf(irp->f, "@splat(");
1229 ir_print_other_instruction(irp, instruction->len);1231 ir_print_other_instruction(irp, instruction->len);
1230 fprintf(irp->f, ", ");1232 fprintf(irp->f, ", ");
...@@ -1232,6 +1234,12 @@ static void ir_print_splat(IrPrint *irp, IrInstructionSplat *instruction) {...@@ -1232,6 +1234,12 @@ static void ir_print_splat(IrPrint *irp, IrInstructionSplat *instruction) {
1232 fprintf(irp->f, ")");1234 fprintf(irp->f, ")");
1233}1235}
12341236
1237static void ir_print_splat_gen(IrPrint *irp, IrInstructionSplatGen *instruction) {
1238 fprintf(irp->f, "@splat(");
1239 ir_print_other_instruction(irp, instruction->scalar);
1240 fprintf(irp->f, ")");
1241}
1242
1235static void ir_print_bool_not(IrPrint *irp, IrInstructionBoolNot *instruction) {1243static void ir_print_bool_not(IrPrint *irp, IrInstructionBoolNot *instruction) {
1236 fprintf(irp->f, "! ");1244 fprintf(irp->f, "! ");
1237 ir_print_other_instruction(irp, instruction->value);1245 ir_print_other_instruction(irp, instruction->value);
...@@ -2170,8 +2178,11 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction, bool...@@ -2170,8 +2178,11 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction, bool
2170 case IrInstructionIdShuffleVector:2178 case IrInstructionIdShuffleVector:
2171 ir_print_shuffle_vector(irp, (IrInstructionShuffleVector *)instruction);2179 ir_print_shuffle_vector(irp, (IrInstructionShuffleVector *)instruction);
2172 break;2180 break;
2173 case IrInstructionIdSplat:2181 case IrInstructionIdSplatSrc:
2174 ir_print_splat(irp, (IrInstructionSplat *)instruction);2182 ir_print_splat_src(irp, (IrInstructionSplatSrc *)instruction);
2183 break;
2184 case IrInstructionIdSplatGen:
2185 ir_print_splat_gen(irp, (IrInstructionSplatGen *)instruction);
2175 break;2186 break;
2176 case IrInstructionIdBoolNot:2187 case IrInstructionIdBoolNot:
2177 ir_print_bool_not(irp, (IrInstructionBoolNot *)instruction);2188 ir_print_bool_not(irp, (IrInstructionBoolNot *)instruction);
test/compile_errors.zig+1-1
...@@ -6514,7 +6514,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -6514,7 +6514,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
6514 \\ var v = @splat(4, c);6514 \\ var v = @splat(4, c);
6515 \\}6515 \\}
6516 ,6516 ,
6517 "tmp.zig:3:20: error: vector element type must be integer, float, bool, or pointer; 'comptime_int' is invalid",6517 "tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; 'comptime_int' is invalid",
6518 );6518 );
65196519
6520 cases.add("compileLog of tagged enum doesn't crash the compiler",6520 cases.add("compileLog of tagged enum doesn't crash the compiler",
test/stage1/behavior/vector.zig+5-4
...@@ -145,10 +145,11 @@ test "vector @splat" {...@@ -145,10 +145,11 @@ test "vector @splat" {
145 var v: u32 = 5;145 var v: u32 = 5;
146 var x = @splat(4, v);146 var x = @splat(4, v);
147 expect(@typeOf(x) == @Vector(4, u32));147 expect(@typeOf(x) == @Vector(4, u32));
148 expect(x[0] == 5);148 var array_x: [4]u32 = x;
149 expect(x[1] == 5);149 expect(array_x[0] == 5);
150 expect(x[2] == 5);150 expect(array_x[1] == 5);
151 expect(x[3] == 5);151 expect(array_x[2] == 5);
152 expect(array_x[3] == 5);
152 }153 }
153 };154 };
154 S.doTheTest();155 S.doTheTest();