aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-12-20 23:13:36 +0200
committerGitHub <noreply@github.com>2022-12-20 23:13:36 +0200
commite1345fd0a05b7dd956f027b6ad7061a9b3a15e26 (patch)
tree1c859fb01d392fb5769c6ac40972f6243559beaf /src/codegen/llvm.zig
parentdc22c3b9a5ef382ed9c7fb4ff503c7d8be187cee (diff)
parent9f23702c21645aeddd64bcf203bc8b62a328f75f (diff)
downloadzig-e1345fd0a05b7dd956f027b6ad7061a9b3a15e26.tar.gz
zig-e1345fd0a05b7dd956f027b6ad7061a9b3a15e26.zip
Merge pull request #14004 from Vexu/packed-struct-vector
llvm: handle vectors in packed structs
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 3b180b4c50..9fc3055969 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -5973,7 +5973,7 @@ pub const FuncGen = struct {
const shift_amt = containing_int.typeOf().constInt(bit_offset, .False);
const shifted_value = self.builder.buildLShr(containing_int, shift_amt, "");
const elem_llvm_ty = try self.dg.lowerType(field_ty);
- if (field_ty.zigTypeTag() == .Float) {
+ if (field_ty.zigTypeTag() == .Float or field_ty.zigTypeTag() == .Vector) {
const elem_bits = @intCast(c_uint, field_ty.bitSize(target));
const same_size_int = self.context.intType(elem_bits);
const truncated_int = self.builder.buildTrunc(shifted_value, same_size_int, "");
@@ -5996,7 +5996,7 @@ pub const FuncGen = struct {
assert(struct_ty.containerLayout() == .Packed);
const containing_int = struct_llvm_val;
const elem_llvm_ty = try self.dg.lowerType(field_ty);
- if (field_ty.zigTypeTag() == .Float) {
+ if (field_ty.zigTypeTag() == .Float or field_ty.zigTypeTag() == .Vector) {
const elem_bits = @intCast(c_uint, field_ty.bitSize(target));
const same_size_int = self.context.intType(elem_bits);
const truncated_int = self.builder.buildTrunc(containing_int, same_size_int, "");
@@ -9896,7 +9896,7 @@ pub const FuncGen = struct {
return result_ptr;
}
- if (info.pointee_type.zigTypeTag() == .Float) {
+ if (info.pointee_type.zigTypeTag() == .Float or info.pointee_type.zigTypeTag() == .Vector) {
const same_size_int = self.context.intType(elem_bits);
const truncated_int = self.builder.buildTrunc(shifted_value, same_size_int, "");
return self.builder.buildBitCast(truncated_int, elem_llvm_ty, "");