]> thyrsus.com Git - intercal.git/commitdiff
Optimiser bugfixes: negation corner cases
authorAlex Smith <ais523@bham.ac.uk>
Thu, 2 Sep 2010 23:07:10 +0000 (00:07 +0100)
committerAlex Smith <ais523@bham.ac.uk>
Thu, 2 Sep 2010 23:07:10 +0000 (00:07 +0100)
src/idiotism.oil

index f94456c8acd7486a714398b8ff344dfe415c798b..371eabf3f0841cec77e6e0d7ae92fa345c3c18f0 100644 (file)
 
 ; bitwise logical equivalence
 [cxorand16]
-((.1 ^ _2) & _2)->((~16 .1) & _2)
-((_2 ^ .1) & _2)->((~16 .1) & _2)
-((.1 & _2) ^ _2)->((~16 .1) & _2)
-((_2 & .1) ^ _2)->((~16 .1) & _2)
-(_2 ^ (.1 & _2))->((~16 .1) & _2)
-(_2 ^ (_2 & .1))->((~16 .1) & _2)
-(_2 & (.1 ^ _2))->((~16 .1) & _2)
-(_2 & (_2 ^ .1))->((~16 .1) & _2)
+((.1 ^ .2) & .2)->((~16 .1) & .2)
+((.2 ^ .1) & .2)->((~16 .1) & .2)
+((.1 & .2) ^ .2)->((~16 .1) & .2)
+((.2 & .1) ^ .2)->((~16 .1) & .2)
+(.2 ^ (.1 & .2))->((~16 .1) & .2)
+(.2 ^ (.2 & .1))->((~16 .1) & .2)
+(.2 & (.1 ^ .2))->((~16 .1) & .2)
+(.2 & (.2 ^ .1))->((~16 .1) & .2)
+[cxorandmixed]
+; This requires typecasting .1 to 32 bits.
+((.1 ^ :2) & :2)->((~32 .1) & :2)
+((:2 ^ .1) & :2)->((~32 .1) & :2)
+((.1 & :2) ^ :2)->((~32 .1) & :2)
+((:2 & .1) ^ :2)->((~32 .1) & :2)
+(:2 ^ (.1 & :2))->((~32 .1) & :2)
+(:2 ^ (:2 & .1))->((~32 .1) & :2)
+(:2 & (.1 ^ :2))->((~32 .1) & :2)
+(:2 & (:2 ^ .1))->((~32 .1) & :2)
 [cxorand32]
 ((:1 ^ _2) & _2)->((~32 _1) & _2)
 ((_2 ^ :1) & _2)->((~32 _1) & _2)
 
 ; Move rshift, AND out of neg
 [rshiftoutofneg]
-(~16 (.1 >> #{1}2))->(((~16 .1) >> _2) | #32768)
-(~32 (:1 >> #{1}2))->(((~32 :1) >> _2) | #2147483648)
+(~16 (.1 >> #1))->(((~16 .1) >> #1) | #32768)
+(~32 (:1 >> #1))->(((~32 :1) >> #1) | #2147483648)
 [andoutofneg]
 (~16 (.1 & #{1}2))->(((~16 .1) & _2) | #{(~x2)&65535}0)
 (~32 (:1 & #{1}2))->(((~32 :1) & _2) | #{~x2}0)