Replies: 2 comments
-
VCMEQ + VBSL // func moveCond(res, a, b *byte, cond int)
// If cond == 0 res=b, else res=a
TEXT ·moveCond(SB),NOSPLIT,$0
MOVD res+0(FP), R0
MOVD a+8(FP), R1
MOVD b+16(FP), R2
MOVD cond+24(FP), R3
VEOR V0.B16, V0.B16, V0.B16
VMOV R3, V1.S4
VCMEQ V0.S4, V1.S4, V2.S4
VLD1 (R1), [V3.B16]
VLD1 (R2), [V4.B16]
VBSL V3.B16, V4.B16, V2.B16
VST1 [V2.B16], (R0)
RET VCMEQ + VBIT // func moveCond(res, a, b *byte, cond int)
// If cond == 0 res=b, else res=a
TEXT ·moveCond(SB),NOSPLIT,$0
MOVD res+0(FP), R0
MOVD a+8(FP), R1
MOVD b+16(FP), R2
MOVD cond+24(FP), R3
VEOR V0.B16, V0.B16, V0.B16
VMOV R3, V1.S4 // should use VDUP (go 1.17+)
VCMEQ V0.S4, V1.S4, V2.S4
VLD1 (R1), [V3.B16]
VLD1 (R2), [V4.B16]
VBIT V2.B16, V4.B16, V3.B16
VST1 [V3.B16], (R0)
RET VCMEQ + VBIF // func moveCond(res, a, b *byte, cond int)
// If cond == 0 res=b, else res=a
TEXT ·moveCond(SB),NOSPLIT,$0
MOVD res+0(FP), R0
MOVD a+8(FP), R1
MOVD b+16(FP), R2
MOVD cond+24(FP), R3
VEOR V0.B16, V0.B16, V0.B16
VMOV R3, V1.S4 // should use VDUP (go 1.17+)
VCMEQ V0.S4, V1.S4, V2.S4
VLD1 (R1), [V3.B16]
VLD1 (R2), [V4.B16]
VBIF V2.B16, V3.B16, V4.B16
VST1 [V4.B16], (R0)
RET VBSL会把条件(mask)作为destination,如果有多个需要move,就不合适了;而VBIT/VBIF类似,只是换一下Vm, Vn。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
gmsm/internal/sm2ec/p256_asm_arm64.s
Line 104 in 7854203
这里也用到了:
参考:
Beta Was this translation helpful? Give feedback.
All reactions