Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
850 B
2
Indexable
Never
"li t1,0;"

"addi %[lw_cnt],%[lw_cnt],1;"



"loop:;"



	"and t2, t1, 1;" 

	"addi %[others_cnt],%[others_cnt],1;"



	"addi %[others_cnt],%[others_cnt],1;"

	"beq t2, x0, Even;"



	"add t2, x0, -1;"

	"addi %[add_cnt],%[add_cnt],1;"



	"addi %[others_cnt],%[others_cnt],1;"

	"j End;"

	

	"Even:;" 

	"add t2, x0, 1;"

	"addi %[add_cnt],%[add_cnt],1;"

	"End:;"



	"slli t3, t1, 1;"

	"addi %[others_cnt],%[others_cnt],1;"



	"add t3, t3, 1;"

	"addi %[add_cnt],%[add_cnt],1;"



	"fcvt.d.w f1,t2;"

	"addi %[others_cnt],%[others_cnt],1;"



	"fcvt.d.w f2,t3;"

	"addi %[others_cnt],%[others_cnt],1;"



	"fdiv.d f2, f1, f2;"

	"addi %[div_cnt],%[div_cnt],1;"



	"fadd.d %[pi], %[pi], f2;"

	"addi %[add_cnt],%[add_cnt],1;"



	"add t1, t1, 1;"

	"addi %[add_cnt],%[add_cnt],1;"



"addi %[others_cnt],%[others_cnt],1;"

"bne t1, %[N], loop;"
Leave a Comment