[Libre-soc-bugs] [Bug 980] Implement C-based Power ISA pseudocode compiler

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Thu Jan 4 08:30:19 GMT 2024


https://bugs.libre-soc.org/show_bug.cgi?id=980

--- Comment #46 from Dmitry Selyutin <ghostmansd at gmail.com> ---
The tree (I'm too lazy to indent it):

Scope([Assign(lvalue=RangeSubscript(start=DecLiteral(0), end=DecLiteral(63),
target=Symbol(tree)), rvalue=GPR(RB)), Assign(lvalue=Symbol(mode),
rvalue=RangeSubscript(start=DecLiteral(62), end=DecLiteral(63),
target=Symbol(tree))), Assign(lvalue=RangeSubscript(start=DecLiteral(62),
end=DecLiteral(63), target=Symbol(tree)), rvalue=DecLiteral(0)),
Assign(lvalue=Symbol(ra_used), rvalue=BinLiteral(0b0)),
Assign(lvalue=RangeSubscript(start=DecLiteral(0), end=DecLiteral(63),
target=Symbol(in_bits)), rvalue=GPR(RC0)),
IfExpr(test=BinaryExpr(left=Symbol(in_bits), op=Eq(=), right=DecLiteral(0)),
body=Scope([Assign(lvalue=RangeSubscript(start=DecLiteral(0),
end=DecLiteral(63), target=Symbol(in_bits)), rvalue=DecLiteral(1))]),
orelse=Scope([])), Assign(lvalue=Symbol(orig_in_bits), rvalue=Symbol(in_bits)),
Assign(lvalue=Symbol(tree_index), rvalue=DecLiteral(1)),
Assign(lvalue=Symbol(found), rvalue=BinLiteral(0b0)),
Assign(lvalue=Symbol(hit_end), rvalue=BinLiteral(0b0)),
ForExpr(target=Symbol(bit_length), start=DecLiteral(1), end=DecLiteral(6),
body=Scope([Assign(lvalue=Symbol(in_bit),
rvalue=Subscript(index=DecLiteral(63), target=Symbol(in_bits))),
IfExpr(test=BinaryExpr(left=Symbol(in_bits), op=Eq(=), right=DecLiteral(1)),
body=Scope([IfExpr(test=BinaryExpr(left=Symbol(ra_used), op=BitOr(|),
right=BinaryExpr(left=Symbol(_RA), op=Eq(=), right=DecLiteral(0))),
body=Scope([Assign(lvalue=Symbol(hit_end), rvalue=BinLiteral(0b1)),
LeaveKeyword(leave)]), orelse=Scope([])), Assign(lvalue=Symbol(ra_used),
rvalue=BinLiteral(0b1)), Assign(lvalue=Symbol(in_bit),
rvalue=Subscript(index=DecLiteral(63), target=GPR(RA))),
Assign(lvalue=Symbol(in_bits), rvalue=BinaryExpr(left=BinLiteral(0b1),
op=BitConcat(||), right=RangeSubscript(start=DecLiteral(0), end=DecLiteral(62),
target=GPR(RA))))]), orelse=Scope([Assign(lvalue=Symbol(in_bits),
rvalue=BinaryExpr(left=BinLiteral(0b0), op=BitConcat(||),
right=RangeSubscript(start=DecLiteral(0), end=DecLiteral(62),
target=Symbol(in_bits))))])), Assign(lvalue=Symbol(tree_index),
rvalue=BinaryExpr(left=Symbol(tree_index), op=Mul(*), right=DecLiteral(2))),
IfExpr(test=BinaryExpr(left=Symbol(in_bit), op=Eq(=), right=DecLiteral(1)),
body=Scope([Assign(lvalue=Symbol(tree_index),
rvalue=BinaryExpr(left=Symbol(tree_index), op=Add(+), right=DecLiteral(1)))]),
orelse=Scope([])), IfExpr(test=BinaryExpr(left=Symbol(tree_index), op=Lt(<),
right=DecLiteral(64)),
body=Scope([IfExpr(test=Subscript(index=BinaryExpr(left=DecLiteral(63),
op=Sub(-), right=Symbol(tree_index)), target=Symbol(tree)),
body=Scope([Assign(lvalue=Symbol(found), rvalue=BinLiteral(0b1)),
LeaveKeyword(leave)]), orelse=Scope([]))]), orelse=Scope([]))])),
Assign(lvalue=Symbol(compressed_index), rvalue=DecLiteral(0)),
ForExpr(target=Symbol(i), start=DecLiteral(0), end=DecLiteral(127),
body=Scope([Assign(lvalue=Symbol(possible), rvalue=DecLiteral(1)),
Assign(lvalue=Symbol(j), rvalue=Symbol(i)),
WhileExpr(test=BinaryExpr(left=Symbol(j), op=Ge(>=), right=DecLiteral(4)),
body=Scope([Assign(lvalue=Symbol(j), rvalue=BinaryExpr(left=Symbol(j),
op=Div(/), right=DecLiteral(2))),
IfExpr(test=Subscript(index=BinaryExpr(left=DecLiteral(63), op=Sub(-),
right=Symbol(j)), target=Symbol(tree)),
body=Scope([Assign(lvalue=Symbol(possible), rvalue=DecLiteral(0)),
LeaveKeyword(leave)]), orelse=Scope([]))]), orelse=Scope([])),
IfExpr(test=BinaryExpr(left=Symbol(i), op=Eq(=), right=Symbol(tree_index)),
body=Scope([LeaveKeyword(leave)]),
orelse=Scope([IfExpr(test=BinaryExpr(left=Symbol(i), op=Ge(>=),
right=DecLiteral(64)), body=Scope([Assign(lvalue=Symbol(compressed_index),
rvalue=BinaryExpr(left=Symbol(compressed_index), op=Add(+),
right=Symbol(possible)))]),
orelse=Scope([IfExpr(test=BinaryExpr(left=Subscript(index=BinaryExpr(left=DecLiteral(63),
op=Sub(-), right=Symbol(i)), target=Symbol(tree)), op=Eq(=),
right=DecLiteral(1)), body=Scope([Assign(lvalue=Symbol(compressed_index),
rvalue=BinaryExpr(left=Symbol(compressed_index), op=Add(+),
right=Symbol(possible)))]), orelse=Scope([]))]))]))])),
SwitchExpr(subject=Symbol(mode), cases=Cases([Case(labels=Labels([Label(0)]),
body=Scope([Assign(lvalue=RangeSubscript(start=DecLiteral(0),
end=DecLiteral(63), target=GPR(RT)), rvalue=Symbol(tree_index)),
IfExpr(test=UnaryExpr(op=Not(¬), value=Symbol(found)),
body=Scope([Assign(lvalue=Symbol(in_bits), rvalue=Symbol(orig_in_bits)),
Assign(lvalue=Symbol(ra_used), rvalue=BinLiteral(0b0))]), orelse=Scope([]))])),
Case(labels=Labels([Label(1)]),
body=Scope([Assign(lvalue=RangeSubscript(start=DecLiteral(0),
end=DecLiteral(63), target=GPR(RT)), rvalue=Symbol(tree_index)),
IfExpr(test=Symbol(hit_end), body=Scope([Assign(lvalue=Symbol(in_bits),
rvalue=Symbol(orig_in_bits)), Assign(lvalue=Symbol(ra_used),
rvalue=BinLiteral(0b0))]), orelse=Scope([]))])),
Case(labels=Labels([Label(2)]),
body=Scope([Assign(lvalue=RangeSubscript(start=DecLiteral(0),
end=DecLiteral(63), target=GPR(RT)), rvalue=Symbol(compressed_index)),
IfExpr(test=UnaryExpr(op=Not(¬), value=Symbol(found)),
body=Scope([Assign(lvalue=Symbol(in_bits), rvalue=Symbol(orig_in_bits)),
Assign(lvalue=Symbol(ra_used), rvalue=BinLiteral(0b0)),
Assign(lvalue=RangeSubscript(start=DecLiteral(0), end=DecLiteral(63),
target=GPR(RT)), rvalue=Symbol(tree_index))]), orelse=Scope([]))])),
Case(labels=Labels([DefaultLabel(default)]),
body=Scope([Assign(lvalue=RangeSubscript(start=DecLiteral(0),
end=DecLiteral(63), target=GPR(RT)), rvalue=Symbol(compressed_index)),
IfExpr(test=Symbol(hit_end), body=Scope([Assign(lvalue=Symbol(in_bits),
rvalue=Symbol(orig_in_bits)), Assign(lvalue=Symbol(ra_used),
rvalue=BinLiteral(0b0))]), orelse=Scope([]))]))])), Assign(lvalue=GPR(RS),
rvalue=Symbol(in_bits)), Assign(lvalue=Symbol(CR0),
rvalue=BinaryExpr(left=Symbol(ra_used), op=BitConcat(||),
right=BinaryExpr(left=BinaryExpr(left=Symbol(tree_index), op=Ge(>=),
right=DecLiteral(64)), op=BitConcat(||), right=BinaryExpr(left=Symbol(found),
op=BitConcat(||), right=Symbol(hit_end)))))])

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list