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
6 // REQUIRES: powerpc-registered-target
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
13 void test_r1_clobber() {
14 __asm__("nop":::"r1");
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");
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.
22 void test_1_clobber() {
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");
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.
31 void test_sp_clobber() {
32 __asm__("nop":::"sp");
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");
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.