File tree Expand file tree Collapse file tree 2 files changed +34
-21
lines changed Expand file tree Collapse file tree 2 files changed +34
-21
lines changed Original file line number Diff line number Diff line change 1
1
from ltypes import bool , i32
2
2
def Test_if_01 ():
3
- x : bool = True
3
+ # x: bool = True
4
4
y : i32 = 1
5
5
6
- if x :
7
- x = False
8
- if x :
9
- print (0 )
10
- else :
11
- print (1 )
6
+ # if x:
7
+ # x = False
8
+ # if x:
9
+ # print(0)
10
+ # else:
11
+ # print(1)
12
12
13
- if y > 0 :
14
- print (1 )
15
- if y < 2 :
16
- print (1 )
17
- if y == 1 :
18
- print (1 )
13
+ # if y > 0:
14
+ # print(1)
15
+ # if y < 2:
16
+ # print(1)
17
+ # if y == 1:
18
+ # print(1)
19
+ # print(y != 1)
19
20
if y != 1 :
20
21
print (0 )
21
22
else :
22
23
print (1 )
23
24
if y <= 1 :
24
25
print (1 )
26
+ print (y )
25
27
26
- y = 5
27
- if y <= 10 :
28
- print (1 )
29
- if y >= 5 :
30
- print (1 )
31
- if y >= 1 :
32
- print (1 )
28
+ # y = 5
29
+ # if y <= 10:
30
+ # print(1)
31
+ # if y >= 5:
32
+ # print(1)
33
+ # if y >= 1:
34
+ # print(1)
33
35
34
36
def Verify ():
35
37
Test_if_01 ()
Original file line number Diff line number Diff line change @@ -186,7 +186,18 @@ class X86Visitor : public WASMDecoder<X86Visitor>,
186
186
void visit_I32GeS () { handle_I32Compare (" GtE" ); }
187
187
void visit_I32LtS () { handle_I32Compare (" Lt" ); }
188
188
void visit_I32LeS () { handle_I32Compare (" LtE" ); }
189
- void visit_I32Ne () { handle_I32Compare (" NotEq" ); }
189
+ void visit_I32Ne () {
190
+ unique_id.push_back (std::to_string (offset));
191
+ m_a.asm_pop_r32 (X86Reg::ebx);
192
+ m_a.asm_pop_r32 (X86Reg::eax);
193
+ m_a.asm_cmp_r32_r32 (X86Reg::eax, X86Reg::ebx);
194
+ m_a.asm_jne_label (" .compare_1" + unique_id.back ());
195
+ m_a.asm_mov_r32_imm32 (X86Reg::eax, 0 );
196
+ m_a.asm_jmp_label (" .compare.end_" + unique_id.back ());
197
+ m_a.add_label (" .compare_1" + unique_id.back ());
198
+ m_a.asm_mov_r32_imm32 (X86Reg::eax, 1 );
199
+ m_a.add_label (" .compare.end_" + unique_id.back ());
200
+ }
190
201
191
202
void gen_x86_bytes () {
192
203
emit_elf32_header (m_a);
You can’t perform that action at this time.
0 commit comments