blob: 10b2e1ee42a470bd6373700eb84d734d42770767 [file] [log] [blame]
Dale Johannesenf2c785e2008-08-28 01:51:09 +00001; RUN: llvm-as < %s | llc -fast-isel -march=x86 -mattr=sse2
Dan Gohmand3aedf42008-08-19 22:37:59 +00002
3; This tests very minimal fast-isel functionality.
4
Evan Cheng8b19e562008-09-03 06:44:39 +00005define i32* @foo(i32* %p, i32* %q, i32** %z) nounwind {
Dan Gohmand3aedf42008-08-19 22:37:59 +00006entry:
7 %r = load i32* %p
8 %s = load i32* %q
Dan Gohman7a0e6592008-08-21 17:25:26 +00009 %y = load i32** %z
Dan Gohmand3aedf42008-08-19 22:37:59 +000010 br label %fast
11
12fast:
Dan Gohmanbdedd442008-08-20 00:11:48 +000013 %t0 = add i32 %r, %s
14 %t1 = mul i32 %t0, %s
15 %t2 = sub i32 %t1, %s
16 %t3 = and i32 %t2, %s
17 %t4 = or i32 %t3, %s
18 %t5 = xor i32 %t4, %s
Dan Gohmand5fe57d2008-08-21 01:41:07 +000019 %t6 = add i32 %t5, 2
Dan Gohman7a0e6592008-08-21 17:25:26 +000020 %t7 = getelementptr i32* %y, i32 1
21 %t8 = getelementptr i32* %t7, i32 %t6
Dan Gohmand3aedf42008-08-19 22:37:59 +000022 br label %exit
23
24exit:
Dan Gohman7a0e6592008-08-21 17:25:26 +000025 ret i32* %t8
Dan Gohmand3aedf42008-08-19 22:37:59 +000026}
Dan Gohmanbdedd442008-08-20 00:11:48 +000027
Evan Cheng8b19e562008-09-03 06:44:39 +000028define double @bar(double* %p, double* %q) nounwind {
Dan Gohman8014e862008-08-20 00:23:20 +000029entry:
30 %r = load double* %p
31 %s = load double* %q
32 br label %fast
33
34fast:
35 %t0 = add double %r, %s
36 %t1 = mul double %t0, %s
37 %t2 = sub double %t1, %s
Dan Gohman10df0fa2008-08-27 01:09:54 +000038 %t3 = add double %t2, 707.0
Dan Gohman8014e862008-08-20 00:23:20 +000039 br label %exit
40
41exit:
Dan Gohman10df0fa2008-08-27 01:09:54 +000042 ret double %t3
Dan Gohman8014e862008-08-20 00:23:20 +000043}
44
Evan Cheng8b19e562008-09-03 06:44:39 +000045define i32 @cast() nounwind {
Owen Anderson6d0c25e2008-08-25 20:20:32 +000046entry:
47 %tmp2 = bitcast i32 0 to i32
48 ret i32 %tmp2
49}
Evan Cheng8b19e562008-09-03 06:44:39 +000050
51@src = external global i32
52
53define i32 @loadgv() nounwind {
54entry:
55 %0 = load i32* @src, align 4
56 ret i32 %0
57}