2019-06-19 08:25:39 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx2,fma -stop-after=finalize-isel 2>&1 | FileCheck %s
|
2016-06-17 00:58:54 +08:00
|
|
|
|
|
|
|
declare float @llvm.sqrt.f32(float) #0
|
|
|
|
|
|
|
|
define float @foo(float %f) #0 {
|
|
|
|
; CHECK: {{name: *foo}}
|
|
|
|
; CHECK: body:
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: %0:fr32 = COPY $xmm0
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: %1:fr32 = VRSQRTSSr killed %2, %0
|
2018-06-07 02:47:55 +08:00
|
|
|
; CHECK: %3:fr32 = VMULSSrr %0, %1
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: %4:fr32 = VMOVSSrm
|
|
|
|
; CHECK: %5:fr32 = VFMADD213SSr %1, killed %3, %4
|
|
|
|
; CHECK: %6:fr32 = VMOVSSrm
|
2018-06-07 02:47:55 +08:00
|
|
|
; CHECK: %7:fr32 = VMULSSrr %1, %6
|
|
|
|
; CHECK: %8:fr32 = VMULSSrr killed %7, killed %5
|
|
|
|
; CHECK: %9:fr32 = VMULSSrr %0, %8
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: %10:fr32 = VFMADD213SSr %8, %9, %4
|
2018-06-07 02:47:55 +08:00
|
|
|
; CHECK: %11:fr32 = VMULSSrr %9, %6
|
|
|
|
; CHECK: %12:fr32 = VMULSSrr killed %11, killed %10
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: %14:fr32 = FsFLD0SS
|
|
|
|
; CHECK: %15:fr32 = VCMPSSrr %0, killed %14, 0
|
2019-06-10 08:41:07 +08:00
|
|
|
; CHECK: %17:vr128 = VPANDNrr killed %16, killed %13
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: $xmm0 = COPY %18
|
|
|
|
; CHECK: RET 0, $xmm0
|
2016-06-17 00:58:54 +08:00
|
|
|
%call = tail call float @llvm.sqrt.f32(float %f) #1
|
|
|
|
ret float %call
|
|
|
|
}
|
|
|
|
|
|
|
|
define float @rfoo(float %f) #0 {
|
|
|
|
; CHECK: {{name: *rfoo}}
|
|
|
|
; CHECK: body: |
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: %0:fr32 = COPY $xmm0
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: %1:fr32 = VRSQRTSSr killed %2, %0
|
2018-05-05 07:41:15 +08:00
|
|
|
; CHECK: %3:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr %0, %1
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: %4:fr32 = VMOVSSrm
|
2018-06-08 06:49:09 +08:00
|
|
|
; CHECK: %5:fr32 = nnan ninf nsz arcp contract afn reassoc VFMADD213SSr %1, killed %3, %4
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: %6:fr32 = VMOVSSrm
|
2018-05-05 07:41:15 +08:00
|
|
|
; CHECK: %7:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr %1, %6
|
|
|
|
; CHECK: %8:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr killed %7, killed %5
|
|
|
|
; CHECK: %9:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr %0, %8
|
2018-06-08 06:49:09 +08:00
|
|
|
; CHECK: %10:fr32 = nnan ninf nsz arcp contract afn reassoc VFMADD213SSr %8, killed %9, %4
|
2018-05-05 07:41:15 +08:00
|
|
|
; CHECK: %11:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr %8, %6
|
|
|
|
; CHECK: %12:fr32 = nnan ninf nsz arcp contract afn reassoc VMULSSrr killed %11, killed %10
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: $xmm0 = COPY %12
|
|
|
|
; CHECK: RET 0, $xmm0
|
2016-06-17 00:58:54 +08:00
|
|
|
%sqrt = tail call float @llvm.sqrt.f32(float %f)
|
|
|
|
%div = fdiv fast float 1.0, %sqrt
|
|
|
|
ret float %div
|
|
|
|
}
|
|
|
|
|
2016-10-05 04:46:43 +08:00
|
|
|
attributes #0 = { "unsafe-fp-math"="true" "reciprocal-estimates"="sqrt:2" }
|
2016-06-17 00:58:54 +08:00
|
|
|
attributes #1 = { nounwind readnone }
|