blob: 271ad1aad0ba91e616115569de5fe6bc0682e374 [file] [log] [blame]
Charles Davisde5c9572010-02-19 18:17:13 +00001; RUN: llc < %s -relocation-model=static -realign-stack=1 -mcpu=yonah | FileCheck %s
Chris Lattner1e3362f2008-01-26 19:45:50 +00002
3; The double argument is at 4(esp) which is 16-byte aligned, allowing us to
4; fold the load into the andpd.
5
6target 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-f80:128:128"
7target triple = "i686-apple-darwin8"
8@G = external global double
9
10define void @test({ double, double }* byval %z, double* %P) {
11entry:
12 %tmp = getelementptr { double, double }* %z, i32 0, i32 0 ; <double*> [#uses=1]
13 %tmp1 = load double* %tmp, align 8 ; <double> [#uses=1]
14 %tmp2 = tail call double @fabs( double %tmp1 ) ; <double> [#uses=1]
Charles Davisde5c9572010-02-19 18:17:13 +000015 ; CHECK: andpd{{.*}}4(%esp), %xmm
Chris Lattner1e3362f2008-01-26 19:45:50 +000016 %tmp3 = load double* @G, align 16 ; <double> [#uses=1]
17 %tmp4 = tail call double @fabs( double %tmp3 ) ; <double> [#uses=1]
Dan Gohman7ce405e2009-06-04 22:49:04 +000018 %tmp6 = fadd double %tmp4, %tmp2 ; <double> [#uses=1]
Chris Lattner1e3362f2008-01-26 19:45:50 +000019 store double %tmp6, double* %P, align 8
20 ret void
21}
22
Charles Davisde5c9572010-02-19 18:17:13 +000023define void @test2() alignstack(16) {
24entry:
25 ; CHECK: andl{{.*}}$-16, %esp
26 ret void
27}
28
29; Use a call to force a spill.
30define <2 x double> @test3(<2 x double> %x, <2 x double> %y) alignstack(32) {
31entry:
32 ; CHECK: andl{{.*}}$-32, %esp
33 call void @test2()
Dan Gohman1698c9b2010-05-03 22:36:46 +000034 %A = fmul <2 x double> %x, %y
Charles Davisde5c9572010-02-19 18:17:13 +000035 ret <2 x double> %A
36}
37
Chris Lattner1e3362f2008-01-26 19:45:50 +000038declare double @fabs(double)
Charles Davisde5c9572010-02-19 18:17:13 +000039