| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 | |
| ; RUN: llc -mtriple=x86_64-linux-android -enable-legalize-types-checking < %s | FileCheck %s --check-prefix=ANDROID | |
| ; On targets whose long double is IEEE-quad (fp128), such as x86_64 Android/OHOS, | |
| ; fp128 math intrinsics lower to the l-suffixed long double libcalls (fmaxl, | |
| ; sqrtl, ...) which the C library provides for long double. This differs from the | |
| ; f128-suffixed _Float128 functions (sqrtf128, ...) used on glibc targets whose | |
| ; long double is x87 (covered by fp128-libcalls-gnu.ll). | |
| ; | |
| ; This is a regression test for #214944, where X86 stopped providing the fp128 | |
| ; long double libcalls, producing "no libcall available" errors on android. | |
| @vf128 = common dso_local global fp128 0xL00000000000000000000000000000000, align 16 | |
| define dso_local void @Test128Max(fp128 %d1, fp128 %d2) nounwind { | |
| ; ANDROID-LABEL: Test128Max: | |
| ; ANDROID: # %bb.0: | |
| ; ANDROID-NEXT: pushq %rax | |
| ; ANDROID-NEXT: callq fmaxl@PLT | |
| ; ANDROID-NEXT: movaps %xmm0, vf128(%rip) | |
| ; ANDROID-NEXT: popq %rax | |
| ; ANDROID-NEXT: retq | |
| %max = call fp128 @llvm.maxnum.f128(fp128 %d1, fp128 %d2) | |
| store fp128 %max, ptr @vf128, align 16 | |
| ret void | |
| } | |
| define dso_local void @Test128Min(fp128 %d1, fp128 %d2) nounwind { | |
| ; ANDROID-LABEL: Test128Min: | |
| ; ANDROID: # %bb.0: | |
| ; ANDROID-NEXT: pushq %rax | |
| ; ANDROID-NEXT: callq fminl@PLT | |
| ; ANDROID-NEXT: movaps %xmm0, vf128(%rip) | |
| ; ANDROID-NEXT: popq %rax | |
| ; ANDROID-NEXT: retq | |
| %min = call fp128 @llvm.minnum.f128(fp128 %d1, fp128 %d2) | |
| store fp128 %min, ptr @vf128, align 16 | |
| ret void | |
| } | |
| define dso_local void @Test128Sqrt(fp128 %d1) nounwind { | |
| ; ANDROID-LABEL: Test128Sqrt: | |
| ; ANDROID: # %bb.0: | |
| ; ANDROID-NEXT: pushq %rax | |
| ; ANDROID-NEXT: callq sqrtl@PLT | |
| ; ANDROID-NEXT: movaps %xmm0, vf128(%rip) | |
| ; ANDROID-NEXT: popq %rax | |
| ; ANDROID-NEXT: retq | |
| %sqrt = call fp128 @llvm.sqrt.f128(fp128 %d1) | |
| store fp128 %sqrt, ptr @vf128, align 16 | |
| ret void | |
| } | |
| define dso_local void @Test128Sin(fp128 %d1) nounwind { | |
| ; ANDROID-LABEL: Test128Sin: | |
| ; ANDROID: # %bb.0: | |
| ; ANDROID-NEXT: pushq %rax | |
| ; ANDROID-NEXT: callq sinl@PLT | |
| ; ANDROID-NEXT: movaps %xmm0, vf128(%rip) | |
| ; ANDROID-NEXT: popq %rax | |
| ; ANDROID-NEXT: retq | |
| %sin = call fp128 @llvm.sin.f128(fp128 %d1) | |
| store fp128 %sin, ptr @vf128, align 16 | |
| ret void | |
| } | |
| define dso_local void @Test128Pow(fp128 %d1, fp128 %d2) nounwind { | |
| ; ANDROID-LABEL: Test128Pow: | |
| ; ANDROID: # %bb.0: | |
| ; ANDROID-NEXT: pushq %rax | |
| ; ANDROID-NEXT: callq powl@PLT | |
| ; ANDROID-NEXT: movaps %xmm0, vf128(%rip) | |
| ; ANDROID-NEXT: popq %rax | |
| ; ANDROID-NEXT: retq | |
| %pow = call fp128 @llvm.pow.f128(fp128 %d1, fp128 %d2) | |
| store fp128 %pow, ptr @vf128, align 16 | |
| ret void | |
| } | |
| define dso_local void @Test128Rint(fp128 %d1) nounwind { | |
| ; ANDROID-LABEL: Test128Rint: | |
| ; ANDROID: # %bb.0: | |
| ; ANDROID-NEXT: pushq %rax | |
| ; ANDROID-NEXT: callq rintl@PLT | |
| ; ANDROID-NEXT: movaps %xmm0, vf128(%rip) | |
| ; ANDROID-NEXT: popq %rax | |
| ; ANDROID-NEXT: retq | |
| %rint = call fp128 @llvm.rint.f128(fp128 %d1) | |
| store fp128 %rint, ptr @vf128, align 16 | |
| ret void | |
| } | |
| define fp128 @Test128Ldexp(fp128 %x, i32 %exp) nounwind { | |
| ; ANDROID-LABEL: Test128Ldexp: | |
| ; ANDROID: # %bb.0: | |
| ; ANDROID-NEXT: jmp ldexpl@PLT # TAILCALL | |
| %r = tail call fp128 @llvm.ldexp.f128.i32(fp128 %x, i32 %exp) | |
| ret fp128 %r | |
| } | |
| declare fp128 @llvm.maxnum.f128(fp128, fp128) | |
| declare fp128 @llvm.minnum.f128(fp128, fp128) | |
| declare fp128 @llvm.sqrt.f128(fp128) | |
| declare fp128 @llvm.sin.f128(fp128) | |
| declare fp128 @llvm.pow.f128(fp128, fp128) | |
| declare fp128 @llvm.rint.f128(fp128) | |
| declare fp128 @llvm.ldexp.f128.i32(fp128, i32) |