From: Michael Beck Date: Fri, 19 Sep 2008 00:52:27 +0000 (+0000) Subject: add example for constant load replacementx X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=8c27f4c5448ce892ba3429714f7624bc3b05288a;p=libfirm add example for constant load replacementx [r22110] --- diff --git a/ir/be/test/const_load.c b/ir/be/test/const_load.c new file mode 100644 index 000000000..9ad98479e --- /dev/null +++ b/ir/be/test/const_load.c @@ -0,0 +1,21 @@ +static const int arr[] = { 1, 2, 3 }; + +static int func1(void) { + return arr[1]; +} + +static const struct X { int a, b[2]; } data[] = { {1,{2, 3}}, {4,{5, 6}} }; + +static int func2(void) { + return *data[1].b; +} + +static const int darr[][2] = { {1,2}, {2,3} }; + +static int func3(void) { + return darr[1][1]; +} + +int main(int argc, char *argv[]) { + return func1() + func2() + func3() != 10; +}