Skip to content

Commit ca6174a

Browse files
Christophe LyonTorbjorn-Svensson
authored andcommitted
testsuite: arm: Fix unsigned-extend-2.c [PR116445]
The test was designed to pass with thumb2, but code generation changed with the introduction of Low Overhead Loops, so the test can fail if one overrides the flags when running the testsuite. In addition, useless subtract / extension instructions require -O2 to remove them (-O is not sufficient), so replace -O with -O2 in dg-options. arm_thumb2_ok_no_arm_v8_1m_lob does not do what the test needs (it can fail because some flags conflict, rather than because lob are supported, and we do not need to check runtime support in this test anyway), so the patch reverts back to arm_thumb2_ok. Finally, replace the scan-assembler directives with check-function-bodies, checking both types of code generation (with and without LOL). Depending on architecture version, the two insns and r0, r1, r0, lsr #1 ands r3, r3, #255 can be swapped, so accept both orders. gcc/testsuite/ChangeLog: PR target/116445 * gcc.target/arm/unsigned-extend-2.c: Fix dg directives. (cherry picked from commit 20c2591)
1 parent ab7ce5d commit ca6174a

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

gcc/testsuite/gcc.target/arm/unsigned-extend-2.c

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
11
/* { dg-do compile } */
2-
/* { dg-require-effective-target arm_thumb2_ok_no_arm_v8_1m_lob } */
3-
/* { dg-options "-O" } */
2+
/* { dg-require-effective-target arm_thumb2_ok } */
3+
/* { dg-options "-O2 -mthumb" } */
4+
/* { dg-final { check-function-bodies "**" "" } } */
5+
6+
/*
7+
** foo:
8+
** movs (r[0-9]+), #8
9+
** (
10+
** subs \1, \1, #1
11+
** ands \1, \1, #255
12+
** and r0, r1, r0, lsr #1
13+
** bne .L[0-9]+
14+
** bx lr
15+
** |
16+
** subs \1, \1, #1
17+
** and r0, r1, r0, lsr #1
18+
** ands \1, \1, #255
19+
** bne .L[0-9]+
20+
** bx lr
21+
** |
22+
** push {lr}
23+
** dls lr, \1
24+
** and r0, r1, r0, lsr #1
25+
** le lr, .L[0-9]+
26+
** pop {pc}
27+
** )
28+
*/
429

530
unsigned short foo (unsigned short x, unsigned short c)
631
{
@@ -12,7 +37,3 @@ unsigned short foo (unsigned short x, unsigned short c)
1237
}
1338
return x;
1439
}
15-
16-
/* { dg-final { scan-assembler "ands" } } */
17-
/* { dg-final { scan-assembler-not "uxtb" } } */
18-
/* { dg-final { scan-assembler-not "cmp" } } */

0 commit comments

Comments
 (0)