diff options
| author | gingerBill <bill@gingerbill.org> | 2021-10-19 11:24:26 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-10-19 11:24:26 +0100 |
| commit | 243e2e2b8a7566087375178a66b25b5d9ac9a356 (patch) | |
| tree | d82f6499edb8a1056c19479c59e6390f294887e7 /src/llvm_backend_utility.cpp | |
| parent | 35111b39b88bb12d61e1dc67ed0161109be3f865 (diff) | |
Basic support for matrix*vector, vector*matrix operations
Diffstat (limited to 'src/llvm_backend_utility.cpp')
| -rw-r--r-- | src/llvm_backend_utility.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/llvm_backend_utility.cpp b/src/llvm_backend_utility.cpp index 1b41be2a3..3971c0ca6 100644 --- a/src/llvm_backend_utility.cpp +++ b/src/llvm_backend_utility.cpp @@ -1224,12 +1224,14 @@ lbValue lb_emit_ptr_offset(lbProcedure *p, lbValue ptr, lbValue index) { lbValue lb_emit_matrix_epi(lbProcedure *p, lbValue s, isize row, isize column) { Type *t = s.type; GB_ASSERT(is_type_pointer(t)); - Type *st = base_type(type_deref(t)); - GB_ASSERT_MSG(is_type_matrix(st), "%s", type_to_string(st)); + Type *mt = base_type(type_deref(t)); + GB_ASSERT_MSG(is_type_matrix(mt), "%s", type_to_string(mt)); - Type *ptr = base_array_type(st); + Type *ptr = base_array_type(mt); + + i64 stride_elems = matrix_type_stride_in_elems(mt); - isize index = row*column; + isize index = row + column*stride_elems; GB_ASSERT(0 <= index); LLVMValueRef indices[2] = { |