[llvm] 92ecc30 - [X86] Add test case for llvm.flt.rounds
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 28 16:28:18 PST 2020
Author: Craig Topper
Date: 2020-01-28T16:27:59-08:00
New Revision: 92ecc306af6b9dd7a27695a136f485700254ba2f
URL: https://github.com/llvm/llvm-project/commit/92ecc306af6b9dd7a27695a136f485700254ba2f
DIFF: https://github.com/llvm/llvm-project/commit/92ecc306af6b9dd7a27695a136f485700254ba2f.diff
LOG: [X86] Add test case for llvm.flt.rounds
Added:
llvm/test/CodeGen/X86/flt-rounds.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/flt-rounds.ll b/llvm/test/CodeGen/X86/flt-rounds.ll
new file mode 100644
index 000000000000..531f0dafc2dc
--- /dev/null
+++ b/llvm/test/CodeGen/X86/flt-rounds.ll
@@ -0,0 +1,38 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=-sse -verify-machineinstrs < %s | FileCheck %s -check-prefixes=X86,X86-NOSSE
+; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=-sse2 -verify-machineinstrs < %s | FileCheck %s -check-prefixes=X86,X86-SSE
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -verify-machineinstrs < %s | FileCheck %s -check-prefixes=X64
+
+declare i32 @llvm.flt.rounds()
+
+define i32 @test_flt_rounds() nounwind {
+; X86-LABEL: test_flt_rounds:
+; X86: # %bb.0:
+; X86-NEXT: subl $12, %esp
+; X86-NEXT: fnstcw (%esp)
+; X86-NEXT: movl (%esp), %eax
+; X86-NEXT: movl %eax, %ecx
+; X86-NEXT: shrl $9, %ecx
+; X86-NEXT: andl $2, %ecx
+; X86-NEXT: shrl $11, %eax
+; X86-NEXT: andl $1, %eax
+; X86-NEXT: leal 1(%eax,%ecx), %eax
+; X86-NEXT: andl $3, %eax
+; X86-NEXT: addl $12, %esp
+; X86-NEXT: retl
+;
+; X64-LABEL: test_flt_rounds:
+; X64: # %bb.0:
+; X64-NEXT: fnstcw -{{[0-9]+}}(%rsp)
+; X64-NEXT: movl -{{[0-9]+}}(%rsp), %eax
+; X64-NEXT: movl %eax, %ecx
+; X64-NEXT: shrl $9, %ecx
+; X64-NEXT: andl $2, %ecx
+; X64-NEXT: shrl $11, %eax
+; X64-NEXT: andl $1, %eax
+; X64-NEXT: leal 1(%rax,%rcx), %eax
+; X64-NEXT: andl $3, %eax
+; X64-NEXT: retq
+ %1 = call i32 @llvm.flt.rounds()
+ ret i32 %1
+}
More information about the llvm-commits
mailing list