[SUMMARY] Re: [PATCH v2] testsuite: arm: Set tuning for MVE FP intrinsic tests
Richard Earnshaw (foss)
Richard.Earnshaw@arm.com
Tue Oct 6 08:26:01 GMT 2026
On 05/10/2026 23:07, Christophe Lyon wrote:
> Hi!
>
>
> On 10/4/26 19:14, Torbjörn Svensson via Sourceware Forge wrote:
>>
>> This is a summary of discussions relative to the merge request created by Torbjörn Svensson (azoff) <torbjorn.svensson@foss.st.com> titled
>> arm: Set Cortex-M55 tuning for MVE FP tests
>> since its creation.
>>
>> Description: Changes since v1:
>> - Dropped the generic change in lib/target-supports.exp
>> - Added the change to the dg-options/dg-additional-options for the affected tests.
>>
>> --
>>
>> When running DejaGNU with thumb/arch=a/tune=b and a does not happen to be armv8.1-m.main+mve.fp, the effective target check will switch target to that. If that happens, the tune "b" will survive and impact what assembler that will be generated.
>> This change resets the tune to the default one for armv8.1-m.main+mve.fp.
>>
>> Tested on arm-none-eabi with both -mcpu and -mtune on r17-4804-gf7094fe5ff882f without any regressions.
>>
>> Ok for trunk, releases/gcc-16 and releases/gcc-15?
>>
>> --
>>
>> CC: Richard Earnshaw <Richard.Earnshaw@arm.com>
>> CC: Andre Simoes Dias Vieira <Andre.SimoesDiasVieira@arm.com>
>> CC: Christophe Lyon <christophe.lyon@arm.com>
>>
>> The full and up to date discussion can be found at https://forge.sourceware.org/gcc/gcc/pulls/238
>>
>> The merge request has been closed without being merged directly on the forge repository.
>>
>> On 2026-10-04 07:03:32+00:00, Torbjörn Svensson (azoff) <torbjorn.svensson@foss.st.com> requested that Christophe Lyon (clyon) <clyon@gcc.gnu.org> review the code:
>>
>>
>>
>>
>> On 2026-10-04 07:31:07+00:00, Richard Earnshaw (rearnsha) <rearnsha@arm.com> commented on the code:
>>
>>
>>> +++ gcc/testsuite/lib/target-supports.exp
>>> @@ -7035,2 +7035,3 @@
>>> # need to be added to the -march option.
>>> - foreach flags {"" "-mfloat-abi=softfp -mfpu=auto -mcpu=unset -march=armv8.1-m.main+mve.fp" "-mfloat-abi=hard -mfpu=auto -mcpu=unset -march=armv8.1-m.main+mve.fp"} {
>>> + foreach flags {
>>> + ""
>> Why would this alternative not also override the tuning? What if we have a CPU with the same architecture but different tuning costs?
>>
>> Which tests are affected by this issue? Would it make sense to override the tuning there as needed?
>>> +++ gcc/testsuite/lib/target-supports.exp
>>> @@ -7035,2 +7035,3 @@
>>> # need to be added to the -march option.
>>> - foreach flags {"" "-mfloat-abi=softfp -mfpu=auto -mcpu=unset -march=armv8.1-m.main+mve.fp" "-mfloat-abi=hard -mfpu=auto -mcpu=unset -march=armv8.1-m.main+mve.fp"} {
>>> + foreach flags {
>>> + ""
>> The tests fixed are:
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpeqq_n_f16.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpeqq_n_f32.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpgeq_n_f16.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpgeq_n_f32.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpgtq_n_f16.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpgtq_n_f32.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpleq_n_f16.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpleq_n_f32.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpltq_n_f16.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpltq_n_f32.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpneq_n_f16.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vcmpneq_n_f32.c check-function-bodies foo2
>> - FAIL: gcc.target/arm/mve/intrinsics/vdupq_n_f16.c check-function-bodies foo1
>> - FAIL: gcc.target/arm/mve/intrinsics/vdupq_n_f32.c check-function-bodies foo1
>>
>> All of these were failing with `thumb/arch=armv7ve+simd/tune=cortex-a7/float-abi=hard/fpu=auto` and `thumb/arch=armv7ve+nofp/tune=cortex-a7/float-abi=soft/fpu=auto`, while passing when replacing `-mtune` with `-mcpu`.
>>
>> The reason why I did not add the `-mtune=cortex-m55` for the empty string is that I thought it was only needed when switching target.
>> I can add it there too in case you think that is better (should have no impact regardless).
>>
>> Comparing -mtune with -mcpu for gcc.target/arm/mve/intrinsics/vcmpeqq_n_f16.c, I see the following difference in generated assembler:
>> ```
>> --- mcpu.s 2026-10-04 09:49:39.835214873 +0200
>> +++ mtune.s 2026-10-04 09:49:39.836214873 +0200
>> @@ -66,11 +66,23 @@
>> @ args = 0, pretend = 0, frame = 0
>> @ frame_needed = 0, uses_anonymous_args = 0
>> @ link register save eliminated.
>> - vmov d6, r0, r1 @ v8hf
>> - vmov d7, r2, r3
>> - movw r3, #15462
>> - vcmp.f16 eq, q3, r3
>> + vmov d4, r0, r1 @ v8hf
>> + vmov d5, r2, r3
>> + vldr.64 d6, .L5
>> + vldr.64 d7, .L5+8
>> + vcmp.f16 eq, q2, q3
>> vmrs r0, p0 @ movhi
>> uxth r0, r0
>> bx lr
>> +.L6:
>> + .align 3
>> +.L5:
>> + .short 15462
>> + .short 15462
>> + .short 15462
>> + .short 15462
>> + .short 15462
>> + .short 15462
>> + .short 15462
>> + .short 15462
>> .size foo2, .-foo2
>> ```
>>
> Sorry it's not clear to me which code is with -mtune and which one is with -mcpu?
>
> and do you mean -mtune=cortexx-a7 / -mcpu=cortex-a7?
>
> Also I'm not sure I understand the fix ;-)
> IIUC without your patch the test fails because it's compiled with
> thumb/arch=armv7ve+simd/tune=cortex-a7/float-abi=hard/fpu=auto followed by "-mfloat-abi=hard -mfpu=auto -mcpu=unset -march=armv8.1-m.main+mve.fp" from arm_v8_1m_mve_fp_ok_nocache?
>
> which gets simplified to
> -mthumb -march=armv8.1-m.main+mve.fp -mtune=cortex-a7
> -mfloat-abi=hard -mfpu=auto -mcpu=unset
> and -mcpu does not cancel the effect of -mtune?
>
-mcpu=unset only unsets -mcpu options; -mtune is not touched, nor should it be.
R.
> Thanks,
>
> Christophe
>
>> If you have a suggestion how to fix the tests in a better way, I'd be happy to try it.
>>
>>
>> On 2026-10-04 11:52:44+00:00, Torbjörn Svensson (azoff) wrote:
>>
>> Updated the patch after live discussion with Richard E.
>>
>> On 2026-10-04 11:54:30+00:00, Richard Earnshaw (rearnsha) <rearnsha@arm.com> approved the changes:
>> OK
>>
>>
>>
>> On 2026-10-04 17:13:16+00:00, Torbjörn Svensson (azoff) wrote:
>>
>> Pushed as r17-4873-g8a5c76ca173f25, r16-9734-ga239230fc45aa9 and r15-11613-gb56c7709b773a2.
>
More information about the Gcc-patches
mailing list