Skip to content

Commit 74dd400

Browse files
committed
FileCheckize a couple of tests.
Also and add a test for popping dead return values and avoid testing the spill precision. llvm-svn: 133997
1 parent 526605d commit 74dd400

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

llvm/test/CodeGen/X86/fp-stack-ret.ll

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
1-
; RUN: llc < %s -mtriple=i686-apple-darwin8 -mcpu=yonah -march=x86 > %t
2-
; RUN: grep fldl %t | count 1
3-
; RUN: not grep xmm %t
4-
; RUN: grep {sub.*esp} %t | count 1
1+
; RUN: llc < %s -mtriple=i686-apple-darwin8 -mcpu=yonah -march=x86 | FileCheck %s
52

63
; These testcases shouldn't require loading into an XMM register then storing
74
; to memory, then reloading into an FPStack reg.
85

6+
; CHECK: test1
7+
; CHECK: fldl
8+
; CHECK-NEXT: ret
99
define double @test1(double *%P) {
1010
%A = load double* %P
1111
ret double %A
1212
}
1313

14-
; fastcc should return a value
14+
; fastcc should return a value
15+
; CHECK: test2
16+
; CHECK-NOT: xmm
17+
; CHECK: ret
1518
define fastcc double @test2(<2 x double> %A) {
1619
%B = extractelement <2 x double> %A, i32 0
1720
ret double %B
1821
}
1922

23+
; CHECK: test3
24+
; CHECK: sub{{.*}}%esp
25+
; CHECLK-NOT: xmm
2026
define fastcc double @test3(<4 x float> %A) {
2127
%B = bitcast <4 x float> %A to <2 x double>
2228
%C = call fastcc double @test2(<2 x double> %B)
2329
ret double %C
2430
}
25-
31+
32+
; Clear the stack when not using a return value.
33+
; CHECK: test4
34+
; CHECK: call
35+
; CHECK: fstp
36+
; CHECK: ret
37+
define void @test4(double *%P) {
38+
%A = call double @test1(double *%P)
39+
ret void
40+
}

llvm/test/CodeGen/X86/pr1505b.ll

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
; RUN: llc < %s -mcpu=i486 | grep fstpl | count 5
2-
; RUN: llc < %s -mcpu=i486 | grep fstps | count 2
1+
; RUN: llc < %s -mcpu=i486 | FileCheck %s
32
; PR1505
43

54
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
@@ -30,19 +29,41 @@ declare void @_ZNSt8ios_base4InitC1Ev(%"struct.std::ctype_base"*)
3029

3130
declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*)
3231

32+
; CHECK: main
3333
define i32 @main() {
3434
entry:
35+
; CHECK: flds
3536
%tmp6 = volatile load float* @a ; <float> [#uses=1]
37+
; CHECK: fstps (%esp)
38+
; CHECK: tanf
3639
%tmp9 = tail call float @tanf( float %tmp6 ) ; <float> [#uses=1]
40+
; Spill returned value:
41+
; CHECK: fstp
42+
43+
; CHECK: fldl
3744
%tmp12 = volatile load double* @b ; <double> [#uses=1]
45+
; CHECK: fstpl (%esp)
46+
; CHECK: tan
3847
%tmp13 = tail call double @tan( double %tmp12 ) ; <double> [#uses=1]
48+
; Spill returned value:
49+
; CHECK: fstp
3950
%tmp1314 = fptrunc double %tmp13 to float ; <float> [#uses=1]
4051
%tmp16 = tail call %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc( %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZSt4cout, i8* getelementptr ([12 x i8]* @.str, i32 0, i32 0) ) ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=1]
4152
%tmp1920 = fpext float %tmp9 to double ; <double> [#uses=1]
53+
; reload:
54+
; CHECK: fld
55+
; CHECK: fstpl
56+
; CHECK: ZNSolsEd
4257
%tmp22 = tail call %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZNSolsEd( %"struct.std::basic_ostream<char,std::char_traits<char> >"* %tmp16, double %tmp1920 ) ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=1]
4358
%tmp30 = tail call %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_( %"struct.std::basic_ostream<char,std::char_traits<char> >"* %tmp22 ) ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=0]
59+
; reload:
60+
; CHECK: fld
61+
; CHECK: fstps
62+
; CHECK: ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
4463
%tmp34 = tail call %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc( %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZSt4cout, i8* getelementptr ([13 x i8]* @.str1, i32 0, i32 0) ) ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=1]
4564
%tmp3940 = fpext float %tmp1314 to double ; <double> [#uses=1]
65+
; CHECK: fstpl
66+
; CHECK: ZNSolsEd
4667
%tmp42 = tail call %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZNSolsEd( %"struct.std::basic_ostream<char,std::char_traits<char> >"* %tmp34, double %tmp3940 ) ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=1]
4768
%tmp51 = tail call %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_( %"struct.std::basic_ostream<char,std::char_traits<char> >"* %tmp42 ) ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=0]
4869
ret i32 0

0 commit comments

Comments
 (0)