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 | 60e7127 | 2010-10-21 03:34:22 +0000 | [diff] [blame^] | 13 | ; FUN-NOT: fadd |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 14 | ; FUN: brlid |
| 15 | ; FPU-NOT: brlid |
Wesley Peck | 60e7127 | 2010-10-21 03:34:22 +0000 | [diff] [blame^] | 16 | ; FPU: fadd |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 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 |
Wesley Peck | 60e7127 | 2010-10-21 03:34:22 +0000 | [diff] [blame^] | 28 | ; FUN-NOT: frsub |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 29 | ; FUN: brlid |
| 30 | ; FPU-NOT: brlid |
Wesley Peck | 60e7127 | 2010-10-21 03:34:22 +0000 | [diff] [blame^] | 31 | ; FPU: frsub |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 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 |
Wesley Peck | 60e7127 | 2010-10-21 03:34:22 +0000 | [diff] [blame^] | 43 | ; FUN-NOT: fmul |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 44 | ; FUN: brlid |
| 45 | ; FPU-NOT: brlid |
Wesley Peck | 60e7127 | 2010-10-21 03:34:22 +0000 | [diff] [blame^] | 46 | ; FPU: fmul |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 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 |
Wesley Peck | 60e7127 | 2010-10-21 03:34:22 +0000 | [diff] [blame^] | 58 | ; FUN-NOT: fdiv |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 59 | ; FUN: brlid |
| 60 | ; FPU-NOT: brlid |
Wesley Peck | 60e7127 | 2010-10-21 03:34:22 +0000 | [diff] [blame^] | 61 | ; FPU: fdiv |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 62 | |
| 63 | ret float %tmp.1 |
| 64 | ; FUN: rtsd |
| 65 | ; FPU: rtsd |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 66 | } |