This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: unspec expressions
- From: Jason R Thorpe <thorpej at wasabisystems dot com>
- To: Ranjit Singh <ranjit_singh_007 at yahoo dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 30 Aug 2002 08:48:35 -0700
- Subject: Re: unspec expressions
- Organization: Wasabi Systems, Inc.
- References: <20020830075003.29982.qmail@web13001.mail.yahoo.com>
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>