unspec expressions
Jason R Thorpe
thorpej@wasabisystems.com
Fri Aug 30 08:48:00 GMT 2002
On Fri, Aug 30, 2002 at 12:50:03AM -0700, Ranjit Singh wrote:
> 1. How are these expresions used and How does
> construction and matching take place in this
> case (if they occur in define_insns)?
> An example would be helpful.
There is a patch awaiting review for the ARM target which uses unspec
in a way which might be helpful as an example to you, pasted here:
-- snip --
;; Generate a sequence of instructions to determine if the processor is
;; in 26-bit or 32-bit mode, and return the appropriate return address
;; mask.
(define_expand "return_addr_mask"
[(set (match_dup 1)
(compare:CC_NOOV (unspec [(const_int 0)] UNSPEC_CHECK_ARCH)
(const_int 0)))
(set (match_operand:SI 0 "s_register_operand" "")
(if_then_else:SI (eq (match_dup 1) (const_int 0))
(const_int -1)
(const_int 67108860)))] ; 0x03fffffc
""
"
operands[1] = gen_rtx_REG (CC_NOOVmode, 24);
")
(define_insn "*check_arch2"
[(set (match_operand:CC_NOOV 0 "cc_register" "")
(compare:CC_NOOV (unspec [(const_int 0)] UNSPEC_CHECK_ARCH)
(const_int 0)))]
""
"teq\\t%|r0, %|r0\;teq\\t%|pc, %|pc"
[(set_attr "length" "8")
(set_attr "conds" "set")]
)
-- snip --
UNSPEC_CHECK_ARCH is the index, defined earlier in the file in a
"define_constants" block.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
More information about the Gcc
mailing list