Skip to content

[X86][GlobalISel] Enable POW/EXP*/LOG* functions with libcall mapping #130328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,

getActionDefinitionsBuilder({G_LROUND, G_LLROUND, G_FCOS, G_FCOSH, G_FACOS,
G_FSIN, G_FSINH, G_FASIN, G_FTAN, G_FTANH,
G_FATAN, G_FATAN2})
G_FATAN, G_FATAN2, G_FPOW, G_FEXP, G_FEXP2,
G_FEXP10, G_FLOG, G_FLOG2, G_FLOG10})
.libcall();

// merge/unmerge
Expand Down
29 changes: 20 additions & 9 deletions llvm/test/CodeGen/X86/exp10-libcall-names.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
; RUN: llc -mtriple=x86_64-apple-xros8.0 < %s | FileCheck -check-prefix=APPLE %s
; RUN: llc -mtriple=x86_64-apple-driverkit < %s | FileCheck -check-prefix=APPLE %s
; RUN: llc -mtriple=x86_64-apple-driverkit24.0 < %s | FileCheck -check-prefix=APPLE %s
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefix=GISEL-X86
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefix=GISEL-X64
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefix=GISEL-X86
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefix=GISEL-X64

; RUN: not llc -mtriple=x86_64-apple-macos10.8 -filetype=null %s 2>&1 | FileCheck -check-prefix=ERR %s
; Check exp10/exp10f is emitted as __exp10/__exp10f on assorted systems.
Expand All @@ -30,15 +30,18 @@ define float @test_exp10_f32(float %x) nounwind {
; GISEL-X86-LABEL: test_exp10_f32:
; GISEL-X86: # %bb.0:
; GISEL-X86-NEXT: subl $12, %esp
; GISEL-X86-NEXT: flds {{[0-9]+}}(%esp)
; GISEL-X86-NEXT: fstps (%esp)
; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT: movl %eax, (%esp)
; GISEL-X86-NEXT: calll exp10f
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
;
; GISEL-X64-LABEL: test_exp10_f32:
; GISEL-X64: # %bb.0:
; GISEL-X64-NEXT: jmp exp10f@PLT # TAILCALL
; GISEL-X64-NEXT: pushq %rax
; GISEL-X64-NEXT: callq exp10f
; GISEL-X64-NEXT: popq %rax
; GISEL-X64-NEXT: retq
%ret = call float @llvm.exp10.f32(float %x)
ret float %ret
}
Expand All @@ -55,15 +58,23 @@ define double @test_exp10_f64(double %x) nounwind {
; GISEL-X86-LABEL: test_exp10_f64:
; GISEL-X86: # %bb.0:
; GISEL-X86-NEXT: subl $12, %esp
; GISEL-X86-NEXT: fldl {{[0-9]+}}(%esp)
; GISEL-X86-NEXT: fstpl (%esp)
; GISEL-X86-NEXT: leal {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; GISEL-X86-NEXT: movl 4(%eax), %eax
; GISEL-X86-NEXT: xorl %edx, %edx
; GISEL-X86-NEXT: addl %esp, %edx
; GISEL-X86-NEXT: movl %ecx, (%esp)
; GISEL-X86-NEXT: movl %eax, 4(%edx)
; GISEL-X86-NEXT: calll exp10
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
;
; GISEL-X64-LABEL: test_exp10_f64:
; GISEL-X64: # %bb.0:
; GISEL-X64-NEXT: jmp exp10@PLT # TAILCALL
; GISEL-X64-NEXT: pushq %rax
; GISEL-X64-NEXT: callq exp10
; GISEL-X64-NEXT: popq %rax
; GISEL-X64-NEXT: retq
%ret = call double @llvm.exp10.f64(double %x)
ret double %ret
}
Expand Down Expand Up @@ -101,7 +112,7 @@ define x86_fp80 @test_exp10_f80(x86_fp80 %x) nounwind {
; GISEL-X64-NEXT: subq $24, %rsp
; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp)
; GISEL-X64-NEXT: fstpt (%rsp)
; GISEL-X64-NEXT: callq exp10l@PLT
; GISEL-X64-NEXT: callq exp10l
; GISEL-X64-NEXT: addq $24, %rsp
; GISEL-X64-NEXT: retq
%ret = call x86_fp80 @llvm.exp10.f80(x86_fp80 %x)
Expand Down
Loading
Loading