aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Li <sparse@chrisli.org>2010-06-17 17:19:01 -0700
committerChristopher Li <sparse@chrisli.org>2010-06-17 17:21:10 -0700
commita04808f22f9c14d258bdb7d4353492ff094a7413 (patch)
tree0c41e301d04bfe39ccbd26e71f19b35052eb7dff /validation
parentIgnore the may_alias GCC attribute (diff)
downloadsparse-a04808f22f9c14d258bdb7d4353492ff094a7413.tar.gz
sparse-a04808f22f9c14d258bdb7d4353492ff094a7413.tar.bz2
sparse-a04808f22f9c14d258bdb7d4353492ff094a7413.zip
Adding asm goto label test case
Provided by Jiri Slaby <jslaby@suse.cz> Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
-rw-r--r--validation/asm-goto-lables.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/validation/asm-goto-lables.c b/validation/asm-goto-lables.c
new file mode 100644
index 0000000..ac2bf2a
--- /dev/null
+++ b/validation/asm-goto-lables.c
@@ -0,0 +1,22 @@
+static inline int __static_cpu_has(unsigned char bit)
+{
+ asm goto("1: jmp %l[t_no]\n"
+ "2:\n"
+ ".section .altinstructions,\"a\"\n"
+ "\n"
+ "1b\n"
+ "0\n" /* no replacement */
+ " .byte %P0\n" /* feature bit */
+ " .byte 2b - 1b\n" /* source len */
+ " .byte 0\n" /* replacement len */
+ " .byte 0xff + 0 - (2b-1b)\n" /* padding */
+ ".previous\n"
+ : : "i" (bit) : : t_no, ble);
+ return 1;
+t_no:
+ return 0;
+}
+/*
+ * check-name: Asm with goto labels.
+ */
+