From ca1aa83cbe22e5b3aa7345a6fd7d0e4d4b1f1d64 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 1 Nov 2017 18:10:06 +0000 Subject: [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 --- .../X86/fast-isel-int-float-conversion-x86-64.ll | 38 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'llvm/test/CodeGen/X86/fast-isel-int-float-conversion-x86-64.ll') diff --git a/llvm/test/CodeGen/X86/fast-isel-int-float-conversion-x86-64.ll b/llvm/test/CodeGen/X86/fast-isel-int-float-conversion-x86-64.ll index 432e190a745..50eddab2b45 100644 --- a/llvm/test/CodeGen/X86/fast-isel-int-float-conversion-x86-64.ll +++ b/llvm/test/CodeGen/X86/fast-isel-int-float-conversion-x86-64.ll @@ -21,7 +21,8 @@ entry: define double @long_to_double_rm(i64* %a) { ; SSE2-LABEL: long_to_double_rm: ; SSE2: # BB#0: # %entry -; SSE2-NEXT: cvtsi2sdq (%rdi), %xmm0 +; SSE2-NEXT: movq (%rdi), %rax +; SSE2-NEXT: cvtsi2sdq %rax, %xmm0 ; SSE2-NEXT: retq ; ; AVX-LABEL: long_to_double_rm: @@ -34,6 +35,22 @@ entry: ret double %1 } +define double @long_to_double_rm_optsize(i64* %a) optsize { +; SSE2-LABEL: long_to_double_rm_optsize: +; SSE2: # BB#0: # %entry +; SSE2-NEXT: cvtsi2sdq (%rdi), %xmm0 +; SSE2-NEXT: retq +; +; AVX-LABEL: long_to_double_rm_optsize: +; AVX: # BB#0: # %entry +; AVX-NEXT: vcvtsi2sdq (%rdi), %xmm0, %xmm0 +; AVX-NEXT: retq +entry: + %0 = load i64, i64* %a + %1 = sitofp i64 %0 to double + ret double %1 +} + define float @long_to_float_rr(i64 %a) { ; SSE2-LABEL: long_to_float_rr: ; SSE2: # BB#0: # %entry @@ -52,7 +69,8 @@ entry: define float @long_to_float_rm(i64* %a) { ; SSE2-LABEL: long_to_float_rm: ; SSE2: # BB#0: # %entry -; SSE2-NEXT: cvtsi2ssq (%rdi), %xmm0 +; SSE2-NEXT: movq (%rdi), %rax +; SSE2-NEXT: cvtsi2ssq %rax, %xmm0 ; SSE2-NEXT: retq ; ; AVX-LABEL: long_to_float_rm: @@ -64,3 +82,19 @@ entry: %1 = sitofp i64 %0 to float ret float %1 } + +define float @long_to_float_rm_optsize(i64* %a) optsize { +; SSE2-LABEL: long_to_float_rm_optsize: +; SSE2: # BB#0: # %entry +; SSE2-NEXT: cvtsi2ssq (%rdi), %xmm0 +; SSE2-NEXT: retq +; +; AVX-LABEL: long_to_float_rm_optsize: +; AVX: # BB#0: # %entry +; AVX-NEXT: vcvtsi2ssq (%rdi), %xmm0, %xmm0 +; AVX-NEXT: retq +entry: + %0 = load i64, i64* %a + %1 = sitofp i64 %0 to float + ret float %1 +} -- cgit v1.2.3