#include "Vec128.h"
void F32fromI32(Vec128 x[2], const Vec128& a) {
__asm volatile ("\n\
ld1 {v0.4s}, [x1] \n\
scvtf v1.4s, v0.4s // float32 <- int32 \n\
st1 {v1.4s}, [x0] // [x0] = v1 \n\
"
:
:
: "v0", "v1", "x0", "x1"
);
}
void I32fromF32(Vec128 x[2], const Vec128& a) {
__asm volatile ("\n\
ld1 {v0.4s}, [x1] \n\
fcvtns v1.4s, v0.4s // int32 <- float32 \n\
st1 {v1.4s}, [x0] // [x0] = v1 \n\
"
:
:
: "v0", "v1", "x0", "x1"
);
}
void F64fromI64(Vec128 x[2], const Vec128& a) {
__asm volatile ("\n\
ld1 {v0.2d}, [x1] \n\
scvtf v1.2d, v0.2d // float64 <- int64 \n\
st1 {v1.2d}, [x0] // [x0] = v1 \n\
"
:
:
: "v0", "v1", "x0", "x1"
);
}
void I64fromF64(Vec128 x[2], const Vec128& a) {
__asm volatile ("\n\
ld1 {v0.2d}, [x1] \n\
fcvtns v1.2d, v0.2d // int32 <- float32 \n\
st1 {v1.2d}, [x0] // [x0] = v1 \n\
"
:
:
: "v0", "v1", "x0", "x1"
);
}
void F32fromU32(Vec128 x[2], const Vec128& a) {
__asm volatile ("\n\
ld1 {v0.4s}, [x1] \n\
ucvtf v1.4s, v0.4s // float32 <- int32 \n\
st1 {v1.4s}, [x0] // [x0] = v1 \n\
"
:
:
: "v0", "v1", "x0", "x1"
);
}
void U32fromF32(Vec128 x[2], const Vec128& a) {
__asm volatile ("\n\
ld1 {v0.4s}, [x1] \n\
fcvtnu v1.4s, v0.4s // uint32 <- float32 \n\
st1 {v1.4s}, [x0] // [x0] = v1 \n\
"
:
:
: "v0", "v1", "x0", "x1"
);
}
void F64fromU64(Vec128 x[2], const Vec128& a) {
__asm volatile ("\n\
ld1 {v0.2d}, [x1] \n\
ucvtf v1.2d, v0.2d // float64 <- int64 \n\
st1 {v1.2d}, [x0] // [x0] = v1 \n\
"
:
:
: "v0", "v1", "x0", "x1"
);
}
void U64fromF64(Vec128 x[2], const Vec128& a) {
__asm volatile ("\n\
ld1 {v0.2d}, [x1] \n\
fcvtnu v1.2d, v0.2d // uint64 <- float64 \n\
st1 {v1.2d}, [x0] // [x0] = v1 \n\
"
:
:
: "v0", "v1", "x0", "x1"
);
}
void F32fromF64(Vec128 x[2], const Vec128& a, const Vec128& b) {
__asm volatile ("\n\
ld1 {v0.2d}, [x1] \n\
ld1 {v2.2d}, [x2] \n\
fcvtn v1.2s, v0.2d // lower-order F32 \n\
fcvtn2 v1.4s, v2.2d // higher-order F32 \n\
st1 {v1.4s}, [x0] // [x0] = v1 \n\
"
:
:
: "v0", "v1", "v2", "x0", "x1"
);
}
void F64fromF32(Vec128 x[2], const Vec128& a) {
__asm volatile ("\n\
ld1 {v0.4s}, [x1] \n\
fcvtl v1.2d, v0.2s // lower-order F32 \n\
fcvtl2 v2.2d, v0.4s // higher-order F32 \n\
st1 {v1.2d, v2.2d}, [x0] // [x0] = v1 \n\
"
:
:
: "v0", "v1", "v2", "x0", "x1"
);
}
|