llvm-project/llvm/test/CodeGen/X86/sqrt-fastmath-mir.ll
Craig Topper 6413f8a8f2 [X86] Remove scalar logical op alias instructions. Just use COPY_FROM/TO_REGCLASS and the normal packed instructions instead
Summary:
This patch removes the scalar logical operation alias instructions. We can just use reg class copies and use the normal packed instructions instead. This removes the need for putting these instructions in the execution domain fixing tables as was done recently.

I removed the loadf64_128 and loadf32_128 patterns as DAG combine creates a narrower load for (extractelt (loadv4f32)) before we ever get to isel.

I plan to add similar patterns for AVX512DQ in a future commit to allow use of the larger register class when available.

Reviewers: spatel, delena, zvi, RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D27401

llvm-svn: 288771
2016-12-06 04:58:39 +00:00

53 lines
1.7 KiB
LLVM

; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx2,fma -stop-after=expand-isel-pseudos 2>&1 | FileCheck %s
declare float @llvm.sqrt.f32(float) #0
define float @foo(float %f) #0 {
; CHECK: {{name: *foo}}
; CHECK: body:
; CHECK: %0 = COPY %xmm0
; CHECK: %1 = VRSQRTSSr killed %2, %0
; CHECK: %3 = VMULSSrr %0, %1
; CHECK: %4 = VMOVSSrm
; CHECK: %5 = VFMADD213SSr %1, killed %3, %4
; CHECK: %6 = VMOVSSrm
; CHECK: %7 = VMULSSrr %1, %6
; CHECK: %8 = VMULSSrr killed %7, killed %5
; CHECK: %9 = VMULSSrr %0, %8
; CHECK: %10 = VFMADD213SSr %8, %9, %4
; CHECK: %11 = VMULSSrr %9, %6
; CHECK: %12 = VMULSSrr killed %11, killed %10
; CHECK: %14 = FsFLD0SS
; CHECK: %15 = VCMPSSrr %0, killed %14, 0
; CHECK: %17 = VANDNPSrr killed %16, killed %13
; CHECK: %xmm0 = COPY %18
; CHECK: RET 0, %xmm0
%call = tail call float @llvm.sqrt.f32(float %f) #1
ret float %call
}
define float @rfoo(float %f) #0 {
; CHECK: {{name: *rfoo}}
; CHECK: body: |
; CHECK: %0 = COPY %xmm0
; CHECK: %1 = VRSQRTSSr killed %2, %0
; CHECK: %3 = VMULSSrr %0, %1
; CHECK: %4 = VMOVSSrm
; CHECK: %5 = VFMADD213SSr %1, killed %3, %4
; CHECK: %6 = VMOVSSrm
; CHECK: %7 = VMULSSrr %1, %6
; CHECK: %8 = VMULSSrr killed %7, killed %5
; CHECK: %9 = VMULSSrr %0, %8
; CHECK: %10 = VFMADD213SSr %8, killed %9, %4
; CHECK: %11 = VMULSSrr %8, %6
; CHECK: %12 = VMULSSrr killed %11, killed %10
; CHECK: %xmm0 = COPY %12
; CHECK: RET 0, %xmm0
%sqrt = tail call float @llvm.sqrt.f32(float %f)
%div = fdiv fast float 1.0, %sqrt
ret float %div
}
attributes #0 = { "unsafe-fp-math"="true" "reciprocal-estimates"="sqrt:2" }
attributes #1 = { nounwind readnone }