https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110273

Jens-Hanno Schwalm <ha...@schwalm-bremen.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ha...@schwalm-bremen.de

--- Comment #10 from Jens-Hanno Schwalm <ha...@schwalm-bremen.de> ---
Hi, i think we found a very-similar issue in darktable code, you might look at

https://github.com/darktable-org/darktable/pull/15742

In short
- reported with gcc 13.2.1, -march=znver4 or using -fvect-cost-model=dynamic

The code in question was
```
typedef struct dt_draw_curve_t
{
  CurveData c;
  CurveSample csample;
} dt_draw_curve_t;

static inline void dt_draw_curve_set_point(dt_draw_curve_t *c,
                                           const int num,
                                           const float x,
                                           const float y)
{
  c->c.m_anchors[num].x = x;
  c->c.m_anchors[num].y = y;
}


static void _generate_curve_lut( ...)
{
  ...
  dt_iop_rgbcurve_node_t curve_nodes[3][20];
  ...
     for(int k = 0; k < d->params.curve_num_nodes[ch]; k++)
      dt_draw_curve_set_point(d->curve[ch], k,
            curve_nodes[ch][k].x,
            curve_nodes[ch][k].y);
 ...
}
```

The relevant point here was:
even if the curve_nodes are not aligned64 the compiled code looked like

lea (%rcx, %rbx,1), %rdi
vmoaps -0x220(%rbp, %rdi,8), %ymm2
vmoups %ymm2, 0x18(%r15,%rcx,8)

forcing an alignment64 on curve_nodes fixed the problem

reporting this as one of darktable devs - no compiler expert at all - and never
reported here before. Yet this seems a bug and possibly the same are originally
reported here.

Reply via email to