-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
After seeing the msub PR (#66621) which folds mul, sub into a single msub I went and looked in the Arm64 manual for other interesting "combined operation" instructions.
There is a set of (shifted register) instructions which can combine a shift, op (the variants ending with s also set flags):
-
add,adds- Add -
sub,subs- Subtract -
cmp- Compare #84605 -
cmn- Compare Negative #84667 -
neg,negs- Negate #84667 -
and,ands- Bitwise AND -
bic,bics- Bitwise bit clear -
eon- Bitwise exclusive OR NOT -
eor- Bitwise exclusive OR -
orr- Bitwise inclusive OR -
mvn- Bitwise NOT -
orn- Bitwise inclusive OR NOT -
tst- Test Bits -
cbzinstead ofcmp #0[arm64] optimize test for bound checks against a 0 index #42514
There is a set of (extended register) instructions which can combine a zero-extend, op or sign-extend, op:
-
add,adds- Add -
sub,subs- Subtract -
cmp- Compare -
cmn- Compare Negative
There is a set of (carry) instructions which can utilize the carry from a previous operation:
-
adc,adcs- Add with carry -
sbc,sbcs- Subtract with carry -
ngc,ngcs- Negate with carry
There are the multiply integer instructions which can combine an op, mul:
-
madd- Multiply-add -
msub- Multiply-subtract -
mneg- Multiply-negate
There are then some long multiply instructions which can return a product twice the size of the inputs (i32 * i32 = i64 or similar; effectively good for covering zero or sign extend, multiply):
-
smull,umull- Multiply long -
smaddl,umaddl- Multiply-add long Optimise long multiply + add/sub/neg on arm64. #91886 -
smsubl,umsubl- Multiply-subtract long Optimise long multiply + add/sub/neg on arm64. #91886 -
smnegl,umnegl- Multiply-negate long Optimise long multiply + add/sub/neg on arm64. #91886
Finally there is the "multiply high" instructions which can return just the upper bits of a wide multiply:
-
smulh,umulh- Multiply High
There may be other interesting instructions as well, but these are ones that may have broader usage/application and which likely be good to validate we are covering
category:implementation
theme:intrinsics