summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/nios2/custom-fp-cmp-1.c
blob: b290c41e4755cd031cb3fe1dd8b05c6c0a35287b (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* Test generation of floating-point compare custom instructions.  */

/* { dg-do compile } */
/* { dg-options "-O1" } */

/* -O1 in the options is significant.  Without it FP operations may not be
   optimized to custom instructions.  */

#pragma GCC target ("custom-frdxhi=40")
#pragma GCC target ("custom-frdxlo=41")
#pragma GCC target ("custom-frdy=42")
#pragma GCC target ("custom-fwrx=43")
#pragma GCC target ("custom-fwry=44")

#pragma GCC target ("custom-fcmpeqs=200")

int
test_fcmpeqs (float a, float b)
{
  return (a == b);
}

/* { dg-final { scan-assembler "custom\\t200, .* # fcmpeqs .*" } } */

#pragma GCC target ("custom-fcmpgtd=201")

int
test_fcmpgtd (double a, double b)
{
  return (a > b);
}

/* { dg-final { scan-assembler "custom\\t201, .* # fcmpgtd .*" } } */

#pragma GCC target ("custom-fcmples=202")

int
test_fcmples (float a, float b)
{
  return (a <= b);
}

/* { dg-final { scan-assembler "custom\\t202, .* # fcmples .*" } } */

#pragma GCC target ("custom-fcmpned=203")

int
test_fcmpned (double a, double b)
{
  return (a != b);
}

/* { dg-final { scan-assembler "custom\\t203, .* # fcmpned .*" } } */