636 lines
9.5 KiB
ArmAsm
636 lines
9.5 KiB
ArmAsm
|
.text
|
||
|
.attribute 4, 16
|
||
|
.attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
|
||
|
.file "95_float.sy"
|
||
|
.globl float_abs
|
||
|
.p2align 1
|
||
|
.type float_abs,@function
|
||
|
float_abs:
|
||
|
fmv.w.x ft0, zero
|
||
|
flt.s a0, fa0, ft0
|
||
|
beqz a0, .LBB0_2
|
||
|
fneg.s fa0, fa0
|
||
|
.LBB0_2:
|
||
|
ret
|
||
|
.Lfunc_end0:
|
||
|
.size float_abs, .Lfunc_end0-float_abs
|
||
|
|
||
|
.section .sdata,"aw",@progbits
|
||
|
.p2align 2
|
||
|
.LCPI1_0:
|
||
|
.word 0x40490fdb
|
||
|
.LCPI1_1:
|
||
|
.word 0x3f000000
|
||
|
.text
|
||
|
.globl circle_area
|
||
|
.p2align 1
|
||
|
.type circle_area,@function
|
||
|
circle_area:
|
||
|
fcvt.s.w ft0, a0
|
||
|
lui a1, %hi(.LCPI1_0)
|
||
|
flw ft1, %lo(.LCPI1_0)(a1)
|
||
|
mulw a0, a0, a0
|
||
|
fcvt.s.w ft2, a0
|
||
|
lui a0, %hi(.LCPI1_1)
|
||
|
flw ft3, %lo(.LCPI1_1)(a0)
|
||
|
fmul.s ft2, ft2, ft1
|
||
|
fmul.s ft1, ft0, ft1
|
||
|
fmadd.s ft0, ft1, ft0, ft2
|
||
|
fmul.s fa0, ft0, ft3
|
||
|
ret
|
||
|
.Lfunc_end1:
|
||
|
.size circle_area, .Lfunc_end1-circle_area
|
||
|
|
||
|
.section .sdata,"aw",@progbits
|
||
|
.p2align 2
|
||
|
.LCPI2_0:
|
||
|
.word 0x358637bd
|
||
|
.text
|
||
|
.globl float_eq
|
||
|
.p2align 1
|
||
|
.type float_eq,@function
|
||
|
float_eq:
|
||
|
fsub.s ft0, fa0, fa1
|
||
|
fmv.w.x ft1, zero
|
||
|
flt.s a0, ft0, ft1
|
||
|
beqz a0, .LBB2_2
|
||
|
fneg.s ft0, ft0
|
||
|
.LBB2_2:
|
||
|
lui a0, %hi(.LCPI2_0)
|
||
|
flw ft1, %lo(.LCPI2_0)(a0)
|
||
|
flt.s a0, ft0, ft1
|
||
|
ret
|
||
|
.Lfunc_end2:
|
||
|
.size float_eq, .Lfunc_end2-float_eq
|
||
|
|
||
|
.globl error
|
||
|
.p2align 1
|
||
|
.type error,@function
|
||
|
error:
|
||
|
addi sp, sp, -16
|
||
|
sd ra, 8(sp)
|
||
|
li a0, 101
|
||
|
call putch
|
||
|
li a0, 114
|
||
|
call putch
|
||
|
li a0, 114
|
||
|
call putch
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
li a0, 114
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
ld ra, 8(sp)
|
||
|
addi sp, sp, 16
|
||
|
tail putch
|
||
|
.Lfunc_end3:
|
||
|
.size error, .Lfunc_end3-error
|
||
|
|
||
|
.globl ok
|
||
|
.p2align 1
|
||
|
.type ok,@function
|
||
|
ok:
|
||
|
addi sp, sp, -16
|
||
|
sd ra, 8(sp)
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
li a0, 107
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
ld ra, 8(sp)
|
||
|
addi sp, sp, 16
|
||
|
tail putch
|
||
|
.Lfunc_end4:
|
||
|
.size ok, .Lfunc_end4-ok
|
||
|
|
||
|
.globl assert
|
||
|
.p2align 1
|
||
|
.type assert,@function
|
||
|
assert:
|
||
|
addi sp, sp, -16
|
||
|
sd ra, 8(sp)
|
||
|
sd s0, 0(sp)
|
||
|
li s0, 107
|
||
|
bnez a0, .LBB5_2
|
||
|
li a0, 101
|
||
|
call putch
|
||
|
li a0, 114
|
||
|
li s0, 114
|
||
|
call putch
|
||
|
li a0, 114
|
||
|
call putch
|
||
|
.LBB5_2:
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
mv a0, s0
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
ld ra, 8(sp)
|
||
|
ld s0, 0(sp)
|
||
|
addi sp, sp, 16
|
||
|
tail putch
|
||
|
.Lfunc_end5:
|
||
|
.size assert, .Lfunc_end5-assert
|
||
|
|
||
|
.globl assert_not
|
||
|
.p2align 1
|
||
|
.type assert_not,@function
|
||
|
assert_not:
|
||
|
addi sp, sp, -16
|
||
|
sd ra, 8(sp)
|
||
|
sd s0, 0(sp)
|
||
|
beqz a0, .LBB6_2
|
||
|
li a0, 101
|
||
|
call putch
|
||
|
li a0, 114
|
||
|
li s0, 114
|
||
|
call putch
|
||
|
li a0, 114
|
||
|
call putch
|
||
|
j .LBB6_3
|
||
|
.LBB6_2:
|
||
|
li s0, 107
|
||
|
.LBB6_3:
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
mv a0, s0
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
ld ra, 8(sp)
|
||
|
ld s0, 0(sp)
|
||
|
addi sp, sp, 16
|
||
|
tail putch
|
||
|
.Lfunc_end6:
|
||
|
.size assert_not, .Lfunc_end6-assert_not
|
||
|
|
||
|
.section .sdata,"aw",@progbits
|
||
|
.p2align 2
|
||
|
.LCPI7_0:
|
||
|
.word 0x40490fdb
|
||
|
.LCPI7_1:
|
||
|
.word 0x3f000000
|
||
|
.text
|
||
|
.globl main
|
||
|
.p2align 1
|
||
|
.type main,@function
|
||
|
main:
|
||
|
addi sp, sp, -80
|
||
|
sd ra, 72(sp)
|
||
|
sd s0, 64(sp)
|
||
|
fsd fs0, 56(sp)
|
||
|
fsd fs1, 48(sp)
|
||
|
fsd fs2, 40(sp)
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
li a0, 107
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
li a0, 107
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
li a0, 107
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
li a0, 107
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
li a0, 107
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
li a0, 107
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
li a0, 107
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
li a0, 111
|
||
|
call putch
|
||
|
li a0, 107
|
||
|
call putch
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
sw zero, 36(sp)
|
||
|
sw zero, 32(sp)
|
||
|
sw zero, 28(sp)
|
||
|
sw zero, 24(sp)
|
||
|
sw zero, 20(sp)
|
||
|
sw zero, 16(sp)
|
||
|
sw zero, 12(sp)
|
||
|
sw zero, 8(sp)
|
||
|
lui a0, 260096
|
||
|
sw a0, 0(sp)
|
||
|
lui a0, 262144
|
||
|
sw a0, 4(sp)
|
||
|
mv a0, sp
|
||
|
call getfarray
|
||
|
mv s0, a0
|
||
|
call getfloat
|
||
|
lui a0, %hi(.LCPI7_0)
|
||
|
flw fs0, %lo(.LCPI7_0)(a0)
|
||
|
fcvt.w.s a0, fa0, rtz
|
||
|
fcvt.s.w ft0, a0
|
||
|
fmul.s ft1, ft0, fs0
|
||
|
mulw a0, a0, a0
|
||
|
fcvt.s.w ft2, a0
|
||
|
fmul.s ft2, ft2, fs0
|
||
|
fmadd.s ft1, ft1, ft0, ft2
|
||
|
lui a0, %hi(.LCPI7_1)
|
||
|
flw fs1, %lo(.LCPI7_1)(a0)
|
||
|
flw ft2, 0(sp)
|
||
|
fmul.s ft0, fa0, fs0
|
||
|
fmul.s ft0, fa0, ft0
|
||
|
fmul.s fs2, ft1, fs1
|
||
|
fadd.s ft1, fa0, ft2
|
||
|
fsw ft1, 0(sp)
|
||
|
fmv.s fa0, ft0
|
||
|
call putfloat
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
fcvt.w.s a0, fs2, rtz
|
||
|
call putint
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
call getfloat
|
||
|
fcvt.w.s a0, fa0, rtz
|
||
|
fcvt.s.w ft0, a0
|
||
|
fmul.s ft1, ft0, fs0
|
||
|
mulw a0, a0, a0
|
||
|
fcvt.s.w ft2, a0
|
||
|
fmul.s ft2, ft2, fs0
|
||
|
fmadd.s ft1, ft1, ft0, ft2
|
||
|
flw ft2, 4(sp)
|
||
|
fmul.s ft0, fa0, fs0
|
||
|
fmul.s ft0, fa0, ft0
|
||
|
fmul.s fs2, ft1, fs1
|
||
|
fadd.s ft1, fa0, ft2
|
||
|
fsw ft1, 4(sp)
|
||
|
fmv.s fa0, ft0
|
||
|
call putfloat
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
fcvt.w.s a0, fs2, rtz
|
||
|
call putint
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
call getfloat
|
||
|
fcvt.w.s a0, fa0, rtz
|
||
|
fcvt.s.w ft0, a0
|
||
|
fmul.s ft1, ft0, fs0
|
||
|
mulw a0, a0, a0
|
||
|
fcvt.s.w ft2, a0
|
||
|
fmul.s ft2, ft2, fs0
|
||
|
fmadd.s ft1, ft1, ft0, ft2
|
||
|
flw ft2, 8(sp)
|
||
|
fmul.s ft0, fa0, fs0
|
||
|
fmul.s ft0, fa0, ft0
|
||
|
fmul.s fs2, ft1, fs1
|
||
|
fadd.s ft1, fa0, ft2
|
||
|
fsw ft1, 8(sp)
|
||
|
fmv.s fa0, ft0
|
||
|
call putfloat
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
fcvt.w.s a0, fs2, rtz
|
||
|
call putint
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
call getfloat
|
||
|
fcvt.w.s a0, fa0, rtz
|
||
|
fcvt.s.w ft0, a0
|
||
|
fmul.s ft1, ft0, fs0
|
||
|
mulw a0, a0, a0
|
||
|
fcvt.s.w ft2, a0
|
||
|
fmul.s ft2, ft2, fs0
|
||
|
fmadd.s ft1, ft1, ft0, ft2
|
||
|
flw ft2, 12(sp)
|
||
|
fmul.s ft0, fa0, fs0
|
||
|
fmul.s ft0, fa0, ft0
|
||
|
fmul.s fs2, ft1, fs1
|
||
|
fadd.s ft1, fa0, ft2
|
||
|
fsw ft1, 12(sp)
|
||
|
fmv.s fa0, ft0
|
||
|
call putfloat
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
fcvt.w.s a0, fs2, rtz
|
||
|
call putint
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
call getfloat
|
||
|
fcvt.w.s a0, fa0, rtz
|
||
|
fcvt.s.w ft0, a0
|
||
|
fmul.s ft1, ft0, fs0
|
||
|
mulw a0, a0, a0
|
||
|
fcvt.s.w ft2, a0
|
||
|
fmul.s ft2, ft2, fs0
|
||
|
fmadd.s ft1, ft1, ft0, ft2
|
||
|
flw ft2, 16(sp)
|
||
|
fmul.s ft0, fa0, fs0
|
||
|
fmul.s ft0, fa0, ft0
|
||
|
fmul.s fs2, ft1, fs1
|
||
|
fadd.s ft1, fa0, ft2
|
||
|
fsw ft1, 16(sp)
|
||
|
fmv.s fa0, ft0
|
||
|
call putfloat
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
fcvt.w.s a0, fs2, rtz
|
||
|
call putint
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
call getfloat
|
||
|
fcvt.w.s a0, fa0, rtz
|
||
|
fcvt.s.w ft0, a0
|
||
|
fmul.s ft1, ft0, fs0
|
||
|
mulw a0, a0, a0
|
||
|
fcvt.s.w ft2, a0
|
||
|
fmul.s ft2, ft2, fs0
|
||
|
fmadd.s ft1, ft1, ft0, ft2
|
||
|
flw ft2, 20(sp)
|
||
|
fmul.s ft0, fa0, fs0
|
||
|
fmul.s ft0, fa0, ft0
|
||
|
fmul.s fs2, ft1, fs1
|
||
|
fadd.s ft1, fa0, ft2
|
||
|
fsw ft1, 20(sp)
|
||
|
fmv.s fa0, ft0
|
||
|
call putfloat
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
fcvt.w.s a0, fs2, rtz
|
||
|
call putint
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
call getfloat
|
||
|
fcvt.w.s a0, fa0, rtz
|
||
|
fcvt.s.w ft0, a0
|
||
|
fmul.s ft1, ft0, fs0
|
||
|
mulw a0, a0, a0
|
||
|
fcvt.s.w ft2, a0
|
||
|
fmul.s ft2, ft2, fs0
|
||
|
fmadd.s ft1, ft1, ft0, ft2
|
||
|
flw ft2, 24(sp)
|
||
|
fmul.s ft0, fa0, fs0
|
||
|
fmul.s ft0, fa0, ft0
|
||
|
fmul.s fs2, ft1, fs1
|
||
|
fadd.s ft1, fa0, ft2
|
||
|
fsw ft1, 24(sp)
|
||
|
fmv.s fa0, ft0
|
||
|
call putfloat
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
fcvt.w.s a0, fs2, rtz
|
||
|
call putint
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
call getfloat
|
||
|
fcvt.w.s a0, fa0, rtz
|
||
|
fcvt.s.w ft0, a0
|
||
|
fmul.s ft1, ft0, fs0
|
||
|
mulw a0, a0, a0
|
||
|
fcvt.s.w ft2, a0
|
||
|
fmul.s ft2, ft2, fs0
|
||
|
fmadd.s ft1, ft1, ft0, ft2
|
||
|
flw ft2, 28(sp)
|
||
|
fmul.s ft0, fa0, fs0
|
||
|
fmul.s ft0, fa0, ft0
|
||
|
fmul.s fs2, ft1, fs1
|
||
|
fadd.s ft1, fa0, ft2
|
||
|
fsw ft1, 28(sp)
|
||
|
fmv.s fa0, ft0
|
||
|
call putfloat
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
fcvt.w.s a0, fs2, rtz
|
||
|
call putint
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
call getfloat
|
||
|
fmul.s ft0, fa0, fs0
|
||
|
fmul.s ft0, fa0, ft0
|
||
|
fcvt.w.s a0, fa0, rtz
|
||
|
fcvt.s.w ft1, a0
|
||
|
mulw a0, a0, a0
|
||
|
fcvt.s.w ft2, a0
|
||
|
fmul.s ft2, ft2, fs0
|
||
|
flw ft3, 32(sp)
|
||
|
fmul.s ft4, ft1, fs0
|
||
|
fmadd.s ft1, ft4, ft1, ft2
|
||
|
fmul.s fs0, ft1, fs1
|
||
|
fadd.s ft1, fa0, ft3
|
||
|
fsw ft1, 32(sp)
|
||
|
fmv.s fa0, ft0
|
||
|
call putfloat
|
||
|
li a0, 32
|
||
|
call putch
|
||
|
fcvt.w.s a0, fs0, rtz
|
||
|
call putint
|
||
|
li a0, 10
|
||
|
call putch
|
||
|
mv a1, sp
|
||
|
mv a0, s0
|
||
|
call putfarray
|
||
|
li a0, 0
|
||
|
ld ra, 72(sp)
|
||
|
ld s0, 64(sp)
|
||
|
fld fs0, 56(sp)
|
||
|
fld fs1, 48(sp)
|
||
|
fld fs2, 40(sp)
|
||
|
addi sp, sp, 80
|
||
|
ret
|
||
|
.Lfunc_end7:
|
||
|
.size main, .Lfunc_end7-main
|
||
|
|
||
|
.type RADIUS,@object
|
||
|
.section .rodata,"a",@progbits
|
||
|
.globl RADIUS
|
||
|
.p2align 2
|
||
|
RADIUS:
|
||
|
.word 0x40b00000
|
||
|
.size RADIUS, 4
|
||
|
|
||
|
.type PI,@object
|
||
|
.globl PI
|
||
|
.p2align 2
|
||
|
PI:
|
||
|
.word 0x40490fdb
|
||
|
.size PI, 4
|
||
|
|
||
|
.type EPS,@object
|
||
|
.globl EPS
|
||
|
.p2align 2
|
||
|
EPS:
|
||
|
.word 0x358637bd
|
||
|
.size EPS, 4
|
||
|
|
||
|
.type PI_HEX,@object
|
||
|
.globl PI_HEX
|
||
|
.p2align 2
|
||
|
PI_HEX:
|
||
|
.word 0x40490fdb
|
||
|
.size PI_HEX, 4
|
||
|
|
||
|
.type HEX2,@object
|
||
|
.globl HEX2
|
||
|
.p2align 2
|
||
|
HEX2:
|
||
|
.word 0x3da00000
|
||
|
.size HEX2, 4
|
||
|
|
||
|
.type FACT,@object
|
||
|
.globl FACT
|
||
|
.p2align 2
|
||
|
FACT:
|
||
|
.word 0xc700e800
|
||
|
.size FACT, 4
|
||
|
|
||
|
.type EVAL1,@object
|
||
|
.globl EVAL1
|
||
|
.p2align 2
|
||
|
EVAL1:
|
||
|
.word 0x42be10fe
|
||
|
.size EVAL1, 4
|
||
|
|
||
|
.type EVAL2,@object
|
||
|
.globl EVAL2
|
||
|
.p2align 2
|
||
|
EVAL2:
|
||
|
.word 0x420a3ae7
|
||
|
.size EVAL2, 4
|
||
|
|
||
|
.type EVAL3,@object
|
||
|
.globl EVAL3
|
||
|
.p2align 2
|
||
|
EVAL3:
|
||
|
.word 0x420a3ae7
|
||
|
.size EVAL3, 4
|
||
|
|
||
|
.type CONV1,@object
|
||
|
.globl CONV1
|
||
|
.p2align 2
|
||
|
CONV1:
|
||
|
.word 0x43690000
|
||
|
.size CONV1, 4
|
||
|
|
||
|
.type CONV2,@object
|
||
|
.globl CONV2
|
||
|
.p2align 2
|
||
|
CONV2:
|
||
|
.word 0x457ff000
|
||
|
.size CONV2, 4
|
||
|
|
||
|
.type MAX,@object
|
||
|
.globl MAX
|
||
|
.p2align 2
|
||
|
MAX:
|
||
|
.word 1000000000
|
||
|
.size MAX, 4
|
||
|
|
||
|
.type TWO,@object
|
||
|
.globl TWO
|
||
|
.p2align 2
|
||
|
TWO:
|
||
|
.word 2
|
||
|
.size TWO, 4
|
||
|
|
||
|
.type THREE,@object
|
||
|
.globl THREE
|
||
|
.p2align 2
|
||
|
THREE:
|
||
|
.word 3
|
||
|
.size THREE, 4
|
||
|
|
||
|
.type FIVE,@object
|
||
|
.globl FIVE
|
||
|
.p2align 2
|
||
|
FIVE:
|
||
|
.word 5
|
||
|
.size FIVE, 4
|
||
|
|
||
|
.type _sysy_start,@object
|
||
|
.bss
|
||
|
.globl _sysy_start
|
||
|
.p2align 3
|
||
|
_sysy_start:
|
||
|
.zero 16
|
||
|
.size _sysy_start, 16
|
||
|
|
||
|
.type _sysy_end,@object
|
||
|
.globl _sysy_end
|
||
|
.p2align 3
|
||
|
_sysy_end:
|
||
|
.zero 16
|
||
|
.size _sysy_end, 16
|
||
|
|
||
|
.type _sysy_l1,@object
|
||
|
.globl _sysy_l1
|
||
|
.p2align 2
|
||
|
_sysy_l1:
|
||
|
.zero 4096
|
||
|
.size _sysy_l1, 4096
|
||
|
|
||
|
.type _sysy_l2,@object
|
||
|
.globl _sysy_l2
|
||
|
.p2align 2
|
||
|
_sysy_l2:
|
||
|
.zero 4096
|
||
|
.size _sysy_l2, 4096
|
||
|
|
||
|
.type _sysy_h,@object
|
||
|
.globl _sysy_h
|
||
|
.p2align 2
|
||
|
_sysy_h:
|
||
|
.zero 4096
|
||
|
.size _sysy_h, 4096
|
||
|
|
||
|
.type _sysy_m,@object
|
||
|
.globl _sysy_m
|
||
|
.p2align 2
|
||
|
_sysy_m:
|
||
|
.zero 4096
|
||
|
.size _sysy_m, 4096
|
||
|
|
||
|
.type _sysy_s,@object
|
||
|
.globl _sysy_s
|
||
|
.p2align 2
|
||
|
_sysy_s:
|
||
|
.zero 4096
|
||
|
.size _sysy_s, 4096
|
||
|
|
||
|
.type _sysy_us,@object
|
||
|
.globl _sysy_us
|
||
|
.p2align 2
|
||
|
_sysy_us:
|
||
|
.zero 4096
|
||
|
.size _sysy_us, 4096
|
||
|
|
||
|
.type _sysy_idx,@object
|
||
|
.section .sbss,"aw",@nobits
|
||
|
.globl _sysy_idx
|
||
|
.p2align 2
|
||
|
_sysy_idx:
|
||
|
.word 0
|
||
|
.size _sysy_idx, 4
|
||
|
|
||
|
.ident "Debian clang version 14.0.6"
|
||
|
.section ".note.GNU-stack","",@progbits
|
||
|
.addrsig
|