1 /// This test checks that the warning includes the location in the C source
2 /// file that contains the inline asm. Although this warning is emitted in llvm
3 /// it cannot be tested from IR as it does not have that location information at
4 /// that stage.
5
6 // REQUIRES: powerpc-registered-target
7
8 // RUN: %clang --target=powerpc-unknown-unknown -mcpu=pwr7 \
9 // RUN: -c %s -o /dev/null 2>&1 | FileCheck %s
10 // RUN: %clang --target=powerpc64-unknown-unknown -mcpu=pwr7 \
11 // RUN: -c %s -o /dev/null 2>&1 | FileCheck %s
12
test_r1_clobber()13 void test_r1_clobber() {
14 __asm__("nop":::"r1");
15 }
16
17 // CHECK: ppc-inline-asm-clobber-warning.c:14:11: warning: inline asm clobber list contains reserved registers: R1 [-Winline-asm]
18 // CHECK-NEXT: __asm__("nop":::"r1");
19 // CHECK-NEXT: ^
20 // CHECK-NEXT: ppc-inline-asm-clobber-warning.c:14:11: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
21
test_1_clobber()22 void test_1_clobber() {
23 __asm__("nop":::"1");
24 }
25
26 // CHECK: ppc-inline-asm-clobber-warning.c:23:11: warning: inline asm clobber list contains reserved registers: R1 [-Winline-asm]
27 // CHECK-NEXT: __asm__("nop":::"1");
28 // CHECK-NEXT: ^
29 // CHECK-NEXT: ppc-inline-asm-clobber-warning.c:23:11: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
30
test_sp_clobber()31 void test_sp_clobber() {
32 __asm__("nop":::"sp");
33 }
34
35 // CHECK: ppc-inline-asm-clobber-warning.c:32:11: warning: inline asm clobber list contains reserved registers: R1 [-Winline-asm]
36 // CHECK-NEXT: __asm__("nop":::"sp");
37 // CHECK-NEXT: ^
38 // CHECK-NEXT: ppc-inline-asm-clobber-warning.c:32:11: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
39