some progress

This commit is contained in:
veclavtlica
2026-10-07 11:21:21 +03:00
parent 14062e9d00
commit 8d502173a2
26 changed files with 705 additions and 212 deletions
+10 -12
View File
@@ -22,7 +22,7 @@
#include <stdint.h>
typedef struct {
com_def_alignedas(64) com_def_vector(com_fix_t, a, 4 * 4);
com_def_alignedas(64) com_def_vector(com_fix_t, a, 4 * 4 * sizeof(com_fix_t));
} com_mat_t;
void com_mat_run_bench(void);
@@ -30,7 +30,7 @@ void com_mat_run_bench(void);
#define COM_MAT_PROFILE_SINK(m_m) \
do { \
for (int i = 0; i < 16; ++i) \
COM_DEF_PROFILE_SINK((m_m).a[i]); \
com_def_profile_sink((m_m).a[i]); \
} while (0)
static inline com_mat_t com_mat_identity(void) {
@@ -60,11 +60,10 @@ static inline com_mat_t com_mat_mul(com_mat_t a, com_mat_t b) {
for (int c = 0; c < 4; ++c) {
for (int r = 0; r < 4; ++r) {
result.a[r + c * 4] = (((int64_t)a.a[r + 0 * 4] * b.a[0 + c * 4]) +
((int64_t)a.a[r + 1 * 4] * b.a[1 + c * 4]) +
((int64_t)a.a[r + 2 * 4] * b.a[2 + c * 4]) +
((int64_t)a.a[r + 3 * 4] * b.a[3 + c * 4])) >>
COM_FIX_FRACBITS;
result.a[r + c * 4] = ((com_fix_mul(a.a[r + 0 * 4], b.a[0 + c * 4])) +
(com_fix_mul(a.a[r + 1 * 4], b.a[1 + c * 4])) +
(com_fix_mul(a.a[r + 2 * 4], b.a[2 + c * 4])) +
(com_fix_mul(a.a[r + 3 * 4], b.a[3 + c * 4])));
}
}
@@ -80,11 +79,10 @@ static inline com_mat_t com_mat_mul_reodered(com_mat_t a, com_mat_t b) {
for (int c = 0; c < 4; ++c) {
for (int r = 0; r < 4; ++r) {
result.a[r + c * 4] = (((int64_t)a.a[0 + r * 4] * b.a[0 + c * 4]) +
((int64_t)a.a[1 + r * 4] * b.a[1 + c * 4]) +
((int64_t)a.a[2 + r * 4] * b.a[2 + c * 4]) +
((int64_t)a.a[3 + r * 4] * b.a[3 + c * 4])) >>
COM_FIX_FRACBITS;
result.a[r + c * 4] = ((com_fix_mul(a.a[0 + r * 4], b.a[0 + c * 4])) +
(com_fix_mul(a.a[1 + r * 4], b.a[1 + c * 4])) +
(com_fix_mul(a.a[2 + r * 4], b.a[2 + c * 4])) +
(com_fix_mul(a.a[3 + r * 4], b.a[3 + c * 4])));
}
}