summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/pr55303-2.c
blob: 34f706327dfece72c1e960bbdbb813212e182f79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Verify that for SH2A smax/smin -> cbranch conversion is done properly
   if the clips insn is not used and the expected comparison insns are
   generated.  */
/* { dg-do compile }  */
/* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
/* { dg-final { scan-assembler-times "cmp/pl" 4 } } */

int
test_00 (int a)
{
  /* 1x cmp/pl  */
  return a >= 0 ? a : 0;
}

int
test_01 (int a)
{
  /* 1x cmp/pl  */
  return a <= 0 ? a : 0;
}

int
test_02 (int a)
{
  /* 1x cmp/pl  */
  return a < 1 ? 1 : a;
}

int
test_03 (int a)
{
  /* 1x cmp/pl  */
  return a < 1 ? a : 1;
}