• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -O1 -mcpu=atom -mtriple=i686-linux  | FileCheck %s
2
3declare void @external_function(...)
4
5define i32 @test_return_val(i32 %a) nounwind {
6; CHECK: test_return_val
7; CHECK: movl
8; CHECK: nop
9; CHECK: nop
10; CHECK: nop
11; CHECK: nop
12; CHECK: nop
13; CHECK: nop
14; CHECK: ret
15  ret i32 %a
16}
17
18define i32 @test_optsize(i32 %a) nounwind optsize {
19; CHECK: test_optsize
20; CHECK: movl
21; CHECK-NEXT: ret
22  ret i32 %a
23}
24
25define i32 @test_minsize(i32 %a) nounwind minsize {
26; CHECK: test_minsize
27; CHECK: movl
28; CHECK-NEXT: ret
29  ret i32 %a
30}
31
32define i32 @test_add(i32 %a, i32 %b) nounwind {
33; CHECK: test_add
34; CHECK: addl
35; CHECK: nop
36; CHECK: nop
37; CHECK: nop
38; CHECK: nop
39; CHECK: ret
40  %result = add i32 %a, %b
41  ret i32 %result
42}
43
44define i32 @test_multiple_ret(i32 %a, i32 %b, i1 %c) nounwind {
45; CHECK: @test_multiple_ret
46; CHECK: je
47
48; CHECK: nop
49; CHECK: nop
50; CHECK: ret
51
52; CHECK: nop
53; CHECK: nop
54; CHECK: ret
55
56  br i1 %c, label %bb1, label %bb2
57
58bb1:
59  ret i32 %a
60
61bb2:
62  ret i32 %b
63}
64
65define void @test_call_others(i32 %x) nounwind
66{
67; CHECK: test_call_others
68; CHECK: je
69  %tobool = icmp eq i32 %x, 0
70  br i1 %tobool, label %if.end, label %true.case
71
72; CHECK: jmp external_function
73true.case:
74  tail call void bitcast (void (...)* @external_function to void ()*)() nounwind
75  br label %if.end
76
77; CHECK: nop
78; CHECK: nop
79; CHECK: nop
80; CHECK: nop
81; CHECK: ret
82if.end:
83  ret void
84
85}
86
87define void @test_branch_to_same_bb(i32 %x, i32 %y) nounwind {
88; CHECK: @test_branch_to_same_bb
89  %cmp = icmp sgt i32 %x, 0
90  br i1 %cmp, label %while.cond, label %while.end
91
92while.cond:
93  br label %while.cond
94
95; CHECK: nop
96; CHECK: nop
97; CHECK: nop
98; CHECK: nop
99; CHECK: ret
100while.end:
101  ret void
102}
103
104