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

            Bug ID: 108009
           Summary: GCC does not produce Pack Halfword instructions
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chris.sidebottom at arm dot com
  Target Milestone: ---

I've been trying to remove a dependency on CMSIS intrinsics
(https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/Core/Include/cmsis_gcc.h),
following https://arm-software.github.io/acle/main/acle.html, I should be able
to generate a halfword packing instructions
(https://developer.arm.com/documentation/dui0489/h/arm-and-thumb-instructions/pkhbt-and-pkhtb)
using C, such as:

  int pack(int x, int y) {
      return ((x & 0xFFFFu) << 16) | (y & 0xffffu);
  }

However, `gcc -mcpu=cortex-m4 -O3` results in two instructions rather than the
single halfword packing instruction.

Reply via email to