
This patch adds support for constraints `f`, `l`, `I`, `K` according to [1]. The remain constraints (`k`, `m`, `ZB`, `ZC`) will be added later as they are a little more complex than the others. f: A floating-point register (if available). l: A signed 16-bit constant. I: A signed 12-bit constant (for arithmetic instructions). K: An unsigned 12-bit constant (for logic instructions). For now, no need to support register alias (e.g. `$a0`) in llvm as clang will correctly decode the usage of register name aliases into their official names. And AFAIK, the not yet upstreamed `rustc` for LoongArch will always use official register names (e.g. `$r4`). [1] https://gcc.gnu.org/onlinedocs/gccint/Machine-Constraints.html Differential Revision: https://reviews.llvm.org/D134157
15 lines
562 B
LLVM
15 lines
562 B
LLVM
; RUN: not llc --mtriple=loongarch32 --mattr=+f,+d 2>&1 < %s | FileCheck %s
|
|
; RUN: not llc --mtriple=loongarch64 --mattr=+f,+d 2>&1 < %s | FileCheck %s
|
|
|
|
define double @non_exit_f32(double %a) nounwind {
|
|
; CHECK: error: couldn't allocate input reg for constraint '{$f32}'
|
|
%1 = tail call double asm "fabs.d $0, $1", "=f,{$f32}"(double %a)
|
|
ret double %1
|
|
}
|
|
|
|
define double @non_exit_foo(double %a) nounwind {
|
|
; CHECK: error: couldn't allocate input reg for constraint '{$foo}'
|
|
%1 = tail call double asm "fabs.d $0, $1", "=f,{$foo}"(double %a)
|
|
ret double %1
|
|
}
|