example: add fipr
This commit is contained in:
parent
05e0a36ca7
commit
bf2c9a3d8c
@ -752,3 +752,11 @@ HOLLY_RECV_DMA_OBJ = \
|
|||||||
|
|
||||||
example/holly_recv_dma.elf: LDSCRIPT = $(LIB)/main.lds
|
example/holly_recv_dma.elf: LDSCRIPT = $(LIB)/main.lds
|
||||||
example/holly_recv_dma.elf: $(START_OBJ) $(HOLLY_RECV_DMA_OBJ)
|
example/holly_recv_dma.elf: $(START_OBJ) $(HOLLY_RECV_DMA_OBJ)
|
||||||
|
|
||||||
|
FIPR_OBJ = \
|
||||||
|
example/fipr.o \
|
||||||
|
fipr.o \
|
||||||
|
sh7091/serial.o
|
||||||
|
|
||||||
|
example/fipr.elf: LDSCRIPT = $(LIB)/main.lds
|
||||||
|
example/fipr.elf: $(START_OBJ) $(FIPR_OBJ)
|
||||||
|
24
example/fipr.cpp
Normal file
24
example/fipr.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "stdint.h"
|
||||||
|
|
||||||
|
#include "sh7091/serial.hpp"
|
||||||
|
|
||||||
|
extern "C" float fipr(float * a, float * b);
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float a[] = {1, 2, 3, 4};
|
||||||
|
float b[] = {5, 6, 7, 8};
|
||||||
|
|
||||||
|
// 70
|
||||||
|
|
||||||
|
union {
|
||||||
|
float f;
|
||||||
|
uint32_t i;
|
||||||
|
} v;
|
||||||
|
|
||||||
|
v.f = fipr(a, b);
|
||||||
|
serial::integer(v.i);
|
||||||
|
serial::integer(v.i);
|
||||||
|
serial::integer(v.i);
|
||||||
|
serial::integer(v.i);
|
||||||
|
}
|
41
fipr.s
Normal file
41
fipr.s
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
fv7 = fr0 * fr4 +
|
||||||
|
fr1 * fr5 +
|
||||||
|
fr2 * fr6 +
|
||||||
|
fr3 * fr7;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
a in r4
|
||||||
|
b in r5
|
||||||
|
*/
|
||||||
|
|
||||||
|
.global _fipr
|
||||||
|
_fipr:
|
||||||
|
fmov.s @r4+,fr0
|
||||||
|
fmov.s @r4+,fr1
|
||||||
|
fmov.s @r4+,fr2
|
||||||
|
fmov.s @r4+,fr3
|
||||||
|
|
||||||
|
fmov.s @r5+,fr4
|
||||||
|
fmov.s @r5+,fr5
|
||||||
|
fmov.s @r5+,fr6
|
||||||
|
fmov.s @r5+,fr7
|
||||||
|
|
||||||
|
fipr fv0,fv4
|
||||||
|
|
||||||
|
rts
|
||||||
|
fmov fr7,fr0
|
||||||
|
|
||||||
|
_load:
|
||||||
|
/* x - 1, y - 1 = - 1 - 640 */
|
||||||
|
/* x , y - 1 = + 0 - 640 */
|
||||||
|
/* x + 1, y - 1 = + 1 - 640 */
|
||||||
|
|
||||||
|
/* x - 1, y 1 = - 1 + 0 */
|
||||||
|
/* x , y 1 = + 0 + 0 */
|
||||||
|
/* x + 1, y 1 = + 1 + 0 */
|
||||||
|
|
||||||
|
/* x - 1, y + 1 = - 1 + 640 */
|
||||||
|
/* x , y + 1 = + 0 + 640 */
|
||||||
|
/* x + 1, y + 1 = + 1 + 640 */
|
Loading…
x
Reference in New Issue
Block a user