aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/arm64-asm-diag.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/arm64-asm-diag.c')
-rw-r--r--test/CodeGen/arm64-asm-diag.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/CodeGen/arm64-asm-diag.c b/test/CodeGen/arm64-asm-diag.c
new file mode 100644
index 0000000000..49b248f6bd
--- /dev/null
+++ b/test/CodeGen/arm64-asm-diag.c
@@ -0,0 +1,24 @@
+// RUN: not %clang_cc1 -triple arm64 %s -S -o /dev/null 2>&1 | FileCheck %s
+
+// This test makes sure that we correctly recover after an error is identified
+// in inline asm during instruction selection.
+// It needs to be in Clang because the diagnostic handler that is used by llc
+// in LLVM's CodeGen tests exits after identifying an error, whereas the
+// diagnostic handler used by Clang keeps running and may trigger assertions
+// (see PR24071).
+// This test as well as arm-asm-diag.c can be moved back into LLVM if llc is
+// updated to use a different diagnostic handler, that tries to catch as many
+// errors as possible without exiting.
+int foo(long int a, long int b){
+ const long int c = 32 - b;
+
+ long int r;
+ asm("lsl %[o],%[s],%[a]"
+ : [o] "=r" (r)
+ : [s] "r" (a),
+ [a] "n" (c));
+
+ return r;
+}
+
+// CHECK: error: invalid operand for inline asm constraint 'n'