1 ; RUN: llc -mtriple=x86_64-apple-macosx10.10.0 < %s | FileCheck %s
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 ; The assertions are *enhanced* from update_test_checks.ll to include
6 ; the constant load values because those are important.
8 ; CHECK: [[SIGNMASK1:L.+]]:
9 ; CHECK-NEXT: .quad -9223372036854775808 ## double -0
10 ; CHECK-NEXT: .quad -9223372036854775808 ## double -0
12 define double @mag_pos0_double(double %x) nounwind {
13 ; CHECK-LABEL: mag_pos0_double:
15 ; CHECK-NEXT: andps [[SIGNMASK1]](%rip), %xmm0
18 %y = call double @copysign(double 0.0, double %x)
22 ; CHECK: [[SIGNMASK2:L.+]]:
23 ; CHECK-NEXT: .quad -9223372036854775808 ## double -0
25 define double @mag_neg0_double(double %x) nounwind {
26 ; CHECK-LABEL: mag_neg0_double:
28 ; CHECK-NEXT: movsd [[SIGNMASK2]](%rip), %xmm1
29 ; CHECK-NEXT: andps %xmm1, %xmm0
32 %y = call double @copysign(double -0.0, double %x)
36 ; CHECK: [[SIGNMASK3:L.+]]:
37 ; CHECK-NEXT: .quad -9223372036854775808 ## double -0
38 ; CHECK-NEXT: .quad -9223372036854775808 ## double -0
39 ; CHECK: [[ONE3:L.+]]:
40 ; CHECK-NEXT: .quad 4607182418800017408 ## double 1
42 define double @mag_pos1_double(double %x) nounwind {
43 ; CHECK-LABEL: mag_pos1_double:
45 ; CHECK-NEXT: andps [[SIGNMASK3]](%rip), %xmm0
46 ; CHECK-NEXT: movsd [[ONE3]](%rip), %xmm1
47 ; CHECK-NEXT: orps %xmm1, %xmm0
50 %y = call double @copysign(double 1.0, double %x)
54 ; CHECK: [[SIGNMASK4:L.+]]:
55 ; CHECK-NEXT: .quad -9223372036854775808 ## double -0
56 ; CHECK-NEXT: .quad -9223372036854775808 ## double -0
57 ; CHECK: [[ONE4:L.+]]:
58 ; CHECK-NEXT: .quad 4607182418800017408 ## double 1
59 ; CHECK-NEXT: .quad 4607182418800017408 ## double 1
61 define double @mag_neg1_double(double %x) nounwind {
62 ; CHECK-LABEL: mag_neg1_double:
64 ; CHECK-NEXT: andps [[SIGNMASK4]](%rip), %xmm0
65 ; CHECK-NEXT: orps [[ONE4]](%rip), %xmm0
68 %y = call double @copysign(double -1.0, double %x)
72 ; CHECK: [[SIGNMASK5:L.+]]:
73 ; CHECK-NEXT: .long 2147483648 ## float -0
74 ; CHECK-NEXT: .long 2147483648 ## float -0
75 ; CHECK-NEXT: .long 2147483648 ## float -0
76 ; CHECK-NEXT: .long 2147483648 ## float -0
78 define float @mag_pos0_float(float %x) nounwind {
79 ; CHECK-LABEL: mag_pos0_float:
81 ; CHECK-NEXT: andps [[SIGNMASK5]](%rip), %xmm0
84 %y = call float @copysignf(float 0.0, float %x)
88 ; CHECK: [[SIGNMASK6:L.+]]:
89 ; CHECK-NEXT: .long 2147483648 ## float -0
91 define float @mag_neg0_float(float %x) nounwind {
92 ; CHECK-LABEL: mag_neg0_float:
94 ; CHECK-NEXT: movss [[SIGNMASK6]](%rip), %xmm1
95 ; CHECK-NEXT: andps %xmm1, %xmm0
98 %y = call float @copysignf(float -0.0, float %x)
102 ; CHECK: [[SIGNMASK7:L.+]]:
103 ; CHECK-NEXT: .long 2147483648 ## float -0
104 ; CHECK-NEXT: .long 2147483648 ## float -0
105 ; CHECK-NEXT: .long 2147483648 ## float -0
106 ; CHECK-NEXT: .long 2147483648 ## float -0
107 ; CHECK: [[ONE7:L.+]]:
108 ; CHECK-NEXT: .long 1065353216 ## float 1
110 define float @mag_pos1_float(float %x) nounwind {
111 ; CHECK-LABEL: mag_pos1_float:
113 ; CHECK-NEXT: andps [[SIGNMASK7]](%rip), %xmm0
114 ; CHECK-NEXT: movss [[ONE7]](%rip), %xmm1
115 ; CHECK-NEXT: orps %xmm1, %xmm0
118 %y = call float @copysignf(float 1.0, float %x)
122 ; CHECK: [[SIGNMASK8:L.+]]:
123 ; CHECK-NEXT: .long 2147483648 ## float -0
124 ; CHECK-NEXT: .long 2147483648 ## float -0
125 ; CHECK-NEXT: .long 2147483648 ## float -0
126 ; CHECK-NEXT: .long 2147483648 ## float -0
127 ; CHECK: [[ONE8:L.+]]:
128 ; CHECK-NEXT: .long 1065353216 ## float 1
129 ; CHECK-NEXT: .long 1065353216 ## float 1
130 ; CHECK-NEXT: .long 1065353216 ## float 1
131 ; CHECK-NEXT: .long 1065353216 ## float 1
133 define float @mag_neg1_float(float %x) nounwind {
134 ; CHECK-LABEL: mag_neg1_float:
136 ; CHECK-NEXT: andps [[SIGNMASK8]](%rip), %xmm0
137 ; CHECK-NEXT: orps [[ONE8]](%rip), %xmm0
140 %y = call float @copysignf(float -1.0, float %x)
144 declare double @copysign(double, double) nounwind readnone
145 declare float @copysignf(float, float) nounwind readnone