summaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2005-05-06 06:38:11 +0000
committerJan Beulich <jbeulich@novell.com>2005-05-06 06:38:11 +0000
commitb81d7e86b21cee7fc288f48bf9836712cc96717f (patch)
tree554ef016396cc0a152e1d6b2b83516bbcbe7a6fc /gas
parent8ca4eaf3632222f5cc0b9e61afd80b01d6390c7c (diff)
downloadbinutils-redhat-b81d7e86b21cee7fc288f48bf9836712cc96717f.tar.gz
gas/
2005-05-06 Jan Beulich <jbeulich@novell.com> * cond.c (s_ifb): New. * read.c (potable): Add s_ifb as handler for .ifb and .ifnb. * read.h (s_ifb): Prototype. * doc/as.texinfo: Document .ifb and .ifnb. gas/testsuite/ 2005-05-06 Jan Beulich <jbeulich@novell.com> * gas/all/cond.s: Also test .ifb/.ifnb. * gas/all/cond.d: Adjust.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/cond.c34
-rw-r--r--gas/doc/as.texinfo9
-rw-r--r--gas/read.c2
-rw-r--r--gas/read.h1
-rw-r--r--gas/testsuite/ChangeLog5
-rw-r--r--gas/testsuite/gas/all/cond.d20
-rw-r--r--gas/testsuite/gas/all/cond.s18
8 files changed, 91 insertions, 5 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 1c08253357..6da2330e69 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2005-05-06 Jan Beulich <jbeulich@novell.com>
+
+ * cond.c (s_ifb): New.
+ * read.c (potable): Add s_ifb as handler for .ifb and .ifnb.
+ * read.h (s_ifb): Prototype.
+ * doc/as.texinfo: Document .ifb and .ifnb.
+
2005-05-05 Steve Ellcey <sje@cup.hp.com>
* config/tc-ia64.c (MIN): Undef.
diff --git a/gas/cond.c b/gas/cond.c
index 8bea97e412..8cd98c2a2d 100644
--- a/gas/cond.c
+++ b/gas/cond.c
@@ -181,6 +181,40 @@ s_if (int arg)
demand_empty_rest_of_line ();
}
+/* Performs the .ifb (test_blank == 1) and
+ the .ifnb (test_blank == 0) pseudo op. */
+
+void
+s_ifb (int test_blank)
+{
+ struct conditional_frame cframe;
+
+ initialize_cframe (&cframe);
+
+ if (cframe.dead_tree)
+ cframe.ignoring = 1;
+ else
+ {
+ int is_eol;
+
+ SKIP_WHITESPACE ();
+ is_eol = is_end_of_line[(unsigned char) *input_line_pointer];
+ cframe.ignoring = (test_blank == !is_eol);
+ }
+
+ current_cframe = ((struct conditional_frame *)
+ obstack_copy (&cond_obstack, &cframe,
+ sizeof (cframe)));
+
+ if (LISTING_SKIP_COND ()
+ && cframe.ignoring
+ && (cframe.previous_cframe == NULL
+ || ! cframe.previous_cframe->ignoring))
+ listing_list (2);
+
+ ignore_rest_of_line ();
+}
+
/* Get a string for the MRI IFC or IFNC pseudo-ops. */
static char *
diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
index 7b14c0b22f..8186aba388 100644
--- a/gas/doc/as.texinfo
+++ b/gas/doc/as.texinfo
@@ -4456,6 +4456,10 @@ Assembles the following section of code if the specified @var{symbol}
has been defined. Note a symbol which has been referenced but not yet defined
is considered to be undefined.
+@cindex @code{ifb} directive
+@item .ifb @var{text}
+Assembles the following section of code if the operand is blank (empty).
+
@cindex @code{ifc} directive
@item .ifc @var{string1},@var{string2}
Assembles the following section of code if the two strings are the same. The
@@ -4490,6 +4494,11 @@ to zero.
@item .iflt @var{absolute expression}
Assembles the following section of code if the argument is less than zero.
+@cindex @code{ifnb} directive
+@item .ifnb @var{text}
+Like @code{.ifb}, but the sense of the test is reversed: this assembles the
+following section of code if the operand is non-blank (non-empty).
+
@cindex @code{ifnc} directive
@item .ifnc @var{string1},@var{string2}.
Like @code{.ifc}, but the sense of the test is reversed: this assembles the
diff --git a/gas/read.c b/gas/read.c
index e173a157b6..2165edf666 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -343,6 +343,7 @@ static const pseudo_typeS potable[] = {
{"globl", s_globl, 0},
{"hword", cons, 2},
{"if", s_if, (int) O_ne},
+ {"ifb", s_ifb, 1},
{"ifc", s_ifc, 0},
{"ifdef", s_ifdef, 0},
{"ifeq", s_if, (int) O_eq},
@@ -351,6 +352,7 @@ static const pseudo_typeS potable[] = {
{"ifgt", s_if, (int) O_gt},
{"ifle", s_if, (int) O_le},
{"iflt", s_if, (int) O_lt},
+ {"ifnb", s_ifb, 0},
{"ifnc", s_ifc, 1},
{"ifndef", s_ifdef, 1},
{"ifne", s_if, (int) O_ne},
diff --git a/gas/read.h b/gas/read.h
index 28f343831a..3510945e32 100644
--- a/gas/read.h
+++ b/gas/read.h
@@ -155,6 +155,7 @@ extern void s_float_space (int mult);
extern void s_func (int);
extern void s_globl (int arg);
extern void s_if (int arg);
+extern void s_ifb (int arg);
extern void s_ifc (int arg);
extern void s_ifdef (int arg);
extern void s_ifeqs (int arg);
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 31e651ee69..d7365b44a2 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2005-05-06 Jan Beulich <jbeulich@novell.com>
+ * gas/all/cond.s: Also test .ifb/.ifnb.
+ * gas/all/cond.d: Adjust.
+
+2005-05-06 Jan Beulich <jbeulich@novell.com>
+
* gas/macros/dot.s: Don't use pseudo-ops in first column.
* gas/macros/dot.l: Match broader range of possible outputs.
* gas/macros/purge.l: Likewise.
diff --git a/gas/testsuite/gas/all/cond.d b/gas/testsuite/gas/all/cond.d
index 4d0da366f7..e13ac9047a 100644
--- a/gas/testsuite/gas/all/cond.d
+++ b/gas/testsuite/gas/all/cond.d
@@ -23,8 +23,18 @@
27[ ]+.elseif 1
29[ ]+.else
31[ ]+.endif
- 32 000c 00 ?00 ?00 ?00[ ]+.p2align 5,0
- 32[ ]+00 ?00 ?00 ?00
- 32[ ]+00 ?00 ?00 ?00
- 32[ ]+00 ?00 ?00 ?00
- 32[ ]+00 ?00 ?00 ?00
+[ ]*[1-9][0-9]*[ ]+
+[ ]*[1-9][0-9]*[ ]+\.macro[ ]+m[ ]+x,[ ]*y[ ]*
+#...
+[ ]*[1-9][0-9]*[ ]+\.endm[ ]*
+[ ]*[1-9][0-9]*[ ]+[0-9a-f]+[048c] FF ?FF ?FF ?FF[ ]+m[ ]+,[ ]*
+[ ]*[1-9][0-9]*[ ]+FF ?FF ?FF ?FF[ ]*
+[ ]*[1-9][0-9]*[ ]+[0-9a-f]+[048c] FF ?FF ?FF ?FF[ ]+m[ ]+,[ ]*10[ ]*
+[ ]*[1-9][0-9]*[ ]+0[0A] ?00 ?00 ?0[0A][ ]*
+[ ]*[1-9][0-9]*[ ]+[0-9a-f]+[048c] 0[0B] ?00 ?00 ?0[0B][ ]+m[ ]+11,[ ]*
+[ ]*[1-9][0-9]*[ ]+FF ?FF ?FF ?FF[ ]*
+[ ]*[1-9][0-9]*[ ]+[0-9a-f]+[048c] 0[0C] ?00 ?00 ?0[0C][ ]+m[ ]+12,[ ]*13[ ]*
+[ ]*[1-9][0-9]*[ ]+0[0D] ?00 ?00 ?0[0D][ ]*
+[ ]*[1-9][0-9]*[ ]+
+[ ]*[1-9][0-9]*[ ]+.*\.p2align 5,0
+#pass
diff --git a/gas/testsuite/gas/all/cond.s b/gas/testsuite/gas/all/cond.s
index ba4bd6ca61..b8136ba224 100644
--- a/gas/testsuite/gas/all/cond.s
+++ b/gas/testsuite/gas/all/cond.s
@@ -29,4 +29,22 @@
.else
.long 9
.endif
+
+ .macro m x, y
+ .ifb \x
+ .long -1
+ .else
+ .long \x
+ .endif
+ .ifnb \y
+ .long \y
+ .else
+ .long -1
+ .endif
+ .endm
+ m ,
+ m , 10
+ m 11,
+ m 12, 13
+
.p2align 5,0