aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2016-05-11 13:28:15 +0300
committerDiana Picus <diana.picus@linaro.org>2016-05-11 17:06:13 +0300
commit3857eed4be8d6c300a3cb6ccc9ff1a23a2cfdff1 (patch)
treefd8751102a94a788021029215bbc213c8ac6b8a7
parent6ab64a90dfafe6edfd8cdaeb5c5c8f38cfa0cbe5 (diff)
Add test for PR24071linaro-local/PR24071
-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'