Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more variants of adcs and cmp with xzr #54

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions slothy/targets/aarch64/aarch64_neon.py
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,18 @@ class adcs_zero2(AArch64BasicArithmetic): # pylint: disable=missing-docstring,in
modifiesFlags=True
dependsOnFlags=True

class adcs_to_zero(AArch64BasicArithmetic): # pylint: disable=missing-docstring,invalid-name
pattern = "adcs xzr, <Xa>, <Xb>"
inputs = ["Xa", "Xb"]
modifiesFlags=True
dependsOnFlags=True

class adcs_zero_r_to_zero(AArch64BasicArithmetic): # pylint: disable=missing-docstring,invalid-name
pattern = "adcs xzr, <Xa>, xzr"
inputs = ["Xa"]
modifiesFlags=True
dependsOnFlags=True

class adc(AArch64BasicArithmetic): # pylint: disable=missing-docstring,invalid-name
pattern = "adc <Xd>, <Xa>, <Xb>"
inputs = ["Xa", "Xb"]
Expand Down Expand Up @@ -2104,6 +2116,11 @@ class cmp_xzr(Tst): # pylint: disable=missing-docstring,invalid-name
inputs = ["Xa"]
modifiesFlags=True

class cmp_xzr2(Tst): # pylint: disable=missing-docstring,invalid-name
pattern = "cmp xzr, xzr"
inputs = []
modifiesFlags=True

class cmp_imm(Tst): # pylint: disable=missing-docstring,invalid-name
pattern = "cmp <Xa>, <imm>"
inputs = ["Xa"]
Expand Down
17 changes: 10 additions & 7 deletions slothy/targets/aarch64/cortex_a55.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ def get_min_max_objective(slothy):
(x_stp_with_imm_sp, w_stp_with_imm_sp, x_str_sp_imm, Str_X) : ExecutionUnit.SCALAR_STORE,
(x_ldr_stack_imm, ldr_const, ldr_sxtw_wform, Ldr_X) : ExecutionUnit.SCALAR_LOAD,
(umull_wform, mul_wform, umaddl_wform ): ExecutionUnit.SCALAR_MUL(),
( lsr, bic, bfi, add, add_imm, add_sp_imm, add2, add_lsr, add_lsl, adcs_zero2, cmn,
and_imm, nop, Vins, tst_wform, movk_imm, sub, sbcs_zero_to_zero, mov, ngc_zero,
subs_wform, asr_wform, and_imm_wform, lsr_wform, eor_wform) : ExecutionUnit.SCALAR(),
( lsr, bic, bfi, add, add_imm, add_sp_imm, add2, add_lsr, add_lsl,
adcs_to_zero, adcs_zero_r_to_zero, adcs_zero2, cmn,
and_imm, nop, Vins, tst_wform, movk_imm, sub, sbcs_zero_to_zero, cmp_xzr2,
mov, ngc_zero, subs_wform, asr_wform, and_imm_wform, lsr_wform, eor_wform) : ExecutionUnit.SCALAR(),
}

inverse_throughput = {
Expand All @@ -194,8 +195,9 @@ def get_min_max_objective(slothy):
(lsr, lsr_wform) : 1,
(umull_wform, mul_wform, umaddl_wform) : 1,
(and_twoarg, and_imm, and_imm_wform) : 1,
(add, add_imm, add2, add_lsr, add_lsl, add_sp_imm, adcs_zero2, cmn) : 1,
(sub, subs_wform, asr_wform, sbcs_zero_to_zero, ngc_zero) : 1,
(add, add_imm, add2, add_lsr, add_lsl, add_sp_imm, adcs_to_zero, adcs_zero2,
adcs_zero_r_to_zero, cmn) : 1,
(cmp_xzr2, sub, subs_wform, asr_wform, sbcs_zero_to_zero, ngc_zero) : 1,
(bfi) : 1,
(vshl, vshl, vushr) : 1,
(vusra) : 1,
Expand Down Expand Up @@ -238,8 +240,9 @@ def get_min_max_objective(slothy):
(umull_wform, mul_wform, umaddl_wform) : 3,
(and_imm, and_imm_wform) : 1,
(add2, add_lsr, add_lsl, add_sp_imm) : 2,
(add, add_imm, adcs_zero2, sub, subs_wform, asr_wform, sbcs_zero_to_zero,
cmn, ngc_zero) : 1,
(add, add_imm, adcs_to_zero, adcs_zero_r_to_zero, adcs_zero2, cmn,
sub, subs_wform, asr_wform, sbcs_zero_to_zero, cmp_xzr2,
ngc_zero) : 1,
(bfi) : 2,
(vshl, vushr) : 2,
(vusra) : 3,
Expand Down
Loading