llvm-project/llvm/test/CodeGen/LoongArch/inline-asm-reg-names-f-error.ll
Weining Lu 394f30919a [Clang][LoongArch] Add inline asm support for constraints f/l/I/K
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
2022-09-26 08:49:58 +08:00

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
}