2014-07-01 13:10:06 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-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) {
|
2014-07-04 03:30:33 +08:00
|
|
|
static const void *addrs[] = { &&L1, &&L2, &&L3, &&L4, &&L5 };
|
2009-10-29 09:20:34 +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;
|
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
int main(void) {
|
2009-10-29 09:20:34 +08:00
|
|
|
return foo(3)+foo2(4);
|
2008-08-05 00:51:22 +08:00
|
|
|
}
|