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