From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11756 invoked by alias); 19 Jul 2009 17:00:44 -0000 Received: (qmail 11733 invoked by uid 22791); 19 Jul 2009 17:00:41 -0000 X-SWARE-Spam-Status: No, hits=0.3 required=5.0 tests=AWL,BAYES_00,DNS_FROM_RFC_BOGUSMX,J_CHICKENPOX_73,J_CHICKENPOX_74 X-Spam-Check-By: sourceware.org Received: from sebabeach.org (HELO sebabeach.org) (64.165.110.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 19 Jul 2009 17:00:34 +0000 Received: by sebabeach.org (Postfix, from userid 500) id 2544A6E3D1; Sun, 19 Jul 2009 10:00:33 -0700 (PDT) From: Doug Evans To: cgen@sourceware.org Subject: [commit] fix pmacro .and/.or snafu Message-Id: <20090719170033.2544A6E3D1@sebabeach.org> Date: Sun, 19 Jul 2009 17:00:00 -0000 X-IsSubscribed: yes Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00031.txt.bz2 I messed up with some of the new builtin pmacros. RTL uses andif/orif and I think pmacros should too. 2009-07-19 Doug Evans Rename builtin boolean pmacros, for consistency with rtl. * pmacros.scm: .and -> .andif, .or -> .orif, .bitand -> .and, .bitor -> .or, .bitxor -> .xor, .bitinv -> .inv. * doc/pmacros.text: Update. * testsuite/pmacros-1.test: Update. Index: pmacros.scm =================================================================== RCS file: /cvs/src/src/cgen/pmacros.scm,v retrieving revision 1.7 diff -u -p -r1.7 pmacros.scm --- pmacros.scm 13 Jul 2009 20:55:21 -0000 1.7 +++ pmacros.scm 19 Jul 2009 16:56:44 -0000 @@ -67,8 +67,8 @@ ; (.length x) - length of symbol, string, or list ; (.replicate n expr) - return list of expr replicated n times ; (.equals x y) - deep comparison -; (.and expr . rest) - && in C -; (.or expr . rest) - || in C +; (.andif expr . rest) - && in C +; (.orif expr . rest) - || in C ; (.not expr) - ! in C ; (.eq x y) ; (.ne x y) @@ -84,10 +84,10 @@ ; (.sll x n) - shift left logical ; (.srl x n) - shift right logical ; (.sra x n) - shift right arithmetic -; (.bitand x y) - bitwise and -; (.bitor x y) - bitwise or -; (.bitxor x y) - bitwise xor -; (.bitinv x) - bitwise invert +; (.and x y) - bitwise and +; (.or x y) - bitwise or +; (.xor x y) - bitwise xor +; (.inv x) - bitwise invert ; (.car l) ; (.cdr l) ; (.caar l) @@ -861,12 +861,12 @@ (equal? x y) ) -; (.and . rest) +; (.andif . rest) ; Note: syntactic form ; Elements of EXPRS are evaluated one at a time. ; Unprocessed elements are not evaluated. -(define (-pmacro-builtin-and env . exprs) +(define (-pmacro-builtin-andif env . exprs) (if (null? exprs) #t (let loop ((exprs exprs)) @@ -876,12 +876,12 @@ (else #f))))) ) -; (.or . rest) +; (.orif . rest) ; Note: syntactic form ; Elements of EXPRS are evaluated one at a time. ; Unprocessed elements are not evaluated. -(define (-pmacro-builtin-or env . exprs) +(define (-pmacro-builtin-orif env . exprs) (let loop ((exprs exprs)) (if (null? exprs) #f @@ -1049,34 +1049,34 @@ (else (quotient x (* n 2)))) ) -; (.bitand x y) - bitwise and +; (.and x y) - bitwise and -(define (-pmacro-builtin-bitand x y) - (-pmacro-verify-integer ".bitand" x) - (-pmacro-verify-integer ".bitand" y) +(define (-pmacro-builtin-and x y) + (-pmacro-verify-integer ".and" x) + (-pmacro-verify-integer ".and" y) (logand x y) ) -; (.bitor x y) - bitwise or +; (.or x y) - bitwise or -(define (-pmacro-builtin-bitor x y) - (-pmacro-verify-integer ".bitor" x) - (-pmacro-verify-integer ".bitor" y) +(define (-pmacro-builtin-or x y) + (-pmacro-verify-integer ".or" x) + (-pmacro-verify-integer ".or" y) (logior x y) ) -; (.bitxor x y) - bitwise xor +; (.xor x y) - bitwise xor -(define (-pmacro-builtin-bitxor x y) - (-pmacro-verify-integer ".bitxor" x) - (-pmacro-verify-integer ".bitxor" y) +(define (-pmacro-builtin-xor x y) + (-pmacro-verify-integer ".xor" x) + (-pmacro-verify-integer ".xor" y) (logxor x y) ) -; (.bitinv x) - bitwise invert +; (.inv x) - bitwise invert -(define (-pmacro-builtin-bitinv x) - (-pmacro-verify-integer ".bitinv" x) +(define (-pmacro-builtin-inv x) + (-pmacro-verify-integer ".inv" x) (lognot x) ) @@ -1165,8 +1165,8 @@ (list '.length '(x) #f -pmacro-builtin-length "return length of symbol, string, or list") (list '.replicate '(n expr) #f -pmacro-builtin-replicate "return list of expr replicated n times") (list '.equals '(x y) #f -pmacro-builtin-equals "deep comparison of x and y") - (list '.and 'rest #t -pmacro-builtin-and "return #f if any element is #f, otherwise return last element") - (list '.or 'rest #t -pmacro-builtin-or "return first non-#f element, otherwise #f") + (list '.andif 'rest #t -pmacro-builtin-andif "return first #f element, otherwise return last element") + (list '.orif 'rest #t -pmacro-builtin-orif "return first non-#f element found, otherwise #f") (list '.not '(x) #f -pmacro-builtin-not "return !x") (list '.eq '(x y) #f -pmacro-builtin-eq "return true if x == y") (list '.ne '(x y) #f -pmacro-builtin-ne "return true if x != y") @@ -1182,10 +1182,10 @@ (list '.sll '(x n) #f -pmacro-builtin-sll "return logical x << n") (list '.srl '(x n) #f -pmacro-builtin-srl "return logical x >> n") (list '.sra '(x n) #f -pmacro-builtin-sra "return arithmetic x >> n") - (list '.bitand '(x y) #f -pmacro-builtin-bitand "return x & y") - (list '.bitor '(x y) #f -pmacro-builtin-bitor "return x | y") - (list '.bitxor '(x y) #f -pmacro-builtin-bitxor "return x ^ y") - (list '.bitinv '(x) #f -pmacro-builtin-bitinv "return ~x") + (list '.and '(x y) #f -pmacro-builtin-and "return x & y") + (list '.or '(x y) #f -pmacro-builtin-or "return x | y") + (list '.xor '(x y) #f -pmacro-builtin-xor "return x ^ y") + (list '.inv '(x) #f -pmacro-builtin-inv "return ~x") (list '.car '(x) #f -pmacro-builtin-car "return (car x)") (list '.cdr '(x) #f -pmacro-builtin-cdr "return (cdr x)") (list '.caar '(x) #f -pmacro-builtin-caar "return (caar x)") Index: doc/pmacros.texi =================================================================== RCS file: /cvs/src/src/cgen/doc/pmacros.texi,v retrieving revision 1.6 diff -u -p -r1.6 pmacros.texi --- doc/pmacros.texi 13 Jul 2009 20:55:21 -0000 1.6 +++ doc/pmacros.texi 19 Jul 2009 16:56:44 -0000 @@ -147,7 +147,7 @@ These pmacros are processed differently @emph{not} evaluated first. Instead it is up to the pmacro to decide when, and if, the parameters are evaluated. The syntactic forms are: @code{.pmacro}, @code{.let}, @code{.if}, -@code{.case}, @code{.cond}, @code{.begin}, @code{.and}, and @code{.or}. +@code{.case}, @code{.cond}, @code{.begin}, @code{.andif}, and @code{.orif}. If the result of the pmacro is another pmacro invocation, it is in turn processed. @@ -1010,8 +1010,8 @@ and ``false'' is represented by @code{#f @menu * .equals:: Deep comparison -* .and:: && in C -* .or:: || in C +* .andif:: && in C +* .orif:: || in C * .not:: ! in C * .eq:: Shallow comparison * .ne:: Shallow comparison @@ -1041,11 +1041,11 @@ Examples: (.equals ((1 2 3) (4 5 6)) ((1 2 3) (4 5 6))) --> #t @end smallexample -@node .and -@subsection .and -@cindex .and +@node .andif +@subsection .andif +@cindex .andif -Syntax: @samp{(.and [expr1 [expr2 ...]])} +Syntax: @samp{(.andif [expr1 [expr2 ...]])} Each expression is evaluated in turn. If an expression evaluates to false (@code{#f}) then @@ -1061,16 +1061,16 @@ that evaluates to ``false''. Examples: @smallexample -(.and 1 #f 2) --> #f -(.and 1 2 3) --> 3 -(.and) --> #t +(.andif 1 #f 2) --> #f +(.andif 1 2 3) --> 3 +(.andif) --> #t @end smallexample -@node .or -@subsection .or -@cindex .or +@node .orif +@subsection .orif +@cindex .orif -Syntax: @samp{(.or [expr1 [expr2 ...]])} +Syntax: @samp{(.orif [expr1 [expr2 ...]])} Each expression is evaluated in turn. If an expression evaluates to non-false (@code{#f}) then @@ -1087,9 +1087,9 @@ that evaluates to non-``false''. Examples: @smallexample -(.or 1 2 3) --> 1 -(.or #f #f #f) --> #f -(.or) --> #f +(.orif 1 2 3) --> 1 +(.orif #f #f #f) --> #f +(.orif) --> #f @end smallexample @node .not @@ -1259,10 +1261,10 @@ Builtin macros for shifts and bitwise fu * .sll:: Shift left logical * .srl:: Shift right logical * .sra:: Shift right arithmetic -* .bitand:: Bitwise and -* .bitor:: Bitwise or -* .bitxor:: Bitwise exclusive-or -* .bitinv:: Bitwise inversion +* .and:: Bitwise and +* .or:: Bitwise or +* .xor:: Bitwise exclusive-or +* .inv:: Bitwise inversion @end menu @node .sll @@ -1302,34 +1304,34 @@ The sign bit of @code{x} is shifted into @code{n} must be a non-negative integer. -@node .bitand -@subsection .bitand -@cindex .bitand +@node .and +@subsection .and +@cindex .and -Syntax: @samp{(.bitand x y)} +Syntax: @samp{(.and x y)} Return the bitwise @code{and} of @code{x} and @code{y}. -@node .bitor -@subsection .bitor -@cindex .bitor +@node .or +@subsection .or +@cindex .or -Syntax: @samp{(.bitor x y)} +Syntax: @samp{(.or x y)} Return the bitwise @code{or} of @code{x} and @code{y}. -@node .bitxor -@subsection .bitxor -@cindex .bitxor +@node .xor +@subsection .xor +@cindex .xor -Syntax: @samp{(.bitxor x y)} +Syntax: @samp{(.xor x y)} Return the bitwise @code{exclusive-or} of @code{x} and @code{y}. -@node .bitinv -@subsection .bitinv -@cindex .bitinv +@node .inv +@subsection .inv +@cindex .inv -Syntax: @samp{(.bitinv x)} +Syntax: @samp{(.inv x)} Return the bitwise @code{inversion} of @code{x}. Index: testsuite/pmacros-1.test =================================================================== RCS file: /cvs/src/src/cgen/testsuite/pmacros-1.test,v retrieving revision 1.1 diff -u -p -r1.1 pmacros-1.test --- testsuite/pmacros-1.test 13 Jul 2009 20:55:21 -0000 1.1 +++ testsuite/pmacros-1.test 19 Jul 2009 16:56:44 -0000 @@ -144,21 +144,21 @@ cat > ${cpu_file} < ${cpu_file} <