1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Check that the condition register is restored properly during unwinding
10 // on AIX. Option -O3 is required so that the compiler will re-use the value
11 // in the condition register instead of re-evaluating the condition expression.
13 // REQUIRES: target=powerpc{{(64)?}}-ibm-aix
14 // ADDITIONAL_COMPILE_FLAGS: -O3
15 // UNSUPPORTED: no-exceptions
20 int __attribute__((noinline
)) test2(int i
) {
21 // The inline assembly forces the prologue/epilogue to save/restore the
22 // condition register.
23 asm volatile("nop" : : : "cr2");
31 void __attribute__((noinline
)) test(int argc
, const char **argv
) {
32 int a
= atoi(argv
[1]);
33 int b
= atoi(argv
[2]);
35 test2(a
< b
? argc
: b
);
40 int main(int, char**) {
41 const char *av
[]={"a.out", "12", "10"};