[llvm] [X86][GlobalIsel] Add ceil/trunc/floor cpp intrinsic test (PR #156281)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 07:33:13 PDT 2025
https://github.com/mahesh-attarde updated https://github.com/llvm/llvm-project/pull/156281
>From 03b45d170cacc892774ecfd1b9a4220725f926db Mon Sep 17 00:00:00 2001
From: mattarde <mattarde at intel.com>
Date: Sun, 31 Aug 2025 22:51:53 -0700
Subject: [PATCH 1/6] add ceil/trunc/floor cpp intrinsic test
---
llvm/test/CodeGen/X86/isel-llvm-ceil.ll | 75 ++++++++++++++++++++++++
llvm/test/CodeGen/X86/isel-llvm-floor.ll | 75 ++++++++++++++++++++++++
llvm/test/CodeGen/X86/isel-llvm-trunc.ll | 75 ++++++++++++++++++++++++
3 files changed, 225 insertions(+)
create mode 100644 llvm/test/CodeGen/X86/isel-llvm-ceil.ll
create mode 100644 llvm/test/CodeGen/X86/isel-llvm-floor.ll
create mode 100644 llvm/test/CodeGen/X86/isel-llvm-trunc.ll
diff --git a/llvm/test/CodeGen/X86/isel-llvm-ceil.ll b/llvm/test/CodeGen/X86/isel-llvm-ceil.ll
new file mode 100644
index 0000000000000..cdd6b9c6cc713
--- /dev/null
+++ b/llvm/test/CodeGen/X86/isel-llvm-ceil.ll
@@ -0,0 +1,75 @@
+; 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
+
+define float @ceil_f32(float %a) nounwind readnone {
+; DAG-X64-LABEL: ceil_f32:
+; DAG-X64: # %bb.0:
+; DAG-X64-NEXT: jmp ceilf at PLT # TAILCALL
+;
+; FASTISEL-X64-LABEL: ceil_f32:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: pushq %rax
+; FASTISEL-X64-NEXT: callq ceilf at PLT
+; 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
+ %c = call float @llvm.ceil.f32(float %a)
+ ret float %c
+}
+
+define double @ceil_f64(double %a) nounwind readnone {
+; DAG-X64-LABEL: ceil_f64:
+; DAG-X64: # %bb.0:
+; DAG-X64-NEXT: jmp ceil at PLT # TAILCALL
+;
+; FASTISEL-X64-LABEL: ceil_f64:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: pushq %rax
+; FASTISEL-X64-NEXT: callq ceil at PLT
+; 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
+ %c = call double @llvm.ceil.f64(double %a)
+ ret double %c
+}
+
+define x86_fp80 @ceil_f80(x86_fp80 %a) nounwind readnone {
+; X64-LABEL: ceil_f80:
+; X64: # %bb.0:
+; X64-NEXT: subq $24, %rsp
+; X64-NEXT: fldt {{[0-9]+}}(%rsp)
+; X64-NEXT: fstpt (%rsp)
+; X64-NEXT: callq ceill at PLT
+; X64-NEXT: addq $24, %rsp
+; X64-NEXT: retq
+;
+; X86-LABEL: ceil_f80:
+; X86: # %bb.0:
+; X86-NEXT: subl $12, %esp
+; X86-NEXT: fldt {{[0-9]+}}(%esp)
+; X86-NEXT: fstpt (%esp)
+; X86-NEXT: calll ceill
+; X86-NEXT: addl $12, %esp
+; X86-NEXT: retl
+ %c = call x86_fp80 @llvm.ceil.f80(x86_fp80 %a)
+ ret x86_fp80 %c
+}
diff --git a/llvm/test/CodeGen/X86/isel-llvm-floor.ll b/llvm/test/CodeGen/X86/isel-llvm-floor.ll
new file mode 100644
index 0000000000000..63b4d6dc4ded6
--- /dev/null
+++ b/llvm/test/CodeGen/X86/isel-llvm-floor.ll
@@ -0,0 +1,75 @@
+; 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
+
+define float @floor_f32(float %a) nounwind readnone {
+; DAG-X64-LABEL: floor_f32:
+; DAG-X64: # %bb.0:
+; DAG-X64-NEXT: jmp floorf at PLT # TAILCALL
+;
+; FASTISEL-X64-LABEL: floor_f32:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: pushq %rax
+; FASTISEL-X64-NEXT: callq floorf at PLT
+; 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
+ %c = call float @llvm.floor.f32(float %a)
+ ret float %c
+}
+
+define double @floor_f64(double %a) nounwind readnone {
+; DAG-X64-LABEL: floor_f64:
+; DAG-X64: # %bb.0:
+; DAG-X64-NEXT: jmp floor at PLT # TAILCALL
+;
+; FASTISEL-X64-LABEL: floor_f64:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: pushq %rax
+; FASTISEL-X64-NEXT: callq floor at PLT
+; 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
+ %c = call double @llvm.floor.f64(double %a)
+ ret double %c
+}
+
+define x86_fp80 @floor_f80(x86_fp80 %a) nounwind readnone {
+; X64-LABEL: floor_f80:
+; X64: # %bb.0:
+; X64-NEXT: subq $24, %rsp
+; X64-NEXT: fldt {{[0-9]+}}(%rsp)
+; X64-NEXT: fstpt (%rsp)
+; X64-NEXT: callq floorl at PLT
+; X64-NEXT: addq $24, %rsp
+; X64-NEXT: retq
+;
+; X86-LABEL: floor_f80:
+; X86: # %bb.0:
+; X86-NEXT: subl $12, %esp
+; X86-NEXT: fldt {{[0-9]+}}(%esp)
+; X86-NEXT: fstpt (%esp)
+; X86-NEXT: calll floorl
+; X86-NEXT: addl $12, %esp
+; X86-NEXT: retl
+ %c = call x86_fp80 @llvm.floor.f80(x86_fp80 %a)
+ ret x86_fp80 %c
+}
diff --git a/llvm/test/CodeGen/X86/isel-llvm-trunc.ll b/llvm/test/CodeGen/X86/isel-llvm-trunc.ll
new file mode 100644
index 0000000000000..303017f1e9411
--- /dev/null
+++ b/llvm/test/CodeGen/X86/isel-llvm-trunc.ll
@@ -0,0 +1,75 @@
+; 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
+
+define float @trunc_f32(float %a) nounwind readnone {
+; DAG-X64-LABEL: trunc_f32:
+; DAG-X64: # %bb.0:
+; DAG-X64-NEXT: jmp truncf at PLT # TAILCALL
+;
+; FASTISEL-X64-LABEL: trunc_f32:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: pushq %rax
+; FASTISEL-X64-NEXT: callq truncf at PLT
+; 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
+ %c = call float @llvm.trunc.f32(float %a)
+ ret float %c
+}
+
+define double @trunc_f64(double %a) nounwind readnone {
+; DAG-X64-LABEL: trunc_f64:
+; DAG-X64: # %bb.0:
+; DAG-X64-NEXT: jmp trunc at PLT # TAILCALL
+;
+; FASTISEL-X64-LABEL: trunc_f64:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: pushq %rax
+; FASTISEL-X64-NEXT: callq trunc at PLT
+; 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
+ %c = call double @llvm.trunc.f64(double %a)
+ ret double %c
+}
+
+define x86_fp80 @trunc_f80(x86_fp80 %a) nounwind readnone {
+; X64-LABEL: trunc_f80:
+; X64: # %bb.0:
+; X64-NEXT: subq $24, %rsp
+; X64-NEXT: fldt {{[0-9]+}}(%rsp)
+; X64-NEXT: fstpt (%rsp)
+; X64-NEXT: callq truncl at PLT
+; X64-NEXT: addq $24, %rsp
+; X64-NEXT: retq
+;
+; X86-LABEL: trunc_f80:
+; X86: # %bb.0:
+; X86-NEXT: subl $12, %esp
+; X86-NEXT: fldt {{[0-9]+}}(%esp)
+; X86-NEXT: fstpt (%esp)
+; X86-NEXT: calll truncl
+; X86-NEXT: addl $12, %esp
+; X86-NEXT: retl
+ %c = call x86_fp80 @llvm.trunc.f80(x86_fp80 %a)
+ ret x86_fp80 %c
+}
>From 6c2d14765a527464afb88cf23326e8e5f85c8558 Mon Sep 17 00:00:00 2001
From: mattarde <mattarde at intel.com>
Date: Sun, 31 Aug 2025 23:10:35 -0700
Subject: [PATCH 2/6] add gisel run
---
llvm/test/CodeGen/X86/isel-llvm-ceil.ll | 2 +
llvm/test/CodeGen/X86/isel-llvm-floor.ll | 62 ++++++++++++++++++------
llvm/test/CodeGen/X86/isel-llvm-trunc.ll | 62 ++++++++++++++++++------
3 files changed, 94 insertions(+), 32 deletions(-)
diff --git a/llvm/test/CodeGen/X86/isel-llvm-ceil.ll b/llvm/test/CodeGen/X86/isel-llvm-ceil.ll
index cdd6b9c6cc713..55c37f71fedcb 100644
--- a/llvm/test/CodeGen/X86/isel-llvm-ceil.ll
+++ b/llvm/test/CodeGen/X86/isel-llvm-ceil.ll
@@ -3,6 +3,8 @@
; 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,GISEL-X86
define float @ceil_f32(float %a) nounwind readnone {
; DAG-X64-LABEL: ceil_f32:
diff --git a/llvm/test/CodeGen/X86/isel-llvm-floor.ll b/llvm/test/CodeGen/X86/isel-llvm-floor.ll
index 63b4d6dc4ded6..2e8799fb6e66f 100644
--- a/llvm/test/CodeGen/X86/isel-llvm-floor.ll
+++ b/llvm/test/CodeGen/X86/isel-llvm-floor.ll
@@ -3,6 +3,8 @@
; 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,GISEL-X86
define float @floor_f32(float %a) nounwind readnone {
; DAG-X64-LABEL: floor_f32:
@@ -16,14 +18,21 @@ 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
+; GISEL-X64-LABEL: floor_f32:
+; GISEL-X64: # %bb.0:
+; 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
}
@@ -40,14 +49,26 @@ 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
+; GISEL-X64-LABEL: floor_f64:
+; GISEL-X64: # %bb.0:
+; 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
}
@@ -70,6 +91,15 @@ define x86_fp80 @floor_f80(x86_fp80 %a) nounwind readnone {
; X86-NEXT: calll floorl
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
+;
+; GISEL-X64-LABEL: floor_f80:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: subq $24, %rsp
+; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp)
+; GISEL-X64-NEXT: fstpt (%rsp)
+; 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
}
diff --git a/llvm/test/CodeGen/X86/isel-llvm-trunc.ll b/llvm/test/CodeGen/X86/isel-llvm-trunc.ll
index 303017f1e9411..fe2bfd51a8891 100644
--- a/llvm/test/CodeGen/X86/isel-llvm-trunc.ll
+++ b/llvm/test/CodeGen/X86/isel-llvm-trunc.ll
@@ -3,6 +3,8 @@
; 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,GISEL-X86
define float @trunc_f32(float %a) nounwind readnone {
; DAG-X64-LABEL: trunc_f32:
@@ -16,14 +18,21 @@ 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
+; GISEL-X64-LABEL: trunc_f32:
+; GISEL-X64: # %bb.0:
+; 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
}
@@ -40,14 +49,26 @@ 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
+; GISEL-X64-LABEL: trunc_f64:
+; GISEL-X64: # %bb.0:
+; 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
}
@@ -70,6 +91,15 @@ define x86_fp80 @trunc_f80(x86_fp80 %a) nounwind readnone {
; X86-NEXT: calll truncl
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
+;
+; GISEL-X64-LABEL: trunc_f80:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: subq $24, %rsp
+; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp)
+; GISEL-X64-NEXT: fstpt (%rsp)
+; 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
}
>From 2f54a2a6770b85e66b43b87d32e79f02649ab65b Mon Sep 17 00:00:00 2001
From: mattarde <mattarde at intel.com>
Date: Sun, 31 Aug 2025 23:40:42 -0700
Subject: [PATCH 3/6] add review comments
---
llvm/test/CodeGen/X86/isel-llvm-ceil.ll | 20 ++++++++-
llvm/test/CodeGen/X86/isel-llvm-floor.ll | 56 ++++++++++--------------
llvm/test/CodeGen/X86/isel-llvm-trunc.ll | 56 ++++++++++--------------
3 files changed, 65 insertions(+), 67 deletions(-)
diff --git a/llvm/test/CodeGen/X86/isel-llvm-ceil.ll b/llvm/test/CodeGen/X86/isel-llvm-ceil.ll
index 55c37f71fedcb..c82cfebd4814d 100644
--- a/llvm/test/CodeGen/X86/isel-llvm-ceil.ll
+++ b/llvm/test/CodeGen/X86/isel-llvm-ceil.ll
@@ -4,7 +4,7 @@
; 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,GISEL-X86
+; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86
define float @ceil_f32(float %a) nounwind readnone {
; DAG-X64-LABEL: ceil_f32:
@@ -26,6 +26,10 @@ define float @ceil_f32(float %a) nounwind readnone {
; X86-NEXT: calll ceilf
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
+;
+; GISEL-X64-LABEL: ceil_f32:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: jmp ceilf at PLT # TAILCALL
%c = call float @llvm.ceil.f32(float %a)
ret float %c
}
@@ -50,6 +54,10 @@ define double @ceil_f64(double %a) nounwind readnone {
; X86-NEXT: calll ceil
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
+;
+; GISEL-X64-LABEL: ceil_f64:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: jmp ceil at PLT # TAILCALL
%c = call double @llvm.ceil.f64(double %a)
ret double %c
}
@@ -72,6 +80,16 @@ define x86_fp80 @ceil_f80(x86_fp80 %a) nounwind readnone {
; X86-NEXT: calll ceill
; X86-NEXT: addl $12, %esp
; X86-NEXT: retl
+;
+; GISEL-X64-LABEL: ceil_f80:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: subq $24, %rsp
+; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp)
+; GISEL-X64-NEXT: fstpt (%rsp)
+; GISEL-X64-NEXT: callq ceill at PLT
+; GISEL-X64-NEXT: addq $24, %rsp
+; GISEL-X64-NEXT: retq
%c = call x86_fp80 @llvm.ceil.f80(x86_fp80 %a)
ret x86_fp80 %c
}
+
diff --git a/llvm/test/CodeGen/X86/isel-llvm-floor.ll b/llvm/test/CodeGen/X86/isel-llvm-floor.ll
index 2e8799fb6e66f..675925b611263 100644
--- a/llvm/test/CodeGen/X86/isel-llvm-floor.ll
+++ b/llvm/test/CodeGen/X86/isel-llvm-floor.ll
@@ -4,7 +4,7 @@
; 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,GISEL-X86
+; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86
define float @floor_f32(float %a) nounwind readnone {
; DAG-X64-LABEL: floor_f32:
@@ -18,21 +18,18 @@ 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
+;
; GISEL-X64-LABEL: floor_f32:
; GISEL-X64: # %bb.0:
-; 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
+; GISEL-X64-NEXT: jmp floorf at PLT # TAILCALL
%c = call float @llvm.floor.f32(float %a)
ret float %c
}
@@ -49,26 +46,18 @@ 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
+;
; GISEL-X64-LABEL: floor_f64:
; GISEL-X64: # %bb.0:
-; 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
+; GISEL-X64-NEXT: jmp floor at PLT # TAILCALL
%c = call double @llvm.floor.f64(double %a)
ret double %c
}
@@ -97,9 +86,10 @@ 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
+; GISEL-X64-NEXT: callq floorl at PLT
; GISEL-X64-NEXT: addq $24, %rsp
; GISEL-X64-NEXT: retq
%c = call x86_fp80 @llvm.floor.f80(x86_fp80 %a)
ret x86_fp80 %c
}
+
diff --git a/llvm/test/CodeGen/X86/isel-llvm-trunc.ll b/llvm/test/CodeGen/X86/isel-llvm-trunc.ll
index fe2bfd51a8891..9bf06193961a3 100644
--- a/llvm/test/CodeGen/X86/isel-llvm-trunc.ll
+++ b/llvm/test/CodeGen/X86/isel-llvm-trunc.ll
@@ -4,7 +4,7 @@
; 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,GISEL-X86
+; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86
define float @trunc_f32(float %a) nounwind readnone {
; DAG-X64-LABEL: trunc_f32:
@@ -18,21 +18,18 @@ 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
+;
; GISEL-X64-LABEL: trunc_f32:
; GISEL-X64: # %bb.0:
-; 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
+; GISEL-X64-NEXT: jmp truncf at PLT # TAILCALL
%c = call float @llvm.trunc.f32(float %a)
ret float %c
}
@@ -49,26 +46,18 @@ 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
+;
; GISEL-X64-LABEL: trunc_f64:
; GISEL-X64: # %bb.0:
-; 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
+; GISEL-X64-NEXT: jmp trunc at PLT # TAILCALL
%c = call double @llvm.trunc.f64(double %a)
ret double %c
}
@@ -97,9 +86,10 @@ 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
+; GISEL-X64-NEXT: callq truncl at PLT
; GISEL-X64-NEXT: addq $24, %rsp
; GISEL-X64-NEXT: retq
%c = call x86_fp80 @llvm.trunc.f80(x86_fp80 %a)
ret x86_fp80 %c
}
+
>From ee0badf105decf3e449c9bc597b9c25a63f50206 Mon Sep 17 00:00:00 2001
From: mattarde <mattarde at intel.com>
Date: Mon, 1 Sep 2025 07:29:43 -0700
Subject: [PATCH 4/6] rename test
---
llvm/test/CodeGen/X86/{isel-llvm-ceil.ll => isel-ceil.ll} | 0
llvm/test/CodeGen/X86/{isel-llvm-floor.ll => isel-floor.ll} | 0
llvm/test/CodeGen/X86/{isel-llvm-trunc.ll => isel-trunc.ll} | 0
3 files changed, 0 insertions(+), 0 deletions(-)
rename llvm/test/CodeGen/X86/{isel-llvm-ceil.ll => isel-ceil.ll} (100%)
rename llvm/test/CodeGen/X86/{isel-llvm-floor.ll => isel-floor.ll} (100%)
rename llvm/test/CodeGen/X86/{isel-llvm-trunc.ll => isel-trunc.ll} (100%)
diff --git a/llvm/test/CodeGen/X86/isel-llvm-ceil.ll b/llvm/test/CodeGen/X86/isel-ceil.ll
similarity index 100%
rename from llvm/test/CodeGen/X86/isel-llvm-ceil.ll
rename to llvm/test/CodeGen/X86/isel-ceil.ll
diff --git a/llvm/test/CodeGen/X86/isel-llvm-floor.ll b/llvm/test/CodeGen/X86/isel-floor.ll
similarity index 100%
rename from llvm/test/CodeGen/X86/isel-llvm-floor.ll
rename to llvm/test/CodeGen/X86/isel-floor.ll
diff --git a/llvm/test/CodeGen/X86/isel-llvm-trunc.ll b/llvm/test/CodeGen/X86/isel-trunc.ll
similarity index 100%
rename from llvm/test/CodeGen/X86/isel-llvm-trunc.ll
rename to llvm/test/CodeGen/X86/isel-trunc.ll
>From 46b64133b2c403c0dba547599e4a9c6092b37e29 Mon Sep 17 00:00:00 2001
From: mattarde <mattarde at intel.com>
Date: Mon, 1 Sep 2025 07:31:57 -0700
Subject: [PATCH 5/6] rename
---
llvm/test/CodeGen/X86/isel-ftrunc.ll | 95 ++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
create mode 100644 llvm/test/CodeGen/X86/isel-ftrunc.ll
diff --git a/llvm/test/CodeGen/X86/isel-ftrunc.ll b/llvm/test/CodeGen/X86/isel-ftrunc.ll
new file mode 100644
index 0000000000000..9bf06193961a3
--- /dev/null
+++ b/llvm/test/CodeGen/X86/isel-ftrunc.ll
@@ -0,0 +1,95 @@
+; 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
+
+define float @trunc_f32(float %a) nounwind readnone {
+; DAG-X64-LABEL: trunc_f32:
+; DAG-X64: # %bb.0:
+; DAG-X64-NEXT: jmp truncf at PLT # TAILCALL
+;
+; FASTISEL-X64-LABEL: trunc_f32:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: pushq %rax
+; FASTISEL-X64-NEXT: callq truncf at PLT
+; 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
+;
+; GISEL-X64-LABEL: trunc_f32:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: jmp truncf at PLT # TAILCALL
+ %c = call float @llvm.trunc.f32(float %a)
+ ret float %c
+}
+
+define double @trunc_f64(double %a) nounwind readnone {
+; DAG-X64-LABEL: trunc_f64:
+; DAG-X64: # %bb.0:
+; DAG-X64-NEXT: jmp trunc at PLT # TAILCALL
+;
+; FASTISEL-X64-LABEL: trunc_f64:
+; FASTISEL-X64: # %bb.0:
+; FASTISEL-X64-NEXT: pushq %rax
+; FASTISEL-X64-NEXT: callq trunc at PLT
+; 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
+;
+; GISEL-X64-LABEL: trunc_f64:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: jmp trunc at PLT # TAILCALL
+ %c = call double @llvm.trunc.f64(double %a)
+ ret double %c
+}
+
+define x86_fp80 @trunc_f80(x86_fp80 %a) nounwind readnone {
+; X64-LABEL: trunc_f80:
+; X64: # %bb.0:
+; X64-NEXT: subq $24, %rsp
+; X64-NEXT: fldt {{[0-9]+}}(%rsp)
+; X64-NEXT: fstpt (%rsp)
+; X64-NEXT: callq truncl at PLT
+; X64-NEXT: addq $24, %rsp
+; X64-NEXT: retq
+;
+; X86-LABEL: trunc_f80:
+; X86: # %bb.0:
+; X86-NEXT: subl $12, %esp
+; X86-NEXT: fldt {{[0-9]+}}(%esp)
+; X86-NEXT: fstpt (%esp)
+; X86-NEXT: calll truncl
+; X86-NEXT: addl $12, %esp
+; X86-NEXT: retl
+;
+; GISEL-X64-LABEL: trunc_f80:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: subq $24, %rsp
+; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp)
+; GISEL-X64-NEXT: fstpt (%rsp)
+; GISEL-X64-NEXT: callq truncl at PLT
+; GISEL-X64-NEXT: addq $24, %rsp
+; GISEL-X64-NEXT: retq
+ %c = call x86_fp80 @llvm.trunc.f80(x86_fp80 %a)
+ ret x86_fp80 %c
+}
+
>From 650d756da3be04f230dd7c30207410d500a05c09 Mon Sep 17 00:00:00 2001
From: mattarde <mattarde at intel.com>
Date: Mon, 1 Sep 2025 07:32:57 -0700
Subject: [PATCH 6/6] rename
---
llvm/test/CodeGen/X86/isel-trunc.ll | 95 -----------------------------
1 file changed, 95 deletions(-)
delete mode 100644 llvm/test/CodeGen/X86/isel-trunc.ll
diff --git a/llvm/test/CodeGen/X86/isel-trunc.ll b/llvm/test/CodeGen/X86/isel-trunc.ll
deleted file mode 100644
index 9bf06193961a3..0000000000000
--- a/llvm/test/CodeGen/X86/isel-trunc.ll
+++ /dev/null
@@ -1,95 +0,0 @@
-; 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
-
-define float @trunc_f32(float %a) nounwind readnone {
-; DAG-X64-LABEL: trunc_f32:
-; DAG-X64: # %bb.0:
-; DAG-X64-NEXT: jmp truncf at PLT # TAILCALL
-;
-; FASTISEL-X64-LABEL: trunc_f32:
-; FASTISEL-X64: # %bb.0:
-; FASTISEL-X64-NEXT: pushq %rax
-; FASTISEL-X64-NEXT: callq truncf at PLT
-; 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
-;
-; GISEL-X64-LABEL: trunc_f32:
-; GISEL-X64: # %bb.0:
-; GISEL-X64-NEXT: jmp truncf at PLT # TAILCALL
- %c = call float @llvm.trunc.f32(float %a)
- ret float %c
-}
-
-define double @trunc_f64(double %a) nounwind readnone {
-; DAG-X64-LABEL: trunc_f64:
-; DAG-X64: # %bb.0:
-; DAG-X64-NEXT: jmp trunc at PLT # TAILCALL
-;
-; FASTISEL-X64-LABEL: trunc_f64:
-; FASTISEL-X64: # %bb.0:
-; FASTISEL-X64-NEXT: pushq %rax
-; FASTISEL-X64-NEXT: callq trunc at PLT
-; 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
-;
-; GISEL-X64-LABEL: trunc_f64:
-; GISEL-X64: # %bb.0:
-; GISEL-X64-NEXT: jmp trunc at PLT # TAILCALL
- %c = call double @llvm.trunc.f64(double %a)
- ret double %c
-}
-
-define x86_fp80 @trunc_f80(x86_fp80 %a) nounwind readnone {
-; X64-LABEL: trunc_f80:
-; X64: # %bb.0:
-; X64-NEXT: subq $24, %rsp
-; X64-NEXT: fldt {{[0-9]+}}(%rsp)
-; X64-NEXT: fstpt (%rsp)
-; X64-NEXT: callq truncl at PLT
-; X64-NEXT: addq $24, %rsp
-; X64-NEXT: retq
-;
-; X86-LABEL: trunc_f80:
-; X86: # %bb.0:
-; X86-NEXT: subl $12, %esp
-; X86-NEXT: fldt {{[0-9]+}}(%esp)
-; X86-NEXT: fstpt (%esp)
-; X86-NEXT: calll truncl
-; X86-NEXT: addl $12, %esp
-; X86-NEXT: retl
-;
-; GISEL-X64-LABEL: trunc_f80:
-; GISEL-X64: # %bb.0:
-; GISEL-X64-NEXT: subq $24, %rsp
-; GISEL-X64-NEXT: fldt {{[0-9]+}}(%rsp)
-; GISEL-X64-NEXT: fstpt (%rsp)
-; GISEL-X64-NEXT: callq truncl at PLT
-; GISEL-X64-NEXT: addq $24, %rsp
-; GISEL-X64-NEXT: retq
- %c = call x86_fp80 @llvm.trunc.f80(x86_fp80 %a)
- ret x86_fp80 %c
-}
-
More information about the llvm-commits
mailing list