-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a regression present on the mainline and 12 branch at -O2, but the issue is related to vectorization so was present at -O3 in earlier versions. The vcondu expander that was added for VIS 3 more than a decade ago does not fully work, because it does not filter out the unsigned condition codes (the instruction is an UNSPEC that accepts only signed condition codes). While I was at it, I also added the missing vcond and vcondu expanders for the new comparison instructions that were added in VIS 4. gcc/ PR target/109140 * config/sparc/sparc.cc (sparc_expand_vcond): Call signed_condition on operand #3 to get the final condition code. Use std::swap. * config/sparc/sparc.md (vcondv8qiv8qi): New VIS 4 expander. (fucmp<gcond:code>8<P:mode>_vis): Move around. (fpcmpu<gcond:code><GCM:gcm_name><P:mode>_vis): Likewise. (vcondu<GCM:mode><GCM:mode>): New VIS 4 expander. gcc/testsuite/ * gcc.target/sparc/20230328-1.c: New test. * gcc.target/sparc/20230328-2.c: Likewise. * gcc.target/sparc/20230328-3.c: Likewise. * gcc.target/sparc/20230328-4.c: Likewise.
- Loading branch information
Eric Botcazou
committed
Mar 28, 2023
1 parent
5cea00d
commit a21bd7f
Showing
6 changed files
with
122 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* PR target/109140 */ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-O3 -mvis3 -std=c99" } */ | ||
|
||
#define TYPE unsigned char | ||
|
||
struct S { TYPE ub[8]; }; | ||
|
||
struct S s; | ||
|
||
TYPE v; | ||
|
||
void foo (void) | ||
{ | ||
for (int i = 0; i < 8; i++) | ||
s.ub[i] = s.ub[i] > v; | ||
} | ||
|
||
/* { dg-final { scan-assembler "fucmpgt8\t%" } } */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* PR target/109140 */ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-O3 -mvis4 -std=c99" } */ | ||
|
||
#define TYPE char | ||
|
||
struct S { TYPE ub[8]; }; | ||
|
||
struct S s; | ||
|
||
TYPE v; | ||
|
||
void foo (void) | ||
{ | ||
for (int i = 0; i < 8; i++) | ||
s.ub[i] = s.ub[i] > v; | ||
} | ||
|
||
/* { dg-final { scan-assembler "fpcmpgt8\t%" } } */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* PR target/109140 */ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-O3 -mvis4 -std=c99" } */ | ||
|
||
#define TYPE unsigned short | ||
|
||
struct S { TYPE ub[4]; }; | ||
|
||
struct S s; | ||
|
||
TYPE v; | ||
|
||
void foo (void) | ||
{ | ||
for (int i = 0; i < 4; i++) | ||
s.ub[i] = s.ub[i] > v; | ||
} | ||
|
||
/* { dg-final { scan-assembler "fpcmpugt16\t%" } } */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* PR target/109140 */ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-O3 -mvis3 -std=c99" } */ | ||
|
||
#define TYPE short | ||
|
||
struct S { TYPE ub[4]; }; | ||
|
||
struct S s; | ||
|
||
TYPE v; | ||
|
||
void foo (void) | ||
{ | ||
for (int i = 0; i < 4; i++) | ||
s.ub[i] = s.ub[i] > v; | ||
} | ||
|
||
/* { dg-final { scan-assembler "fcmpgt16\t%" } } */ |