Evan Cheng | c143dd4 | 2011-02-11 02:28:55 +0000 | [diff] [blame^] | 1 | ; RUN: llc < %s -mtriple=armv7-apple-darwin -mcpu=cortex-a8 | FileCheck %s -check-prefix=SOFT |
| 2 | ; RUN: llc < %s -mtriple=armv7-gnueabi -float-abi=hard -mcpu=cortex-a8 | FileCheck %s -check-prefix=HARD |
Lauro Ramos Venancio | 4c6676c | 2007-01-04 14:24:32 +0000 | [diff] [blame] | 3 | |
Evan Cheng | c143dd4 | 2011-02-11 02:28:55 +0000 | [diff] [blame^] | 4 | ; rdar://8984306 |
| 5 | define float @test1(float %x, float %y) nounwind { |
| 6 | entry: |
| 7 | ; SOFT: test1: |
| 8 | ; SOFT: lsr r1, r1, #31 |
| 9 | ; SOFT: bfi r0, r1, #31, #1 |
| 10 | |
| 11 | ; HARD: test1: |
| 12 | ; HARD: vabs.f32 d0, d0 |
| 13 | ; HARD: cmp r0, #0 |
| 14 | ; HARD: vneglt.f32 s0, s0 |
| 15 | %0 = tail call float @copysignf(float %x, float %y) nounwind |
| 16 | ret float %0 |
Lauro Ramos Venancio | 4c6676c | 2007-01-04 14:24:32 +0000 | [diff] [blame] | 17 | } |
| 18 | |
Evan Cheng | c143dd4 | 2011-02-11 02:28:55 +0000 | [diff] [blame^] | 19 | define double @test2(double %x, double %y) nounwind { |
| 20 | entry: |
| 21 | ; SOFT: test2: |
| 22 | ; SOFT: lsr r2, r3, #31 |
| 23 | ; SOFT: bfi r1, r2, #31, #1 |
| 24 | |
| 25 | ; HARD: test2: |
| 26 | ; HARD: vabs.f64 d0, d0 |
| 27 | ; HARD: cmp r1, #0 |
| 28 | ; HARD: vneglt.f64 d0, d0 |
| 29 | %0 = tail call double @copysign(double %x, double %y) nounwind |
| 30 | ret double %0 |
Evan Cheng | 02b985c | 2007-01-19 09:20:23 +0000 | [diff] [blame] | 31 | } |
Lauro Ramos Venancio | 4c6676c | 2007-01-04 14:24:32 +0000 | [diff] [blame] | 32 | |
Evan Cheng | c143dd4 | 2011-02-11 02:28:55 +0000 | [diff] [blame^] | 33 | define double @test3(double %x, double %y, double %z) nounwind { |
| 34 | entry: |
| 35 | ; SOFT: test3: |
| 36 | ; SOFT: vabs.f64 |
| 37 | ; SOFT: cmp {{.*}}, #0 |
| 38 | ; SOFT: vneglt.f64 |
| 39 | %0 = fmul double %x, %y |
| 40 | %1 = tail call double @copysign(double %0, double %z) nounwind |
| 41 | ret double %1 |
| 42 | } |
| 43 | |
| 44 | declare double @copysign(double, double) nounwind |
| 45 | declare float @copysignf(float, float) nounwind |