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

            Bug ID: 107626
           Summary: STRICT_ALIGNMENT and TARGET_SLOW_UNALIGNED_ACCESS
                    usage
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: documentation, internal-improvement
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

As explained in bug 107601 comment #3, these target macros/hooks usage should
be auditted in the middle-end to make sure they are used correctly and explain
better in the documentation on what their usage is.

STRICT_ALIGNMENT says all (some?) unaligned access will cause a trap and GCC
should not try to use them at all.
While TARGET_SLOW_UNALIGNED_ACCESS should tell the middle-end if a load/store
with a specific mode with a specific alignment will be much slow (where much is
usually in the order of 10x or so) than an aligned case.

An good example for usage of TARGET_SLOW_UNALIGNED_ACCESS is the powerpc*-linux
(ABI and arch) which says a floating point load/store to a 4 byte aligned (even
a 8 byte load) will not cause a trap so it will be handled in HW while
otherwise it will cause a trap (and the Linux kernel should handle the
load/store) and it will be slow. So this is techincally not a STRICT_ALIGNMENT
target as required by the ABI but  TARGET_SLOW_UNALIGNED_ACCESS should be used
there.

This should be expanded and put in the documentation here.

Reply via email to