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: |
Evan Cheng | e573fb3 | 2011-02-23 02:24:55 +0000 | [diff] [blame^] | 12 | ; HARD: vmov.i32 [[REG1:(d[0-9]+)]], #0x80000000 |
| 13 | ; HARD: vbsl [[REG1]], d2, d0 |
Evan Cheng | c143dd4 | 2011-02-11 02:28:55 +0000 | [diff] [blame] | 14 | %0 = tail call float @copysignf(float %x, float %y) nounwind |
| 15 | ret float %0 |
Lauro Ramos Venancio | 4c6676c | 2007-01-04 14:24:32 +0000 | [diff] [blame] | 16 | } |
| 17 | |
Evan Cheng | c143dd4 | 2011-02-11 02:28:55 +0000 | [diff] [blame] | 18 | define double @test2(double %x, double %y) nounwind { |
| 19 | entry: |
| 20 | ; SOFT: test2: |
| 21 | ; SOFT: lsr r2, r3, #31 |
| 22 | ; SOFT: bfi r1, r2, #31, #1 |
| 23 | |
| 24 | ; HARD: test2: |
Evan Cheng | e573fb3 | 2011-02-23 02:24:55 +0000 | [diff] [blame^] | 25 | ; HARD: vmov.i32 [[REG2:(d[0-9]+)]], #0x80000000 |
| 26 | ; HARD: vshl.i64 [[REG2]], [[REG2]], #32 |
| 27 | ; HARD: vbsl [[REG2]], d1, d0 |
Evan Cheng | c143dd4 | 2011-02-11 02:28:55 +0000 | [diff] [blame] | 28 | %0 = tail call double @copysign(double %x, double %y) nounwind |
| 29 | ret double %0 |
Evan Cheng | 02b985c | 2007-01-19 09:20:23 +0000 | [diff] [blame] | 30 | } |
Lauro Ramos Venancio | 4c6676c | 2007-01-04 14:24:32 +0000 | [diff] [blame] | 31 | |
Evan Cheng | c143dd4 | 2011-02-11 02:28:55 +0000 | [diff] [blame] | 32 | define double @test3(double %x, double %y, double %z) nounwind { |
| 33 | entry: |
| 34 | ; SOFT: test3: |
Evan Cheng | e573fb3 | 2011-02-23 02:24:55 +0000 | [diff] [blame^] | 35 | ; SOFT: vmov.i32 [[REG3:(d[0-9]+)]], #0x80000000 |
| 36 | ; SOFT: vshl.i64 [[REG3]], [[REG3]], #32 |
| 37 | ; SOFT: vbsl [[REG3]], |
Evan Cheng | c143dd4 | 2011-02-11 02:28:55 +0000 | [diff] [blame] | 38 | %0 = fmul double %x, %y |
| 39 | %1 = tail call double @copysign(double %0, double %z) nounwind |
| 40 | ret double %1 |
| 41 | } |
| 42 | |
| 43 | declare double @copysign(double, double) nounwind |
| 44 | declare float @copysignf(float, float) nounwind |