jez becomes jnz, complete cmp+jmp contraction

This commit is contained in:
Quentin Carbonneaux 2015-08-07 16:01:07 -04:00
parent ad012e9d55
commit e65a615c90
12 changed files with 77 additions and 75 deletions

View file

@ -9,15 +9,15 @@
%alt =w phi @start 0, @left %alt1, @right %alt1
%cnt =w phi @start 100, @left %cnt, @right %cnt1
%alt1 =w sub 1, %alt
jez %alt1, @left, @right
jnz %alt1, @right, @left
@left
%x =w phi @loop 10, @left %x1
%x1 =w sub %x, 1
%z =w copy %x
jez %z, @loop, @left
jnz %z, @left, @loop
@right
%cnt1 =w sub %cnt, %ten
jez %cnt1, @end, @loop
jnz %cnt1, @loop, @end
@end
%ret =w add %cnt, %dum
ret

View file

@ -5,6 +5,6 @@
%n0 =l phi @start -1988, @loop %n1
%n1 =l add 1, %n0
%cmp =w csle 1991, %n1
jez %cmp, @loop, @end
jnz %cmp, @end, @loop
@end
ret

View file

@ -9,7 +9,7 @@
%a =w phi @start 380, @loop %r
%b =w phi @start 747, @loop %a
%r =w rem %b, %a
jez %r, @end, @loop
jnz %r, @loop, @end
@end
ret

View file

@ -1,7 +1,7 @@
@start
%x =w copy 1
@loop
jez %x, @isz, @noz
jnz %x, @noz, @isz
@noz
%x =w copy 0
jmp @end

View file

@ -1,10 +1,10 @@
@start
%x =w copy 1
@loop
jez %x, @isz, @noz
jnz %x, @noz, @isz
@noz
%x =w copy 0
jez %x, @end, @loop
jnz %x, @loop, @end
@isz
%x =w copy 1
jmp @loop

View file

@ -8,7 +8,7 @@
@start
%b =w copy 0
%x =w copy 10
jez 0, @left, @loop
jnz 0, @loop, @left
@left
jmp @inloop
@loop

View file

@ -8,7 +8,7 @@
%n =w phi @start 0, @loop %n1
%n1 =w sub %n, 1
%s1 =w add %s, %n
jez %n1, @end, @loop
jnz %n1, @loop, @end
@end
ret

View file

@ -1,10 +1,10 @@
@start
jmp @foo
@baz
jez 1, @end, @foo
jnz 1, @end, @foo
@bar
jmp @end
@foo
jez 0, @bar, @baz
jnz 0, @bar, @baz
@end
ret