xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/fp128-i128.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=+mmx | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu -mattr=+mmx | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; These tests were generated from simplified libm C code.
5*9880d681SAndroid Build Coastguard Worker; When compiled for the x86_64-linux-android target,
6*9880d681SAndroid Build Coastguard Worker; long double is mapped to f128 type that should be passed
7*9880d681SAndroid Build Coastguard Worker; in SSE registers. When the f128 type calling convention
8*9880d681SAndroid Build Coastguard Worker; problem was fixed, old llvm code failed to handle f128 values
9*9880d681SAndroid Build Coastguard Worker; in several f128/i128 type operations. These unit tests hopefully
10*9880d681SAndroid Build Coastguard Worker; will catch regression in any future change in this area.
11*9880d681SAndroid Build Coastguard Worker; To modified or enhance these test cases, please consult libm
12*9880d681SAndroid Build Coastguard Worker; code pattern and compile with -target x86_64-linux-android
13*9880d681SAndroid Build Coastguard Worker; to generate IL. The __float128 keyword if not accepted by
14*9880d681SAndroid Build Coastguard Worker; clang, just define it to "long double".
15*9880d681SAndroid Build Coastguard Worker;
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; typedef long double __float128;
18*9880d681SAndroid Build Coastguard Worker; union IEEEl2bits {
19*9880d681SAndroid Build Coastguard Worker;   __float128 e;
20*9880d681SAndroid Build Coastguard Worker;   struct {
21*9880d681SAndroid Build Coastguard Worker;     unsigned long manl :64;
22*9880d681SAndroid Build Coastguard Worker;     unsigned long manh :48;
23*9880d681SAndroid Build Coastguard Worker;     unsigned int exp :15;
24*9880d681SAndroid Build Coastguard Worker;     unsigned int sign :1;
25*9880d681SAndroid Build Coastguard Worker;   } bits;
26*9880d681SAndroid Build Coastguard Worker;   struct {
27*9880d681SAndroid Build Coastguard Worker;     unsigned long manl :64;
28*9880d681SAndroid Build Coastguard Worker;     unsigned long manh :48;
29*9880d681SAndroid Build Coastguard Worker;     unsigned int expsign :16;
30*9880d681SAndroid Build Coastguard Worker;   } xbits;
31*9880d681SAndroid Build Coastguard Worker; };
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker; C code:
34*9880d681SAndroid Build Coastguard Worker; void foo(__float128 x);
35*9880d681SAndroid Build Coastguard Worker; void TestUnionLD1(__float128 s, unsigned long n) {
36*9880d681SAndroid Build Coastguard Worker;      union IEEEl2bits u;
37*9880d681SAndroid Build Coastguard Worker;      __float128 w;
38*9880d681SAndroid Build Coastguard Worker;      u.e = s;
39*9880d681SAndroid Build Coastguard Worker;      u.bits.manh = n;
40*9880d681SAndroid Build Coastguard Worker;      w = u.e;
41*9880d681SAndroid Build Coastguard Worker;      foo(w);
42*9880d681SAndroid Build Coastguard Worker; }
43*9880d681SAndroid Build Coastguard Workerdefine void @TestUnionLD1(fp128 %s, i64 %n) #0 {
44*9880d681SAndroid Build Coastguard Workerentry:
45*9880d681SAndroid Build Coastguard Worker  %0 = bitcast fp128 %s to i128
46*9880d681SAndroid Build Coastguard Worker  %1 = zext i64 %n to i128
47*9880d681SAndroid Build Coastguard Worker  %bf.value = shl nuw i128 %1, 64
48*9880d681SAndroid Build Coastguard Worker  %bf.shl = and i128 %bf.value, 5192296858534809181786422619668480
49*9880d681SAndroid Build Coastguard Worker  %bf.clear = and i128 %0, -5192296858534809181786422619668481
50*9880d681SAndroid Build Coastguard Worker  %bf.set = or i128 %bf.shl, %bf.clear
51*9880d681SAndroid Build Coastguard Worker  %2 = bitcast i128 %bf.set to fp128
52*9880d681SAndroid Build Coastguard Worker  tail call void @foo(fp128 %2) #2
53*9880d681SAndroid Build Coastguard Worker  ret void
54*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestUnionLD1:
55*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps %xmm0, -24(%rsp)
56*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq -24(%rsp), %rax
57*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movabsq $281474976710655, %rcx
58*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  andq %rdi, %rcx
59*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movabsq $-281474976710656, %rdx
60*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  andq -16(%rsp), %rdx
61*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq %rax, -40(%rsp)
62*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  orq %rcx, %rdx
63*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq %rdx, -32(%rsp)
64*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps -40(%rsp), %xmm0
65*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  jmp foo
66*9880d681SAndroid Build Coastguard Worker}
67*9880d681SAndroid Build Coastguard Worker
68*9880d681SAndroid Build Coastguard Worker; C code:
69*9880d681SAndroid Build Coastguard Worker; __float128 TestUnionLD2(__float128 s) {
70*9880d681SAndroid Build Coastguard Worker;      union IEEEl2bits u;
71*9880d681SAndroid Build Coastguard Worker;      __float128 w;
72*9880d681SAndroid Build Coastguard Worker;      u.e = s;
73*9880d681SAndroid Build Coastguard Worker;      u.bits.manl = 0;
74*9880d681SAndroid Build Coastguard Worker;      w = u.e;
75*9880d681SAndroid Build Coastguard Worker;      return w;
76*9880d681SAndroid Build Coastguard Worker; }
77*9880d681SAndroid Build Coastguard Workerdefine fp128 @TestUnionLD2(fp128 %s) #0 {
78*9880d681SAndroid Build Coastguard Workerentry:
79*9880d681SAndroid Build Coastguard Worker  %0 = bitcast fp128 %s to i128
80*9880d681SAndroid Build Coastguard Worker  %bf.clear = and i128 %0, -18446744073709551616
81*9880d681SAndroid Build Coastguard Worker  %1 = bitcast i128 %bf.clear to fp128
82*9880d681SAndroid Build Coastguard Worker  ret fp128 %1
83*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestUnionLD2:
84*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps %xmm0, -24(%rsp)
85*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq -16(%rsp), %rax
86*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq %rax, -32(%rsp)
87*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq $0, -40(%rsp)
88*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps -40(%rsp), %xmm0
89*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  retq
90*9880d681SAndroid Build Coastguard Worker}
91*9880d681SAndroid Build Coastguard Worker
92*9880d681SAndroid Build Coastguard Worker; C code:
93*9880d681SAndroid Build Coastguard Worker; __float128 TestI128_1(__float128 x)
94*9880d681SAndroid Build Coastguard Worker; {
95*9880d681SAndroid Build Coastguard Worker;  union IEEEl2bits z;
96*9880d681SAndroid Build Coastguard Worker;  z.e = x;
97*9880d681SAndroid Build Coastguard Worker;  z.bits.sign = 0;
98*9880d681SAndroid Build Coastguard Worker;  return (z.e < 0.1L) ? 1.0L : 2.0L;
99*9880d681SAndroid Build Coastguard Worker; }
100*9880d681SAndroid Build Coastguard Workerdefine fp128 @TestI128_1(fp128 %x) #0 {
101*9880d681SAndroid Build Coastguard Workerentry:
102*9880d681SAndroid Build Coastguard Worker  %0 = bitcast fp128 %x to i128
103*9880d681SAndroid Build Coastguard Worker  %bf.clear = and i128 %0, 170141183460469231731687303715884105727
104*9880d681SAndroid Build Coastguard Worker  %1 = bitcast i128 %bf.clear to fp128
105*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp olt fp128 %1, 0xL999999999999999A3FFB999999999999
106*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, fp128 0xL00000000000000003FFF000000000000, fp128 0xL00000000000000004000000000000000
107*9880d681SAndroid Build Coastguard Worker  ret fp128 %cond
108*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestI128_1:
109*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps %xmm0,
110*9880d681SAndroid Build Coastguard Worker; CHECK:       movabsq $9223372036854775807,
111*9880d681SAndroid Build Coastguard Worker; CHECK:       callq __lttf2
112*9880d681SAndroid Build Coastguard Worker; CHECK:       testl %eax, %eax
113*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps {{.*}}, %xmm0
114*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
115*9880d681SAndroid Build Coastguard Worker}
116*9880d681SAndroid Build Coastguard Worker
117*9880d681SAndroid Build Coastguard Worker; C code:
118*9880d681SAndroid Build Coastguard Worker; __float128 TestI128_2(__float128 x, __float128 y)
119*9880d681SAndroid Build Coastguard Worker; {
120*9880d681SAndroid Build Coastguard Worker;  unsigned short hx;
121*9880d681SAndroid Build Coastguard Worker;  union IEEEl2bits ge_u;
122*9880d681SAndroid Build Coastguard Worker;  ge_u.e = x;
123*9880d681SAndroid Build Coastguard Worker;  hx = ge_u.xbits.expsign;
124*9880d681SAndroid Build Coastguard Worker;  return (hx & 0x8000) == 0 ? x : y;
125*9880d681SAndroid Build Coastguard Worker; }
126*9880d681SAndroid Build Coastguard Workerdefine fp128 @TestI128_2(fp128 %x, fp128 %y) #0 {
127*9880d681SAndroid Build Coastguard Workerentry:
128*9880d681SAndroid Build Coastguard Worker  %0 = bitcast fp128 %x to i128
129*9880d681SAndroid Build Coastguard Worker  %cmp = icmp sgt i128 %0, -1
130*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, fp128 %x, fp128 %y
131*9880d681SAndroid Build Coastguard Worker  ret fp128 %cond
132*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestI128_2:
133*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps %xmm0, -24(%rsp)
134*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  cmpq $0, -16(%rsp)
135*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  jns
136*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps %xmm1, %xmm0
137*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
138*9880d681SAndroid Build Coastguard Worker}
139*9880d681SAndroid Build Coastguard Worker
140*9880d681SAndroid Build Coastguard Worker; C code:
141*9880d681SAndroid Build Coastguard Worker; __float128 TestI128_3(__float128 x, int *ex)
142*9880d681SAndroid Build Coastguard Worker; {
143*9880d681SAndroid Build Coastguard Worker;  union IEEEl2bits u;
144*9880d681SAndroid Build Coastguard Worker;  u.e = x;
145*9880d681SAndroid Build Coastguard Worker;  if (u.bits.exp == 0) {
146*9880d681SAndroid Build Coastguard Worker;    u.e *= 0x1.0p514;
147*9880d681SAndroid Build Coastguard Worker;    u.bits.exp = 0x3ffe;
148*9880d681SAndroid Build Coastguard Worker;  }
149*9880d681SAndroid Build Coastguard Worker;  return (u.e);
150*9880d681SAndroid Build Coastguard Worker; }
151*9880d681SAndroid Build Coastguard Workerdefine fp128 @TestI128_3(fp128 %x, i32* nocapture readnone %ex) #0 {
152*9880d681SAndroid Build Coastguard Workerentry:
153*9880d681SAndroid Build Coastguard Worker  %0 = bitcast fp128 %x to i128
154*9880d681SAndroid Build Coastguard Worker  %bf.cast = and i128 %0, 170135991163610696904058773219554885632
155*9880d681SAndroid Build Coastguard Worker  %cmp = icmp eq i128 %bf.cast, 0
156*9880d681SAndroid Build Coastguard Worker  br i1 %cmp, label %if.then, label %if.end
157*9880d681SAndroid Build Coastguard Worker
158*9880d681SAndroid Build Coastguard Workerif.then:                                          ; preds = %entry
159*9880d681SAndroid Build Coastguard Worker  %mul = fmul fp128 %x, 0xL00000000000000004201000000000000
160*9880d681SAndroid Build Coastguard Worker  %1 = bitcast fp128 %mul to i128
161*9880d681SAndroid Build Coastguard Worker  %bf.clear4 = and i128 %1, -170135991163610696904058773219554885633
162*9880d681SAndroid Build Coastguard Worker  %bf.set = or i128 %bf.clear4, 85060207136517546210586590865283612672
163*9880d681SAndroid Build Coastguard Worker  br label %if.end
164*9880d681SAndroid Build Coastguard Worker
165*9880d681SAndroid Build Coastguard Workerif.end:                                           ; preds = %if.then, %entry
166*9880d681SAndroid Build Coastguard Worker  %u.sroa.0.0 = phi i128 [ %bf.set, %if.then ], [ %0, %entry ]
167*9880d681SAndroid Build Coastguard Worker  %2 = bitcast i128 %u.sroa.0.0 to fp128
168*9880d681SAndroid Build Coastguard Worker  ret fp128 %2
169*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestI128_3:
170*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps %xmm0,
171*9880d681SAndroid Build Coastguard Worker; CHECK:       movabsq $9223090561878065152,
172*9880d681SAndroid Build Coastguard Worker; CHECK:       testq
173*9880d681SAndroid Build Coastguard Worker; CHECK:       callq __multf3
174*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps %xmm0
175*9880d681SAndroid Build Coastguard Worker; CHECK:       movabsq $-9223090561878065153,
176*9880d681SAndroid Build Coastguard Worker; CHECK:       movabsq $4611123068473966592,
177*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
178*9880d681SAndroid Build Coastguard Worker}
179*9880d681SAndroid Build Coastguard Worker
180*9880d681SAndroid Build Coastguard Worker; C code:
181*9880d681SAndroid Build Coastguard Worker; __float128 TestI128_4(__float128 x)
182*9880d681SAndroid Build Coastguard Worker; {
183*9880d681SAndroid Build Coastguard Worker;  union IEEEl2bits u;
184*9880d681SAndroid Build Coastguard Worker;  __float128 df;
185*9880d681SAndroid Build Coastguard Worker;  u.e = x;
186*9880d681SAndroid Build Coastguard Worker;  u.xbits.manl = 0;
187*9880d681SAndroid Build Coastguard Worker;  df = u.e;
188*9880d681SAndroid Build Coastguard Worker;  return x + df;
189*9880d681SAndroid Build Coastguard Worker; }
190*9880d681SAndroid Build Coastguard Workerdefine fp128 @TestI128_4(fp128 %x) #0 {
191*9880d681SAndroid Build Coastguard Workerentry:
192*9880d681SAndroid Build Coastguard Worker  %0 = bitcast fp128 %x to i128
193*9880d681SAndroid Build Coastguard Worker  %bf.clear = and i128 %0, -18446744073709551616
194*9880d681SAndroid Build Coastguard Worker  %1 = bitcast i128 %bf.clear to fp128
195*9880d681SAndroid Build Coastguard Worker  %add = fadd fp128 %1, %x
196*9880d681SAndroid Build Coastguard Worker  ret fp128 %add
197*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestI128_4:
198*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps %xmm0, %xmm1
199*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps %xmm1, 16(%rsp)
200*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq 24(%rsp), %rax
201*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq %rax, 8(%rsp)
202*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq $0, (%rsp)
203*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps (%rsp), %xmm0
204*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  callq __addtf3
205*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
206*9880d681SAndroid Build Coastguard Worker}
207*9880d681SAndroid Build Coastguard Worker
208*9880d681SAndroid Build Coastguard Worker@v128 = common global i128 0, align 16
209*9880d681SAndroid Build Coastguard Worker@v128_2 = common global i128 0, align 16
210*9880d681SAndroid Build Coastguard Worker
211*9880d681SAndroid Build Coastguard Worker; C code:
212*9880d681SAndroid Build Coastguard Worker; unsigned __int128 v128, v128_2;
213*9880d681SAndroid Build Coastguard Worker; void TestShift128_2() {
214*9880d681SAndroid Build Coastguard Worker;   v128 = ((v128 << 96) | v128_2);
215*9880d681SAndroid Build Coastguard Worker; }
216*9880d681SAndroid Build Coastguard Workerdefine void @TestShift128_2() #2 {
217*9880d681SAndroid Build Coastguard Workerentry:
218*9880d681SAndroid Build Coastguard Worker  %0 = load i128, i128* @v128, align 16
219*9880d681SAndroid Build Coastguard Worker  %shl = shl i128 %0, 96
220*9880d681SAndroid Build Coastguard Worker  %1 = load i128, i128* @v128_2, align 16
221*9880d681SAndroid Build Coastguard Worker  %or = or i128 %shl, %1
222*9880d681SAndroid Build Coastguard Worker  store i128 %or, i128* @v128, align 16
223*9880d681SAndroid Build Coastguard Worker  ret void
224*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestShift128_2:
225*9880d681SAndroid Build Coastguard Worker; CHECK:       movq v128(%rip), %rax
226*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  shlq $32, %rax
227*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq v128_2(%rip), %rcx
228*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  orq v128_2+8(%rip), %rax
229*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq %rcx, v128(%rip)
230*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq %rax, v128+8(%rip)
231*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  retq
232*9880d681SAndroid Build Coastguard Worker}
233*9880d681SAndroid Build Coastguard Worker
234*9880d681SAndroid Build Coastguard Workerdefine fp128 @acosl(fp128 %x) #0 {
235*9880d681SAndroid Build Coastguard Workerentry:
236*9880d681SAndroid Build Coastguard Worker  %0 = bitcast fp128 %x to i128
237*9880d681SAndroid Build Coastguard Worker  %bf.clear = and i128 %0, -18446744073709551616
238*9880d681SAndroid Build Coastguard Worker  %1 = bitcast i128 %bf.clear to fp128
239*9880d681SAndroid Build Coastguard Worker  %add = fadd fp128 %1, %x
240*9880d681SAndroid Build Coastguard Worker  ret fp128 %add
241*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: acosl:
242*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps %xmm0, %xmm1
243*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps %xmm1, 16(%rsp)
244*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq 24(%rsp), %rax
245*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq %rax, 8(%rsp)
246*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movq $0, (%rsp)
247*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps (%rsp), %xmm0
248*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  callq __addtf3
249*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
250*9880d681SAndroid Build Coastguard Worker}
251*9880d681SAndroid Build Coastguard Worker
252*9880d681SAndroid Build Coastguard Worker; Compare i128 values and check i128 constants.
253*9880d681SAndroid Build Coastguard Workerdefine fp128 @TestComp(fp128 %x, fp128 %y) #0 {
254*9880d681SAndroid Build Coastguard Workerentry:
255*9880d681SAndroid Build Coastguard Worker  %0 = bitcast fp128 %x to i128
256*9880d681SAndroid Build Coastguard Worker  %cmp = icmp sgt i128 %0, -1
257*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, fp128 %x, fp128 %y
258*9880d681SAndroid Build Coastguard Worker  ret fp128 %cond
259*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestComp:
260*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps %xmm0, -24(%rsp)
261*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  cmpq $0, -16(%rsp)
262*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  jns
263*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps %xmm1, %xmm0
264*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
265*9880d681SAndroid Build Coastguard Worker}
266*9880d681SAndroid Build Coastguard Worker
267*9880d681SAndroid Build Coastguard Workerdeclare void @foo(fp128) #1
268*9880d681SAndroid Build Coastguard Worker
269*9880d681SAndroid Build Coastguard Worker; Test logical operations on fp128 values.
270*9880d681SAndroid Build Coastguard Workerdefine fp128 @TestFABS_LD(fp128 %x) #0 {
271*9880d681SAndroid Build Coastguard Workerentry:
272*9880d681SAndroid Build Coastguard Worker  %call = tail call fp128 @fabsl(fp128 %x) #2
273*9880d681SAndroid Build Coastguard Worker  ret fp128 %call
274*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestFABS_LD
275*9880d681SAndroid Build Coastguard Worker; CHECK:       andps {{.*}}, %xmm0
276*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  retq
277*9880d681SAndroid Build Coastguard Worker}
278*9880d681SAndroid Build Coastguard Worker
279*9880d681SAndroid Build Coastguard Workerdeclare fp128 @fabsl(fp128) #1
280*9880d681SAndroid Build Coastguard Worker
281*9880d681SAndroid Build Coastguard Workerdeclare fp128 @copysignl(fp128, fp128) #1
282*9880d681SAndroid Build Coastguard Worker
283*9880d681SAndroid Build Coastguard Worker; Test more complicated logical operations generated from copysignl.
284*9880d681SAndroid Build Coastguard Workerdefine void @TestCopySign({ fp128, fp128 }* noalias nocapture sret %agg.result, { fp128, fp128 }* byval nocapture readonly align 16 %z) #0 {
285*9880d681SAndroid Build Coastguard Workerentry:
286*9880d681SAndroid Build Coastguard Worker  %z.realp = getelementptr inbounds { fp128, fp128 }, { fp128, fp128 }* %z, i64 0, i32 0
287*9880d681SAndroid Build Coastguard Worker  %z.real = load fp128, fp128* %z.realp, align 16
288*9880d681SAndroid Build Coastguard Worker  %z.imagp = getelementptr inbounds { fp128, fp128 }, { fp128, fp128 }* %z, i64 0, i32 1
289*9880d681SAndroid Build Coastguard Worker  %z.imag4 = load fp128, fp128* %z.imagp, align 16
290*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp ogt fp128 %z.real, %z.imag4
291*9880d681SAndroid Build Coastguard Worker  %sub = fsub fp128 %z.imag4, %z.imag4
292*9880d681SAndroid Build Coastguard Worker  br i1 %cmp, label %if.then, label %cleanup
293*9880d681SAndroid Build Coastguard Worker
294*9880d681SAndroid Build Coastguard Workerif.then:                                          ; preds = %entry
295*9880d681SAndroid Build Coastguard Worker  %call = tail call fp128 @fabsl(fp128 %sub) #2
296*9880d681SAndroid Build Coastguard Worker  br label %cleanup
297*9880d681SAndroid Build Coastguard Worker
298*9880d681SAndroid Build Coastguard Workercleanup:                                          ; preds = %entry, %if.then
299*9880d681SAndroid Build Coastguard Worker  %z.real.sink = phi fp128 [ %z.real, %if.then ], [ %sub, %entry ]
300*9880d681SAndroid Build Coastguard Worker  %call.sink = phi fp128 [ %call, %if.then ], [ %z.real, %entry ]
301*9880d681SAndroid Build Coastguard Worker  %call5 = tail call fp128 @copysignl(fp128 %z.real.sink, fp128 %z.imag4) #2
302*9880d681SAndroid Build Coastguard Worker  %0 = getelementptr inbounds { fp128, fp128 }, { fp128, fp128 }* %agg.result, i64 0, i32 0
303*9880d681SAndroid Build Coastguard Worker  %1 = getelementptr inbounds { fp128, fp128 }, { fp128, fp128 }* %agg.result, i64 0, i32 1
304*9880d681SAndroid Build Coastguard Worker  store fp128 %call.sink, fp128* %0, align 16
305*9880d681SAndroid Build Coastguard Worker  store fp128 %call5, fp128* %1, align 16
306*9880d681SAndroid Build Coastguard Worker  ret void
307*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestCopySign
308*9880d681SAndroid Build Coastguard Worker; CHECK-NOT:   call
309*9880d681SAndroid Build Coastguard Worker; CHECK:       callq __subtf3
310*9880d681SAndroid Build Coastguard Worker; CHECK-NOT:   call
311*9880d681SAndroid Build Coastguard Worker; CHECK:       callq __gttf2
312*9880d681SAndroid Build Coastguard Worker; CHECK-NOT:   call
313*9880d681SAndroid Build Coastguard Worker; CHECK:       andps {{.*}}, %xmm0
314*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
315*9880d681SAndroid Build Coastguard Worker}
316*9880d681SAndroid Build Coastguard Worker
317*9880d681SAndroid Build Coastguard Worker
318*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+ssse3,+sse3,+popcnt,+sse,+sse2,+sse4.1,+sse4.2" "unsafe-fp-math"="false" "use-soft-float"="false" }
319*9880d681SAndroid Build Coastguard Workerattributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+ssse3,+sse3,+popcnt,+sse,+sse2,+sse4.1,+sse4.2" "unsafe-fp-math"="false" "use-soft-float"="false" }
320*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind readnone }
321