2010-04-03 06:29:38 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm -o - %s | grep "ret i32 2520"
|
2008-08-05 00:51:22 +08:00
|
|
|
|
|
|
|
static int foo(unsigned i) {
|
2009-10-29 09:20:34 +08:00
|
|
|
void *addrs[] = { &&L1, &&L2, &&L3, &&L4, &&L5 };
|
2008-08-05 00:51:22 +08:00
|
|
|
int res = 1;
|
|
|
|
|
|
|
|
goto *addrs[i];
|
|
|
|
L5: res *= 11;
|
|
|
|
L4: res *= 7;
|
|
|
|
L3: res *= 5;
|
|
|
|
L2: res *= 3;
|
|
|
|
L1: res *= 2;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2009-10-29 09:20:34 +08:00
|
|
|
static int foo2(unsigned i) {
|
|
|
|
static const void *addrs[] = { &&L1, &&L2, &&L3, &&L4, &&L5 };
|
|
|
|
int res = 1;
|
|
|
|
|
|
|
|
goto *addrs[i];
|
|
|
|
L5: res *= 11;
|
|
|
|
L4: res *= 7;
|
|
|
|
L3: res *= 5;
|
|
|
|
L2: res *= 3;
|
|
|
|
L1: res *= 2;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2009-10-29 13:25:27 +08:00
|
|
|
int main() {
|
2009-10-29 09:20:34 +08:00
|
|
|
return foo(3)+foo2(4);
|
2008-08-05 00:51:22 +08:00
|
|
|
}
|