Hi, When ARMv8-M Baseline support was introduced no testcase was added for support of the MOVT instruction because GCC would always prefer a load from literal pool. With the recent work to fix -mslow-flash-data by Andre Simoes Dias Vieira and Prakhar Bahuguna it is now possible to test that support.
This commit adds a test for MOVT based on the MOVW test by using -mslow-flash-data to ensure that GCC does not do a literal load of the immediate. As such, this test is restricted to Cortex-M devices (where -mslow-flash-data is available) with MOVT instruction. ChangeLog entry is as follows: *** gcc/testsuite/ChangeLog *** 2017-05-2017 Thomas Preud'homme <thomas.preudho...@arm.com> * gcc.target/arm/movsi_movt.c: New test. * gcc.target/arm/movdi_movt.c: New test. Testing: the new tests have been tested to pass for ARMv7-M and ARMv8-M (Baseline and Mainline) on arm-none-eabi and armeb-none-eabi targets. Is this ok for trunk? Best regards, Thomas
diff --git a/gcc/testsuite/gcc.target/arm/movdi_movt.c b/gcc/testsuite/gcc.target/arm/movdi_movt.c new file mode 100644 index 0000000000000000000000000000000000000000..e2a28ccbd994ed0e4d0b9ac432df32138820432c --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/movdi_movt.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { arm_cortex_m && { arm_thumb2_ok || arm_thumb1_movt_ok } } } } */ +/* { dg-options "-O2 -mslow-flash-data" } */ + +unsigned long long +movdi_1 (int a) +{ + return 0xF0F00000LLU; +} + +unsigned long long +movdi_2 (int a) +{ + return 0xF0F0000000000000LLU; +} + +/* Accept r1 because big endian targets put the low bits in the highest + numbered register of a pair. */ +/* { dg-final { scan-assembler-times "movt\tr\[01\], 61680" 2 } } */ diff --git a/gcc/testsuite/gcc.target/arm/movsi_movt.c b/gcc/testsuite/gcc.target/arm/movsi_movt.c new file mode 100644 index 0000000000000000000000000000000000000000..3cf46e2fd172ee1728b7b50c1cead90924962dca --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/movsi_movt.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target { arm_cortex_m && { arm_thumb2_ok || arm_thumb1_movt_ok } } } } */ +/* { dg-options "-O2 -mslow-flash-data" } */ + +unsigned +movsi (void) +{ + return 0xF0F00000U; +} + +/* { dg-final { scan-assembler-times "movt\tr0, 61680" 1 } } */