Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Add cmov test
Browse files Browse the repository at this point in the history
  • Loading branch information
rdolbeau committed Jun 7, 2021
1 parent 38f0701 commit 3a37d03
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvb-zbt-cmov.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* { dg-do compile } */
/* { dg-options "-march=rv32gc_zbt -O2" { target { riscv32*-*-* } } } */
/* { dg-options "-march=rv64gc_zbt -O2" { target { riscv64*-*-* } } } */

#if __riscv_xlen == 32
int cmov(int s, int b, int c) {
return (s ? b : c);
}
int cmov2(int s, int b, int c) {
return (s == 0 ? b : c);
}
#else
long cmov(long s, long b, long c) {
return (s ? b : c);
}
long cmov2(long s, long b, long c) {
return (s == 0 ? b : c);
}
#endif

/* { dg-final { scan-assembler-times "cmov\t" 2 } } */

0 comments on commit 3a37d03

Please sign in to comment.