Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
811 B
4
Indexable
Never
"li t1,0;" "addi %[others_cnt],%[others_cnt],1;"

"loop:;"

	"and t2, t1, 1;"  "addi %[others_cnt],%[others_cnt],1;"

	"beq t2, x0, Even;" "addi %[others_cnt],%[others_cnt],1;"

	"add t2, x0, -1;" "addi %[add_cnt],%[add_cnt],1;"

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

	"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;"

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