diff options
author | Michael Kuperstein <michael.m.kuperstein@intel.com> | 2015-06-30 14:38:57 +0000 |
---|---|---|
committer | Michael Kuperstein <michael.m.kuperstein@intel.com> | 2015-06-30 14:38:57 +0000 |
commit | 8a6c9ccc9899d8eceff91780be8e7bb756ee63d7 (patch) | |
tree | f63af60cc8dcbfc3e8985d4f90513d8fb83d16c2 /llvm/test | |
parent | 660dcd9168276f655ea365476ba23e82b8d10381 (diff) | |
download | bcm5719-llvm-8a6c9ccc9899d8eceff91780be8e7bb756ee63d7.tar.gz bcm5719-llvm-8a6c9ccc9899d8eceff91780be8e7bb756ee63d7.zip |
[X86] Fix a bug in WIN_FTOL_32/64 handling.
Duplicating an FP register "as itself" is a bad idea, since it violates the
invariant that every FP register is mapped to at most one FPU stack slot.
Use the scratch FP register instead.
This fixes PR23957.
llvm-svn: 241069
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/X86/win_ftol2.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/win_ftol2.ll b/llvm/test/CodeGen/X86/win_ftol2.ll index 14591248f35..dfa6e3aa76b 100644 --- a/llvm/test/CodeGen/X86/win_ftol2.ll +++ b/llvm/test/CodeGen/X86/win_ftol2.ll @@ -142,3 +142,25 @@ define i64 @double_ui64_5(double %X) { %tmp.1 = fptoui double %X to i64 ret i64 %tmp.1 } + +define double @pr23957_32(double %A) { +; FTOL-LABEL: @pr23957_32 +; FTOL: fldl +; FTOL-NEXT: fld %st(0) +; FTOL-NEXT: calll __ftol2 + %B = fptoui double %A to i32 + %C = uitofp i32 %B to double + %D = fsub double %C, %A + ret double %D +} + +define double @pr23957_64(double %A) { +; FTOL-LABEL: @pr23957_64 +; FTOL: fldl +; FTOL-NEXT: fld %st(0) +; FTOL-NEXT: calll __ftol2 + %B = fptoui double %A to i64 + %C = uitofp i64 %B to double + %D = fsub double %C, %A + ret double %D +} |