[Libre-soc-bugs] [Bug 980] Implement C-based Power ISA pseudocode compiler
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Sat Jan 13 12:59:19 GMT 2024
https://bugs.libre-soc.org/show_bug.cgi?id=980
--- Comment #87 from Dmitry Selyutin <ghostmansd at gmail.com> ---
a[0:XLEN/2] <- [0]*(XLEN/2)
do i = 0 to 1
a[i] <- i
...gets converted to this (again, ignore lack of ctx and "leave" section which
updates its state):
void
oppc_cocojamboo(void) {
struct oppc_int a;
struct oppc_int i;
/* a[0:(XLEN / 2)] <- ([0] * (XLEN / 2)) */
oppc_range_subscript_assign(
&a,
/* 0 */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {0},
},
/* (XLEN / 2) */
oppc_div(
/* transient */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {},
},
/* XLEN */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {ctx->XLEN},
},
/* 2 */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {2},
},
),
/* ([0] * (XLEN / 2)) */
oppc_repeat(
/* transient */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {},
},
/* 0 */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {0},
},
/* (XLEN / 2) */
oppc_div(
/* transient */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {},
},
/* XLEN */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {ctx->XLEN},
},
/* 2 */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {2},
}
)
)
);
/* for i = 0 to 1 */
for (
/* i <- 0 */
oppc_assign(
&i,
/* 0 */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {0},
}
);
/* (i <= 1) */
oppc_le(
&i,
/* 1 */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {1},
}
);
/* i <- (i + 1) */
oppc_assign(
&i,
/* (i + 1) */
oppc_add(
/* transient */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {},
},
&i,
/* 1 */
&(struct oppc_int){
.count = ctx->XLEN,
.array = {1},
}
)
)
/* for i = 0 to 1 */
) {
/* a[i] <- i */
oppc_subscript_assign(
&a,
&i,
&i
);
}
}
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list