Adding the MicroBlaze backend.
[oota-llvm.git] / test / CodeGen / MBlaze / fpu.ll
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
8 define 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-NOT:    fadd
14     ; FUN:        brlid
15     ; FPU-NOT:    brlid
16     ; FPU:        fadd
17
18     ret float %tmp.1
19     ; FUN:        rtsd
20     ; FPU:        rtsd
21 }
22
23 define 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-NOT:    frsub
29     ; FUN:        brlid
30     ; FPU-NOT:    brlid
31     ; FPU:        frsub
32
33     ret float %tmp.1
34     ; FUN:        rtsd
35     ; FPU:        rtsd
36 }
37
38 define 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-NOT:    fmul
44     ; FUN:        brlid
45     ; FPU-NOT:    brlid
46     ; FPU:        fmul
47
48     ret float %tmp.1
49     ; FUN:        rtsd
50     ; FPU:        rtsd
51 }
52
53 define 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-NOT:    fdiv
59     ; FUN:        brlid
60     ; FPU-NOT:    brlid
61     ; FPU:        fdiv
62
63     ret float %tmp.1
64     ; FUN:        rtsd
65     ; FPU:        rtsd
66 }