Hi Robin:
On Thu, Nov 5, 2026 at 10:16 PM Robin Dapp <[email protected]> wrote:
>
> Hi Kito,
>
> > We take whether misaligned accesses work from the -mtune table, but this
> > depends on the hardware. So -mtune=generic-ooo emits misaligned
> > vle32.v/vse32.v for any -march, and these can trap. It also overrides an
> > explicit -mvector-strict-align.
>
> I haven't read the rest yet but this one caught my eye right away. I
> think there is an unwritten rule "explicit wins over implicit", so an
> explicit -mvector-strict-align should IMHO not be overridden, except by
> a later -mno-vector-strict-align. Or will that break things?
The current code is:
riscv_vector_unaligned_access_p = opts->x_rvv_vector_strict_align == 0
|| cpu->tune_param->vector_unaligned_access;
So -mtune/-mcpu will always win because `||`.
and the new logic (w/ this patch) is:
static bool
riscv_vector_unaligned_access_allowed_p (int vector_strict_align,
const char *cpu_string)
{
if (vector_strict_align != -1)
return vector_strict_align == 0;
const riscv_tune_info *cpu
= cpu_string ? riscv_parse_tune (cpu_string, true) : nullptr;
return cpu && cpu->tune_param->vector_unaligned_access;
}
And vector_strict_align is inited to -1 in the patch-set to present
user isn't give -m[no-]vector-strict-align,
which means the behavior with this patch set should meet your (and
mine) expectations :)