Function splatVector [src]
Prototype
pub fn splatVector( self: *WipFunction, ty: Type, elem: Value, name: []const u8, ) Allocator.Error!Value
Parameters
self: *WipFunction
ty: Type
elem: Value
name: []const u8
Source
pub fn splatVector(
self: *WipFunction,
ty: Type,
elem: Value,
name: []const u8,
) Allocator.Error!Value {
const scalar_ty = try ty.changeLength(1, self.builder);
const mask_ty = try ty.changeScalar(.i32, self.builder);
const poison = try self.builder.poisonValue(scalar_ty);
const mask = try self.builder.splatValue(mask_ty, .@"0");
const scalar = try self.insertElement(poison, elem, .@"0", name);
return self.shuffleVector(scalar, poison, mask, name);
}