xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/fp128-libcalls.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; Check all soft floating point library function calls.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker@vf64 = common global double 0.000000e+00, align 8
7*9880d681SAndroid Build Coastguard Worker@vf128 = common global fp128 0xL00000000000000000000000000000000, align 16
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdefine void @Test128Add(fp128 %d1, fp128 %d2) {
10*9880d681SAndroid Build Coastguard Workerentry:
11*9880d681SAndroid Build Coastguard Worker  %add = fadd fp128 %d1, %d2
12*9880d681SAndroid Build Coastguard Worker  store fp128 %add, fp128* @vf128, align 16
13*9880d681SAndroid Build Coastguard Worker  ret void
14*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: Test128Add:
15*9880d681SAndroid Build Coastguard Worker; CHECK:       callq __addtf3
16*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps %xmm0, vf128(%rip)
17*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
18*9880d681SAndroid Build Coastguard Worker}
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerdefine void @Test128_1Add(fp128 %d1){
21*9880d681SAndroid Build Coastguard Workerentry:
22*9880d681SAndroid Build Coastguard Worker  %0 = load fp128, fp128* @vf128, align 16
23*9880d681SAndroid Build Coastguard Worker  %add = fadd fp128 %0, %d1
24*9880d681SAndroid Build Coastguard Worker  store fp128 %add, fp128* @vf128, align 16
25*9880d681SAndroid Build Coastguard Worker  ret void
26*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: Test128_1Add:
27*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps  %xmm0, %xmm1
28*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps  vf128(%rip), %xmm0
29*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  callq   __addtf3
30*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps  %xmm0, vf128(%rip)
31*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerdefine void @Test128Sub(fp128 %d1, fp128 %d2){
35*9880d681SAndroid Build Coastguard Workerentry:
36*9880d681SAndroid Build Coastguard Worker  %sub = fsub fp128 %d1, %d2
37*9880d681SAndroid Build Coastguard Worker  store fp128 %sub, fp128* @vf128, align 16
38*9880d681SAndroid Build Coastguard Worker  ret void
39*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: Test128Sub:
40*9880d681SAndroid Build Coastguard Worker; CHECK:       callq __subtf3
41*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps %xmm0, vf128(%rip)
42*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
43*9880d681SAndroid Build Coastguard Worker}
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Workerdefine void @Test128_1Sub(fp128 %d1){
46*9880d681SAndroid Build Coastguard Workerentry:
47*9880d681SAndroid Build Coastguard Worker  %0 = load fp128, fp128* @vf128, align 16
48*9880d681SAndroid Build Coastguard Worker  %sub = fsub fp128 %0, %d1
49*9880d681SAndroid Build Coastguard Worker  store fp128 %sub, fp128* @vf128, align 16
50*9880d681SAndroid Build Coastguard Worker  ret void
51*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: Test128_1Sub:
52*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps  %xmm0, %xmm1
53*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps  vf128(%rip), %xmm0
54*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  callq   __subtf3
55*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps  %xmm0, vf128(%rip)
56*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
57*9880d681SAndroid Build Coastguard Worker}
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Workerdefine void @Test128Mul(fp128 %d1, fp128 %d2){
60*9880d681SAndroid Build Coastguard Workerentry:
61*9880d681SAndroid Build Coastguard Worker  %mul = fmul fp128 %d1, %d2
62*9880d681SAndroid Build Coastguard Worker  store fp128 %mul, fp128* @vf128, align 16
63*9880d681SAndroid Build Coastguard Worker  ret void
64*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: Test128Mul:
65*9880d681SAndroid Build Coastguard Worker; CHECK:       callq __multf3
66*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps %xmm0, vf128(%rip)
67*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
68*9880d681SAndroid Build Coastguard Worker}
69*9880d681SAndroid Build Coastguard Worker
70*9880d681SAndroid Build Coastguard Workerdefine void @Test128_1Mul(fp128 %d1){
71*9880d681SAndroid Build Coastguard Workerentry:
72*9880d681SAndroid Build Coastguard Worker  %0 = load fp128, fp128* @vf128, align 16
73*9880d681SAndroid Build Coastguard Worker  %mul = fmul fp128 %0, %d1
74*9880d681SAndroid Build Coastguard Worker  store fp128 %mul, fp128* @vf128, align 16
75*9880d681SAndroid Build Coastguard Worker  ret void
76*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: Test128_1Mul:
77*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps  %xmm0, %xmm1
78*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps  vf128(%rip), %xmm0
79*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  callq   __multf3
80*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps  %xmm0, vf128(%rip)
81*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
82*9880d681SAndroid Build Coastguard Worker}
83*9880d681SAndroid Build Coastguard Worker
84*9880d681SAndroid Build Coastguard Workerdefine void @Test128Div(fp128 %d1, fp128 %d2){
85*9880d681SAndroid Build Coastguard Workerentry:
86*9880d681SAndroid Build Coastguard Worker  %div = fdiv fp128 %d1, %d2
87*9880d681SAndroid Build Coastguard Worker  store fp128 %div, fp128* @vf128, align 16
88*9880d681SAndroid Build Coastguard Worker  ret void
89*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: Test128Div:
90*9880d681SAndroid Build Coastguard Worker; CHECK:       callq __divtf3
91*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps %xmm0, vf128(%rip)
92*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
93*9880d681SAndroid Build Coastguard Worker}
94*9880d681SAndroid Build Coastguard Worker
95*9880d681SAndroid Build Coastguard Workerdefine void @Test128_1Div(fp128 %d1){
96*9880d681SAndroid Build Coastguard Workerentry:
97*9880d681SAndroid Build Coastguard Worker  %0 = load fp128, fp128* @vf128, align 16
98*9880d681SAndroid Build Coastguard Worker  %div = fdiv fp128 %0, %d1
99*9880d681SAndroid Build Coastguard Worker  store fp128 %div, fp128* @vf128, align 16
100*9880d681SAndroid Build Coastguard Worker  ret void
101*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: Test128_1Div:
102*9880d681SAndroid Build Coastguard Worker; CHECK:       movaps  %xmm0, %xmm1
103*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps  vf128(%rip), %xmm0
104*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  callq   __divtf3
105*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  movaps  %xmm0, vf128(%rip)
106*9880d681SAndroid Build Coastguard Worker; CHECK:       retq
107*9880d681SAndroid Build Coastguard Worker}
108