diff mbox

[GCC/testsuite/ARM] Add MOVT testing for ARMv8-M Baseline

Message ID cea89130-ee14-adff-8ce0-d3c53feb089c@foss.arm.com
State New
Headers show

Commit Message

Thomas Preudhomme May 22, 2017, 7:48 a.m. UTC
Ping?

Best regards,

Thomas

On 11/05/17 16:13, Thomas Preudhomme wrote:
> 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.preudhomme@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

Comments

Kyrill Tkachov May 22, 2017, 8:46 a.m. UTC | #1
On 22/05/17 08:48, Thomas Preudhomme wrote:
> Ping?
>
> Best regards,
>
> Thomas
>
> On 11/05/17 16:13, Thomas Preudhomme wrote:
>> 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.preudhomme@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?
>>

Ok.
Thanks,
Kyrill

>> Best regards,
>>
>> Thomas
diff mbox

Patch

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 } } */