RISC-V/testsuite: Add branched cases for FP NE cond-move operations

Verify, for generic, Ventana and Zicond targets and the floating-point
NE conditional-move operation, that if-conversion does *not* trigger at
the respective sufficiently low `-mbranch-cost=' settings that make
original branched code sequences cheaper than their branchless
equivalents if-conversion would emit.

	gcc/testsuite/
	* gcc.target/riscv/movdibfeq-ventana.c: New test.
	* gcc.target/riscv/movdibfeq-zicond.c: New test.
	* gcc.target/riscv/movdibfeq.c: New test.
	* gcc.target/riscv/movsibfeq-ventana.c: New test.
	* gcc.target/riscv/movsibfeq-zicond.c: New test.
	* gcc.target/riscv/movsibfeq.c: New test.
This commit is contained in:
Maciej W. Rozycki 2023-11-22 01:18:31 +00:00
parent 9a1a2e9857
commit 4c69b5fbb9
6 changed files with 176 additions and 0 deletions

View file

@ -0,0 +1,30 @@
/* { dg-do compile } */
/* { dg-require-effective-target rv64 } */
/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */
/* { dg-options "-march=rv64gc_xventanacondops -mtune=rocket -mbranch-cost=2 -fdump-rtl-ce1" } */
typedef int __attribute__ ((mode (DI))) int_t;
int_t
movdifeq (double w, double x, int_t y, int_t z)
{
return w == x ? y : z;
}
/* Expect branched assembly like:
feq.d a4,fa0,fa1
mv a5,a0
mv a0,a1
beq a4,zero,.L2
mv a0,a5
.L2:
*/
/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */
/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */
/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */
/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */
/* { dg-final { scan-assembler-not "\\svt\\.maskc\\s" } } */
/* { dg-final { scan-assembler-not "\\svt\\.maskcn\\s" } } */
/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */

View file

@ -0,0 +1,30 @@
/* { dg-do compile } */
/* { dg-require-effective-target rv64 } */
/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */
/* { dg-options "-march=rv64gc_zicond -mtune=rocket -mbranch-cost=2 -fdump-rtl-ce1" } */
typedef int __attribute__ ((mode (DI))) int_t;
int_t
movdifeq (double w, double x, int_t y, int_t z)
{
return w == x ? y : z;
}
/* Expect branched assembly like:
feq.d a4,fa0,fa1
mv a5,a0
mv a0,a1
beq a4,zero,.L2
mv a0,a5
.L2:
*/
/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */
/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */
/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */
/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */
/* { dg-final { scan-assembler-not "\\sczero\\.eqz\\s" } } */
/* { dg-final { scan-assembler-not "\\sczero\\.nez\\s" } } */
/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */

View file

@ -0,0 +1,28 @@
/* { dg-do compile } */
/* { dg-require-effective-target rv64 } */
/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */
/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=4 -mmovcc -fdump-rtl-ce1" } */
typedef int __attribute__ ((mode (DI))) int_t;
int_t
movdifeq (double w, double x, int_t y, int_t z)
{
return w == x ? y : z;
}
/* Expect branched assembly like:
feq.d a4,fa0,fa1
mv a5,a0
mv a0,a1
beq a4,zero,.L2
mv a0,a5
.L2:
*/
/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */
/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */
/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */
/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */
/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */

View file

@ -0,0 +1,30 @@
/* { dg-do compile } */
/* { dg-require-effective-target rv64 } */
/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */
/* { dg-options "-march=rv64gc_xventanacondops -mtune=rocket -mbranch-cost=2 -fdump-rtl-ce1" } */
typedef int __attribute__ ((mode (SI))) int_t;
int_t
movsifeq (double w, double x, int_t y, int_t z)
{
return w == x ? y : z;
}
/* Expect branched assembly like:
feq.d a4,fa0,fa1
mv a5,a0
mv a0,a1
beq a4,zero,.L2
mv a0,a5
.L2:
*/
/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */
/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */
/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */
/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */
/* { dg-final { scan-assembler-not "\\svt\\.maskc\\s" } } */
/* { dg-final { scan-assembler-not "\\svt\\.maskcn\\s" } } */
/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */

View file

@ -0,0 +1,30 @@
/* { dg-do compile } */
/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */
/* { dg-options "-march=rv64gc_zicond -mtune=rocket -mbranch-cost=2 -fdump-rtl-ce1" { target { rv64 } } } */
/* { dg-options "-march=rv32gc_zicond -mtune=rocket -mbranch-cost=2 -fdump-rtl-ce1" { target { rv32 } } } */
typedef int __attribute__ ((mode (SI))) int_t;
int_t
movsifeq (double w, double x, int_t y, int_t z)
{
return w == x ? y : z;
}
/* Expect branched assembly like:
feq.d a4,fa0,fa1
mv a5,a0
mv a0,a1
beq a4,zero,.L2
mv a0,a5
.L2:
*/
/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */
/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */
/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */
/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */
/* { dg-final { scan-assembler-not "\\sczero\\.eqz\\s" } } */
/* { dg-final { scan-assembler-not "\\sczero\\.nez\\s" } } */
/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */

View file

@ -0,0 +1,28 @@
/* { dg-do compile } */
/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */
/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=4 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */
/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=4 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */
typedef int __attribute__ ((mode (SI))) int_t;
int_t
movsifeq (double w, double x, int_t y, int_t z)
{
return w == x ? y : z;
}
/* Expect branched assembly like:
feq.d a4,fa0,fa1
mv a5,a0
mv a0,a1
beq a4,zero,.L2
mv a0,a5
.L2:
*/
/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */
/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */
/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */
/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */
/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */