Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -580,7 +580,8 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
.lower();

// fp intrinsics
getActionDefinitionsBuilder(G_INTRINSIC_ROUNDEVEN)
getActionDefinitionsBuilder(
{G_INTRINSIC_ROUNDEVEN, G_INTRINSIC_TRUNC, G_FCEIL, G_FFLOOR})
.scalarize(0)
.minScalar(0, LLT::scalar(32))
.libcall();
Expand Down
93 changes: 70 additions & 23 deletions llvm/test/CodeGen/X86/isel-ceil.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64,DAG-X64
; RUN: llc < %s -mtriple=x86_64-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X64,FASTISEL-X64
; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=GISEL-X64
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,DAG-X86
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X86,FASTISEL-X86
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X86


define float @ceil_f32(float %a) nounwind readnone {
; DAG-X64-LABEL: ceil_f32:
Expand All @@ -18,18 +18,39 @@ define float @ceil_f32(float %a) nounwind readnone {
; FASTISEL-X64-NEXT: popq %rax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: ceil_f32:
; X86: # %bb.0:
; X86-NEXT: subl $12, %esp
; X86-NEXT: flds {{[0-9]+}}(%esp)
; X86-NEXT: fstps (%esp)
; X86-NEXT: calll ceilf
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
; DAG-X86-LABEL: ceil_f32:
; DAG-X86: # %bb.0:
; DAG-X86-NEXT: subl $12, %esp
; DAG-X86-NEXT: flds {{[0-9]+}}(%esp)
; DAG-X86-NEXT: fstps (%esp)
; DAG-X86-NEXT: calll ceilf
; DAG-X86-NEXT: addl $12, %esp
; DAG-X86-NEXT: retl
;
; FASTISEL-X86-LABEL: ceil_f32:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: subl $12, %esp
; FASTISEL-X86-NEXT: flds {{[0-9]+}}(%esp)
; FASTISEL-X86-NEXT: fstps (%esp)
; FASTISEL-X86-NEXT: calll ceilf
; FASTISEL-X86-NEXT: addl $12, %esp
; FASTISEL-X86-NEXT: retl
;
; GISEL-X64-LABEL: ceil_f32:
; GISEL-X64: # %bb.0:
; GISEL-X64-NEXT: jmp ceilf@PLT # TAILCALL
; GISEL-X64-NEXT: pushq %rax
; GISEL-X64-NEXT: callq ceilf
; GISEL-X64-NEXT: popq %rax
; GISEL-X64-NEXT: retq
;
; GISEL-X86-LABEL: ceil_f32:
; GISEL-X86: # %bb.0:
; GISEL-X86-NEXT: subl $12, %esp
; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT: movl %eax, (%esp)
; GISEL-X86-NEXT: calll ceilf
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
%c = call float @llvm.ceil.f32(float %a)
ret float %c
}
Expand All @@ -46,18 +67,44 @@ define double @ceil_f64(double %a) nounwind readnone {
; FASTISEL-X64-NEXT: popq %rax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: ceil_f64:
; X86: # %bb.0:
; X86-NEXT: subl $12, %esp
; X86-NEXT: fldl {{[0-9]+}}(%esp)
; X86-NEXT: fstpl (%esp)
; X86-NEXT: calll ceil
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
; DAG-X86-LABEL: ceil_f64:
; DAG-X86: # %bb.0:
; DAG-X86-NEXT: subl $12, %esp
; DAG-X86-NEXT: fldl {{[0-9]+}}(%esp)
; DAG-X86-NEXT: fstpl (%esp)
; DAG-X86-NEXT: calll ceil
; DAG-X86-NEXT: addl $12, %esp
; DAG-X86-NEXT: retl
;
; FASTISEL-X86-LABEL: ceil_f64:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: subl $12, %esp
; FASTISEL-X86-NEXT: fldl {{[0-9]+}}(%esp)
; FASTISEL-X86-NEXT: fstpl (%esp)
; FASTISEL-X86-NEXT: calll ceil
; FASTISEL-X86-NEXT: addl $12, %esp
; FASTISEL-X86-NEXT: retl
;
; GISEL-X64-LABEL: ceil_f64:
; GISEL-X64: # %bb.0:
; GISEL-X64-NEXT: jmp ceil@PLT # TAILCALL
; GISEL-X64-NEXT: pushq %rax
; GISEL-X64-NEXT: callq ceil
; GISEL-X64-NEXT: popq %rax
; GISEL-X64-NEXT: retq
;
; GISEL-X86-LABEL: ceil_f64:
; GISEL-X86: # %bb.0:
; GISEL-X86-NEXT: subl $12, %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 ceil
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
%c = call double @llvm.ceil.f64(double %a)
ret double %c
}
Expand Down Expand Up @@ -86,7 +133,7 @@ define x86_fp80 @ceil_f80(x86_fp80 %a) nounwind readnone {
; GISEL-X64-NEXT: subq $24, %rsp
; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp)
; GISEL-X64-NEXT: fstpt (%rsp)
; GISEL-X64-NEXT: callq ceill@PLT
; GISEL-X64-NEXT: callq ceill
; GISEL-X64-NEXT: addq $24, %rsp
; GISEL-X64-NEXT: retq
%c = call x86_fp80 @llvm.ceil.f80(x86_fp80 %a)
Expand Down
94 changes: 70 additions & 24 deletions llvm/test/CodeGen/X86/isel-floor.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64,DAG-X64
; RUN: llc < %s -mtriple=x86_64-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X64,FASTISEL-X64
; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=GISEL-X64
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,DAG-X86
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X86,FASTISEL-X86
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X86

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should allow to keep fast-isel and sdag under the same check unchanged but then it will introduce a copy for fp80. So it is about have 2 copies (for float and double) vs one copy for (fp80)


define float @floor_f32(float %a) nounwind readnone {
; DAG-X64-LABEL: floor_f32:
Expand All @@ -18,18 +18,39 @@ define float @floor_f32(float %a) nounwind readnone {
; FASTISEL-X64-NEXT: popq %rax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: floor_f32:
; X86: # %bb.0:
; X86-NEXT: subl $12, %esp
; X86-NEXT: flds {{[0-9]+}}(%esp)
; X86-NEXT: fstps (%esp)
; X86-NEXT: calll floorf
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
; DAG-X86-LABEL: floor_f32:
; DAG-X86: # %bb.0:
; DAG-X86-NEXT: subl $12, %esp
; DAG-X86-NEXT: flds {{[0-9]+}}(%esp)
; DAG-X86-NEXT: fstps (%esp)
; DAG-X86-NEXT: calll floorf
; DAG-X86-NEXT: addl $12, %esp
; DAG-X86-NEXT: retl
;
; FASTISEL-X86-LABEL: floor_f32:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: subl $12, %esp
; FASTISEL-X86-NEXT: flds {{[0-9]+}}(%esp)
; FASTISEL-X86-NEXT: fstps (%esp)
; FASTISEL-X86-NEXT: calll floorf
; FASTISEL-X86-NEXT: addl $12, %esp
; FASTISEL-X86-NEXT: retl
;
; GISEL-X64-LABEL: floor_f32:
; GISEL-X64: # %bb.0:
; GISEL-X64-NEXT: jmp floorf@PLT # TAILCALL
; GISEL-X64-NEXT: pushq %rax
; GISEL-X64-NEXT: callq floorf
; GISEL-X64-NEXT: popq %rax
; GISEL-X64-NEXT: retq
;
; GISEL-X86-LABEL: floor_f32:
; GISEL-X86: # %bb.0:
; GISEL-X86-NEXT: subl $12, %esp
; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT: movl %eax, (%esp)
; GISEL-X86-NEXT: calll floorf
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
%c = call float @llvm.floor.f32(float %a)
ret float %c
}
Expand All @@ -46,18 +67,44 @@ define double @floor_f64(double %a) nounwind readnone {
; FASTISEL-X64-NEXT: popq %rax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: floor_f64:
; X86: # %bb.0:
; X86-NEXT: subl $12, %esp
; X86-NEXT: fldl {{[0-9]+}}(%esp)
; X86-NEXT: fstpl (%esp)
; X86-NEXT: calll floor
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
; DAG-X86-LABEL: floor_f64:
; DAG-X86: # %bb.0:
; DAG-X86-NEXT: subl $12, %esp
; DAG-X86-NEXT: fldl {{[0-9]+}}(%esp)
; DAG-X86-NEXT: fstpl (%esp)
; DAG-X86-NEXT: calll floor
; DAG-X86-NEXT: addl $12, %esp
; DAG-X86-NEXT: retl
;
; FASTISEL-X86-LABEL: floor_f64:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: subl $12, %esp
; FASTISEL-X86-NEXT: fldl {{[0-9]+}}(%esp)
; FASTISEL-X86-NEXT: fstpl (%esp)
; FASTISEL-X86-NEXT: calll floor
; FASTISEL-X86-NEXT: addl $12, %esp
; FASTISEL-X86-NEXT: retl
;
; GISEL-X64-LABEL: floor_f64:
; GISEL-X64: # %bb.0:
; GISEL-X64-NEXT: jmp floor@PLT # TAILCALL
; GISEL-X64-NEXT: pushq %rax
; GISEL-X64-NEXT: callq floor
; GISEL-X64-NEXT: popq %rax
; GISEL-X64-NEXT: retq
;
; GISEL-X86-LABEL: floor_f64:
; GISEL-X86: # %bb.0:
; GISEL-X86-NEXT: subl $12, %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 floor
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
%c = call double @llvm.floor.f64(double %a)
ret double %c
}
Expand Down Expand Up @@ -86,10 +133,9 @@ define x86_fp80 @floor_f80(x86_fp80 %a) nounwind readnone {
; GISEL-X64-NEXT: subq $24, %rsp
; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp)
; GISEL-X64-NEXT: fstpt (%rsp)
; GISEL-X64-NEXT: callq floorl@PLT
; GISEL-X64-NEXT: callq floorl
; GISEL-X64-NEXT: addq $24, %rsp
; GISEL-X64-NEXT: retq
%c = call x86_fp80 @llvm.floor.f80(x86_fp80 %a)
ret x86_fp80 %c
}

94 changes: 70 additions & 24 deletions llvm/test/CodeGen/X86/isel-ftrunc.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64,DAG-X64
; RUN: llc < %s -mtriple=x86_64-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X64,FASTISEL-X64
; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=GISEL-X64
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,DAG-X86
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel | FileCheck %s --check-prefixes=X86,FASTISEL-X86
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86

define float @trunc_f32(float %a) nounwind readnone {
; DAG-X64-LABEL: trunc_f32:
Expand All @@ -18,18 +18,39 @@ define float @trunc_f32(float %a) nounwind readnone {
; FASTISEL-X64-NEXT: popq %rax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: trunc_f32:
; X86: # %bb.0:
; X86-NEXT: subl $12, %esp
; X86-NEXT: flds {{[0-9]+}}(%esp)
; X86-NEXT: fstps (%esp)
; X86-NEXT: calll truncf
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
; DAG-X86-LABEL: trunc_f32:
; DAG-X86: # %bb.0:
; DAG-X86-NEXT: subl $12, %esp
; DAG-X86-NEXT: flds {{[0-9]+}}(%esp)
; DAG-X86-NEXT: fstps (%esp)
; DAG-X86-NEXT: calll truncf
; DAG-X86-NEXT: addl $12, %esp
; DAG-X86-NEXT: retl
;
; FASTISEL-X86-LABEL: trunc_f32:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: subl $12, %esp
; FASTISEL-X86-NEXT: flds {{[0-9]+}}(%esp)
; FASTISEL-X86-NEXT: fstps (%esp)
; FASTISEL-X86-NEXT: calll truncf
; FASTISEL-X86-NEXT: addl $12, %esp
; FASTISEL-X86-NEXT: retl
;
; GISEL-X64-LABEL: trunc_f32:
; GISEL-X64: # %bb.0:
; GISEL-X64-NEXT: jmp truncf@PLT # TAILCALL
; GISEL-X64-NEXT: pushq %rax
; GISEL-X64-NEXT: callq truncf
; GISEL-X64-NEXT: popq %rax
; GISEL-X64-NEXT: retq
;
; GISEL-X86-LABEL: trunc_f32:
; GISEL-X86: # %bb.0:
; GISEL-X86-NEXT: subl $12, %esp
; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; GISEL-X86-NEXT: movl %eax, (%esp)
; GISEL-X86-NEXT: calll truncf
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
%c = call float @llvm.trunc.f32(float %a)
ret float %c
}
Expand All @@ -46,18 +67,44 @@ define double @trunc_f64(double %a) nounwind readnone {
; FASTISEL-X64-NEXT: popq %rax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: trunc_f64:
; X86: # %bb.0:
; X86-NEXT: subl $12, %esp
; X86-NEXT: fldl {{[0-9]+}}(%esp)
; X86-NEXT: fstpl (%esp)
; X86-NEXT: calll trunc
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
; DAG-X86-LABEL: trunc_f64:
; DAG-X86: # %bb.0:
; DAG-X86-NEXT: subl $12, %esp
; DAG-X86-NEXT: fldl {{[0-9]+}}(%esp)
; DAG-X86-NEXT: fstpl (%esp)
; DAG-X86-NEXT: calll trunc
; DAG-X86-NEXT: addl $12, %esp
; DAG-X86-NEXT: retl
;
; FASTISEL-X86-LABEL: trunc_f64:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: subl $12, %esp
; FASTISEL-X86-NEXT: fldl {{[0-9]+}}(%esp)
; FASTISEL-X86-NEXT: fstpl (%esp)
; FASTISEL-X86-NEXT: calll trunc
; FASTISEL-X86-NEXT: addl $12, %esp
; FASTISEL-X86-NEXT: retl
;
; GISEL-X64-LABEL: trunc_f64:
; GISEL-X64: # %bb.0:
; GISEL-X64-NEXT: jmp trunc@PLT # TAILCALL
; GISEL-X64-NEXT: pushq %rax
; GISEL-X64-NEXT: callq trunc
; GISEL-X64-NEXT: popq %rax
; GISEL-X64-NEXT: retq
;
; GISEL-X86-LABEL: trunc_f64:
; GISEL-X86: # %bb.0:
; GISEL-X86-NEXT: subl $12, %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 trunc
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
%c = call double @llvm.trunc.f64(double %a)
ret double %c
}
Expand Down Expand Up @@ -86,10 +133,9 @@ define x86_fp80 @trunc_f80(x86_fp80 %a) nounwind readnone {
; GISEL-X64-NEXT: subq $24, %rsp
; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp)
; GISEL-X64-NEXT: fstpt (%rsp)
; GISEL-X64-NEXT: callq truncl@PLT
; GISEL-X64-NEXT: callq truncl
; GISEL-X64-NEXT: addq $24, %rsp
; GISEL-X64-NEXT: retq
%c = call x86_fp80 @llvm.trunc.f80(x86_fp80 %a)
ret x86_fp80 %c
}