blob: 1050cd265998b84d216e793eeb9e5ccdb97c7fcc [file] [log] [blame]
Evan Chengc143dd42011-02-11 02:28:55 +00001; 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 Venancio4c6676c2007-01-04 14:24:32 +00003
Evan Chengc143dd42011-02-11 02:28:55 +00004; rdar://8984306
5define float @test1(float %x, float %y) nounwind {
6entry:
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 Venancio4c6676c2007-01-04 14:24:32 +000017}
18
Evan Chengc143dd42011-02-11 02:28:55 +000019define double @test2(double %x, double %y) nounwind {
20entry:
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 Cheng02b985c2007-01-19 09:20:23 +000031}
Lauro Ramos Venancio4c6676c2007-01-04 14:24:32 +000032
Evan Chengc143dd42011-02-11 02:28:55 +000033define double @test3(double %x, double %y, double %z) nounwind {
34entry:
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
44declare double @copysign(double, double) nounwind
45declare float @copysignf(float, float) nounwind