From: Alex Smith Date: Thu, 2 Sep 2010 23:07:10 +0000 (+0100) Subject: Optimiser bugfixes: negation corner cases X-Git-Tag: 0.29~41^2~8 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=40b939837e059c665eaa9daca5f9a2dbdedefdf7;p=intercal.git Optimiser bugfixes: negation corner cases --- diff --git a/src/idiotism.oil b/src/idiotism.oil index f94456c..371eabf 100644 --- a/src/idiotism.oil +++ b/src/idiotism.oil @@ -153,14 +153,24 @@ ; 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) @@ -270,8 +280,8 @@ ; 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)