Open mmcloughlin opened 4 years ago
Thoughts for x86
lowering:
ADX
extensionInstruction set architectures for multi-precision arithmetic.
test/codegen/mathbits.go
shows instructions the math/bits
intrinsics are lowered to.=
subtle.ConstantTimeSelect
math/bits.Add
math/bits.Sub
math.bits.Mul
<<
>>
MOV
CSEL
ADCS
SBCS
UMULL
, UMULH
LSLV
LSRV
Other:
ADD
(extended register): Add (extended register) adds a register value and a sign or zero-extended register value, followed by an optional left shift amountADDS
(shifted register): Add (shifted register), setting flags, adds a register value and an optionally-shifted register value, and writes the result to the destination register. It updates the condition flags based on the result.UMADDL
: Unsigned Multiply-Add Long multiplies two 32-bit register values, adds a 64-bit register value, and writes the result to the 64-bit destination register.LDP
: Load Pair of RegistersVSEL
VAQ
, VACQ
, VACCQ
, VACCCQ
VSBIQ
, VSCBIQ
, VSBCBIQ
VMLF
, VMSLG
, VMALF
, VMALHF
, VMLHF
, VMSLEOG
VSLDB
VSRLB
Reference:
MOVD
, MOVDU
(go instructions)stdcx
addc
, addco
, adde
, addeo
, addze
, addzeo
, ...subfe
, subfeo
, subfze
, subfzeo
, ...mulld
, mulhd
sld
srd
Registers:
Other:
addme
, addmeo
: Add to Minus One Extended (and subtraction version)addze
, addzeo
: Add to Zero Extended (and subtraction version)Reference:
select
add i128
(use zext
, shl
, lshr
, trunc
, ... to manipulate carries)sub i128
with methods similar to addition for borrow bitsmul i128
with arguments zext
ended to i128
shl
lshr
Reference:
Generate architecture-specific code from arithmetic IR.
x86
viaavo
math/bits
andcrypto/subtle
arm64
s390x
Related #96