mirror of
https://github.com/emmansun/gmsm.git
synced 2025-05-11 03:26:17 +08:00
Updated Golang ppc64 asm Reference (markdown)
parent
6eebafdeb8
commit
a2646c7dd0
@ -34,5 +34,41 @@
|
||||
```
|
||||
|
||||
## 算术乘法
|
||||
乘法太复杂:
|
||||
```asm
|
||||
// The following macros are used to implement the ppc64le
|
||||
// equivalent function from the corresponding s390x
|
||||
// instruction for vector multiply high, low, and add,
|
||||
// since there aren't exact equivalent instructions.
|
||||
// The corresponding s390x instructions appear in the
|
||||
// comments.
|
||||
// Implementation for big endian would have to be
|
||||
// investigated, I think it would be different.
|
||||
//
|
||||
//
|
||||
// Vector multiply word
|
||||
//
|
||||
// VMLF x0, x1, out_low
|
||||
// VMLHF x0, x1, out_hi
|
||||
#define VMULT(x1, x2, out_low, out_hi) \
|
||||
VMULEUW x1, x2, TMP1; \
|
||||
VMULOUW x1, x2, TMP2; \
|
||||
VMRGEW TMP1, TMP2, out_hi; \
|
||||
VMRGOW TMP1, TMP2, out_low
|
||||
|
||||
//
|
||||
// Vector multiply add word
|
||||
//
|
||||
// VMALF x0, x1, y, out_low
|
||||
// VMALHF x0, x1, y, out_hi
|
||||
#define VMULT_ADD(x1, x2, y, one, out_low, out_hi) \
|
||||
VMULEUW y, one, TMP2; \
|
||||
VMULOUW y, one, TMP1; \
|
||||
VMULEUW x1, x2, out_low; \
|
||||
VMULOUW x1, x2, out_hi; \
|
||||
VADDUDM TMP2, out_low, TMP2; \
|
||||
VADDUDM TMP1, out_hi, TMP1; \
|
||||
VMRGOW TMP2, TMP1, out_low; \
|
||||
VMRGEW TMP2, TMP1, out_hi
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user