This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Using intrinsic functions to extend the isa
- From: Feng LI <nemokingdom at gmail dot com>
- To: GCC <gcc at gcc dot gnu dot org>
- Date: Wed, 13 Apr 2011 16:46:09 +0200
- Subject: Using intrinsic functions to extend the isa
Hi,
I'm currently try to add intrinsic functions to extend the x86 instruction
set. Encountered a problem when the intrinsic function's return value
is void, where the asm will not generate in this case.
the intrinsic function looks like:
extern void
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
__TTest (unsigned int __C, unsigned int __V, unsigned int offset)
{
__builtin_ia32_ttest (__C, __V, offset);
}
and the corresponding md part is:
(define_expand "dta_ttest"
[(set (match_operand:SI 1 "register_operand" "")
(unspec:SI
[(match_operand:SI 2 "register_operand" "")
(match_operand:SI 3 "register_operand" "")]
UNSPEC_TSTORE))]
"TARGET_DTA"
"(void) operand0;")
(define_insn "*dta_ttest"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec:SI
[(match_operand:SI 1 "register_operand" "0")
(match_operand:SI 2 "register_operand" "")]
UNSPEC_TSTORE))]
"TARGET_DTA"
"ttest\t%0 %1 %2"
[(set_attr "length" "3")
(set_attr "mode" "SI")])
The asm will not generate "ttest\t %0 %1 %2" in this case, but if I
change the return value from void to uint, it will generate the correct
code.
I'm wondering how could I generate asm code for the intrinsic functions
with return value of void.
Thanks,
Feng