• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Ensure that floating point operations are lowered to function calls when the
2; FPU is not available in the hardware and that function calls are not used
3; when the FPU is available in the hardware.
4;
5; RUN: llc < %s -march=mblaze | FileCheck -check-prefix=FUN %s
6; RUN: llc < %s -march=mblaze -mattr=+fpu | FileCheck -check-prefix=FPU %s
7
8define float @test_add(float %a, float %b) {
9    ; FUN:        test_add:
10    ; FPU:        test_add:
11
12    %tmp.1 = fadd float %a, %b
13    ; FUN:        brlid
14    ; FPU-NOT:    brlid
15
16    ret float %tmp.1
17    ; FUN:        rtsd
18    ; FPU:        rtsd
19    ; FUN-NOT:    fadd
20    ; FPU-NEXT:   fadd
21}
22
23define float @test_sub(float %a, float %b) {
24    ; FUN:        test_sub:
25    ; FPU:        test_sub:
26
27    %tmp.1 = fsub float %a, %b
28    ; FUN:        brlid
29    ; FPU-NOT:    brlid
30
31    ret float %tmp.1
32    ; FUN:        rtsd
33    ; FPU:        rtsd
34    ; FUN-NOT:    frsub
35    ; FPU-NEXT:   frsub
36}
37
38define float @test_mul(float %a, float %b) {
39    ; FUN:        test_mul:
40    ; FPU:        test_mul:
41
42    %tmp.1 = fmul float %a, %b
43    ; FUN:        brlid
44    ; FPU-NOT:    brlid
45
46    ret float %tmp.1
47    ; FUN:        rtsd
48    ; FPU:        rtsd
49    ; FUN-NOT:    fmul
50    ; FPU-NEXT:   fmul
51}
52
53define float @test_div(float %a, float %b) {
54    ; FUN:        test_div:
55    ; FPU:        test_div:
56
57    %tmp.1 = fdiv float %a, %b
58    ; FUN:        brlid
59    ; FPU-NOT:    brlid
60
61    ret float %tmp.1
62    ; FUN:        rtsd
63    ; FPU:        rtsd
64    ; FUN-NOT:    fdiv
65    ; FPU-NEXT:   fdiv
66}
67