Files
clang-p2996/llvm/test/CodeGen/PowerPC/inline-asm-clobber-warning.ll
Quinn Pham 6a028296fe [PowerPC] Emit warning when SP is clobbered by asm
This patch emits a warning when the stack pointer register (`R1`) is found in
the clobber list of an inline asm statement. Clobbering the stack pointer is
not supported.

Reviewed By: #powerpc, nemanjai

Differential Revision: https://reviews.llvm.org/D112073
2022-01-24 15:12:23 -06:00

23 lines
890 B
LLVM

; RUN: llc < %s -verify-machineinstrs -mtriple=powerpc-unknown-unkown \
; RUN: -mcpu=pwr7 2>&1 | FileCheck %s
; RUN: llc < %s -verify-machineinstrs -mtriple=powerpc64-unknown-unkown \
; RUN: -mcpu=pwr7 2>&1 | FileCheck %s
define void @test_r1_clobber() {
entry:
call void asm sideeffect "nop", "~{r1}"()
ret void
}
; CHECK: warning: inline asm clobber list contains reserved registers: R1
; CHECK-NEXT: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
define void @test_x1_clobber() {
entry:
call void asm sideeffect "nop", "~{x1}"()
ret void
}
; CHECK: warning: inline asm clobber list contains reserved registers: X1
; CHECK-NEXT: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.