Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
1618465c
Commit
1618465c
authored
Aug 25, 2007
by
Matthias Braun
Browse files
more AM tests
[r15607]
parent
a4d170a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
ir/be/test/am_test3.c
0 → 100644
View file @
1618465c
int
arr
[
10
]
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
};
int
sum
(
int
c
)
{
int
i
,
res
=
0
;
for
(
i
=
0
;
i
<
c
;
++
i
)
{
res
+=
i
;
}
return
res
;
}
int
main
(
void
)
{
printf
(
"Sum: %d
\n
"
,
sum
(
10
));
return
0
;
}
ir/be/test/am_test4.c
0 → 100644
View file @
1618465c
char
c
;
int
f
(
int
x
,
int
y
)
{
return
x
+
y
*
8
;
}
int
f2
(
int
x
,
int
y
)
{
return
x
*
2
+
y
*
8
;
}
int
f3
(
int
x
)
{
return
x
*
2
;
}
char
f4
(
char
*
p
,
int
k
)
{
return
p
[
k
];
}
void
dest_am
(
int
*
arr
,
int
from
,
int
to
)
{
int
i
;
for
(
i
=
from
+
1
;
i
<
to
;
++
i
)
{
arr
[
i
]
+=
arr
[
i
-
1
];
}
}
void
dest_am2
(
int
*
arr
,
int
from
,
int
to
)
{
int
i
;
for
(
i
=
from
+
1
;
i
<
to
;
++
i
)
{
arr
[
i
]
=
-
arr
[
i
];
}
}
int
main
(
void
)
{
int
arr
[]
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
};
int
i
;
dest_am
(
arr
,
0
,
10
);
for
(
i
=
0
;
i
<
10
;
++
i
)
{
printf
(
"%d "
,
arr
[
i
]);
}
printf
(
"
\n
"
);
dest_am2
(
arr
,
0
,
10
);
for
(
i
=
0
;
i
<
10
;
++
i
)
{
printf
(
"%d "
,
arr
[
i
]);
}
printf
(
"
\n
"
);
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment