Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 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 |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 13 | ; FUN: brlid |
| 14 | ; FPU-NOT: brlid |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 15 | |
| 16 | ret float %tmp.1 |
| 17 | ; FUN: rtsd |
| 18 | ; FPU: rtsd |
Wesley Peck | 4e9141f | 2010-10-21 03:57:26 +0000 | [diff] [blame] | 19 | ; FUN-NOT: fadd |
| 20 | ; FPU-NEXT: fadd |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 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 |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 28 | ; FUN: brlid |
| 29 | ; FPU-NOT: brlid |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 30 | |
| 31 | ret float %tmp.1 |
| 32 | ; FUN: rtsd |
| 33 | ; FPU: rtsd |
Wesley Peck | 4e9141f | 2010-10-21 03:57:26 +0000 | [diff] [blame] | 34 | ; FUN-NOT: frsub |
| 35 | ; FPU-NEXT: frsub |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 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 |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 43 | ; FUN: brlid |
| 44 | ; FPU-NOT: brlid |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 45 | |
| 46 | ret float %tmp.1 |
| 47 | ; FUN: rtsd |
| 48 | ; FPU: rtsd |
Wesley Peck | 4e9141f | 2010-10-21 03:57:26 +0000 | [diff] [blame] | 49 | ; FUN-NOT: fmul |
| 50 | ; FPU-NEXT: fmul |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 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 |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 58 | ; FUN: brlid |
| 59 | ; FPU-NOT: brlid |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 60 | |
| 61 | ret float %tmp.1 |
| 62 | ; FUN: rtsd |
| 63 | ; FPU: rtsd |
Wesley Peck | 4e9141f | 2010-10-21 03:57:26 +0000 | [diff] [blame] | 64 | ; FUN-NOT: fdiv |
| 65 | ; FPU-NEXT: fdiv |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 66 | } |