summaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/X86/lround-conv-i32.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/CodeGen/X86/lround-conv-i32.ll')
-rw-r--r--llvm/test/CodeGen/X86/lround-conv-i32.ll176
1 files changed, 128 insertions, 48 deletions
diff --git a/llvm/test/CodeGen/X86/lround-conv-i32.ll b/llvm/test/CodeGen/X86/lround-conv-i32.ll
index c37536623143..389f29233dcc 100644
--- a/llvm/test/CodeGen/X86/lround-conv-i32.ll
+++ b/llvm/test/CodeGen/X86/lround-conv-i32.ll
@@ -1,17 +1,27 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s
-; RUN: llc < %s -mtriple=i686-unknown -mattr=sse2 | FileCheck %s
+; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefixes=X86,X86-NOSSE
+; RUN: llc < %s -mtriple=i686-unknown -mattr=sse2 | FileCheck %s --check-prefixes=X86,X86-SSE2
+; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefixes=X64
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X86
-; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefix=X64
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=GISEL-X64
-define i32 @testmsws(float %x) nounwind {
-; CHECK-LABEL: testmsws:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: jmp lroundf # TAILCALL
+; FIXME: crash
+; define i32 @test_lround_i32_f16(half %x) nounwind {
+; %conv = tail call i32 @llvm.lround.i32.f16(half %x)
+; ret i32 %conv
+; }
+
+define i32 @test_lround_i32_f32(float %x) nounwind {
+; X86-LABEL: test_lround_i32_f32:
+; X86: # %bb.0:
+; X86-NEXT: jmp lroundf # TAILCALL
+;
+; X64-LABEL: test_lround_i32_f32:
+; X64: # %bb.0:
+; X64-NEXT: jmp lroundf@PLT # TAILCALL
;
-; GISEL-X86-LABEL: testmsws:
-; GISEL-X86: # %bb.0: # %entry
+; GISEL-X86-LABEL: test_lround_i32_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)
@@ -19,28 +29,27 @@ define i32 @testmsws(float %x) nounwind {
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
;
-; X64-LABEL: testmsws:
-; X64: # %bb.0: # %entry
-; X64-NEXT: jmp lroundf@PLT # TAILCALL
-;
-; GISEL-X64-LABEL: testmsws:
-; GISEL-X64: # %bb.0: # %entry
+; GISEL-X64-LABEL: test_lround_i32_f32:
+; GISEL-X64: # %bb.0:
; GISEL-X64-NEXT: pushq %rax
; GISEL-X64-NEXT: callq lroundf
; GISEL-X64-NEXT: popq %rcx
; GISEL-X64-NEXT: retq
-entry:
- %0 = tail call i32 @llvm.lround.i32.f32(float %x)
- ret i32 %0
+ %conv = tail call i32 @llvm.lround.i32.f32(float %x)
+ ret i32 %conv
}
-define i32 @testmswd(double %x) nounwind {
-; CHECK-LABEL: testmswd:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: jmp lround # TAILCALL
+define i32 @test_lround_i32_f64(double %x) nounwind {
+; X86-LABEL: test_lround_i32_f64:
+; X86: # %bb.0:
+; X86-NEXT: jmp lround # TAILCALL
+;
+; X64-LABEL: test_lround_i32_f64:
+; X64: # %bb.0:
+; X64-NEXT: jmp lround@PLT # TAILCALL
;
-; GISEL-X86-LABEL: testmswd:
-; GISEL-X86: # %bb.0: # %entry
+; GISEL-X86-LABEL: test_lround_i32_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
@@ -53,28 +62,27 @@ define i32 @testmswd(double %x) nounwind {
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
;
-; X64-LABEL: testmswd:
-; X64: # %bb.0: # %entry
-; X64-NEXT: jmp lround@PLT # TAILCALL
-;
-; GISEL-X64-LABEL: testmswd:
-; GISEL-X64: # %bb.0: # %entry
+; GISEL-X64-LABEL: test_lround_i32_f64:
+; GISEL-X64: # %bb.0:
; GISEL-X64-NEXT: pushq %rax
; GISEL-X64-NEXT: callq lround
; GISEL-X64-NEXT: popq %rcx
; GISEL-X64-NEXT: retq
-entry:
- %0 = tail call i32 @llvm.lround.i32.f64(double %x)
- ret i32 %0
+ %conv = tail call i32 @llvm.lround.i32.f64(double %x)
+ ret i32 %conv
}
-define i32 @testmsll(x86_fp80 %x) nounwind {
-; CHECK-LABEL: testmsll:
-; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: jmp lroundl # TAILCALL
+define i32 @test_lround_i32_f80(x86_fp80 %x) nounwind {
+; X86-LABEL: test_lround_i32_f80:
+; X86: # %bb.0:
+; X86-NEXT: jmp lroundl # TAILCALL
+;
+; X64-LABEL: test_lround_i32_f80:
+; X64: # %bb.0:
+; X64-NEXT: jmp lroundl@PLT # TAILCALL
;
-; GISEL-X86-LABEL: testmsll:
-; GISEL-X86: # %bb.0: # %entry
+; GISEL-X86-LABEL: test_lround_i32_f80:
+; GISEL-X86: # %bb.0:
; GISEL-X86-NEXT: subl $12, %esp
; GISEL-X86-NEXT: fldt {{[0-9]+}}(%esp)
; GISEL-X86-NEXT: fstpt (%esp)
@@ -82,19 +90,91 @@ define i32 @testmsll(x86_fp80 %x) nounwind {
; GISEL-X86-NEXT: addl $12, %esp
; GISEL-X86-NEXT: retl
;
-; X64-LABEL: testmsll:
-; X64: # %bb.0: # %entry
-; X64-NEXT: jmp lroundl@PLT # TAILCALL
-;
-; GISEL-X64-LABEL: testmsll:
-; GISEL-X64: # %bb.0: # %entry
+; GISEL-X64-LABEL: test_lround_i32_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 lroundl
; GISEL-X64-NEXT: addq $24, %rsp
; GISEL-X64-NEXT: retq
-entry:
- %0 = tail call i32 @llvm.lround.i32.f80(x86_fp80 %x)
- ret i32 %0
+ %conv = tail call i32 @llvm.lround.i32.f80(x86_fp80 %x)
+ ret i32 %conv
}
+
+define i32 @test_lround_i32_f128(fp128 %x) nounwind {
+; X86-LABEL: test_lround_i32_f128:
+; X86: # %bb.0:
+; X86-NEXT: pushl %ebp
+; X86-NEXT: movl %esp, %ebp
+; X86-NEXT: andl $-16, %esp
+; X86-NEXT: subl $16, %esp
+; X86-NEXT: pushl 20(%ebp)
+; X86-NEXT: pushl 16(%ebp)
+; X86-NEXT: pushl 12(%ebp)
+; X86-NEXT: pushl 8(%ebp)
+; X86-NEXT: calll lroundl
+; X86-NEXT: addl $16, %esp
+; X86-NEXT: movl %ebp, %esp
+; X86-NEXT: popl %ebp
+; X86-NEXT: retl
+;
+; X64-LABEL: test_lround_i32_f128:
+; X64: # %bb.0:
+; X64-NEXT: jmp lroundl@PLT # TAILCALL
+;
+; GISEL-X86-LABEL: test_lround_i32_f128:
+; GISEL-X86: # %bb.0:
+; GISEL-X86-NEXT: pushl %esi
+; GISEL-X86-NEXT: subl $24, %esp
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
+; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %esi
+; GISEL-X86-NEXT: movl %eax, (%esp)
+; GISEL-X86-NEXT: movl %ecx, {{[0-9]+}}(%esp)
+; GISEL-X86-NEXT: movl %edx, {{[0-9]+}}(%esp)
+; GISEL-X86-NEXT: movl %esi, {{[0-9]+}}(%esp)
+; GISEL-X86-NEXT: calll lroundf128
+; GISEL-X86-NEXT: addl $24, %esp
+; GISEL-X86-NEXT: popl %esi
+; GISEL-X86-NEXT: retl
+;
+; GISEL-X64-LABEL: test_lround_i32_f128:
+; GISEL-X64: # %bb.0:
+; GISEL-X64-NEXT: pushq %rax
+; GISEL-X64-NEXT: callq lroundf128
+; GISEL-X64-NEXT: popq %rcx
+; GISEL-X64-NEXT: retq
+ %conv = tail call i32 @llvm.lround.i32.f128(fp128 %x)
+ ret i32 %conv
+}
+
+; FIXME: not yet implemented in global isel
+; define i32 @test_lround_i32_f16_strict(half %x) nounwind strictfp {
+; %conv = tail call i32 @llvm.experimental.constrained.lround.i32.f16(half %x, metadata!"round.dynamic", metadata!"fpexcept.strict")
+; ret i32 %conv
+; }
+
+; define i32 @test_lround_i32_f32_strict(float %x) nounwind strictfp {
+; %conv = tail call i32 @llvm.experimental.constrained.lround.i32.f32(float %x, metadata!"round.dynamic", metadata!"fpexcept.strict")
+; ret i32 %conv
+; }
+
+; define i32 @test_lround_i32_f64_strict(double %x) nounwind strictfp {
+; %conv = tail call i32 @llvm.experimental.constrained.lround.i32.f64(double %x, metadata!"round.dynamic", metadata!"fpexcept.strict")
+; ret i32 %conv
+; }
+
+; define i32 @test_lround_i32_f80_strict(x86_fp80 %x) nounwind strictfp {
+; %conv = tail call i32 @llvm.experimental.constrained.lround.i32.f80(x86_fp80 %x, metadata!"round.dynamic", metadata!"fpexcept.strict")
+; ret i32 %conv
+; }
+
+; define i32 @test_lround_i32_f128_strict(fp128 %x) nounwind strictfp {
+; %conv = tail call i32 @llvm.experimental.constrained.lround.i32.f128(fp128 %x, metadata!"round.dynamic", metadata!"fpexcept.strict")
+; ret i32 %conv
+; }
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; X86-NOSSE: {{.*}}
+; X86-SSE2: {{.*}}