use update_llc_test_checks.py to tighten checking

test features, not CPUs

remove unnecessary cruft


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234622 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel 2015-04-10 18:31:42 +00:00
parent e37b898edb
commit dc0ca89635

View File

@ -1,132 +1,141 @@
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=core2 | FileCheck %s ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=sse2 | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=btver2 | FileCheck %s --check-prefix=BTVER2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx,use-sqrt-est | FileCheck %s --check-prefix=ESTIMATE
; generated using "clang -S -O2 -ffast-math -emit-llvm sqrt.c" from declare double @__sqrt_finite(double) #0
; #include <math.h> declare float @__sqrtf_finite(float) #0
; declare x86_fp80 @__sqrtl_finite(x86_fp80) #0
; double fd(double d){ declare float @llvm.sqrt.f32(float) #0
; return sqrt(d); declare <4 x float> @llvm.sqrt.v4f32(<4 x float>) #0
; } declare <8 x float> @llvm.sqrt.v8f32(<8 x float>) #0
;
; float ff(float f){
; return sqrtf(f);
; }
;
; long double fld(long double ld){
; return sqrtl(ld);
; }
;
; Tests conversion of sqrt function calls into sqrt instructions when
; -ffast-math is in effect.
; ModuleID = 'sqrt.c'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind readnone uwtable
define double @fd(double %d) #0 { define double @fd(double %d) #0 {
entry: ; CHECK-LABEL: fd:
; CHECK: sqrtsd ; CHECK: # BB#0:
%call = tail call double @__sqrt_finite(double %d) #2 ; CHECK-NEXT: sqrtsd %xmm0, %xmm0
; CHECK-NEXT: retq
;
; ESTIMATE-LABEL: fd:
; ESTIMATE: # BB#0:
; ESTIMATE-NEXT: vsqrtsd %xmm0, %xmm0, %xmm0
; ESTIMATE-NEXT: retq
%call = tail call double @__sqrt_finite(double %d) #1
ret double %call ret double %call
} }
; Function Attrs: nounwind readnone
declare double @__sqrt_finite(double) #1
; Function Attrs: nounwind readnone uwtable
define float @ff(float %f) #0 { define float @ff(float %f) #0 {
entry: ; CHECK-LABEL: ff:
; CHECK: sqrtss ; CHECK: # BB#0:
%call = tail call float @__sqrtf_finite(float %f) #2 ; CHECK-NEXT: sqrtss %xmm0, %xmm0
; CHECK-NEXT: retq
;
; ESTIMATE-LABEL: ff:
; ESTIMATE: # BB#0:
; ESTIMATE-NEXT: vrsqrtss %xmm0, %xmm0, %xmm1
; ESTIMATE-NEXT: vmulss {{.*}}(%rip), %xmm1, %xmm2
; ESTIMATE-NEXT: vmulss %xmm1, %xmm1, %xmm1
; ESTIMATE-NEXT: vmulss %xmm0, %xmm1, %xmm1
; ESTIMATE-NEXT: vaddss {{.*}}(%rip), %xmm1, %xmm1
; ESTIMATE-NEXT: vmulss %xmm2, %xmm1, %xmm1
; ESTIMATE-NEXT: vmulss %xmm1, %xmm0, %xmm1
; ESTIMATE-NEXT: vxorps %xmm2, %xmm2, %xmm2
; ESTIMATE-NEXT: vcmpeqss %xmm2, %xmm0, %xmm0
; ESTIMATE-NEXT: vandnps %xmm1, %xmm0, %xmm0
; ESTIMATE-NEXT: retq
%call = tail call float @__sqrtf_finite(float %f) #1
ret float %call ret float %call
} }
; Function Attrs: nounwind readnone
declare float @__sqrtf_finite(float) #1
; Function Attrs: nounwind readnone uwtable
define x86_fp80 @fld(x86_fp80 %ld) #0 { define x86_fp80 @fld(x86_fp80 %ld) #0 {
entry: ; CHECK-LABEL: fld:
; CHECK: fsqrt ; CHECK: # BB#0:
%call = tail call x86_fp80 @__sqrtl_finite(x86_fp80 %ld) #2 ; CHECK-NEXT: fldt {{[0-9]+}}(%rsp)
; CHECK-NEXT: fsqrt
; CHECK-NEXT: retq
;
; ESTIMATE-LABEL: fld:
; ESTIMATE: # BB#0:
; ESTIMATE-NEXT: fldt {{[0-9]+}}(%rsp)
; ESTIMATE-NEXT: fsqrt
; ESTIMATE-NEXT: retq
%call = tail call x86_fp80 @__sqrtl_finite(x86_fp80 %ld) #1
ret x86_fp80 %call ret x86_fp80 %call
} }
declare x86_fp80 @__sqrtl_finite(x86_fp80) #1
declare float @llvm.sqrt.f32(float) #1
declare <4 x float> @llvm.sqrt.v4f32(<4 x float>) #1
declare <8 x float> @llvm.sqrt.v8f32(<8 x float>) #1
; If the target's sqrtss and divss instructions are substantially
; slower than rsqrtss with a Newton-Raphson refinement, we should
; generate the estimate sequence.
define float @reciprocal_square_root(float %x) #0 { define float @reciprocal_square_root(float %x) #0 {
; CHECK-LABEL: reciprocal_square_root:
; CHECK: # BB#0:
; CHECK-NEXT: sqrtss %xmm0, %xmm1
; CHECK-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; CHECK-NEXT: divss %xmm1, %xmm0
; CHECK-NEXT: retq
;
; ESTIMATE-LABEL: reciprocal_square_root:
; ESTIMATE: # BB#0:
; ESTIMATE-NEXT: vrsqrtss %xmm0, %xmm0, %xmm1
; ESTIMATE-NEXT: vmulss {{.*}}(%rip), %xmm1, %xmm2
; ESTIMATE-NEXT: vmulss %xmm1, %xmm1, %xmm1
; ESTIMATE-NEXT: vmulss %xmm0, %xmm1, %xmm0
; ESTIMATE-NEXT: vaddss {{.*}}(%rip), %xmm0, %xmm0
; ESTIMATE-NEXT: vmulss %xmm2, %xmm0, %xmm0
; ESTIMATE-NEXT: retq
%sqrt = tail call float @llvm.sqrt.f32(float %x) %sqrt = tail call float @llvm.sqrt.f32(float %x)
%div = fdiv fast float 1.0, %sqrt %div = fdiv fast float 1.0, %sqrt
ret float %div ret float %div
; CHECK-LABEL: reciprocal_square_root:
; CHECK: sqrtss
; CHECK-NEXT: movss
; CHECK-NEXT: divss
; CHECK-NEXT: retq
; BTVER2-LABEL: reciprocal_square_root:
; BTVER2: vrsqrtss
; BTVER2-NEXT: vmulss
; BTVER2-NEXT: vmulss
; BTVER2-NEXT: vmulss
; BTVER2-NEXT: vaddss
; BTVER2-NEXT: vmulss
; BTVER2-NEXT: retq
} }
define <4 x float> @reciprocal_square_root_v4f32(<4 x float> %x) #0 { define <4 x float> @reciprocal_square_root_v4f32(<4 x float> %x) #0 {
; CHECK-LABEL: reciprocal_square_root_v4f32:
; CHECK: # BB#0:
; CHECK-NEXT: sqrtps %xmm0, %xmm1
; CHECK-NEXT: movaps {{.*#+}} xmm0 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
; CHECK-NEXT: divps %xmm1, %xmm0
; CHECK-NEXT: retq
;
; ESTIMATE-LABEL: reciprocal_square_root_v4f32:
; ESTIMATE: # BB#0:
; ESTIMATE-NEXT: vrsqrtps %xmm0, %xmm1
; ESTIMATE-NEXT: vmulps %xmm1, %xmm1, %xmm2
; ESTIMATE-NEXT: vmulps %xmm0, %xmm2, %xmm0
; ESTIMATE-NEXT: vaddps {{.*}}(%rip), %xmm0, %xmm0
; ESTIMATE-NEXT: vmulps {{.*}}(%rip), %xmm1, %xmm1
; ESTIMATE-NEXT: vmulps %xmm1, %xmm0, %xmm0
; ESTIMATE-NEXT: retq
%sqrt = tail call <4 x float> @llvm.sqrt.v4f32(<4 x float> %x) %sqrt = tail call <4 x float> @llvm.sqrt.v4f32(<4 x float> %x)
%div = fdiv fast <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>, %sqrt %div = fdiv fast <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>, %sqrt
ret <4 x float> %div ret <4 x float> %div
; CHECK-LABEL: reciprocal_square_root_v4f32:
; CHECK: sqrtps
; CHECK-NEXT: movaps
; CHECK-NEXT: divps
; CHECK-NEXT: retq
; BTVER2-LABEL: reciprocal_square_root_v4f32:
; BTVER2: vrsqrtps
; BTVER2-NEXT: vmulps
; BTVER2-NEXT: vmulps
; BTVER2-NEXT: vmulps
; BTVER2-NEXT: vaddps
; BTVER2-NEXT: vmulps
; BTVER2-NEXT: retq
} }
define <8 x float> @reciprocal_square_root_v8f32(<8 x float> %x) #0 { define <8 x float> @reciprocal_square_root_v8f32(<8 x float> %x) #0 {
; CHECK-LABEL: reciprocal_square_root_v8f32:
; CHECK: # BB#0:
; CHECK-NEXT: sqrtps %xmm1, %xmm2
; CHECK-NEXT: sqrtps %xmm0, %xmm3
; CHECK-NEXT: movaps {{.*#+}} xmm1 = [1.000000e+00,1.000000e+00,1.000000e+00,1.000000e+00]
; CHECK-NEXT: movaps %xmm1, %xmm0
; CHECK-NEXT: divps %xmm3, %xmm0
; CHECK-NEXT: divps %xmm2, %xmm1
; CHECK-NEXT: retq
;
; ESTIMATE-LABEL: reciprocal_square_root_v8f32:
; ESTIMATE: # BB#0:
; ESTIMATE-NEXT: vrsqrtps %ymm0, %ymm1
; ESTIMATE-NEXT: vmulps %ymm1, %ymm1, %ymm2
; ESTIMATE-NEXT: vmulps %ymm0, %ymm2, %ymm0
; ESTIMATE-NEXT: vaddps {{.*}}(%rip), %ymm0, %ymm0
; ESTIMATE-NEXT: vmulps {{.*}}(%rip), %ymm1, %ymm1
; ESTIMATE-NEXT: vmulps %ymm1, %ymm0, %ymm0
; ESTIMATE-NEXT: retq
%sqrt = tail call <8 x float> @llvm.sqrt.v8f32(<8 x float> %x) %sqrt = tail call <8 x float> @llvm.sqrt.v8f32(<8 x float> %x)
%div = fdiv fast <8 x float> <float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0>, %sqrt %div = fdiv fast <8 x float> <float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0>, %sqrt
ret <8 x float> %div ret <8 x float> %div
; CHECK-LABEL: reciprocal_square_root_v8f32:
; CHECK: sqrtps
; CHECK-NEXT: sqrtps
; CHECK-NEXT: movaps
; CHECK-NEXT: movaps
; CHECK-NEXT: divps
; CHECK-NEXT: divps
; CHECK-NEXT: retq
; BTVER2-LABEL: reciprocal_square_root_v8f32:
; BTVER2: vrsqrtps
; BTVER2-NEXT: vmulps
; BTVER2-NEXT: vmulps
; BTVER2-NEXT: vmulps
; BTVER2-NEXT: vaddps
; BTVER2-NEXT: vmulps
; BTVER2-NEXT: retq
} }
attributes #0 = { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" "use-soft-float"="false" } attributes #0 = { "unsafe-fp-math"="true" }
attributes #1 = { nounwind readnone "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" "use-soft-float"="false" } attributes #1 = { nounwind readnone }
attributes #2 = { nounwind readnone }