[llvm] [Xtensa] Add basic support for inline asm constraints. (PR #108986)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 17 23:18:12 PDT 2024
================
@@ -0,0 +1,29 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
+; RUN: llc -mtriple=xtensa -verify-machineinstrs < %s \
+; RUN: | FileCheck -check-prefix=XTENSA %s
+
+ at gi = external global i32
+
+define i32 @constraint_r(i32 %a) {
+; XTENSA-LABEL: constraint_r:
+; XTENSA: l32r a8, .LCPI0_0
+; XTENSA-NEXT: l32i a8, a8, 0
+; XTENSA-NEXT: #APP
+; XTENSA-NEXT: add a2, a2, a8
+; XTENSA-NEXT: #NO_APP
+; XTENSA-NEXT: ret
+ %1 = load i32, i32* @gi
+ %2 = tail call i32 asm "add $0, $1, $2", "=r,r,r"(i32 %a, i32 %1)
+ ret i32 %2
+}
+
----------------
arsenm wrote:
Also test an unrecognized constraint code for an error
https://github.com/llvm/llvm-project/pull/108986
More information about the llvm-commits
mailing list