1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/RISCV/inline-asm-invalid.ll
Bill Wendling fa94d17420 Emit diagnostic if an inline asm constraint requires an immediate
Summary:
An inline asm call can result in an immediate after inlining. Therefore emit a
diagnostic here if constraint requires an immediate but one isn't supplied.

Reviewers: joerg, mgorny, efriedma, rsmith

Reviewed By: joerg

Subscribers: asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, s.egerton, MaskRay, jyknight, dylanmckay, javed.absar, fedor.sergeev, jrtc27, Jim, krytarowski, eraman, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60942

llvm-svn: 367750
2019-08-03 05:52:47 +00:00

33 lines
1.1 KiB
LLVM

; RUN: not llc -mtriple=riscv32 < %s 2>&1 | FileCheck %s
; RUN: not llc -mtriple=riscv64 < %s 2>&1 | FileCheck %s
define void @constraint_I() {
; CHECK: error: value out of range for constraint 'I'
tail call void asm sideeffect "addi a0, a0, $0", "I"(i32 2048)
; CHECK: error: value out of range for constraint 'I'
tail call void asm sideeffect "addi a0, a0, $0", "I"(i32 -2049)
ret void
}
define void @constraint_J() {
; CHECK: error: value out of range for constraint 'J'
tail call void asm sideeffect "addi a0, a0, $0", "J"(i32 1)
ret void
}
define void @constraint_K() {
; CHECK: error: value out of range for constraint 'K'
tail call void asm sideeffect "csrwi mstatus, $0", "K"(i32 32)
; CHECK: error: value out of range for constraint 'K'
tail call void asm sideeffect "csrwi mstatus, $0", "K"(i32 -1)
ret void
}
define void @constraint_f() nounwind {
; CHECK: error: couldn't allocate input reg for constraint 'f'
tail call void asm "fadd.s fa0, fa0, $0", "f"(float 0.0)
; CHECK: error: couldn't allocate input reg for constraint 'f'
tail call void asm "fadd.d fa0, fa0, $0", "f"(double 0.0)
ret void
}