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

--- Comment #16 from Arnd Bergmann <arnd at linaro dot org> ---
Here is a simplified version of the file in question, to try as standalone:

typedef unsigned int u32;
asm("    .arch armv5te\n");
extern int cpuid;
static _Bool cpu_is_xscale_family()
{
        /* this code must be compiled to execute on other CPUs, so
           we cannot just use -march=armv5te */
        switch (cpuid & 0xffffe000) {
        case 0x69052000: /* Intel XScale 1 */
        case 0x69054000: /* Intel XScale 2 */
        case 0x69056000: /* Intel XScale 3 */
        case 0x56056000: /* Marvell XScale 3 */
        case 0x56158000: /* Marvell Mohawk */
                return 1;
        }
        return 0;
}
static int cpu_has_iwmmxt(void)
{
        u32 lo;
        u32 hi;

        /*
         * This sequence is interpreted by the DSP coprocessor as:
         *      mar     acc0, %2, %3
         *      mra     %0, %1, acc0
         *
         * And by the iWMMXt coprocessor as:
         *      tmcrr   wR0, %2, %3
         *      tmrrc   %0, %1, wR0
         */
        __asm__ __volatile__ (
                "mcrr   p0, 0, %2, %3, c0\n"
                "mrrc   p0, 0, %0, %1, c0\n"
                : "=r" (lo), "=r" (hi)
                : "r" (0), "r" (0x100));

        return !!hi;
}
int xscale_cp0_init(void)
{
        /* do not attempt to probe iwmmxt on non-xscale family CPUs */
        if (!cpu_is_xscale_family())
                return 0;

        if (!cpu_has_iwmmxt())
                return 0;

        /* ... start using iwmmxt */

        return 0;
}

$ arm-linux-gnueabi-gcc-7.2.1 -Wall -O2 -c test.c -march=armv4t
# no output

$ arm-linux-gnueabi-gcc-8.0.1 -Wall -O2 -c test.c -march=armv4t
/tmp/ccobFwz5.s: Assembler messages:
/tmp/ccobFwz5.s:34: Error: selected processor does not support `mcrr
p0,0,r0,r3,c0' in ARM mode
/tmp/ccobFwz5.s:35: Error: selected processor does not support `mrrc
p0,0,r3,r2,c0' in ARM mode

Reply via email to