[InstCombine] Preserve NSW flags for `lshr (mul nuw X, C1), C2 -> mul nuw nsw X,...
[llvm-project.git] / clang / test / AST / arithmetic-fence-builtin.c
blobacdefade0748a258a8184d06cbb3c53dda68a621
1 // Tests without serialization:
2 // RUN: %clang_cc1 -ast-dump -triple i386-pc-linux-gnu %s \
3 // RUN: | FileCheck %s --strict-whitespace --check-prefixes=CHECK,CHECK1
4 //
5 // RUN: %clang_cc1 -ast-dump -triple aarch64-unknown-linux-gnu %s \
6 // RUN: | FileCheck %s --strict-whitespace --check-prefixes=CHECK,CHECK1
7 //
8 // RUN: %clang_cc1 -ast-dump -triple i386-pc-linux-gnu -DFAST -mreassociate %s \
9 // RUN: | FileCheck %s --strict-whitespace --check-prefixes=CHECK,CHECK1
11 // RUN: %clang_cc1 -ast-dump -triple aarch64-unknown-linux-gnu -DFAST -mreassociate %s \
12 // RUN: | FileCheck %s --strict-whitespace --check-prefixes=CHECK,CHECK1
14 // RUN: %clang_cc1 -ast-dump -triple i386-pc-linux-gnu -DFAST -mreassociate %s \
15 // RUN: -fprotect-parens \
16 // RUN: | FileCheck %s --strict-whitespace --check-prefixes=CHECK,CHECK2
18 // RUN: %clang_cc1 -ast-dump -triple aarch64-unknown-linux-gnu -DFAST -mreassociate %s \
19 // RUN: -fprotect-parens \
20 // RUN: | FileCheck %s --strict-whitespace --check-prefixes=CHECK,CHECK2
22 // Tests with serialization:
23 // RUN: %clang_cc1 -ast-dump -triple i386-pc-linux-gnu -emit-pch -o %t %s
24 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -include-pch %t -ast-dump-all /dev/null \
25 // RUN: | FileCheck %s --strict-whitespace
27 // RUN: %clang_cc1 -ast-dump -triple aarch64-unknown-linux-gnu -emit-pch -o %t %s
28 // RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -include-pch %t -ast-dump-all /dev/null \
29 // RUN: | FileCheck %s --strict-whitespace
31 // RUN: %clang_cc1 -ast-dump -triple i386-pc-linux-gnu -DFAST -mreassociate %s \
32 // RUN: -emit-pch -o %t
33 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -include-pch %t -ast-dump-all /dev/null \
34 // RUN: | FileCheck %s --strict-whitespace --check-prefixes=CHECK,CHECK1
36 // RUN: %clang_cc1 -ast-dump -triple aarch64-unknown-linux-gnu -DFAST -mreassociate %s \
37 // RUN: -emit-pch -o %t
38 // RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -include-pch %t -ast-dump-all /dev/null \
39 // RUN: | FileCheck %s --strict-whitespace --check-prefixes=CHECK,CHECK1
41 // RUN: %clang_cc1 -ast-dump -triple i386-pc-linux-gnu -DFAST -mreassociate %s \
42 // RUN: -fprotect-parens \
43 // RUN: -emit-pch -o %t
44 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -include-pch %t -ast-dump-all /dev/null -fprotect-parens\
45 // RUN: | FileCheck %s --strict-whitespace --check-prefixes=CHECK,CHECK2
47 // RUN: %clang_cc1 -ast-dump -triple aarch64-unknown-linux-gnu -DFAST -mreassociate %s \
48 // RUN: -fprotect-parens \
49 // RUN: -emit-pch -o %t
50 // RUN: %clang_cc1 -triple aarch64-unknown-linux-gnu -include-pch %t -ast-dump-all /dev/null -fprotect-parens\
51 // RUN: | FileCheck %s --strict-whitespace --check-prefixes=CHECK,CHECK2
53 int v;
54 int addit(float a, float b) {
56 v = __arithmetic_fence(a + b);
58 v = (a + b);
60 return 0;
62 //CHECK:| `-CompoundStmt {{.*}}
63 //CHECK-NEXT:| |-BinaryOperator {{.*}} 'int' '='
64 //CHECK-NEXT:| | |-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'v' 'int'
65 //CHECK-NEXT:| | `-ImplicitCastExpr {{.*}}
66 //CHECK-NEXT:| | `-CallExpr {{.*}} 'float'
67 //CHECK-NEXT:| | |-ImplicitCastExpr {{.*}}
68 //CHECK-NEXT:| | | `-DeclRefExpr {{.*}}' Function {{.*}} '__arithmetic_fence'{{.*}}
69 //CHECK1-NOT:| | | `-DeclRefExpr {{.*}}' Function{{.*}} '__arithmetic_fence' 'void ()'
70 //CHECK2:| | | `-DeclRefExpr {{.*}} Function{{.*}} '__arithmetic_fence' 'void ()'