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

--- Comment #2 from Christophe Lyon <clyon at gcc dot gnu.org> ---
(In reply to Stefan Schulze Frielinghaus from comment #1)
> (In reply to Christophe Lyon from comment #0)
> > Given the dg-do line:
> > /* { dg-do compile { target { { aarch64*-*-* powerpc64*-*-* riscv64-*-*
> > s390*-*-* x86_64-*-* } && int128 } } } */
> > 
> > 
> > I suppose you want to skip the test on arm? (but that's not what the above
> > does)
> 
> I think the quoted dg-do compile directive belongs to a different test.  In
> gcc.dg/asm-hard-reg-error-3.c we have
> 
> /* { dg-do compile { target arm-*-* s390-*-* } } */

Oops sorry indeed I copy/pasted from asm-hard-reg-3.c


> 
> For some reason that test passes my cross compiler.  What I would like to
> test is that a register pair must be in an even/odd pair.  So I think the
> correct option is -marm here since that requires for a `long long` an
> even/odd register pair whereas for -mthumb any register pair is allowed. 
> Can you confirm that?

You are right: in CI we configure GCC with --with-mode=thumb, so when compiling
this testcase, we do not emit the expected error at line 21.  Adding -marm
triggers the error.

In gcc/config/arm/arm.cc arm_hard_regno_mode_ok, you can see these comments:
  if (TARGET_THUMB1)
    /* For the Thumb we only allow values bigger than SImode in
       registers 0 - 6, so that there is always a second low
       register available to hold the upper part of the value.
       We probably we ought to ensure that the register is the
       start of an even numbered register pair.  */

Then for arm mode:
  /* We allow almost any value to be stored in the general registers.
     Restrict doubleword quantities to even register pairs in ARM state
     so that we can use ldrd. [...]

Reply via email to