diff options
author | Craig Topper <craig.topper@intel.com> | 2017-11-01 18:10:06 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2017-11-01 18:10:06 +0000 |
commit | ca1aa83cbe22e5b3aa7345a6fd7d0e4d4b1f1d64 (patch) | |
tree | 6f6e721f11d79808c898ac7c43493005625463c1 /llvm/test/CodeGen/X86/fast-isel-int-float-conversion.ll | |
parent | 671526148c547c453d320075ec619f5519499de2 (diff) | |
download | bcm5719-llvm-ca1aa83cbe22e5b3aa7345a6fd7d0e4d4b1f1d64.tar.gz bcm5719-llvm-ca1aa83cbe22e5b3aa7345a6fd7d0e4d4b1f1d64.zip |
[X86] Prevent fast isel from folding loads into the instructions listed in hasPartialRegUpdate.
This patch moves the check for opt size and hasPartialRegUpdate into the lower level implementation of foldMemoryOperandImpl to catch the entry point that fast isel uses.
We're still folding undef register instructions in AVX that we should also probably disable, but that's a problem for another patch.
Unfortunately, this requires reordering a bunch of functions which is why the diff is so large. I can do the function reordering separately if we want.
Differential Revision: https://reviews.llvm.org/D39402
llvm-svn: 317112
Diffstat (limited to 'llvm/test/CodeGen/X86/fast-isel-int-float-conversion.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/fast-isel-int-float-conversion.ll | 98 |
1 files changed, 96 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/X86/fast-isel-int-float-conversion.ll b/llvm/test/CodeGen/X86/fast-isel-int-float-conversion.ll index d722d37ee6b..57b50abab53 100644 --- a/llvm/test/CodeGen/X86/fast-isel-int-float-conversion.ll +++ b/llvm/test/CodeGen/X86/fast-isel-int-float-conversion.ll @@ -58,7 +58,8 @@ entry: define double @int_to_double_rm(i32* %a) { ; SSE2-LABEL: int_to_double_rm: ; SSE2: # BB#0: # %entry -; SSE2-NEXT: cvtsi2sdl (%rdi), %xmm0 +; SSE2-NEXT: movl (%rdi), %eax +; SSE2-NEXT: cvtsi2sdl %eax, %xmm0 ; SSE2-NEXT: retq ; ; AVX-LABEL: int_to_double_rm: @@ -107,6 +108,58 @@ entry: ret double %1 } +define double @int_to_double_rm_optsize(i32* %a) optsize { +; SSE2-LABEL: int_to_double_rm_optsize: +; SSE2: # BB#0: # %entry +; SSE2-NEXT: cvtsi2sdl (%rdi), %xmm0 +; SSE2-NEXT: retq +; +; AVX-LABEL: int_to_double_rm_optsize: +; AVX: # BB#0: # %entry +; AVX-NEXT: vcvtsi2sdl (%rdi), %xmm0, %xmm0 +; AVX-NEXT: retq +; +; SSE2_X86-LABEL: int_to_double_rm_optsize: +; SSE2_X86: # BB#0: # %entry +; SSE2_X86-NEXT: pushl %ebp +; SSE2_X86-NEXT: .cfi_def_cfa_offset 8 +; SSE2_X86-NEXT: .cfi_offset %ebp, -8 +; SSE2_X86-NEXT: movl %esp, %ebp +; SSE2_X86-NEXT: .cfi_def_cfa_register %ebp +; SSE2_X86-NEXT: andl $-8, %esp +; SSE2_X86-NEXT: subl $8, %esp +; SSE2_X86-NEXT: movl 8(%ebp), %eax +; SSE2_X86-NEXT: cvtsi2sdl (%eax), %xmm0 +; SSE2_X86-NEXT: movsd %xmm0, (%esp) +; SSE2_X86-NEXT: fldl (%esp) +; SSE2_X86-NEXT: movl %ebp, %esp +; SSE2_X86-NEXT: popl %ebp +; SSE2_X86-NEXT: .cfi_def_cfa %esp, 4 +; SSE2_X86-NEXT: retl +; +; AVX_X86-LABEL: int_to_double_rm_optsize: +; AVX_X86: # BB#0: # %entry +; AVX_X86-NEXT: pushl %ebp +; AVX_X86-NEXT: .cfi_def_cfa_offset 8 +; AVX_X86-NEXT: .cfi_offset %ebp, -8 +; AVX_X86-NEXT: movl %esp, %ebp +; AVX_X86-NEXT: .cfi_def_cfa_register %ebp +; AVX_X86-NEXT: andl $-8, %esp +; AVX_X86-NEXT: subl $8, %esp +; AVX_X86-NEXT: movl 8(%ebp), %eax +; AVX_X86-NEXT: vcvtsi2sdl (%eax), %xmm0, %xmm0 +; AVX_X86-NEXT: vmovsd %xmm0, (%esp) +; AVX_X86-NEXT: fldl (%esp) +; AVX_X86-NEXT: movl %ebp, %esp +; AVX_X86-NEXT: popl %ebp +; AVX_X86-NEXT: .cfi_def_cfa %esp, 4 +; AVX_X86-NEXT: retl +entry: + %0 = load i32, i32* %a + %1 = sitofp i32 %0 to double + ret double %1 +} + define float @int_to_float_rr(i32 %a) { ; SSE2-LABEL: int_to_float_rr: ; SSE2: # BB#0: # %entry @@ -148,7 +201,8 @@ entry: define float @int_to_float_rm(i32* %a) { ; SSE2-LABEL: int_to_float_rm: ; SSE2: # BB#0: # %entry -; SSE2-NEXT: cvtsi2ssl (%rdi), %xmm0 +; SSE2-NEXT: movl (%rdi), %eax +; SSE2-NEXT: cvtsi2ssl %eax, %xmm0 ; SSE2-NEXT: retq ; ; AVX-LABEL: int_to_float_rm: @@ -184,3 +238,43 @@ entry: %1 = sitofp i32 %0 to float ret float %1 } + +define float @int_to_float_rm_optsize(i32* %a) optsize { +; SSE2-LABEL: int_to_float_rm_optsize: +; SSE2: # BB#0: # %entry +; SSE2-NEXT: cvtsi2ssl (%rdi), %xmm0 +; SSE2-NEXT: retq +; +; AVX-LABEL: int_to_float_rm_optsize: +; AVX: # BB#0: # %entry +; AVX-NEXT: vcvtsi2ssl (%rdi), %xmm0, %xmm0 +; AVX-NEXT: retq +; +; SSE2_X86-LABEL: int_to_float_rm_optsize: +; SSE2_X86: # BB#0: # %entry +; SSE2_X86-NEXT: pushl %eax +; SSE2_X86-NEXT: .cfi_def_cfa_offset 8 +; SSE2_X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; SSE2_X86-NEXT: cvtsi2ssl (%eax), %xmm0 +; SSE2_X86-NEXT: movss %xmm0, (%esp) +; SSE2_X86-NEXT: flds (%esp) +; SSE2_X86-NEXT: popl %eax +; SSE2_X86-NEXT: .cfi_def_cfa_offset 4 +; SSE2_X86-NEXT: retl +; +; AVX_X86-LABEL: int_to_float_rm_optsize: +; AVX_X86: # BB#0: # %entry +; AVX_X86-NEXT: pushl %eax +; AVX_X86-NEXT: .cfi_def_cfa_offset 8 +; AVX_X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; AVX_X86-NEXT: vcvtsi2ssl (%eax), %xmm0, %xmm0 +; AVX_X86-NEXT: vmovss %xmm0, (%esp) +; AVX_X86-NEXT: flds (%esp) +; AVX_X86-NEXT: popl %eax +; AVX_X86-NEXT: .cfi_def_cfa_offset 4 +; AVX_X86-NEXT: retl +entry: + %0 = load i32, i32* %a + %1 = sitofp i32 %0 to float + ret float %1 +} |