2019-06-11 20:52:05 +08:00
|
|
|
; RUN: not llc -mtriple=riscv32 < %s 2>&1 | FileCheck %s
|
|
|
|
; RUN: not llc -mtriple=riscv64 < %s 2>&1 | FileCheck %s
|
|
|
|
|
|
|
|
define void @constraint_I() {
|
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 13:52:47 +08:00
|
|
|
; CHECK: error: value out of range for constraint 'I'
|
2019-06-11 20:52:05 +08:00
|
|
|
tail call void asm sideeffect "addi a0, a0, $0", "I"(i32 2048)
|
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 13:52:47 +08:00
|
|
|
; CHECK: error: value out of range for constraint 'I'
|
2019-06-11 20:52:05 +08:00
|
|
|
tail call void asm sideeffect "addi a0, a0, $0", "I"(i32 -2049)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @constraint_J() {
|
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 13:52:47 +08:00
|
|
|
; CHECK: error: value out of range for constraint 'J'
|
2019-06-11 20:52:05 +08:00
|
|
|
tail call void asm sideeffect "addi a0, a0, $0", "J"(i32 1)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @constraint_K() {
|
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 13:52:47 +08:00
|
|
|
; CHECK: error: value out of range for constraint 'K'
|
2019-06-11 20:52:05 +08:00
|
|
|
tail call void asm sideeffect "csrwi mstatus, $0", "K"(i32 32)
|
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 13:52:47 +08:00
|
|
|
; CHECK: error: value out of range for constraint 'K'
|
2019-06-11 20:52:05 +08:00
|
|
|
tail call void asm sideeffect "csrwi mstatus, $0", "K"(i32 -1)
|
|
|
|
ret void
|
|
|
|
}
|
[RISCV] Support 'f' Inline Assembly Constraint
Summary:
This adds the 'f' inline assembly constraint, as supported by GCC. An
'f'-constrained operand is passed in a floating point register. Exactly
which kind of floating-point register (32-bit or 64-bit) is decided
based on the operand type and the available standard extensions (-f and
-d, respectively).
This patch adds support in both the clang frontend, and LLVM itself.
Reviewers: asb, lewis-revill
Reviewed By: asb
Subscribers: hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D65500
llvm-svn: 367403
2019-07-31 17:45:55 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|