CBE: implement vector element pointers
This commit is contained in:
@@ -17,12 +17,6 @@ const LazySrcLoc = Module.LazySrcLoc;
|
||||
const Air = @import("../Air.zig");
|
||||
const Liveness = @import("../Liveness.zig");
|
||||
|
||||
const target_util = @import("../target.zig");
|
||||
const libcFloatPrefix = target_util.libcFloatPrefix;
|
||||
const libcFloatSuffix = target_util.libcFloatSuffix;
|
||||
const compilerRtFloatAbbrev = target_util.compilerRtFloatAbbrev;
|
||||
const compilerRtIntAbbrev = target_util.compilerRtIntAbbrev;
|
||||
|
||||
const BigIntLimb = std.math.big.Limb;
|
||||
const BigInt = std.math.big.int;
|
||||
|
||||
@@ -3317,7 +3311,7 @@ fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue {
|
||||
try writer.writeAll(", sizeof(");
|
||||
try f.renderType(writer, src_ty);
|
||||
try writer.writeAll("))");
|
||||
} else if (ptr_info.host_size != 0) {
|
||||
} else if (ptr_info.host_size > 0 and ptr_info.vector_index == .none) {
|
||||
var host_pl = Type.Payload.Bits{
|
||||
.base = .{ .tag = .int_unsigned },
|
||||
.data = ptr_info.host_size * 8,
|
||||
@@ -3647,7 +3641,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index) !CValue {
|
||||
if (src_val == .constant) {
|
||||
try freeLocal(f, inst, array_src.new_local, 0);
|
||||
}
|
||||
} else if (ptr_info.host_size != 0) {
|
||||
} else if (ptr_info.host_size > 0 and ptr_info.vector_index == .none) {
|
||||
const host_bits = ptr_info.host_size * 8;
|
||||
var host_pl = Type.Payload.Bits{ .base = .{ .tag = .int_unsigned }, .data = host_bits };
|
||||
const host_ty = Type.initPayload(&host_pl.base);
|
||||
|
||||
@@ -1465,7 +1465,7 @@ pub const CType = extern union {
|
||||
.base = .{ .tag = .int_unsigned },
|
||||
.data = info.host_size * 8,
|
||||
};
|
||||
const pointee_ty = if (info.host_size > 0)
|
||||
const pointee_ty = if (info.host_size > 0 and info.vector_index == .none)
|
||||
Type.initPayload(&host_int_pl.base)
|
||||
else
|
||||
info.pointee_type;
|
||||
|
||||
@@ -1118,7 +1118,6 @@ test "byte vector initialized in inline function" {
|
||||
}
|
||||
|
||||
test "byte vector initialized in inline function" {
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
@@ -1233,7 +1232,6 @@ test "load packed vector element" {
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var x: @Vector(2, u15) = .{ 1, 4 };
|
||||
try expect((&x[0]).* == 1);
|
||||
@@ -1246,7 +1244,6 @@ test "store packed vector element" {
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
|
||||
|
||||
var v = @Vector(4, u1){ 1, 1, 1, 1 };
|
||||
try expectEqual(@Vector(4, u1){ 1, 1, 1, 1 }, v);
|
||||
|
||||
Reference in New Issue
Block a user