Skip to content

arcv: Add APEX support. #160

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

Open
wants to merge 17 commits into
base: arc-2025.06
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f35a1f2
arcv: apex: Add `#pragma intrinsic` handler.
luismgsilva Jun 23, 2025
20836ca
arcv: apex: Add lookup function declaration helper.
luismgsilva Jun 25, 2025
b4b837f
arcv: apex: set APEX operand flags based on function prototype.
luismgsilva Jun 23, 2025
0ea40fa
arcv: apex: Determine APEX instruction format when unspecified.
luismgsilva Jun 23, 2025
d621c89
arcv: apex: Add validation for insn. format and operand rules.
luismgsilva Jun 23, 2025
4c1f778
arcv: apex: Print ".extInstruction" assembly section.
luismgsilva Jun 23, 2025
0b691e2
arcv: apex: Add constraints and format support check.
luismgsilva Jun 23, 2025
cfef83c
arcv: apex: Add machine description patterns for APEX instructions.
luismgsilva Jun 23, 2025
90be406
arcv: apex: Map APEX operand layouts to insn codes.
luismgsilva Jun 26, 2025
fa76bf9
arcv: apex: Add APEX intrinsic built-in registration mechanism.
luismgsilva Jun 26, 2025
862ec62
arcv: apex: Add subcode operand to APEX RTX instructions.
luismgsilva Jun 25, 2025
e5a7477
arcv: apex: Add volatile variants for instructions with side effects.
luismgsilva Jun 27, 2025
e0844cf
arcv: apex: Register pragma handler after macro expansion.
luismgsilva Jun 27, 2025
10f06d6
arcv: apex: Use recog-based selection of variants via mode iterators.
luismgsilva Jul 8, 2025
a0f976a
arcv: apex: Validate immediate arguments during expansion.
luismgsilva Jul 8, 2025
568e719
arcv: apex: Add "i" suffix to resolved immediate-format instructions.
luismgsilva Jul 8, 2025
240d1c5
arcv: apex: Avoid registering instructions with duplicate opcode and …
luismgsilva Jul 11, 2025
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
437 changes: 437 additions & 0 deletions gcc/config/riscv/arcv-apex.md

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions gcc/config/riscv/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,38 @@
(define_register_constraint "xAVn30" "GENERAL_REGS"
"Even-odd register pair suitable as a 64-bit operand of some uDSP instructions."
"regno != 30")

;; ARC-V APEX Constraints
(define_constraint "B8"
"An 8-bit signed immediate (-128 to 127)."
(and (match_code "const_int")
(match_test "IN_RANGE (ival, -128, 127)")))

;; These constraints check whether the APEX builtin instruction identified by
;; the given subcode (an integer indexing into `riscv_apex_builtins`) has the
;; specified instruction format enabled (APEX_XD, APEX_XS, APEX_XI, or APEX_XC).
;;
;; The function `arcv_apex_format_supports_p` returns true if the instruction's
;; supported formats include the queried format.
;;
;; This validation is used in instruction selection to ensure the chosen pattern
;; matches only when the instruction supports the required format.
(define_constraint "xAVpXD"
"Validate support of APEX_XD instruction format."
(and (match_code "const_int")
(match_test "arcv_apex_format_supports_p (INTVAL (op), APEX_XD)")))

(define_constraint "xAVpXS"
"Validate support of APEX_XS instruction format."
(and (match_code "const_int")
(match_test "arcv_apex_format_supports_p (INTVAL (op), APEX_XS)")))

(define_constraint "xAVpXI"
"Validate support of APEX_XI instruction format."
(and (match_code "const_int")
(match_test "arcv_apex_format_supports_p (INTVAL (op), APEX_XI)")))

(define_constraint "xAVpXC"
"Validate support of APEX_XC instruction format."
(and (match_code "const_int")
(match_test "arcv_apex_format_supports_p (INTVAL (op), APEX_XC)")))
6 changes: 6 additions & 0 deletions gcc/config/riscv/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
;; Mode Iterators
;; -------------------------------------------------------------------

;; These mode iterators are used by ARCV APEX to generate
;; all valid combinations of operand types.
(define_mode_iterator DM [SI DI SF DF]) ;; dest
(define_mode_iterator S0M [SI DI SF DF]) ;; src0
(define_mode_iterator S1M [SI DI SF DF]) ;; src1

;; This mode iterator allows 32-bit and 64-bit GPR patterns to be generated
;; from the same template.
(define_mode_iterator GPR [SI (DI "TARGET_64BIT")])
Expand Down
Loading