]> thyrsus.com Git - intercal.git/commitdiff
Optimiser bugfixes: some idioms didn't match the comments next to them
authorAlex Smith <ais523@bham.ac.uk>
Thu, 2 Sep 2010 22:34:53 +0000 (23:34 +0100)
committerAlex Smith <ais523@bham.ac.uk>
Thu, 2 Sep 2010 22:34:53 +0000 (23:34 +0100)
src/idiotism.oil

index fceb7185ec76773e9cc529283c0b974b064376d9..68f76c6e07259e3ce218df55910dcf3b71639a83 100644 (file)
@@ -65,6 +65,7 @@
 (#{1}1 << #{1}2)->(#{x1 << x2}0)
 (#{1}1 == #{1}2)->(#{x1 == x2}0)
 (#{1}1 != #{1}2)->(#{x1 != x2}0)
+(! #{1}1)->(#{!x1}0)
 
 ; Reducing constants inside a C or operation can help to recognize idioms
 [cfoldintoorinand]
 [selectmingle4]
 (_1$(_2~#2863311530))->(((_2&#2863311530)>>#1)|(_1$#0))
 [selectmingle5]
+;3579139412=0xd5555554
 ((_{!(c&4294901760UL)}1$_{!(c&4294901760UL)}2)~#3579139412)
 ->((_1&#32768)|(_2>>#1))
 
 ; optimizes through distributions over C_OR and then constant folding
 
 ; When a 0 is on one side of a C binary logic operation, or the two sides are
-; the same, simplification is often possible. The and-0 case has been dealt
-; with already.
+; the same, simplification is often possible.
 [noopor]
 (_1|#0)->(_1)
 (#0|_1)->(_1)
 (#0^_1)->(_1)
 [anditself]
 (_1&_1)->(_1)
+[and0]
+(_1&#0)->(#0)
+(#0&_1)->(#0)
 [oritself]
 (_1|_1)->(_1)
 [xoritself]